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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# The default gzip compressor has been changed in dpkg >= 1.17.0.
deb_default_compress = $(shell LANG=C dpkg-deb --version | head -n1 | \
sed -e "s|.*version ||" -e "s| .*||" | \
xargs -r dpkg --compare-versions 1.17.0 lt \
&& echo xz || echo gzip)
ifeq ($(deb_default_compress),gzip)
DEB_DH_BUILDDEB_ARGS += -- -Z$(shell dpkg-deb --help | grep -q ":.* xz[,.]" \
&& echo xz || echo bzip2)
endif
export DH_OPTIONS
PY2_PROVIDES=sip-tqt-api-7.0, sip-tqt-api-7.1
PY3_PROVIDES=sip-tqt-py3api-7.0, sip-tqt-py3api-7.1
PYDIST=sip $(shell python -c "a=[i.strip() for i in '$(PY3_PROVIDES)'.split(',')]; print sorted(a, reverse=True)[0]")
INSTDIR=$(CURDIR)/debian
CFLAGS=
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0 -g
else
CFLAGS += -O2 -g
endif
PYTHONS := $(shell pyversions -vr) $(shell py3versions -vd)
DEB_PYTHON_SYSTEM = $(if $(wildcard /usr/bin/dh_python2),,pysupport)
DH_PYTHON2 = $(if $(wildcard /usr/bin/dh_python2),dh_python2,dh_pysupport)
-include /usr/share/python/python.mk
ifeq (,$(py_sitename))
py_sitename = site-packages
py_libdir = /usr/lib/python$(subst python,,$(1))/site-packages
py_sitename_sh = $(py_sitename)
py_libdir_sh = $(py_libdir)
endif
.PRECIOUS: build-%/configure-stamp dbg-build-%/configure-stamp
configure: $(PYTHONS:%=build-%/configure-stamp) $(PYTHONS:%=dbg-build-%/configure-stamp)
build-%/configure-stamp:
dh_testdir
mkdir -p build-$*
cd build-$* \
&& python$* ../configure.py \
-d /usr/lib/python$*/$(call py_sitename,$*) \
-u STRIP="" CFLAGS="${CFLAGS} -I/usr/include/tqt -I/usr/include/tqt3 -I/usr/include/qt3" CFLAGS_RELEASE="" CXXFLAGS="${CFLAGS} -I/usr/include/tqt -I/usr/include/tqt3 -I/usr/include/qt3" CXXFLAGS_RELEASE=""
touch $@
dbg-build-%/configure-stamp:
dh_testdir
mkdir -p dbg-build-$*
cd dbg-build-$* \
&& python$*-dbg ../configure.py \
-d /usr/lib/python$*/$(call py_sitename,$*) \
-u CFLAGS="-O0 -g -I/usr/include/tqt -I/usr/include/tqt3 -I/usr/include/qt3" CFLAGS_RELEASE="" CXXFLAGS="-O0 -g -I/usr/include/tqt -I/usr/include/tqt3 -I/usr/include/qt3" CXXFLAGS_RELEASE="" STRIP=""
touch $@
build: $(PYTHONS:%=build-%/build-stamp) $(PYTHONS:%=dbg-build-%/build-stamp)
build-%/build-stamp: build-%/configure-stamp
dh_testdir
$(MAKE) -C build-$*
touch $@
dbg-build-%/build-stamp: dbg-build-%/configure-stamp
dh_testdir
$(MAKE) -C dbg-build-$*
touch $@
clean:
dh_testdir
dh_testroot
rm -rf *-stamp siputils.pyc $(PYTHONS:%=build-%) $(PYTHONS:%=dbg-build-%)
dh_clean debian/python3-sip.pydist
install-arch: build
dh_testdir
dh_testroot
dh_prep -a
echo "python:Provides=$(PY2_PROVIDES)" >> debian/python-sip-tqt.substvars
echo "python3:Provides=$(PY3_PROVIDES)" >> debian/python3-sip-tqt.substvars
dh_installdirs -a
# This is needed to enforce that the install-arch-% rules are
# not run in parallel. Both rules install into the same directory,
# and therefore might try to access the same files at the same time.
# Therefore, instead of depending on the install-arch-% rules,
# we invoke them explicitly.
for p in $(PYTHONS) ; do \
$(MAKE) -f debian/rules install-arch-$$p;\
done
for i in $$(find debian/python-sip-tqt-dbg -name '*.so'); do \
b=$$(basename $$i .so); \
mv $$i $$(dirname $$i)/$${b}_d.so; \
done
for i in $$(find debian/python3-sip-tqt-dbg -name '*.so'); do \
b=$$(basename $$i .so); \
mv $$i $$(dirname $$i)/$${b}_d.so; \
done
find debian/python-sip-tqt-dbg ! -type d ! -name '*_d.*' | xargs rm -f
find debian/python-sip-tqt-dbg -depth -empty -exec rmdir {} \;
find debian/python3-sip-tqt-dbg ! -type d ! -name '*_d.*' | xargs rm -f
find debian/python3-sip-tqt-dbg -depth -empty -exec rmdir {} \;
dh_install -a --sourcedir=$(CURDIR)/debian/tmp
install -m 755 -o root -g root debian/dh_sip_tqt debian/python-sip-tqt-dev/usr/bin
install-arch-3.%:
$(MAKE) -C build-3.$* install DESTDIR=$(CURDIR)/debian/tmp
$(MAKE) -C dbg-build-3.$* install DESTDIR=$(CURDIR)/debian/python3-sip-tqt-dbg
mkdir -p debian/python3-sip-tqt/usr/lib/python3.$*/dist-packages/
install -m 644 -o root -g root debian/sip_tqt_config_py3.py debian/python3-sip-tqt/usr/lib/python3.$*/dist-packages/sip_tqt_config.py
install -m 644 -o root -g root build-3.$*/sip_tqt_config.py debian/python3-sip-tqt/usr/lib/python3.$*/dist-packages/sip_tqt_config_nd.py
install -m 644 -o root -g root dbg-build-3.$*/sip_tqt_config.py debian/python3-sip-tqt-dbg/usr/lib/python3.$*/dist-packages/sip_tqt_config_d.py
mkdir -p debian/python3-sip-tqt-dev$$(python3.$* -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())')
install -m 644 -o root -g root siplib/sip-tqt.h debian/python3-sip-tqt-dev$$(python3.$* -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())')/
mkdir -p debian/python3-sip-tqt-dev/$$(python3.$*-dbg -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())')
ln -s ../$$(python3.$* -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())' | xargs basename)/sip-tqt.h \
debian/python3-sip-tqt-dev/$$(python3.$*-dbg -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())')/sip-tqt.h
mkdir -p debian/python3-sip-tqt-dev/usr/lib/python3.$*/dist-packages
install -m 644 -o root -g root sip_tqt_distutils.py debian/python3-sip-tqt-dev/usr/lib/python3.$*/dist-packages
install-arch-%:
$(MAKE) -C build-$* install DESTDIR=$(CURDIR)/debian/tmp
$(MAKE) -C dbg-build-$* install DESTDIR=$(CURDIR)/debian/python-sip-tqt-dbg
mkdir -p debian/python-sip-tqt/usr/lib/python$*/$(call py_sitename,$*)/
install -m 644 -o root -g root debian/sip_tqt_config.py debian/python-sip-tqt/usr/lib/python$*/$(call py_sitename,$*)/sip_tqt_config.py
install -m 644 -o root -g root build-$*/sip_tqt_config.py debian/python-sip-tqt/usr/lib/python$*/$(call py_sitename,$*)/sip_tqt_config_nd.py
install -m 644 -o root -g root dbg-build-$*/sip_tqt_config.py debian/python-sip-tqt-dbg/usr/lib/python$*/$(call py_sitename,$*)/sip_tqt_config_d.py
mkdir -p debian/python-sip-tqt-dev$$(python$* -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())')
install -m 644 -o root -g root siplib/sip-tqt.h debian/python-sip-tqt-dev$$(python$* -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())')/
mkdir -p debian/python-sip-tqt-dev$$(python$*-dbg -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())')
ln -s ../$$(python$* -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())' | xargs basename)/sip-tqt.h \
debian/python-sip-tqt-dev/$$(python$*-dbg -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())')/sip-tqt.h
mkdir -p debian/python-sip-tqt-dev/usr/lib/python$*/$(call py_sitename,$*)
install -m 644 -o root -g root sip_tqt_distutils.py debian/python-sip-tqt-dev/usr/lib/python$*/$(call py_sitename,$*)
# Must not depend on anything. This is to be called by
# binary-arch/binary-indep
# in another 'make' thread.
binary-common:
dh_testdir
dh_testroot
dh_installman
dh_installchangelogs
dh_installdocs -A
dh_installexamples
dh_link
# don't call strip twice, it's in binary-common
ifneq (,$(findstring -a, $(DH_OPTIONS)))
DH_OPTIONS= dh_strip -ppython-sip-tqt-dev
DH_OPTIONS= dh_strip -ppython-sip-tqt -Npython-sip-tqt-dev --dbg-package=python-sip-tqt-dbg
DH_OPTIONS= dh_strip -ppython3-sip-tqt-dev
DH_OPTIONS= dh_strip -ppython3-sip-tqt -Npython3-sip-tqt-dev --dbg-package=python3-sip-tqt-dbg
rm -rf debian/python-sip-tqt-dbg/usr/share/doc/python-sip-tqt-dbg
mkdir -p debian/python-sip-tqt-dbg/usr/share/doc
ln -s python-sip-tqt debian/python-sip-tqt-dbg/usr/share/doc/python-sip-tqt-dbg
rm -rf debian/python3-sip-tqt-dbg/usr/share/doc/python3-sip-tqt-dbg
mkdir -p debian/python3-sip-tqt-dbg/usr/share/doc
ln -s python3-sip-tqt debian/python3-sip-tqt-dbg/usr/share/doc/python3-sip-tqt-dbg
endif
dh_compress -X.inv
dh_fixperms
ifneq (dh_pysupport,${DH_PYTHON2})
${DH_PYTHON2} --no-dbg-cleaning
else
${DH_PYTHON2}
endif
dh_python3 --no-dbg-cleaning
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb $(DEB_DH_BUILDDEB_ARGS)
# Build architecture independant packages using the common target.
binary-indep:
$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
# Build architecture dependant packages using the common target.
binary-arch: install-arch
$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary configure
|