#!/usr/bin/make -f export DH_VERBOSE=1 DOPACKAGES = $(shell dh_listpackages) ifneq (,$(filter python3-libxml2 python3-libxml2-dbg,$(DOPACKAGES))) # The versions of python3 currently supported PY3VERS=$(shell py3versions -s) else PY3VERS= endif export DEB_BUILD_MAINT_OPTIONS=hardening=+all export DEB_CFLAGS_MAINT_APPEND = -Wall -O3 export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed include /usr/share/dpkg/architecture.mk TARGETS := main $(PYVERS) $(PYVERS:%=%-dbg) $(PY3VERS) $(PY3VERS:%=%-dbg) CONFIGURE_FLAGS := --with-history --cache-file="$(CURDIR)/builddir/config.cache" override_dh_auto_configure-arch: $(TARGETS:%=doconfigure-%) override_dh_auto_configure-indep: dh_auto_configure -- --enable-rebuild-docs --without-python doconfigure-%: dh_auto_configure --builddirectory=builddir/$(*) -- $(CONFIGURE_FLAGS) touch $@ doconfigure-main: CONFIGURE_FLAGS += --without-python --with-icu doconfigure-python%: CONFIGURE_FLAGS += --with-python=/usr/bin/$(subst -dbg,,$(*)) --with-python-install-dir=/usr/lib/$(subst -dbg,,$(*))/dist-packages dobuild-%: BUILD_DIR=builddir/$(*) dobuild-%: doconfigure-% $(if $(filter $(BUILD_DIR),builddir/$(*)),,[ -d $(BUILD_DIR) ] || mv builddir/$(*)/python $(BUILD_DIR)) dh_auto_build --builddirectory=$(BUILD_DIR) -- $(BUILD_FLAGS) dobuild-python%: BUILD_DIR=builddir/main/$(*) dobuild-python%: BUILD_FLAGS=libxml2mod_la_LIBADD='$$(mylibs)' \ PYTHON_INCLUDES='$(shell $(DEB_HOST_GNU_TYPE)-$(*)-config --includes)' \ PYTHON_LIBS='$(shell $(DEB_HOST_GNU_TYPE)-$(*)-config --ldflags)' dobuild-python%-dbg: BUILD_FLAGS+=PYTHON_INCLUDES='$(shell $(DEB_HOST_GNU_TYPE)-$(*)-config --includes)' \ PYTHON_LIBS='$(shell $(DEB_HOST_GNU_TYPE)-$(*)-config --ldflags)' \ CFLAGS='$(CFLAGS) -Wall -g -O0' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS) \ -L$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)' override_dh_auto_build-arch: $(TARGETS:%=dobuild-%) override_dh_auto_build-indep: dh_auto_build -i override_dh_auto_test-indep: : Skipping tests during indep build override_dh_auto_clean: rm -rf builddir debian/tmp-dbg rm -f doconfigure-* dh_auto_clean doinstall-main: dh_auto_install --builddirectory=builddir/main mv debian/tmp/usr/share/aclocal/libxml.m4 debian/tmp/usr/share/aclocal/libxml2.m4 override_dh_auto_install-arch: $(TARGETS:%=doinstall-%) find debian/tmp -name *.la -delete override_dh_auto_install-indep: dh_auto_install -i doinstall-python%-dbg: $(MAKE) -C builddir/main/python$(*)-dbg DESTDIR=$(CURDIR)/debian/tmp-dbg install-pythonLTLIBRARIES rename -v -f 's/(?= 2.9.8)' -- -c4 # I need to specify all the targets (build, binary, clean, etc) as # otherwise dh may invoke them in a order that is not appropriate for the # build system (the -indep part is done in-tree because rebuilding the # docs out of tree is not supported. And once an in-tree build is done no # out-of-tree builds can't be done, so we wouldn't be able to do the -arch # builds after the -indep one). clean build-arch binary-arch build-indep binary-indep: dh $@ build: build-arch build-indep binary: binary-arch binary-indep