| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
# For Hardening |
| 4 |
export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
| 5 |
DPKG_EXPORT_BUILDFLAGS = 1 |
| 6 |
include /usr/share/dpkg/architecture.mk |
| 7 |
include /usr/share/dpkg/buildflags.mk |
| 8 |
include /usr/share/dpkg/pkg-info.mk |
| 9 |
|
| 10 |
# Reproducible timestamp |
| 11 |
export KBUILD_BUILD_TIMESTAMP = "@$(SOURCE_DATE_EPOCH)" |
| 12 |
|
| 13 |
# Disable libdmmp, no known users exist |
| 14 |
export ENABLE_LIBDMMP=0 |
| 15 |
|
| 16 |
TREENAMES = build-deb build-udeb |
| 17 |
|
| 18 |
%: |
| 19 |
dh $@ |
| 20 |
|
| 21 |
execute_before_dh_clean: |
| 22 |
rm -f debian/libmpathpersist0.symbols |
| 23 |
for treename in $(TREENAMES); do \ |
| 24 |
rm -rf debian/$$treename ;\ |
| 25 |
done |
| 26 |
# Force recreation of docs re. reproducibility |
| 27 |
rm -fv libdmmp/docs/man/dmmp_strerror.3 |
| 28 |
|
| 29 |
execute_before_dh_auto_configure: |
| 30 |
# no out of tree build support, prepare two source trees |
| 31 |
for treename in $(TREENAMES); do \ |
| 32 |
mkdir debian/$$treename ;\ |
| 33 |
cp -r -t debian/$$treename $$(find . -mindepth 1 -maxdepth 1 \! -name debian \! -name .git) ;\ |
| 34 |
done |
| 35 |
|
| 36 |
override_dh_auto_configure: |
| 37 |
|
| 38 |
override_dh_auto_build-indep: |
| 39 |
|
| 40 |
override_dh_auto_build-arch: |
| 41 |
dh_auto_build --sourcedirectory=debian/build-deb -- V=1 WARN_ONLY=1 |
| 42 |
# multipath-udeb: build separately; don't reference dynamic libgcc at runtime (#779579); disable systemd |
| 43 |
dh_auto_build --sourcedirectory=debian/build-udeb -- V=1 WARN_ONLY=1 \ |
| 44 |
SYSTEMD= EXTRACFLAGS="-static-libgcc" |
| 45 |
|
| 46 |
override_dh_auto_test: |
| 47 |
# on loong64 the test aborts with: loongarch64-linux-gnu-ld.bfd: directio.o: in function libcheck_pending: libmultipath/checkers/directio.c:430: undefined reference to __fxstat |
| 48 |
ifneq ($(DEB_HOST_ARCH),loong64) |
| 49 |
dh_auto_test -a --sourcedirectory=debian/build-deb |
| 50 |
dh_auto_test -a --sourcedirectory=debian/build-udeb |
| 51 |
endif |
| 52 |
|
| 53 |
override_dh_auto_install-arch: |
| 54 |
dh_auto_install --sourcedirectory=debian/build-deb -- DESTDIR=$(CURDIR)/debian/tmp/deb |
| 55 |
dh_auto_install --sourcedirectory=debian/build-udeb -- DESTDIR=$(CURDIR)/debian/tmp/udeb |
| 56 |
|
| 57 |
# udebs dont get manpages |
| 58 |
rm -rf $(CURDIR)/debian/tmp/udeb/usr/share/man |
| 59 |
|
| 60 |
# Delete development files from udebs. |
| 61 |
rm \ |
| 62 |
$(CURDIR)/debian/tmp/udeb/usr/include/mpath_cmd.h \ |
| 63 |
$(CURDIR)/debian/tmp/udeb/usr/include/mpath_persist.h \ |
| 64 |
$(CURDIR)/debian/tmp/udeb/usr/lib/libm*.so |
| 65 |
|
| 66 |
override_dh_auto_install-indep: |
| 67 |
|
| 68 |
execute_after_dh_install: |
| 69 |
if strings debian/multipath-udeb/usr/lib/libmultipath.so.0 | grep libsystemd.so ; then \ |
| 70 |
echo ERROR: udeb linked to libsystemd ;\ |
| 71 |
exit 1 ;\ |
| 72 |
fi |
| 73 |
|
| 74 |
override_dh_bugfiles: |
| 75 |
dh_bugfiles -A -pmultipath-tools -pmultipath-tools-boot |
| 76 |
|
| 77 |
override_dh_installsystemd: |
| 78 |
dh_installsystemd -pmultipath-tools multipathd.service multipathd-queueing.service \ |
| 79 |
--no-stop-on-upgrade |
| 80 |
|
| 81 |
debian/libmpathpersist0.symbols: debian/libmpathpersist0.symbols.in |
| 82 |
sed -e 's/$${DEB_VERSION}/${DEB_VERSION}/g' \ |
| 83 |
< $< > $@ |
| 84 |
|
| 85 |
override_dh_makeshlibs: debian/libmpathpersist0.symbols |
| 86 |
dh_makeshlibs -a --add-udeb=multipath-udeb -- -c4 |