File: rules

package info (click to toggle)
libxml2 2.15.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,964 kB
  • sloc: ansic: 138,103; python: 6,692; sh: 4,736; xml: 1,476; makefile: 715
file content (133 lines) | stat: -rwxr-xr-x 4,402 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
#!/usr/bin/make -f
export DH_VERBOSE=1

DOPACKAGES = $(shell dh_listpackages)

ifneq (,$(filter python3-libxml2,$(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

include /usr/share/dpkg/architecture.mk

TARGETS := main $(PY3VERS)

CONFIGURE_FLAGS := --with-history \
		   --with-legacy \
		   --with-ftp \
		   --with-xptr-loc \
		   --with-http \
		   --with-lzma \
		   --with-docs \

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

override_dh_auto_configure-indep:
	dh_auto_configure -- --with-docs --docdir \$${prefix}/share/doc/libxml2 --enable-rebuild-docs --with-python=no

doconfigure-%:
	export PYTHON=$(PYTHON) && dh_auto_configure --builddirectory=builddir/$(*) -- $(CONFIGURE_FLAGS) && unset PYTHON
	touch $@

ifeq (,$(filter noi18n,$(DEB_BUILD_PROFILES)))
doconfigure-main: CONFIGURE_FLAGS += --with-python=no --enable-static
else
doconfigure-main: CONFIGURE_FLAGS += --with-python=no --enable-static
endif
doconfigure-python%: CONFIGURE_FLAGS += --with-python
	#PYTHON_VERSION=$(subst python,,$(*))
	PYTHON=$(shell which $(*))

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)-$(*)-config --includes)' \
    PYTHON_LIBS='$(shell $(DEB_HOST_GNU_TYPE)-$(*)-config --ldflags)'
dobuild-python%: dobuild-%

override_dh_auto_build-arch: $(TARGETS:%=dobuild-%)

override_dh_auto_build-indep:
	dh_auto_build -i

override_dh_auto_test-indep:
	: Skipping tests during indep build

execute_after_dh_auto_clean:
	rm -rf builddir
	rm -f doconfigure-*

doinstall-main: dobuild-%
	dh_auto_install --builddirectory=builddir/main

override_dh_auto_install-arch: $(TARGETS:%=doinstall-%)
	find debian/tmp -name *.la -delete
ifneq ($(PY3VERS),)
	rm -r debian/tmp/usr/lib/python*/site-packages/__pycache__
	rm -f debian/tmp/usr/lib/python*/site-packages/*.a
endif

doinstall-python%: dobuild-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 -a
	sed -i -e 's,/lib/$(DEB_HOST_MULTIARCH),/lib,' debian/libxml2-dev/usr/bin/xml2-config

DEB_SVERSION    := $(shell dpkg-parsechangelog -S Version | sed 's/-.*//')
BUILD_DATE := $(shell dpkg-parsechangelog | sed -n -e 's/^Date: //p')
source_dir := $(shell basename $(CURDIR))
source_files = $(addprefix $(source_dir)/, \
                 $(filter-out stamps .pc .git .gitignore debian test result builddir, $(wildcard *)))

override_dh_install-indep:
	dh_install -i

	mkdir -p debian/libxml2-source/usr/src/libxml2
	tar -C .. -c -f - $(source_files) | tar -C debian/libxml2-source/usr/src/libxml2 -x -f -
	-make -C debian/libxml2-source/usr/src/libxml2/$(source_dir) distclean
	cd debian/libxml2-source/usr/src/libxml2 \
	  && find -depth -newermt '$(BUILD_DATE)' -print0 | \
	     xargs -0r touch --no-dereference --date='$(BUILD_DATE)' \
	  && find  -type f -print0 | LC_ALL=C sort -z | \
	     tar --null -T - -c --xz --mode=go=rX,u+rw,a-s \
		--owner=0 --group=0 --numeric-owner --sort=name \
		--xform='s=^[^/]*\/=libxml2-$(DEB_SVERSION)/=' \
		-f libxml2-$(DEB_SVERSION).tar.xz \
		$(source_dir)
	rm -rf debian/libxml2-source/usr/src/libxml2/$(source_dir)

override_dh_makeshlibs:
	dh_makeshlibs -plibxml2-16 -V 'libxml2-16 (>= 2.14.1)' -- -c4
	dh_makeshlibs --remaining-packages

#  I need to specify all the targets (build, binary, clean, etc) as
#  otherwise dh may invoke them in a order that is not appropriate for the
#  build system (the -indep part is done in-tree because rebuilding the
#  docs out of tree is not supported.  And once an in-tree build is done no
#  out-of-tree builds can be done, so we wouldn't be able to do the -arch
#  builds after the -indep one).
clean build-arch binary-arch build-indep binary-indep:
	dh $@

build: build-arch build-indep
binary: binary-arch binary-indep

dfsg-source-tree:
	rm -rf test/
	rm -rf result/