#!/usr/bin/make -f DEB_BUILD_MAINT_OPTIONS = hardening=+all DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 include /usr/share/dpkg/architecture.mk ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),) include /usr/share/python3/python.mk PY3VERS := $(shell py3versions -vs) DH_WITH_PARAMETERS := python3 else NOPYTHON_OPTIONS = -Npython3-cracklib DH_WITH_PARAMETERS := endif ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) CRACKLIB_PACKER=$(CURDIR)/debian/buildtmp/base/util/cracklib-packer else CRACKLIB_PACKER=/usr/sbin/cracklib-packer endif # The _PYTHON_* asssignments are required for cross building. Don't # delete them unless you verify that cross building keeps working. export _PYTHON_HOST_PLATFORM=$(DEB_HOST_ARCH_OS)-$(DEB_HOST_GNU_CPU) export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__$(DEB_HOST_ARCH_OS)_$(DEB_HOST_MULTIARCH) override_dh_auto_configure: aclocal && libtoolize && automake --add-missing && autoreconf mkdir -p $(CURDIR)/debian/buildtmp/base cd $(CURDIR)/debian/buildtmp/base; \ $(CURDIR)/configure \ --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr --disable-rpath --without-python \ --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-default-dict=/var/cache/cracklib/cracklib_dict \ --without-zlib \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" set -e; \ for i in $(PY3VERS); do \ mkdir -p $(CURDIR)/debian/buildtmp/python$$i; \ cd $(CURDIR)/debian/buildtmp/python$$i; \ $(CURDIR)/configure \ --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr --disable-rpath \ --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ --with-default-dict=/var/cache/cracklib/cracklib_dict \ --without-zlib \ PYTHON_PREFIX=$(call py_builddir_sh,$$i) \ PYTHON=/usr/bin/python$$i \ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"; \ done override_dh_auto_build: $(MAKE) -C $(CURDIR)/debian/buildtmp/base ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),) ln -s $(CURDIR)/debian/crack.py $(CURDIR)/python; \ set -e; \ for i in $(PY3VERS); do \ cd $(CURDIR)/debian/buildtmp/python$$i; \ rm -rf lib; ln -s $(CURDIR)/debian/buildtmp/base/lib lib; \ cd python; \ CFLAGS='-I$(CURDIR)/lib $(CFLAGS)' \ LDFLAGS='$(LDFLAGS)' \ CPPFLAGS='$(CPPFLAGS) -DLOCALEDIR=\"/usr/share/locale\"' \ python$$i setup.py build ; \ done endif docbook2html -o debian/doc --nochunks debian/libcrack2.xml docbook2html -o debian/doc --nochunks debian/cracklib-runtime.xml override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) mkdir $(CURDIR)/debian/tmp ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES))$(filter nocheck,$(DEB_BUILD_OPTIONS)),) $(CRACKLIB_PACKER) $(CURDIR)/debian/tmp/cracklib_dict < \ $(CURDIR)/dicts/cracklib-small set -e; \ for i in $(PY3VERS); do \ cd $(CURDIR)/debian/buildtmp/python$$i/python/$(call py_builddir_sh,$$i); \ LD_LIBRARY_PATH=$(CURDIR)/debian/buildtmp/base/lib/.libs python$$i \ -c 'import cracklib; cracklib.test(dictpath="$(CURDIR)/debian/tmp/cracklib_dict")'; \ done endif endif override_dh_auto_clean: rm -rf debian/buildtmp rm -rf debian/doc if [ -f Makefile ]; then $(MAKE) clean; fi if [ -f Makefile ]; then $(MAKE) distclean; fi # remove files created or modified by autogen.sh rm -f config.guess config.sub Makefile.in aclocal.m4 configure \ dicts/Makefile.in doc/Makefile.in lib/Makefile.in m4/Makefile.in \ py-compile python/Makefile.in util/Makefile.in ltmain.sh \ m4/ltoptions.m4 m4/ltversion.m4 m4/libtool.m4 m4/ltsugar.m4 \ m4/lt~obsolete.m4 compile # remove files created or changed by build rm -rf python/crack.py python/cracklib.egg-info dh_auto_clean override_dh_auto_install: $(MAKE) -C $(CURDIR)/debian/buildtmp/base DESTDIR=$(CURDIR)/debian/libcrack2 install # copy files for libcrack2-udeb mkdir -p $(CURDIR)/debian/libcrack2-udeb/usr/lib/$(DEB_HOST_MULTIARCH) \ $(CURDIR)/debian/libcrack2-udeb/usr/share/locale \ $(CURDIR)/debian/libcrack2-udeb/var/cache/cracklib cp -P $(CURDIR)/debian/libcrack2/usr/lib/$(DEB_HOST_MULTIARCH)/*.so.* \ $(CURDIR)/debian/libcrack2-udeb/usr/lib/$(DEB_HOST_MULTIARCH) cp -r $(CURDIR)/debian/libcrack2/usr/share/locale/* \ $(CURDIR)/debian/libcrack2-udeb/usr/share/locale $(CRACKLIB_PACKER) $(CURDIR)/debian/libcrack2-udeb/var/cache/cracklib/cracklib_dict < \ $(CURDIR)/dicts/cracklib-small # move files to libcrack2-dev mkdir -p $(CURDIR)/debian/libcrack2-dev/usr/lib/$(DEB_HOST_MULTIARCH) mv $(CURDIR)/debian/libcrack2/usr/include \ $(CURDIR)/debian/libcrack2-dev/usr mv $(CURDIR)/debian/libcrack2/usr/lib/$(DEB_HOST_MULTIARCH)/*.a \ $(CURDIR)/debian/libcrack2-dev/usr/lib/$(DEB_HOST_MULTIARCH) # move files to cracklib-runtime mkdir -p $(CURDIR)/debian/cracklib-runtime/usr/share/dict mv $(CURDIR)/debian/libcrack2/usr/sbin \ $(CURDIR)/debian/cracklib-runtime/usr mv $(CURDIR)/debian/libcrack2/usr/share/cracklib/cracklib-small \ $(CURDIR)/debian/cracklib-runtime/usr/share/dict # remove unused files rm -f $(CURDIR)/debian/libcrack2/usr/lib/$(DEB_HOST_MULTIARCH)/*.la \ $(CURDIR)/debian/libcrack2/usr/lib/$(DEB_HOST_MULTIARCH)/libcrack.so rm -rf $(CURDIR)/debian/libcrack2/usr/share/cracklib chrpath -d \ $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-check \ $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-packer \ $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-unpacker ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),) set -e; \ for i in $(PY3VERS); do \ cd $(CURDIR)/debian/buildtmp/python$$i/python; \ python$$i setup.py install --install-layout=deb --root $(CURDIR)/debian/python3-cracklib; \ done endif override_dh_link: dh_link -plibcrack2-dev usr/lib/$(DEB_HOST_MULTIARCH)/libcrack.so.2 \ usr/lib/$(DEB_HOST_MULTIARCH)/libcrack.so dh_link override_dh_installchangelogs: dh_installchangelogs NEWS ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),) override_dh_python3: dh_python3 -ppython3-cracklib endif %: dh $@ --with=$(DH_WITH_PARAMETERS) $(NOPYTHON_OPTIONS)