File: rules

package info (click to toggle)
libxml2 2.9.4+dfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 31,888 kB
  • sloc: ansic: 197,610; xml: 23,190; python: 21,415; sh: 5,035; makefile: 1,968; php: 365; perl: 67
file content (128 lines) | stat: -rwxr-xr-x 4,669 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/make -f
export DH_VERBOSE=1

DOPACKAGES = $(shell dh_listpackages)

ifneq (,$(filter python-libxml2 python-libxml2-dbg,$(DOPACKAGES)))
# The versions of python currently supported
PYVERS=$(shell pyversions -s)
else
PYVERS=
endif
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

DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

TARGETS := main $(PYVERS) $(PYVERS:%=%-dbg) $(PY3VERS) $(PY3VERS:%=%-dbg)

CONFIGURE_FLAGS := --disable-silent-rules --with-history --cache-file="$(CURDIR)/builddir/config.cache"

override_dh_auto_configure: $(TARGETS:%=doconfigure-%)

doconfigure-%:
	dh_auto_configure --parallel --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 --parallel --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: dobuild-main

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: doinstall-main
	find debian/tmp -name *.la -delete
	# 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
	rename -v -f 's/(?<!_d)\.so$$/_d.so/' debian/tmp-dbg/usr/lib/python$(*)/*-packages/*.so

doinstall-python%:
	dh_auto_install --builddirectory=builddir/main/python$(*)

override_dh_compress:
	dh_compress -Xexamples/ -Xtutorial/ -Xhtml/ -X.html

override_dh_installchangelogs:
	dh_installchangelogs -k NEWS

override_dh_install-arch:
	dh_install -Npython-libxml2-dbg -Npython3-libxml2-dbg
ifneq (,$(filter python-libxml2-dbg,$(DOPACKAGES)))
	dh_install -ppython-libxml2-dbg --sourcedir=debian/tmp-dbg
endif
ifneq (,$(filter python3-libxml2-dbg,$(DOPACKAGES)))
	dh_install -ppython3-libxml2-dbg --sourcedir=debian/tmp-dbg
endif
	sed -i -e 's,/lib/$(DEB_HOST_MULTIARCH),/lib,' debian/libxml2-dev/usr/bin/xml2-config

override_dh_strip:
	dh_strip -plibxml2 -plibxml2-dev --dbg-package=libxml2-dbg
	dh_strip -plibxml2-utils
ifneq (,$(filter python-libxml2 python-libxml2-dbg,$(DOPACKAGES)))
	dh_strip -ppython-libxml2 --dbg-package=python-libxml2-dbg
endif
ifneq (,$(filter python3-libxml2 python3-libxml2-dbg,$(DOPACKAGES)))
	dh_strip -ppython3-libxml2 --dbg-package=python3-libxml2-dbg
endif

override_dh_makeshlibs:
	dh_makeshlibs -a -V 'libxml2 (>= 2.7.4)' -- -c4

#override_dh_gencontrol:
#	dh_gencontrol -- -Vdep:libicudbg="`dpkg-query -f '$${Depends}' -W libicu-dev | sed 's/.*\(libicu[0-9]*\).*/\1/'`-dbg"

%:
	dh $@ \
		$(if $(filter python-libxml2 python-libxml2-dbg,$(DOPACKAGES)),--with python2) \
		$(if $(filter python3-libxml2 python3-libxml2-dbg,$(DOPACKAGES)),--with python3)