File: rules

package info (click to toggle)
sip4 4.19.18+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,004 kB
  • sloc: ansic: 31,741; yacc: 7,067; python: 2,563; lex: 849; makefile: 72; perl: 30; cpp: 4
file content (93 lines) | stat: -rwxr-xr-x 4,364 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
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

PY2_PROVIDES=sip-api-12.0, sip-api-12.1, sip-api-12.2, sip-api-12.3, sip-api-12.4, sip-api-12.5, sip-api-12.6
PY3_PROVIDES=sip-py3api-12.0, sip-py3api-12.1, sip-py3api-12.2, sip-py3api-12.3, sip-py3api-12.4, sip-py3api-12.5, sip-py3api-12.6
# `dh_python3 --depends sip` should generate dependency on newest API only
PYDIST=sip $(lastword $(PY3_PROVIDES))

PYTHON3S := $(shell py3versions -vr)

CONFIGURE_PY_ARGS=--destdir /usr/lib/python{version}/dist-packages --debug \
	"CFLAGS=$(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)" \
	"CXXFLAGS=$(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)" \
	"LFLAGS=$(shell dpkg-buildflags --get LDFLAGS)"

export DEB_BUILD_MAINT_OPTIONS=reproducible=+fixfilepath
export PYBUILD_NAME=sip
export PYBUILD_SYSTEM=custom
export PYBUILD_CONFIGURE_ARGS=mkdir build-{interpreter}; cd build-{interpreter}; {interpreter} ../configure.py $(CONFIGURE_PY_ARGS)
export PYBUILD_CONFIGURE_ARGS_python2-dbg=$(PYBUILD_CONFIGURE_ARGS) --no-tools --no-dist-info --no-stubs
export PYBUILD_CONFIGURE_ARGS_python3-dbg=$(PYBUILD_CONFIGURE_ARGS_python2-dbg)
export PYBUILD_BUILD_ARGS=$(MAKE) -C build-{interpreter}
export PYBUILD_AFTER_BUILD=sed -Ei "s, -f(debug|file)-prefix-map=$(CURDIR)=.,,g" build-{interpreter}/sipconfig.py
export PYBUILD_INSTALL_ARGS=$(MAKE) -C build-{interpreter} install DESTDIR=$(CURDIR)/debian/tmp
export PYBUILD_INSTALL_ARGS_python2-dbg=$(MAKE) -C build-{interpreter} install DESTDIR=$(CURDIR)/debian/{package}
export PYBUILD_INSTALL_ARGS_python3-dbg=$(PYBUILD_INSTALL_ARGS_python2-dbg)
export PYBUILD_CLEAN_ARGS=rm -rf build-{interpreter}

%:
	dh $@ --with python2,python3 --buildsystem=pybuild

sipgen/lexer.c: sipgen/metasrc/lexer.l
	flex --outfile=sipgen/lexer.c sipgen/metasrc/lexer.l

sipgen/parser.c: sipgen/metasrc/parser.y
	bison --yacc --defines=sipgen/parser.h --output=sipgen/parser.c sipgen/metasrc/parser.y

override_dh_auto_configure: sipgen/lexer.c sipgen/parser.c
	dh_auto_configure

debian/sipconfig_py3.py:
	cp debian/sipconfig_py3.header debian/sipconfig_py3.py
	set -e; for version in $(PYTHON3S:3.%=%); do \
		sed -e "s/@MINORVERS@/$$version/g" debian/sipconfig_py3.snippet \
		>> debian/sipconfig_py3.py; \
	done

override_dh_auto_install: debian/sipconfig_py3.py
	dh_auto_install
	cp build-python2.7/sipconfig.py debian/tmp/usr/lib/python2.7/dist-packages/sipconfig_nd.py
	cp build-python2.7-dbg/sipconfig.py debian/tmp/usr/lib/python2.7/dist-packages/sipconfig_d.py
	mkdir -p debian/tmp/usr/lib/python3/dist-packages
	cp debian/sipconfig_py3.py debian/tmp/usr/lib/python3/dist-packages/sipconfig.py
	set -ex; for version in $(PYTHON3S:3.%=%); do \
		sed -Ei "s,python3\.$$version/dist-packages,python3/dist-packages," build-python3.$$version/sipconfig.py; \
		sed -Ei "s,python3\.$$version/dist-packages,python3/dist-packages," build-python3.$$version-dbg/sipconfig.py; \
		cp build-python3.$$version/sipconfig.py debian/tmp/usr/lib/python3/dist-packages/sipconfig_nd$$version.py; \
		cp build-python3.$$version-dbg/sipconfig.py debian/tmp/usr/lib/python3/dist-packages/sipconfig_d$$version.py; \
		mkdir debian/tmp/usr/include/python3.$${version}dm; \
		ln -s ../python3.$${version}m/sip.h debian/tmp/usr/include/python3.$${version}dm/sip.h; \
	done

override_dh_installman:
	pod2man -c Debhelper -r '' debian/dh_sip debian/manpages/dh_sip.1
	pod2man -c Debhelper -r '' debian/dh_sip3 debian/manpages/dh_sip3.1
	dh_installman

override_dh_strip:
	dh_strip -ppython-sip --dbg-package=python-sip-dbg
	dh_strip -ppython3-sip --dbg-package=python3-sip-dbg
	dh_strip --remaining-packages -Npython-sip-dbg -Npython3-sip-dbg

override_dh_install-indep:
	python3 -m sphinx sphinx debian/python-sip-doc/usr/share/doc/python-sip-doc/html
	dh_sphinxdoc

override_dh_installdocs:
	dh_installdocs -ppython-sip-dbg --link-doc=python-sip
	dh_installdocs -ppython3-sip-dbg --link-doc=python3-sip
	dh_installdocs --remaining-packages -A NEWS

override_dh_python2:
	dh_python2 --no-dbg-cleaning

override_dh_python3:
	echo "$(PYDIST)" > debian/python3-sip.pydist
	dh_python3 --no-dbg-cleaning

override_dh_gencontrol:
	echo "sip:Provides=$(PY2_PROVIDES)" >> debian/python-sip.substvars
	echo "sip3:Provides=$(PY3_PROVIDES)" >> debian/python3-sip.substvars
	dh_gencontrol