3 # The versions of python currently supported
4 PYVERS=$(shell pyversions -s)
5 # The current default version of python
6 PYVER=$(shell pyversions -d)
10 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
13 CFLAGS += -O2 -fno-strict-aliasing
16 TARGETS := main #$(PYVERS) $(PYVERS:%=%-dbg)
18 WITH_UDEB := $(shell dpkg-vendor --derives-from Ubuntu && echo yes)
21 $(if $(shell grep -q libxml2-udeb debian/control || echo yes),$(shell cat debian/control.udeb >> debian/control))
24 $(if $(shell grep -q libxml2-udeb debian/control && echo yes),$(shell sed -i /libxml2-udeb/,\$$d debian/control))
25 export DH_OPTIONS = -Nlibxml2-udeb
28 CONFIGURE_FLAGS := --with-history CC="gcc -Wl,--as-needed" CFLAGS="$(CFLAGS)" --cache-file="$(CURDIR)/build/config.cache"
30 override_dh_auto_configure: $(TARGETS:%=configure-%)
33 dh_auto_configure --builddirectory=build/$* -- $(CONFIGURE_FLAGS)
35 configure-main: CONFIGURE_FLAGS += --without-python
36 #configure-python%: CONFIGURE_FLAGS += --with-python=/usr/bin/$*
37 configure-udeb: CONFIGURE_FLAGS += --without-history --with-minimum --with-tree --with-output
39 override_dh_auto_build: $(TARGETS:%=build-%)
41 build-%: BUILD_DIR=build/$*
43 $(if $(filter $(BUILD_DIR),build/$*),,[ -d $(BUILD_DIR) ] || mv build/$*/python $(BUILD_DIR))
44 dh_auto_build --builddirectory=$(BUILD_DIR) -- $(BUILD_FLAGS)
46 #build-python%: BUILD_DIR=build/main/$*
47 #build-python%: BUILD_FLAGS = libxml2mod_la_LIBADD='$$(mylibs)'
48 #build-python%-dbg: BUILD_FLAGS += PYTHON_INCLUDES=/usr/include/$(*:-dbg=_d) LDFLAGS="-L$(CURDIR)/debian/tmp/usr/lib" CFLAGS="-Wall -g -O0"
50 override_dh_auto_clean:
51 rm -rf build debian/tmp-dbg
53 -test -r /usr/share/misc/config.sub && \
54 cp -f /usr/share/misc/config.sub config.sub
55 -test -r /usr/share/misc/config.guess && \
56 cp -f /usr/share/misc/config.guess config.guess
58 override_dh_auto_install: $(TARGETS:%=install-%)
61 dh_auto_install --builddirectory=build/main
62 mv debian/tmp/usr/share/aclocal/libxml.m4 debian/tmp/usr/share/aclocal/libxml2.m4
64 # Properly install documentation in /usr/share/doc/libxml2-doc
65 install -d debian/tmp/usr/share/doc/libxml2-doc/examples
70 doc/libxml2-api.xml debian/tmp/usr/share/doc/libxml2-doc
74 doc/examples/index.html \
75 doc/examples/[tw]*.xml debian/tmp/usr/share/doc/libxml2-doc/examples
78 doc/tutorial debian/tmp/usr/share/doc/libxml2-doc
81 # $(MAKE) -C build/main/python$*-dbg DESTDIR=$(CURDIR)/debian/tmp-dbg install-pythonLTLIBRARIES
82 # prename 's/(?<!_d)\.so$$/_d.so/' debian/tmp-dbg/usr/lib/python$*/*-packages/*.so
85 # dh_auto_install --builddirectory=build/main/python$*
88 dh_auto_install --builddirectory=build/udeb --destdir=debian/tmp-udeb
90 override_dh_installdocs:
91 dh_installdocs -A AUTHORS TODO README NEWS
92 # dh_installdocs -ppython-libxml2 python/TODO
95 dh_compress -Xexamples/ -Xtutorial/ -Xhtml/ -X.html
97 override_dh_installchangelogs:
98 dh_installchangelogs -plibxml2 ChangeLog
99 dh_installchangelogs -Nlibxml2 -XChangeLog
102 dh_install -Npython-libxml2-dbg -Nlibxml2-udeb
103 # dh_install -ppython-libxml2-dbg --sourcedir=debian/tmp-dbg
104 dh_install -plibxml2-udeb --sourcedir=debian/tmp-udeb
105 sed "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/libxml2.la > debian/libxml2-dev/usr/lib/libxml2.la
108 dh_strip -a --dbg-package=libxml2-dbg #-Npython-libxml2 -Npython-libxml2-dbg
109 # dh_strip -ppython-libxml2 --dbg-package=python-libxml2-dbg
110 # $(foreach python, $(filter-out $(PYVER), $(PYVERS)),\
111 # cd $(CURDIR)/debian/python-libxml2/usr/lib/pyshared; \
112 # if diff $(python)/libxml2mod.so $(PYVER)/libxml2mod.so > /dev/null 2>&1; then \
113 # rm -f $(python)/libxml2mod.so; \
114 # ln -s ../$(PYVER)/libxml2mod.so $(python)/libxml2mod.so; \
117 override_dh_makeshlibs:
118 dh_makeshlibs -a $(if $(WITH_UDEB),--add-udeb=libxml2-udeb )-V 'libxml2 (>= 2.7.4)' -- -c4