summaryrefslogtreecommitdiffstats
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules186
1 files changed, 186 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..86a1463
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,186 @@
+#!/usr/bin/make -f
+
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/pkg-info.mk
+
+CONFOPTS += --libdir=/lib/$(DEB_HOST_MULTIARCH)
+CONFOPTS += --libexecdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
+
+ifeq ($(DEB_HOST_ARCH_OS),linux)
+CONFOPTS += --enable-raw
+CONFOPTS += --with-selinux
+CONFOPTS += --with-smack
+CONFOPTS += --enable-partx
+ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
+ CONFOPTS += --without-systemd --without-udev --without-audit
+else
+ CONFOPTS += --with-systemd --with-udev --with-audit
+endif
+endif
+
+# build static versions of programs used in fdisk-udeb and util-linux-udeb
+CONFOPTS += --enable-static-programs=fdisk,sfdisk,blkid
+
+# Help welcome packaging the (libmount) python bindings.
+# See http://bugs.debian.org/811361
+CONFOPTS += --without-python
+
+# disable utilities shipped by other packages
+# => login
+CONFOPTS += --disable-login
+CONFOPTS += --disable-nologin
+# => procps
+CONFOPTS += --disable-kill
+# => eject
+CONFOPTS += --disable-eject
+# => passwd
+CONFOPTS += --disable-chfn-chsh
+# => bsdmainutils
+CONFOPTS += --disable-look
+CONFOPTS += --disable-hexdump
+CONFOPTS += --disable-col --disable-colcrt --disable-colrm --disable-column
+CONFOPTS += --disable-ul
+CONFOPTS += --disable-cal
+
+# Get the list of binary package, except lib* and *-udeb, from
+# debian/control instead of hardcoding the list when installing
+# bash-completions below.
+BINARYPACKAGES := $(shell awk '/^Package: /{if($$2 !~ /^lib|-udeb$$/) print $$2}' $(CURDIR)/debian/control )
+
+# hardening
+export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow
+
+%:
+ dh $@
+
+override_dh_autoreconf:
+ AM_OPTS=--copy LT_OPTS=--copy dh_autoreconf ./autogen.sh
+
+override_dh_auto_configure:
+ dh_auto_configure -- $(CONFOPTS)
+
+override_dh_auto_install:
+ dh_auto_install
+ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
+ # Manually generate and install units to avoid missing files when
+ # util-linux.install gets executed in stage1 builds.
+ install -d debian/tmp/lib/systemd/system
+ make PATHFILES=sys-utils/fstrim.service sys-utils/fstrim.service
+ install -m644 sys-utils/fstrim.service debian/tmp/lib/systemd/system/fstrim.service
+ install -m644 sys-utils/fstrim.timer debian/tmp/lib/systemd/system/fstrim.timer
+endif
+ #
+ # remove *.la files
+ rm -f debian/tmp/usr/lib/*/*.la
+
+override_dh_auto_clean:
+ dh_auto_clean
+ # drop arch-overrides, generated in dh_install by dh-exec usage.
+ rm -f debian/uuid-runtime.install.$(DEB_HOST_ARCH) \
+ debian/util-linux.install.$(DEB_HOST_ARCH)
+
+override_dh_install:
+ # generate arch-override, as dh-exec install-rename can only run once.
+ [ -f debian/util-linux.install.$(DEB_HOST_ARCH) ] || \
+ debian/util-linux.install > \
+ debian/util-linux.install.$(DEB_HOST_ARCH)
+ [ -f debian/uuid-runtime.install.$(DEB_HOST_ARCH) ] || \
+ debian/uuid-runtime.install > \
+ debian/uuid-runtime.install.$(DEB_HOST_ARCH)
+ #
+ install -D -p -m644 debian/fdisk-udeb.lintian-overrides \
+ debian/fdisk-udeb/usr/share/lintian/overrides/fdisk-udeb
+ dh_install \
+ -Nfdisk-udeb -Nlibblkid1-udeb \
+ -Nlibfdisk1-udeb -Nlibsmartcols1-udeb -Nlibuuid1-udeb \
+ -Nutil-linux-udeb
+ dh_install --remaining-packages
+ #
+ # Install bash-completions only for binaries we ship
+ for PACKAGE in $(BINARYPACKAGES) ; do \
+ for BINARY in debian/$$PACKAGE/bin/* debian/$$PACKAGE/sbin/* \
+ debian/$$PACKAGE/usr/bin/* \
+ debian/$$PACKAGE/usr/sbin/* ; \
+ do \
+ BASENAME=$$(basename $$BINARY); \
+ BCDIR=usr/share/bash-completion/completions/; \
+ BCNAME=$$BCDIR/$$BASENAME ; \
+ if [ "$$BASENAME" != '*' ] && [ -e "debian/tmp/$$BCNAME" ]; \
+ then \
+ echo "$$PACKAGE: Installing $$BCNAME"; \
+ [ -d debian/$$PACKAGE/$$BCDIR ] || \
+ mkdir -p debian/$$PACKAGE/$$BCDIR; \
+ mv debian/tmp/$$BCNAME debian/$$PACKAGE/$$BCNAME; \
+ fi; \
+ done; \
+ done
+ #
+ rm -rf debian/*-udeb/usr/share/doc
+
+override_dh_installman:
+ dh_installman --language=C
+
+override_dh_gencontrol:
+ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
+ dh_gencontrol --package=bsdutils -- -v1:$(DEB_VERSION_UPSTREAM_REVISION)
+endif
+ dh_gencontrol --remaining-packages
+
+override_dh_installinit:
+ # hwclock works on all Linux architectures, except s390
+ # (and s390x, of course).
+ifeq (linux,$(DEB_HOST_ARCH_OS))
+ifeq (,$(findstring s390,$(DEB_HOST_ARCH)))
+ # install /etc/init.d/hwclock.sh
+ dh_installinit --name=hwclock.sh --no-start
+ # install /etc/default/hwclock
+ dh_installinit --name=hwclock
+endif
+endif
+ # install uuidd sysvinit script
+ make misc-utils/uuidd.rc
+ ln -s ../misc-utils/uuidd.rc debian/uuid-runtime.uuidd.init
+ dh_installinit --name=uuidd --restart-after-upgrade
+ rm -f debian/uuid-runtime.uuidd.init
+
+override_dh_installpam:
+ dh_installpam --package=util-linux --name=runuser
+ dh_installpam --package=util-linux --name=runuser-l
+ dh_installpam --package=util-linux --name=su
+ dh_installpam --package=util-linux --name=su-l
+
+override_dh_makeshlibs:
+ dh_makeshlibs \
+ -N libsmartcols1 -N libblkid1 \
+ -N libfdisk1 -N libmount1 -N libuuid1
+ dh_makeshlibs -plibsmartcols1 -V \
+ --add-udeb=libsmartcols1-udeb
+ dh_makeshlibs -plibblkid1 -V \
+ --add-udeb=libblkid1-udeb
+ dh_makeshlibs -plibfdisk1 -V \
+ --add-udeb=libfdisk1-udeb
+ dh_makeshlibs -plibmount1 -V \
+ --add-udeb=libmount1-udeb
+ dh_makeshlibs -plibuuid1 -V \
+ --add-udeb=libuuid1-udeb
+
+override_dh_fixperms:
+ dh_fixperms -i -a -Xusr/bin/wall -Xbin/mount -Xbin/umount -Xbin/su
+
+ifeq (linux,$(DEB_HOST_ARCH_OS))
+override_dh_installsystemd:
+ dh_installsystemd -putil-linux --no-enable --no-start fstrim.timer fstrim.service
+ dh_installsystemd --remaining-packages
+endif
+
+override_dh_auto_test:
+ifneq (,$(filter alpha armel armhf arm64,$(DEB_HOST_ARCH)))
+ @echo "WARNING: Making tests non-fatal because of arch $(DEB_HOST_ARCH)"
+ dh_auto_test --max-parallel=1 || true
+else ifeq ($(DEB_HOST_ARCH_OS), linux)
+ dh_auto_test --max-parallel=1
+else
+ @echo "WARNING: non-linux detected, making tests non-fatal."
+ dh_auto_test --max-parallel=1 || true
+endif
+