X-Git-Url: http://andersk.mit.edu/gitweb/nss_nonlocal.git/blobdiff_plain/75b66003aa1a0706d1c7ca9a468f77f65c82a545..61375334a54d5a88b6a6161bfcfd02d137a19fe6:/debian/rules diff --git a/debian/rules b/debian/rules index c90fcf2..202ff61 100755 --- a/debian/rules +++ b/debian/rules @@ -1,22 +1,67 @@ #!/usr/bin/make -f -DEB_AUTO_UPDATE_AUTOCONF = 2.50 -DEB_AUTO_UPDATE_AUTOHEADER = 2.50 -DEB_AUTO_UPDATE_AUTOMAKE = 1.9 -DEB_AUTO_UPDATE_ACLOCAL = 1.9 -DEB_AUTO_UPDATE_LIBTOOL = pre +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/autotools.mk +# Work around http://bugs.debian.org/572077 (debhelper < 7.4.16) +binary: binary-arch binary-indep ; -DEB_CONFIGURE_PREFIX = / +%: + dh $@ --with autoreconf -debian/stamp-autotools-files: DEB_AUTO_UPDATE_AUTOMAKE += --foreign --add-missing +all_flavors = libnss-nonlocal +libnss-nonlocal_configure_args += --prefix=/ +libnss-nonlocal_dh_install = 'lib/*' -debian/stamp-autotools-files: aclocal.m4 -aclocal.m4: - touch $@ +ifneq ($(DEB_HOST_MULTIARCH),) + export DH_COMPAT = 9 + libnss-nonlocal_configure_args += --libdir='$${prefix}/lib/$(DEB_HOST_MULTIARCH)' + libnss-nonlocal_dh_install = 'lib/$(DEB_HOST_MULTIARCH)/*' + libnss-nonlocal_dh_gencontrol = -- -DMulti-Arch=same +else ifeq ($(shell hash dpkg-buildflags 2>/dev/null && echo y),y) + all_configure_args += $(foreach var,CFLAGS CPPFLAGS LDFLAGS,"$(var)=$$(dpkg-buildflags --get $(var))") +endif -clean:: - rm -f aclocal.m4 config.guess config.sub install-sh ltmain.sh \ - configure config.h.in missing depcomp Makefile.in +IS_UBUNTU := $(if $(filter Ubuntu,$(shell lsb_release -is)),y) +LIBC6_VERSION := $(shell dpkg-query --showformat='$${Version}' --show libc6) +libc6_ge = $(shell dpkg --compare-versions '$(LIBC6_VERSION)' ge '$(1)' && echo y) + +all_flavors += lib32nss-nonlocal +# i386_configure_target in eglibc/debian/sysdeps/amd64.mk +ifeq ($(or $(IS_UBUNTU),$(call libc6_ge,2.8+20080809)),y) +lib32nss-nonlocal_configure_args += --build=i686-linux +else +lib32nss-nonlocal_configure_args += --build=i486-linux +endif +# i386_CC in eglibc/debian/sysdeps/amd64.mk +lib32nss-nonlocal_configure_args += CC='$(CC) -m32' +# i386_slibdir in eglibc/debian/sysdeps/amd64.mk +ifeq ($(or $(IS_UBUNTU),$(call libc6_ge,2.9-14~)),y) +lib32nss-nonlocal_configure_args += --prefix=/ --libdir='$${prefix}/lib32' +lib32nss-nonlocal_dh_install = 'lib32/*' +else +lib32nss-nonlocal_configure_args += --prefix=/emul/ia32-linux +lib32nss-nonlocal_dh_install = 'emul/ia32-linux/*' +endif + +all_flavors += lib64nss-nonlocal +# amd64_configure_target in eglibc/debian/sysdeps/i386.mk +lib64nss-nonlocal_configure_args += --build=x86_64-linux +# amd64_CC in eglibc/debian/sysdeps/i386.mk +lib64nss-nonlocal_configure_args += CC='$(CC) -m64 -D__x86_64__' +# amd64_slibdir in eglibc/debian/sysdeps/i386.mk +lib64nss-nonlocal_configure_args += --prefix=/ --libdir="\$${prefix}/lib64" + +flavors := $(filter $(all_flavors),$(shell dh_listpackages)) + +define do_overrides +override_$(1): $(addsuffix _$(1),$(2)) +$(addsuffix _$(1),$(filter-out REMAINING,$(2))): %_$(1): + $(1) -p$$* $(3) +REMAINING_$(1): $(addsuffix _$(1),$(filter-out REMAINING,$(2))) + $(1) --remaining-packages $(4) + +endef + +$(eval $(foreach auto,configure build install test clean,$(call do_overrides,dh_auto_$(auto),$(flavors),-Bdebian/build_$$* -- $$(all_$(auto)_args) $$($$*_$(auto)_args)))) +$(eval $(call do_overrides,dh_install,$(flavors) REMAINING,$$($$*_dh_install))) +$(eval $(call do_overrides,dh_gencontrol,libnss-nonlocal REMAINING,$$($$*_dh_gencontrol)))