]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - debian/rules
UBUNTU: [Packaging] Generate linux-libc-dev package only for primary variant
[mirror_ubuntu-focal-kernel.git] / debian / rules
CommitLineData
c74bfc18
LO
1#!/usr/bin/make -f
2#
3# $(DEBIAN)/rules for Ubuntu linux
4#
5# Use this however you want, just give credit where credit is due.
6#
7# Copyright (c) 2007 Ben Collins <bcollins@ubuntu.com>
8#
9
10DEBIAN=$(shell awk -F= '($$1 == "DEBIAN") { print $$2 }' <debian/debian.env)
11
12# dpkg-buildpackage passes options that are incomptatible
13# with the kernel build.
14unexport CFLAGS
15unexport LDFLAGS
16
17export LC_ALL=C
18export SHELL=/bin/bash -e
19
20# Where do we find the common configuration.
21export DROOT=debian
22
23# Common variables for all architectures
24include $(DROOT)/rules.d/0-common-vars.mk
25
26# Pull in some arch specific stuff
27-include $(DEBIAN)/rules.d/$(arch).mk
28
29# Pull in some branch specific stuff. Used by LTS backport
30# branches to override master branch settings such as do_tools_common.
31-include $(DEBIAN)/rules.d/hooks.mk
32
33# Maintainer targets
34include $(DROOT)/rules.d/1-maintainer.mk
35
36do_linux_tools=$(sort $(filter-out false,$(do_tools_usbip) $(do_tools_cpupower) $(do_tools_perf) $(do_tools_bpftool) $(do_tools_x86)))
37do_cloud_tools=$(sort $(filter-out false,$(do_tools_hyperv)))
38do_tools_common?=true
39do_tools_host?=false
40do_tools_perf_jvmti?=false
41
42# Don't build tools or udebs in a cross compile environment.
43ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
44 do_tools=false
45 disable_d_i=true
46 do_zfs=false
47 do_dkms_nvidia=false
48 do_dkms_vbox=false
49endif
50
51# Are any of the kernel signing options enabled.
52any_signed=$(sort $(filter-out false,$(uefi_signed) $(opal_signed) $(sipl_signed)))
53ifeq ($(any_signed),true)
54bin_pkg_name=$(bin_pkg_name_unsigned)
55else
56bin_pkg_name=$(bin_pkg_name_signed)
57endif
58
59# Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap
60ifeq ($(DEB_STAGE),stage1)
61 DEB_BUILD_PROFILES=stage1
62endif
63ifneq ($(DEB_BUILD_PROFILE),)
64 DEB_BUILD_PROFILES=$(DEB_BUILD_PROFILE)
65endif
66ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
67 do_tools=false
68 do_doc_package=false
69 do_source_package=false
70 do_flavour_image_package=false
71 do_flavour_header_package=false
72endif
73
74# autopkgtest -- rebuild support
75# - only build the first flavour on the assumption it is representative
76# - disable dkms builds as the versions used may have been deleted
77ifneq ($(filter autopkgtest,$(DEB_BUILD_PROFILES)),)
78 flavours := $(firstword $(flavours))
79 disable_d_i=true
80 do_zfs=false
81 do_dkms_nvidia=false
82 do_dkms_vbox=false
83endif
84
85# Being used to build a mainline build -- turn off things which do not work.
86ifeq ($(do_mainline_build),true)
87 do_extras_package=false
88 do_tools=false
89 no_dumpfile=1
90 do_zfs=false
91 do_dkms_nvidia=false
92 do_dkms_vbox=false
93 skipabi=true
94 skipmodule=true
95 skipretpoline=true
96endif
97
98# Disable tools build and packaging if do_tools != true
99ifneq ($(do_tools),true)
100 do_linux_tools=
101 do_cloud_tools=
102 do_tools_common=
103 do_tools_host=
104endif
105
106ifeq ($(do_zfs),false)
107 do_zfs_disable:=$(shell cat $(DROOT)/zfs-modules.ignore >>$(prev_abidir)/../modules.ignore)
108endif
109
110ifeq ($(do_dkms_vbox),false)
111 do_vbox_disable:=$(shell cat $(DROOT)/vbox-modules.ignore >>$(prev_abidir)/../modules.ignore)
112endif
113
114# Either tools package needs the common source preparation
115do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
116
117# Versions of dkms packages.
118dkms_zfs_linux_version=$(shell gawk '/^zfs-linux / { print $$2; }' debian/dkms-versions)
119dkms_nvidia_390_version=$(shell gawk '/^nvidia-graphics-drivers-390/ { print $$2; }' debian/dkms-versions)
4c9eb22c 120dkms_nvidia_440_version=$(shell gawk '/^nvidia-graphics-drivers-440/ { print $$2; }' debian/dkms-versions)
c74bfc18
LO
121dkms_vbox_guest_version=$(shell gawk '/^virtualbox/ { print $$2; }' debian/dkms-versions)
122
123# Debian Build System targets
124binary: binary-indep binary-arch
125
126build: build-arch build-indep
127
128clean: debian/control
129 dh_testdir
130 dh_testroot
131 dh_clean
132
133 # d-i stuff
134 rm -rf $(DEBIAN)/d-i-$(arch)
135 # Generated on the fly.
136 rm -f $(DEBIAN)/d-i/firmware/$(arch)/kernel-image
137
138 # normal build junk
139 rm -rf $(DEBIAN)/abi/$(release)-$(revision)
140 rm -rf $(builddir)
141 rm -f $(stampdir)/stamp-*
142 rm -rf $(DEBIAN)/linux-*
143
144 # This gets rid of the d-i packages in control
145 cp -f $(DEBIAN)/control.stub $(DROOT)/control
146 cp $(DEBIAN)/changelog debian/changelog
147
148 # Install the copyright information.
149 cp $(DEBIAN)/copyright debian/copyright
150
151 # Install the retpoline extractor.
152 cp $(DROOT)/scripts/retpoline-extract-one scripts/ubuntu-retpoline-extract-one
153
154 # If we have a reconstruct script use it.
155 [ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct || true
156
157 # Remove generated intermediate files
158 rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub
159 rm -f $(DROOT)/scripts/fix-filenames
160
161distclean: clean
162 rm -rf $(DROOT)/control debian/changelog \
163 debian/control debian/control.stub debian/copyright \
164 scripts/ubuntu-retpoline-extract-one
165
166# Builds the image, arch headers and debug packages
167include $(DROOT)/rules.d/2-binary-arch.mk
168
169# Rules for building the udebs ($(DEBIAN)-installer)
170include $(DROOT)/rules.d/5-udebs.mk
171
172# Builds the source, doc and linux-headers indep packages
173include $(DROOT)/rules.d/3-binary-indep.mk
174
175# Various checks to be performed on builds
176include $(DROOT)/rules.d/4-checks.mk
177
19120635
SF
178control_files := $(DEBIAN)/control.stub.in
179ifeq ($(do_libc_dev_package),true)
180 control_files += $(DROOT)/control.d/linux-libc-dev.stub
181endif
182
c74bfc18
LO
183# Misc stuff
184.PHONY: $(DEBIAN)/control.stub
185$(DEBIAN)/control.stub: \
186 $(DROOT)/scripts/control-create \
19120635 187 $(control_files) \
c74bfc18
LO
188 $(DEBIAN)/changelog \
189 $(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars)
19120635
SF
190 for i in $(control_files); do \
191 cat $$i; \
192 echo ""; \
193 done | sed -e 's/PKGVER/$(release)/g' \
c74bfc18
LO
194 -e 's/ABINUM/$(abinum)/g' \
195 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
196 -e 's/=HUMAN=/$(human_arch)/g' \
197 -e 's/=SERIES=/$(series)/g' \
19120635 198 > $(DEBIAN)/control.stub;
c74bfc18
LO
199 flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
200 for i in $$flavours; do \
201 $(SHELL) $(DROOT)/scripts/control-create $$i "$(any_signed)" | \
202 sed -e 's/PKGVER/$(release)/g' \
203 -e 's/ABINUM/$(abinum)/g' \
204 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
205 -e 's/=HUMAN=/$(human_arch)/g' \
206 -e 's/=SERIES=/$(series)/g' \
207 >> $(DEBIAN)/control.stub; \
208 done
209
210.PHONY: debian/control
211debian/control: $(DEBIAN)/control.stub
212 echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub
213 cp $(DEBIAN)/control.stub debian/control
214 export KW_DEFCONFIG_DIR=$(DEBIAN)/d-i && \
215 export KW_CONFIG_DIR=$(DEBIAN)/d-i && \
216 LANG=C kernel-wedge gen-control $(release)-$(abinum) | \
217 perl -f $(DROOT)/scripts/misc/kernel-wedge-arch.pl $(arch) \
218 >>$(CURDIR)/debian/control