File: rules

package info (click to toggle)
pyqt5 5.11.3+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 15,956 kB
  • sloc: python: 93,806; cpp: 21,390; xml: 285; makefile: 266; sh: 31
file content (332 lines) | stat: -rwxr-xr-x 14,637 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
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DH_OPTIONS=${EXTRA_DH_OPTIONS}

py3_dbusmoddir = $(shell python3 -c 'import dbus.mainloop; print(dbus.mainloop.__path__[0])')
py_dbusmoddir = $(shell python -c 'import dbus.mainloop; print(dbus.mainloop.__path__[0])')

CFLAGS=
CPPFLAGS=
CXXFLAGS=
LDFLAGS=
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0 -g
	CXXFLAGS += -O0
else
	CFLAGS += $(shell dpkg-buildflags --get CFLAGS)
	CPPFLAGS += $(shell dpkg-buildflags --get CPPFLAGS)
	CXXFLAGS += $(shell dpkg-buildflags --get CXXFLAGS)
	LDFLAGS += $(shell dpkg-buildflags --get LDFLAGS)
endif

LDFLAGS += -Wl,-O1 -Wl,--as-needed

SPLIT=10

PYTHON3S := $(shell  py3versions -vr)
DEFAULT_PYTHON := $(shell py3versions -vd)
PYTHON := 2.7
ALLPYTHONS := $(PYTHON3S) $(PYTHON)

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
QTWEBENGINE_ARCHS := amd64 arm64 armhf i386 mipsel

PYQT_MODULES := opengl sql webchannel webkit websockets xmlpatterns svg \
	multimedia quick serialport sensors x11extras positioning
ifneq (,$(filter $(DEB_HOST_ARCH),$(QTWEBENGINE_ARCHS)))
	PYQT_MODULES += webengine
endif

PY_PACKAGE_NAMES := pyqt5 $(PYQT_MODULES:%=pyqt5.qt%) dbus.mainloop.pyqt5

export QT_SELECT=qt5

# LIBS_* is unset to avoid linking to too many libraries
# STRIP is unset to let stripping be handled by dh_strip
SHARED_CONFIGURE_OPTIONS=--confirm-license --verbose \
	-q /usr/bin/qmake -c -j $(SPLIT) \
	STRIP="" MOC=/usr/bin/moc \
	LIBS_OPENGL="" LIBS_X11="" LIBS_THREAD="" \
	QMAKE_CFLAGS+="${CFLAGS} ${CPPFLAGS}" \
	QMAKE_CXXFLAGS+="${CXXFLAGS} ${CPPFLAGS}" \
	QMAKE_LFLAGS+="${LDFLAGS}"


.PRECIOUS: build-%/configure-stamp dbg-build-%/configure-stamp

configure: $(ALLPYTHONS:%=build-%/configure-stamp) $(ALLPYTHONS:%=dbg-build-%/configure-stamp)

build-%/configure-stamp:
	dh_testdir
	mkdir -p build-$*
	cp -r config-tests build-$*/
	cd build-$* && python$* ../configure.py $(SHARED_CONFIGURE_OPTIONS) \
			-m $(shell python$*-config --configdir) \
			-d /usr/lib/python$*/dist-packages \
			--sip-incdir /usr/include/python$*$(if $(filter 3.%, $*),m,) \
			--no-dist-info \
			--no-sip-files \
			$(if $(filter $(DEFAULT_PYTHON),$*),,--no-designer-plugin --no-qml-plugin --no-tools)
	sed -i '/strip/d' build-$*/*/Makefile
	touch $@

dbg-build-%/configure-stamp:
	dh_testdir
	mkdir -p dbg-build-$*
	cp -r config-tests dbg-build-$*/
	cd dbg-build-$* && python$*-dbg ../configure.py $(SHARED_CONFIGURE_OPTIONS) \
			-m $(shell python$*-dbg-config --configdir) \
			-l /usr/include/python$*$(if $(filter 3.%, $*),dm,_d) \
			-d /usr/lib/python$*/dist-packages \
			--sip-incdir /usr/include/python$*$(if $(filter 3.%, $*),dm,_d) \
			--no-dist-info \
			--debug --no-designer-plugin --no-qml-plugin --no-tools --no-sip-files
	sed -i '/strip/d' dbg-build-$*/*/Makefile
	sed -i 's/-isystem/-I/' dbg-build-$*/*/Makefile
	touch $@


build: build-arch build-indep
build-arch: $(ALLPYTHONS:%=build-%/build-stamp) $(ALLPYTHONS:%=dbg-build-%/build-stamp)
build-indep: build-$(DEFAULT_PYTHON)/build-stamp

build-%/build-stamp: build-%/configure-stamp
	dh_testdir
	dh_auto_build --parallel -B build-$*
	touch $@

dbg-build-%/build-stamp: dbg-build-%/configure-stamp
	dh_testdir
	dh_auto_build --parallel -B dbg-build-$*
	touch $@

install-indep: build-indep
	dh_testdir
	dh_testroot
	dh_prep -i

	# Install the files to temporary location to be able to use pyrcc5 below
	mkdir -p tmp_install_root
	$(MAKE) -C build-$(DEFAULT_PYTHON) install INSTALL_ROOT=$(CURDIR)/tmp_install_root

	dh_installdirs -i
	dh_install -i
	dh_installexamples -Xactiveqt -i
	# Use python3 shebangs and regenerate resource files
	export PYTHONPATH=$(CURDIR)/tmp_install_root/usr/lib/python$(DEFAULT_PYTHON)/dist-packages; \
	cd $(CURDIR)/debian/pyqt5-examples/usr/share/doc/pyqt5-examples/examples/; \
		cp --preserve=timestamps /usr/share/javascript/jquery/jquery.min.js webkit/fancybrowser/; \
		find . -name '*.py' -exec sed -i 's/\/env python/\/python3/g' {} +; \
		find . -name '*.qrc' | sed 's/\.qrc//g' | QT_HASH_SEED=0 xargs -I {} \
		$(CURDIR)/tmp_install_root/usr/bin/pyrcc5 {}.qrc -o {}_rc.py
	# Symlink duplicate files in examples. Based on Andrew Starr-Bochicchio's
	# code in ubuntu-packaging-guide.
	cd $(CURDIR)/debian/pyqt5-examples && \
	fdupes -r1nq usr/share/doc/pyqt5-examples/examples | while read s; do \
		set -- $$(echo $$s | tr ' ' '\n' | sort); \
		f=$$1; shift; for d; do \
			echo "symlinking identical file $$d to $$f"; \
			rm $$d; ln -s /$$f $$d; \
		done; \
	done
	dh_link -i

install-arch: build-arch
	dh_testdir
	dh_testroot
	dh_prep -a
	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 $(ALLPYTHONS) ; do \
		$(MAKE) -f debian/rules install-arch-$$p;\
	done

	dh_install -a
	dh_missing --fail-missing
	sed -i 's,/usr/bin/python3[.0-9]*,/usr/bin/python3,' debian/pyqt5-dev-tools/usr/bin/*

	find debian/python*-dbg ! -type d \
		! \( -name '*.so' -o -name '*config_*d*.py' \) | xargs rm -f

	for i in $$(find debian/python-*-dbg -name '*.so'); do \
		b=$$(basename $$i .so); \
		mv $$i $$(dirname $$i)/$${b}_d.so; \
		done

d3_qt5_dbg = debian/python3-pyqt5-dbg

install-arch-3.%:
	$(MAKE) -C build-3.$* install INSTALL_ROOT=$(CURDIR)/debian/tmp DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) -C dbg-build-3.$* install INSTALL_ROOT=$(CURDIR)/$(d3_qt5_dbg) DESTDIR=$(CURDIR)/$(d3_qt5_dbg)

	mkdir -p $(CURDIR)/debian/python3-dbus.mainloop.pyqt5/usr/lib/python3.$*/dist-packages/dbus/mainloop; \
	mv $(CURDIR)/debian/tmp$(py3_dbusmoddir)/pyqt5.so \
	   $(CURDIR)/debian/python3-dbus.mainloop.pyqt5/usr/lib/python3.$*/dist-packages/dbus/mainloop; \

	mkdir -p $(CURDIR)/debian/python3-dbus.mainloop.pyqt5-dbg/usr/lib/python3.$*/dist-packages/dbus/mainloop; \
	mv $(CURDIR)/debian/python3-pyqt5-dbg$(py3_dbusmoddir)/pyqt5.so \
	   $(CURDIR)/debian/python3-dbus.mainloop.pyqt5-dbg/usr/lib/python3.$*/dist-packages/dbus/mainloop; \

	# Don't initiate the uic/widget-plugins
	touch $(CURDIR)/debian/tmp/usr/lib/python3.$*/dist-packages/PyQt5/uic/widget-plugins/.noinit
	for module in $(PYQT_MODULES); do \
		mkdir -p debian/python3-pyqt5.qt$$module-dbg/usr/lib/python3.$*/dist-packages/PyQt5; \
	done
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/*OpenGL*.so \
		debian/python3-pyqt5.qtopengl-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtSql.so \
		debian/python3-pyqt5.qtsql-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtWebChannel.so \
		debian/python3-pyqt5.qtwebchannel-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtWebKit*.so \
		debian/python3-pyqt5.qtwebkit-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtWebSockets.so \
		debian/python3-pyqt5.qtwebsockets-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtXmlPatterns.so \
		debian/python3-pyqt5.qtxmlpatterns-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtSvg.so \
		debian/python3-pyqt5.qtsvg-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtMultimedia*.so \
		debian/python3-pyqt5.qtmultimedia-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtQml.so \
	   $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtQuick*.so \
		debian/python3-pyqt5.qtquick-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtSerialPort.so \
		debian/python3-pyqt5.qtserialport-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtSensors.so \
		debian/python3-pyqt5.qtsensors-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtX11Extras.so \
		debian/python3-pyqt5.qtx11extras-dbg/usr/lib/python3.$*/dist-packages/PyQt5
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtPositioning.so \
	   $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtLocation.so \
		debian/python3-pyqt5.qtpositioning-dbg/usr/lib/python3.$*/dist-packages/PyQt5
ifneq (,$(filter $(DEB_HOST_ARCH),$(QTWEBENGINE_ARCHS)))
	mv $(d3_qt5_dbg)/usr/lib/python3.$*/dist-packages/PyQt5/QtWebEngine*.so \
		debian/python3-pyqt5.qtwebengine-dbg/usr/lib/python3.$*/dist-packages/PyQt5
endif


d_qt5_dbg = debian/python-pyqt5-dbg

install-arch-2.%:
	$(MAKE) -C build-2.$* install INSTALL_ROOT=$(CURDIR)/debian/tmp DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) -C dbg-build-2.$* install INSTALL_ROOT=$(CURDIR)/$(d_qt5_dbg) DESTDIR=$(CURDIR)/$(d_qt5_dbg)

	mkdir -p $(CURDIR)/debian/python-dbus.mainloop.pyqt5/usr/lib/python2.$*/dist-packages/dbus/mainloop; \
	mv $(CURDIR)/debian/tmp$(py_dbusmoddir)/pyqt5.so \
	   $(CURDIR)/debian/python-dbus.mainloop.pyqt5/usr/lib/python2.$*/dist-packages/dbus/mainloop; \

	mkdir -p $(CURDIR)/debian/python-dbus.mainloop.pyqt5-dbg/usr/lib/python2.$*/dist-packages/dbus/mainloop; \
	mv $(CURDIR)/debian/python-pyqt5-dbg$(py_dbusmoddir)/pyqt5.so \
	   $(CURDIR)/debian/python-dbus.mainloop.pyqt5-dbg/usr/lib/python2.$*/dist-packages/dbus/mainloop; \

	# Don't initiate the uic/widget-plugins
	touch $(CURDIR)/debian/tmp/usr/lib/python2.$*/dist-packages/PyQt5/uic/widget-plugins/.noinit
	for module in $(PYQT_MODULES); do \
		mkdir -p debian/python-pyqt5.qt$$module-dbg/usr/lib/python2.$*/dist-packages/PyQt5; \
	done
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/*OpenGL*.so \
		debian/python-pyqt5.qtopengl-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtSql.so \
		debian/python-pyqt5.qtsql-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtWebChannel.so \
		debian/python-pyqt5.qtwebchannel-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtWebKit*.so \
		debian/python-pyqt5.qtwebkit-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtWebSockets.so \
		debian/python-pyqt5.qtwebsockets-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtXmlPatterns.so \
		debian/python-pyqt5.qtxmlpatterns-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtSvg.so \
		debian/python-pyqt5.qtsvg-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtMultimedia*.so \
		debian/python-pyqt5.qtmultimedia-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtQml.so \
	   $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtQuick*.so \
		debian/python-pyqt5.qtquick-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtSerialPort.so \
		debian/python-pyqt5.qtserialport-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtSensors.so \
		debian/python-pyqt5.qtsensors-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtX11Extras.so \
		debian/python-pyqt5.qtx11extras-dbg/usr/lib/python2.$*/dist-packages/PyQt5
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtPositioning.so \
	   $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtLocation.so \
		debian/python-pyqt5.qtpositioning-dbg/usr/lib/python2.$*/dist-packages/PyQt5
ifneq (,$(filter $(DEB_HOST_ARCH),$(QTWEBENGINE_ARCHS)))
	mv $(d_qt5_dbg)/usr/lib/python2.$*/dist-packages/PyQt5/QtWebEngine*.so \
		debian/python-pyqt5.qtwebengine-dbg/usr/lib/python2.$*/dist-packages/PyQt5
endif

clean:
	dh_testdir
	dh_testroot
	rm -rf $(ALLPYTHONS:%=build-%) $(ALLPYTHONS:%=dbg-build-%)
	rm -rf tmp_install_root
	find . -type f -name .DS_Store -delete
	find . -type f -name *.pyc -delete
	find . -type d -name __pycache__ -delete
	cd sip; rm -rf Qt opengl_types.sip pyqt-gpl.sip5
	rm -f examples/quick/tutorials/extending/chapter6-plugins/Charts/qmldir
	dh_clean

# 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 NEWS
	dh_sip
	dh_sip3
ifeq (,$(findstring -i, $(DH_OPTIONS)))
	DH_OPTIONS= dh_strip -ppyqt5-dev-tools
	set -e; \
	for p in $(PY_PACKAGE_NAMES:%=python3-%) $(PY_PACKAGE_NAMES:%=python-%); do \
		DH_OPTIONS= dh_strip -p$$p --dbg-package=$$p-dbg; \
		rm -rf debian/$$p-dbg/usr/share/doc/$$p-dbg; \
		mkdir -p debian/$$p-dbg/usr/share/doc; \
		ln -s $$p debian/$$p-dbg/usr/share/doc/$$p-dbg; \
	done
endif
	dh_python2 --no-dbg-cleaning -N pyqt5-dev-tools -N pyqt5-examples
	rm -rf $(CURDIR)/debian/python-pyqt5/usr/lib/python2.7/dist-packages/PyQt5/uic/port_v3
	rm -rf $(CURDIR)/debian/python-pyqt5-dbg/usr/bin
	rm -rf $(CURDIR)/debian/python-pyqt5-dbg/usr/lib/python2.7/dist-packages/PyQt5/uic
	rm -rf $(CURDIR)/debian/python-pyqt5-dbg/usr/lib/python2.7/dist-packages/dbus
	dh_python3 --no-dbg-cleaning -N pyqt5-examples
	rm -rf $(CURDIR)/debian/python3-pyqt5/usr/lib/python3/dist-packages/PyQt5/uic/port_v2
	rm -rf $(CURDIR)/debian/python3-pyqt5-dbg/usr/bin
	rm -rf $(CURDIR)/debian/python3-pyqt5-dbg/usr/lib/python3/dist-packages/PyQt5/uic
	rm -rf $(CURDIR)/debian/python3-pyqt5-dbg/usr/lib/python3/dist-packages/dbus
	rm -rf $(CURDIR)/debian/pyqt5-examples/usr/share/doc/pyqt5-examples/examples/webkit/googlechat
	rm -rf $(CURDIR)/debian/pyqt5-examples/usr/share/doc/pyqt5-examples/examples/designer/plugins/python/__pycache__
	rm -rf $(CURDIR)/debian/pyqt5-examples/usr/share/doc/pyqt5-examples/examples/designer/plugins/widgets/__pycache__
	dh_fixperms
	dh_compress -X/examples
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture independant packages using the common target.
binary-indep: install-indep
	$(MAKE) -f debian/rules DH_OPTIONS="-i ${EXTRA_DH_OPTIONS}" binary-common

# Build architecture dependant packages using the common target.
binary-arch: install-arch
	$(MAKE) -f debian/rules DH_OPTIONS="-a ${EXTRA_DH_OPTIONS}" binary-common


binary: binary-arch binary-indep

.PHONY: build-indep build-arch build clean binary-indep binary-arch binary configure