diff options
Diffstat (limited to 'debian/rules')
-rwxr-xr-x | debian/rules | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..19b1189 --- /dev/null +++ b/debian/rules @@ -0,0 +1,113 @@ +#!/usr/bin/make -f + +ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),) +BUILD_UDEB := 1 +endif + +D := $(CURDIR)/debian/kmod +DK := $(CURDIR)/debian/libkmod2 +DD := $(CURDIR)/debian/libkmod-dev +DU := $(CURDIR)/debian/kmod-udeb +DKU := $(CURDIR)/debian/libkmod2-udeb + +CONFFLAGS = \ + --sysconfdir=/etc \ + --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \ + --with-module-directory=/lib/modules \ + --with-rootlibdir=/usr/lib/$(DEB_HOST_MULTIARCH) +CONFFLAGS_deb = $(CONFFLAGS) \ + $(shell DEB_BUILD_MAINT_OPTIONS="hardening=+bindnow" \ + dpkg-buildflags --export=configure || true) \ + --enable-gtk-doc \ + --with-openssl \ + --with-xz \ + --with-zstd \ + --disable-test-modules \ + --enable-debug +CONFFLAGS_udeb = $(CONFFLAGS) \ + $(subst -O2,-Os -fomit-frame-pointer,$(shell DEB_BUILD_MAINT_OPTIONS="hardening=-all" \ + dpkg-buildflags --export=configure || true)) \ + --with-xz + +############################################################################## +include /usr/share/dpkg/architecture.mk + +ifdef BUILD_UDEB + BUILD_UDEB_TARGET := build-udeb/.stamp-build +else + NO_PACKAGE := --no-package=kmod-udeb --no-package=libkmod2-udeb +endif + +############################################################################## +%: + dh $@ $(NO_PACKAGE) + +override_dh_clean: + rm -rf build-*deb + dh_clean $$(find m4/ build-aux/ libkmod/ -type l) + +libkmod/docs/gtk-doc.make: + gtkdocize --docdir libkmod/docs + +override_dh_autoreconf: libkmod/docs/gtk-doc.make + dh_autoreconf + +build-deb/config.status: configure + dh_auto_configure --builddir=build-deb -- $(CONFFLAGS_deb) + +build-udeb/config.status: configure + dh_auto_configure --builddir=build-udeb -- $(CONFFLAGS_udeb) + +override_dh_auto_configure: + +build-deb/.stamp-build: build-deb/config.status + dh_auto_build --builddir=build-deb + touch $@ + +build-udeb/.stamp-build: build-udeb/config.status + dh_auto_build --builddir=build-udeb + touch $@ + +override_dh_auto_build: build-deb/.stamp-build $(BUILD_UDEB_TARGET) + +override_dh_auto_test: + dh_auto_test --builddir=build-deb + +override_dh_auto_install: + dh_auto_install --builddir=build-deb --destdir=$D +ifdef BUILD_UDEB + cd build-udeb && $(MAKE) DESTDIR=$(DU) install-binPROGRAMS +endif + +override_dh_install: + rm $D/usr/lib/*/*.la + dh_movefiles --sourcedir=debian/kmod + cp debian/extra/aliases.conf $D/usr/lib/modprobe.d/ + install --mode=755 debian/kmod.initramfs-hook \ + $D/usr/share/initramfs-tools/hooks/kmod + find $D/usr -type d -empty -delete +ifdef BUILD_UDEB + rm $(DU)/usr/lib/*/*.la $(DU)/usr/lib/*/*.so + mv $(DU)/usr/lib/*/libkmod.so.* $(DKU)/usr/lib/ + egrep -i '^[a-z]' debian/extra/aliases.conf > $(DU)/etc/modprobe.d/aliases.conf + find $D/usr -type d -empty -delete +endif + +override_dh_installdocs: + dh_installdocs -pkmod -plibkmod-dev --link-doc=libkmod2 + dh_installdocs -pkmod --link-doc=libkmod2 README.md TODO + dh_installdocs -plibkmod2 + cp libkmod/README $(DD)/usr/share/doc/libkmod2/README.libkmod + +override_dh_installchangelogs: + dh_installchangelogs NEWS + +override_dh_installinit: + dh_installinit --no-start + +override_dh_makeshlibs: + dh_makeshlibs -V'libkmod2 (>= $(shell perl debian/highest_symbol_version debian/libkmod2.symbols))' -- -c4 + +override_dh_shlibdeps: + dh_shlibdeps -- --warnings=7 + |