#!/usr/bin/make -f export DH_VERBOSE=1 include /usr/share/dpkg/architecture.mk # The versions of python currently supported PYVERS=$(shell pyversions -s) # The current default version of python PYVER=$(shell pyversions -d) export DEB_BUILD_MAINT_OPTIONS=hardening=+all DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) CC = $(DEB_HOST_GNU_TYPE)-gcc CFLAGS = `dpkg-buildflags --get CFLAGS` -Wall -O3 LDFLAGS = `dpkg-buildflags --get LDFLAGS` -Wl,--as-needed CPPFLAGS = `dpkg-buildflags --get CPPFLAGS` TARGETS := main $(PYVERS) $(PYVERS:%=%-dbg) ifeq (illumos-amd64,$(DEB_HOST_ARCH)) TARGETS += 32 endif WITH_UDEB := $(shell dpkg-vendor --derives-from Ubuntu && echo yes) ifdef WITH_UDEB $(if $(shell grep -q libxml2-udeb debian/control || echo yes),$(shell cat debian/control.udeb >> debian/control)) TARGETS += udeb else $(if $(shell grep -q libxml2-udeb debian/control && echo yes),$(shell sed -i /libxml2-udeb/,\$$d debian/control)) export DH_OPTIONS = -Nlibxml2-udeb endif ifeq ($(DEB_BUILD_PROFILE),stage1) DH_OPTIONS += -Npython-libxml2 -Npython-libxml2-dbg export DH_OPTIONS endif CONFIGURE_FLAGS = --disable-silent-rules --with-history CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" --cache-file="$(CURDIR)/builddir/config.cache" override_dh_auto_configure: $(TARGETS:%=doconfigure-%) debian/autoreconf.after: dh_autoreconf doconfigure-%: debian/autoreconf.after dh_auto_configure --builddirectory=builddir/$* -- $(CONFIGURE_FLAGS) doconfigure-main: CONFIGURE_FLAGS += --without-python --with-icu doconfigure-python%: CONFIGURE_FLAGS += --with-python=/usr/bin/$* doconfigure-udeb: CONFIGURE_FLAGS += --without-history --with-tree --with-output --without-python --without-icu doconfigure-32: CONFIGURE_FLAGS += --libdir=/usr/lib32 --without-python --without-lzma --without-history --with-tree --with-output --without-icu --cache-file=/dev/null doconfigure-32: CC += -m32 override_dh_auto_build: $(TARGETS:%=dobuild-%) 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)-python-config --includes)" \ PYTHON_LIBS="$(shell $(DEB_HOST_GNU_TYPE)-python-config --ldflags)" dobuild-python%-dbg: BUILD_FLAGS += PYTHON_INCLUDES="$(shell $(DEB_HOST_GNU_TYPE)-python-dbg-config --includes)" \ PYTHON_LIBS="$(shell $(DEB_HOST_GNU_TYPE)-python-dbg-config --ldflags)" \ CFLAGS="$(CFLAGS) -Wall -g -O0" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS) \ -L$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)" #override_dh_auto_build: $(TARGETS:%=dobuild-%) build-arch: $(TARGETS:%=dobuild-%) build-indep: build: build-arch build-indep override_dh_auto_clean: rm -rf builddir debian/tmp-dbg debian/tmp-udeb dh_auto_clean override_dh_auto_install: $(TARGETS:%=doinstall-%) find debian/ -name *.la -delete doinstall-32: $(MAKE) -C builddir/32 install-libLTLIBRARIES \ DESTDIR=$(CURDIR)/debian/tmp doinstall-main: dh_auto_install --builddirectory=builddir/main mv debian/tmp/usr/share/aclocal/libxml.m4 debian/tmp/usr/share/aclocal/libxml2.m4 # Properly install documentation in /usr/share/doc/libxml2-doc install -d debian/tmp/usr/share/doc/libxml2-doc/examples install -m 644 \ doc/*.html \ doc/*.gif \ doc/*.png \ doc/libxml2-api.xml debian/tmp/usr/share/doc/libxml2-doc install -m 644 \ doc/examples/*.c \ doc/examples/*.res \ doc/examples/index.html \ doc/examples/[tw]*.xml debian/tmp/usr/share/doc/libxml2-doc/examples cp -a \ doc/html \ doc/tutorial debian/tmp/usr/share/doc/libxml2-doc doinstall-python%-dbg: $(MAKE) -C builddir/main/python$*-dbg DESTDIR=$(CURDIR)/debian/tmp-dbg install-pythonLTLIBRARIES prename -vf 's/(? /dev/null 2>&1; then \ rm -f $(python)/libxml2mod.so; \ ln -s ../$(PYVER)/libxml2mod.so $(python)/libxml2mod.so; \ fi;) dh_strip override_dh_makeshlibs: dh_makeshlibs -a $(if $(WITH_UDEB),--add-udeb=libxml2-udeb ) -- -c4 override_dh_gencontrol: dh_gencontrol -- -Vdep:libicudbg="`dpkg-query -f '$${Depends}' -W libicu-dev | sed 's/.*\(libicu[0-9]*\).*/\1/'`-dbg" %: ifeq ($(DEB_BUILD_PROFILE),stage1) dh $@ --with autoreconf else dh $@ --parallel --with autoreconf,python2 endif