Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 export DH_VERBOSE=1
3
4 DOPACKAGES = $(shell dh_listpackages)
5
6 ifneq (,$(filter python3-libxml2,$(DOPACKAGES)))
7 # The versions of python3 currently supported
8 PY3VERS=$(shell py3versions -s)
9 else
10 PY3VERS=
11 endif
12
13 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
14 export DEB_CFLAGS_MAINT_APPEND = -Wall -O3
15
16 include /usr/share/dpkg/architecture.mk
17
18 TARGETS := main $(PY3VERS)
19
20 CONFIGURE_FLAGS := --with-history \
21 --with-legacy \
22 --with-ftp \
23 --with-xptr-loc \
24 --with-http \
25 --with-lzma \
26 --with-docs \
27
28 override_dh_auto_configure-arch: $(TARGETS:%=doconfigure-%)
29
30 override_dh_auto_configure-indep:
31 dh_auto_configure -- --with-docs --docdir \$${prefix}/share/doc/libxml2 --enable-rebuild-docs --with-python=no
32
33 doconfigure-%:
34 export PYTHON=$(PYTHON) && dh_auto_configure --builddirectory=builddir/$(*) -- $(CONFIGURE_FLAGS) && unset PYTHON
35 touch $@
36
37 ifeq (,$(filter noi18n,$(DEB_BUILD_PROFILES)))
38 doconfigure-main: CONFIGURE_FLAGS += --with-python=no --enable-static
39 else
40 doconfigure-main: CONFIGURE_FLAGS += --with-python=no --enable-static
41 endif
42 doconfigure-python%: CONFIGURE_FLAGS += --with-python
43 #PYTHON_VERSION=$(subst python,,$(*))
44 PYTHON=$(shell which $(*))
45
46 dobuild-%: BUILD_DIR=builddir/$(*)
47 dobuild-%: doconfigure-%
48 $(if $(filter $(BUILD_DIR),builddir/$(*)),,[ -d $(BUILD_DIR) ] || mv builddir/$(*)/python $(BUILD_DIR))
49 dh_auto_build --builddirectory=$(BUILD_DIR) -- $(BUILD_FLAGS)
50
51 dobuild-python%: BUILD_DIR=builddir/main/$(*)
52 dobuild-python%: BUILD_FLAGS=libxml2mod_la_LIBADD='$$(mylibs)' \
53 PYTHON_INCLUDES='$(shell $(DEB_HOST_GNU_TYPE)-$(*)-config --includes)' \
54 PYTHON_LIBS='$(shell $(DEB_HOST_GNU_TYPE)-$(*)-config --ldflags)'
55 dobuild-python%: dobuild-%
56
57 override_dh_auto_build-arch: $(TARGETS:%=dobuild-%)
58
59 override_dh_auto_build-indep:
60 dh_auto_build -i
61
62 override_dh_auto_test-indep:
63 : Skipping tests during indep build
64
65 execute_after_dh_auto_clean:
66 rm -rf builddir
67 rm -f doconfigure-*
68
69 doinstall-main: dobuild-%
70 dh_auto_install --builddirectory=builddir/main
71
72 override_dh_auto_install-arch: $(TARGETS:%=doinstall-%)
73 find debian/tmp -name *.la -delete
74 ifneq ($(PY3VERS),)
75 rm -r debian/tmp/usr/lib/python*/site-packages/__pycache__
76 rm -f debian/tmp/usr/lib/python*/site-packages/*.a
77 endif
78
79 doinstall-python%: dobuild-python%
80 dh_auto_install --builddirectory=builddir/main/python$(*)
81
82 override_dh_compress:
83 dh_compress -Xexamples/ -Xtutorial/ -Xhtml/ -X.html
84
85 override_dh_installchangelogs:
86 dh_installchangelogs -k NEWS
87
88 override_dh_install-arch:
89 dh_install -a
90 sed -i -e 's,/lib/$(DEB_HOST_MULTIARCH),/lib,' debian/libxml2-dev/usr/bin/xml2-config
91
92 DEB_SVERSION := $(shell dpkg-parsechangelog -S Version | sed 's/-.*//')
93 BUILD_DATE := $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p')
94 source_dir := $(shell basename $(CURDIR))
95 source_files = $(addprefix $(source_dir)/, \
96 $(filter-out stamps .pc .git .gitignore debian test result builddir doconfigure-% , $(wildcard *)))
97
98 override_dh_install-indep:
99 dh_install -i
100
101 mkdir -p debian/libxml2-source/usr/src/libxml2
102 tar -C .. -c -f - $(source_files) | tar -C debian/libxml2-source/usr/src/libxml2 -x -f -
103 -make -C debian/libxml2-source/usr/src/libxml2/$(source_dir) distclean
104 rm -rvf debian/libxml2-source/usr/src/libxml2/$(source_dir)/autom4te.cache
105 rm -rvf debian/libxml2-source/usr/src/libxml2/$(source_dir)/codegen/__pycache__
106 cd debian/libxml2-source/usr/src/libxml2 \
107 && find -depth -newermt '$(BUILD_DATE)' -print0 | \
108 xargs -0r touch --no-dereference --date='$(BUILD_DATE)' \
109 && find $(source_dir) -type f -print0 | LC_ALL=C sort -z | \
110 tar -v --null -T - -c --xz --mode=go=rX,u+rw,a-s \
111 --owner=0 --group=0 --numeric-owner --sort=name \
112 --xform='s=^[^/]*\/=libxml2-$(DEB_SVERSION)/=' \
113 -f libxml2-$(DEB_SVERSION).tar.xz
114 rm -rf debian/libxml2-source/usr/src/libxml2/$(source_dir)
115
116 override_dh_makeshlibs:
117 dh_makeshlibs -plibxml2-16 -V 'libxml2-16 (>= 2.14.2)' -- -c4
118 dh_makeshlibs --remaining-packages
119
120 # I need to specify all the targets (build, binary, clean, etc) as
121 # otherwise dh may invoke them in a order that is not appropriate for the
122 # build system (the -indep part is done in-tree because rebuilding the
123 # docs out of tree is not supported. And once an in-tree build is done no
124 # out-of-tree builds can be done, so we wouldn't be able to do the -arch
125 # builds after the -indep one).
126 clean build-arch binary-arch build-indep binary-indep:
127 dh $@
128
129 build: build-arch build-indep
130 binary: binary-arch binary-indep
131
132 dfsg-source-tree:
133 rm -rf test/
134 rm -rf result/