File: rules

package info (click to toggle)
pyqt5 5.15.1+dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 16,328 kB
  • sloc: python: 94,696; cpp: 22,030; javascript: 721; xml: 285; makefile: 104; sh: 36
file content (138 lines) | stat: -rwxr-xr-x 4,618 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
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DH_OPTIONS=${EXTRA_DH_OPTIONS}

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

SPLIT=10

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

PYQT_MODULES := opengl remoteobjects sql webchannel webkit websockets xmlpatterns svg \
	multimedia quick serialport sensors texttospeech x11extras positioning bluetooth nfc networkauth

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

export QT_SELECT=qt5

# STRIP is unset to let stripping be handled by dh_strip
SHARED_CONFIGURE_OPTIONS=--confirm-license --verbose \
	--target-dir /usr/lib/python3/dist-packages \
	--concatenate $(SPLIT) \
	--no-make \
	--qmake-setting 'QMAKE_CFLAGS += "${CFLAGS} ${CPPFLAGS}"' \
	--qmake-setting 'QMAKE_CXXFLAGS += "${CXXFLAGS} ${CPPFLAGS}"' \
	--qmake-setting 'QMAKE_LFLAGS += "${LDFLAGS}"'


%:
	dh $@ --with python3

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

override_dh_auto_configure-indep: build-$(DEFAULT_PYTHON)/configure-stamp

build-%/configure-stamp:
	dh_testdir
	python$* /usr/bin/sip-build $(SHARED_CONFIGURE_OPTIONS) \
			--build-dir build-$* \
			$(if $(filter $(DEFAULT_PYTHON),$*),--pep484-pyi,--no-designer-plugin --no-qml-plugin)
	sed -i '/strip/d' build-$*/*/Makefile
	touch $@

dbg-build-%/configure-stamp:
	dh_testdir
	python$*-dbg /usr/bin/sip-build $(SHARED_CONFIGURE_OPTIONS) \
			--build-dir dbg-build-$* \
			--debug --no-designer-plugin --no-qml-plugin --no-tools
	sed -i '/strip/d' dbg-build-$*/*/Makefile
	sed -i 's/-isystem/-I/' dbg-build-$*/*/Makefile
	touch $@

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

override_dh_auto_build-indep: build-$(DEFAULT_PYTHON)/build-stamp

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

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

override_dh_auto_install-indep:
	$(MAKE) -C build-$(DEFAULT_PYTHON) install INSTALL_ROOT=$(CURDIR)/debian/tmp

override_dh_installexamples-indep:
	dh_installexamples -Xactiveqt -i
	# Use python3 shebangs and regenerate resource files
	export PYTHONPATH=$(CURDIR)/debian/tmp/usr/lib/python3/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)/debian/tmp/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

override_dh_auto_install-arch:
	set -e; for p in $(ALLPYTHONS); do \
		$(MAKE) -C build-$$p install INSTALL_ROOT=$(CURDIR)/debian/tmp; \
		$(MAKE) -C dbg-build-$$p install INSTALL_ROOT=$(CURDIR)/debian/tmp; \
	done

execute_after_dh_install-arch:
	sed -i 's,/usr/bin/python3[.0-9]*,/usr/bin/python3,' debian/pyqt5-dev-tools/usr/bin/*
	rm -rfv debian/python3-pyqt5/usr/lib/python3/dist-packages/PyQt5/uic/port_v2

override_dh_auto_clean:
	rm -rf $(ALLPYTHONS:%=build-%) $(ALLPYTHONS:%=dbg-build-%)
	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

override_dh_installdocs:
	set -e; for p in $(PY_PACKAGE_NAMES:%=python3-%); do \
		dh_installdocs -p$$p-dbg --link-doc=$$p; \
	done
	dh_installdocs --remaining-packages -A NEWS

override_dh_strip-arch:
	dh_strip -ppyqt5-dev-tools
	set -e; \
	for p in $(PY_PACKAGE_NAMES:%=python3-%); do \
		DH_OPTIONS= dh_strip -p$$p --dbg-package=$$p-dbg; \
	done

override_dh_python3:
	dh_python3 --no-dbg-cleaning -N pyqt5-examples