1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
  
     | 
    
      #!/usr/bin/make -f
export CC = diet gcc
export DEB_CFLAGS_MAINT_APPEND = -Os
# Neither dietlibc nor musl libc is not compiled with -fPIC, so
# creating statically linked -fPIE executables won't work (also we'd
# need to use -Wl,-Bstatic instead of -static to make this work with
# crtbeginT.so even if dietlibc were to be compiled with -fPIC, see
# <https://bugzilla.redhat.com/show_bug.cgi?id=214465>)
# The static versions of other libc implementations (e.g. glibc) are
# also not compiled with -fPIC, so this is not unique to dietlibc or
# musl-libc.
# (dietlibc upstream is interested in supporting static PIE
# executables, so this will change in the future.)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
%:
	dh $@
# Build two variants: the regular one with all features enabled,
# and a debugging version that is verbose.
VARIANTS = standard debug
override_dh_auto_build:     $(foreach variant,$(VARIANTS),dh_auto_build_$(variant))
override_dh_auto_install:   $(foreach variant,$(VARIANTS),dh_auto_install_$(variant))
override_dh_auto_configure: $(foreach variant,$(VARIANTS),dh_auto_configure_$(variant))
	sed 's%@@libexecdir@@%/usr/libexec%g' < debian/extra/mktirfs.in > debian/extra/mktirfs
	chmod 0755 debian/extra/mktirfs
override_dh_auto_clean:     $(foreach variant,$(VARIANTS),dh_auto_clean_$(variant))
	rm -f debian/extra/mktirfs
# Call both binaries -static (hence variant-name also for the standard
# variant), because that will not cause a lintian error, and the
# binaries are supposed to be statically linked.
dh_auto_configure_standard:
	dh_auto_configure -Bbuild.standard -- \
	  --enable-nfs4 --enable-uuid --enable-modules --disable-debug \
	  --with-variant-name=static
dh_auto_configure_debug:
	dh_auto_configure -Bbuild.debug -- \
	  --enable-nfs4 --enable-uuid --enable-modules --enable-debug \
	  --with-variant-name=debug-static
dh_auto_build_%:
	dh_auto_build -Bbuild.$(subst dh_auto_build_,,$@)
dh_auto_clean_%:
	dh_auto_clean -Bbuild.$(subst dh_auto_clean_,,$@)
dh_auto_install_%:
	dh_auto_install -Bbuild.$(subst dh_auto_install_,,$@)
override_dh_gencontrol:
	dh_gencontrol -- -VBuilt-Using="`dpkg-query -f'$${source:Package} (= $${source:Version})' -W dietlibc-dev`"
 
     |