Skip to content

Commit 31f735c

Browse files
committed
kbuild: add srcdeb-pkg target
This new target builds only the debian source package. Unify the build rules of deb-pkg, srcdeb-pkg, bindeb-pkg to avoid code duplication. --no-check-builddeps is added to srcdeb-pkg so that build dependencies will not be checked. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
1 parent ccb2d17 commit 31f735c

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

scripts/Makefile.package

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ include $(srctree)/scripts/Kbuild.include
55
include $(srctree)/scripts/Makefile.lib
66

77
KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
8-
KBUILD_PKG_ROOTCMD ?="fakeroot -u"
98
# Include only those top-level files that are needed by make, plus the GPL copy
109
TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \
1110
include init io_uring ipc kernel lib mm net rust \
@@ -86,6 +85,9 @@ binrpm-pkg:
8685
+rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
8786
$(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec
8887

88+
# deb-pkg srcdeb-pkg bindeb-pkg
89+
# ---------------------------------------------------------------------------
90+
8991
quiet_cmd_debianize = GEN $@
9092
cmd_debianize = $(srctree)/scripts/package/mkdebian $(mkdebian-opts)
9193

@@ -104,14 +106,25 @@ debian-orig: linux.tar.gz debian
104106
cp $< ../$(orig-name); \
105107
fi
106108

107-
PHONY += deb-pkg
108-
deb-pkg: debian-orig
109-
+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) \
110-
--build=source,binary -nc -us -uc
109+
KBUILD_PKG_ROOTCMD ?= 'fakeroot -u'
110+
111+
PHONY += deb-pkg srcdeb-pkg bindeb-pkg
112+
113+
deb-pkg: private build-type := source,binary
114+
srcdeb-pkg: private build-type := source
115+
bindeb-pkg: private build-type := binary
111116

112-
PHONY += bindeb-pkg
117+
deb-pkg srcdeb-pkg: debian-orig
113118
bindeb-pkg: debian
114-
+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -b -nc -uc
119+
deb-pkg srcdeb-pkg bindeb-pkg:
120+
+$(strip dpkg-buildpackage \
121+
--build=$(build-type) --no-pre-clean --unsigned-changes \
122+
$(if $(findstring source, $(build-type)), \
123+
--unsigned-source) \
124+
$(if $(findstring binary, $(build-type)), \
125+
-r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch), \
126+
--no-check-builddeps) \
127+
$(DPKG_FLAGS))
115128

116129
PHONY += intdeb-pkg
117130
intdeb-pkg:
@@ -208,6 +221,7 @@ help:
208221
@echo ' srcrpm-pkg - Build only the source kernel RPM package'
209222
@echo ' binrpm-pkg - Build only the binary kernel RPM package'
210223
@echo ' deb-pkg - Build both source and binary deb kernel packages'
224+
@echo ' srcdeb-pkg - Build only the source kernel deb package'
211225
@echo ' bindeb-pkg - Build only the binary kernel deb package'
212226
@echo ' snap-pkg - Build only the binary kernel snap package'
213227
@echo ' (will connect to external hosts)'

0 commit comments

Comments
 (0)