File: rules

package info (click to toggle)
libxml2 2.9.4+dfsg1-2.2+deb9u2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 31,180 kB
  • sloc: ansic: 197,586; xml: 23,190; python: 21,415; sh: 5,055; makefile: 1,999; php: 365; perl: 67
file content (165 lines) | stat: -rwxr-xr-x 6,430 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/make -f
export DH_VERBOSE=1

# The versions of python currently supported
PYVERS=$(shell pyversions -s)
PY3VERS=$(shell py3versions -s)
# The current default version of python
PYVER=$(shell pyversions -d)
PY3VER=$(shell py3versions -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) $(PY3VERS) $(PY3VERS:%=%-dbg)

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 -Npython3-libxml2 -Npython3-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 --parallel --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-minimum --with-tree --with-output
doconfigure-udeb: CONFIGURE_FLAGS += --without-history --with-tree --with-output --without-python --without-icu

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: $(TARGETS:%=dobuild-%)
build-arch: $(TARGETS:%=dobuild-%)
build-indep: dobuild-main
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-arch: $(TARGETS:%=doinstall-%)
	find debian/ -name *.la -delete

override_dh_auto_install-indep: doinstall-main
	find debian/ -name *.la -delete

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-indep:
	# 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/(?<!_d)\.so$$/_d.so/' debian/tmp-dbg/usr/lib/python$(*)/*-packages/*.so

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

doinstall-udeb:
	dh_auto_install --builddirectory=builddir/udeb --destdir=debian/tmp-udeb

override_dh_installdocs:
	dh_installdocs -A AUTHORS TODO README NEWS
	dh_installdocs -ppython-libxml2 python/TODO
	dh_installdocs -ppython3-libxml2 python/TODO

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

override_dh_installchangelogs:
	dh_installchangelogs -plibxml2 ChangeLog
	dh_installchangelogs -Nlibxml2 -XChangeLog

override_dh_install-arch:
	dh_install -Npython-libxml2-dbg -Npython3-libxml2-dbg -Nlibxml2-udeb
ifneq ($(DEB_BUILD_PROFILE),stage1)
	dh_install -ppython-libxml2-dbg --sourcedir=debian/tmp-dbg
	dh_install -ppython3-libxml2-dbg --sourcedir=debian/tmp-dbg
endif
	dh_install -plibxml2-udeb --sourcedir=debian/tmp-udeb
	sed -i -e 's,/lib/$(DEB_HOST_MULTIARCH),/lib,' debian/libxml2-dev/usr/bin/xml2-config

override_dh_strip:
	dh_strip -a --dbg-package=libxml2-dbg -Nlibxml2-udeb -Nlibxml2-utils -Nlibxml2-utils-dbg -Npython-libxml2 -Npython-libxml2-dbg -Npython3-libxml2 -Npython3-libxml2-dbg
	dh_strip -plibxml2-utils --dbg-package=libxml2-utils-dbg
ifneq ($(DEB_BUILD_PROFILE),stage1)
	dh_strip -ppython-libxml2 --dbg-package=python-libxml2-dbg
	dh_strip -ppython3-libxml2 --dbg-package=python3-libxml2-dbg
endif
	$(foreach python, $(filter-out $(PYVER), $(PYVERS)),\
		cd $(CURDIR)/debian/python-libxml2/usr/lib/pyshared; \
		if diff $(python)/libxml2mod.so $(PYVER)/libxml2mod.so > /dev/null 2>&1; then \
			rm -f $(python)/libxml2mod.so; \
			ln -s ../$(PYVER)/libxml2mod.so $(python)/libxml2mod.so; \
		fi;)
	$(foreach python3, $(filter-out $(PY3VER), $(PY3VERS)),\
		cd $(CURDIR)/debian/python3-libxml2/usr/lib/pyshared; \
		if diff $(python3)/libxml2mod.so $(PYVER)/libxml2mod.so > /dev/null 2>&1; then \
			rm -f $(python3)/libxml2mod.so; \
			ln -s ../$(PY3VER)/libxml2mod.so $(python3)/libxml2mod.so; \
		fi;)
	dh_strip -Npython-libxml2-dbg -Npython3-libxml2-dbg

override_dh_makeshlibs:
	dh_makeshlibs -a $(if $(WITH_UDEB),--add-udeb=libxml2-udeb )-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"

%:
ifeq ($(DEB_BUILD_PROFILE),stage1)
	dh $@ --with autoreconf
else
	dh $@ --parallel --with autoreconf,python2,python3
endif