summaryrefslogtreecommitdiffstats
path: root/ubuntu/_base/dependencies/python-tqt/debian/rules
blob: 932c1bc3511b0a4ef7f479719fc8531f9e65d8af (plain)
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
#!/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

-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


DOC=$(CURDIR)/debian/python-tqt-doc/usr/share/doc/python-tqt-doc
INSTDIR=$(CURDIR)/debian

export QTDIR=/usr/share/tqt3
export QMAKESPEC=$(QTDIR)/mkspecs/linux-g++

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CXXFLAGS += -O0
else
	CXXFLAGS += -O1
endif
CXXFLAGS += "-I/usr/include/tqt"

PYTHONS	:= $(shell pyversions -vr debian/control) $(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)

DEB_PARALLEL_JOBS ?= 40

.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-$* && echo yes \
                | python$* ../configure.py \
                        -c -n /usr/include/tqt3 \
                        -o /usr/lib/$(DEB_HOST_MULTIARCH) -u -j $(DEB_PARALLEL_JOBS) \
                        -d /usr/lib/python$*/$(call py_sitename,$*)/python_tqt \
                        -l /usr/include/python$* \
                        -v /usr/share/sip/tqt \
                        -m /usr/lib/python$*/config \
                        -z \
                        CXXFLAGS_RELEASE="" CXXFLAGS="${CXXFLAGS}" STRIP=""
	touch $@

dbg-build-%/configure-stamp:
	dh_testdir
	mkdir -p dbg-build-$*
	cd dbg-build-$* && echo yes \
                | python$*-dbg ../configure.py \
                        -c -n /usr/include/tqt3 \
                        -o /usr/lib/$(DEB_HOST_MULTIARCH) -u -j $(DEB_PARALLEL_JOBS) \
                        -d /usr/lib/python$*/$(call py_sitename,$*)/python_tqt \
                        -l /usr/include/python$*_d \
                        -v /usr/share/sip/tqt \
                        -m /usr/lib/python$*/config_d \
                        -z \
                        CXXFLAGS_RELEASE="" CXXFLAGS="-O0 -g -I/usr/include/tqt" STRIP=""
	touch $@

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

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 $@

install-indep: configure
	dh_testdir
	dh_testroot
	dh_clean -k -i
	dh_installdirs -i
	for version in ${PYTHONS}; do\
		pylib=$$(python$$version -c 'from distutils import sysconfig; print (sysconfig.get_python_lib())')/python_tqt;\
		mkdir -p debian/python-tqt-dev/$$pylib;\
		install -m 644 -o root -g root build-$$version/pyqtconfig.py debian/python-tqt-dev/$$pylib;\
	done
	dh_install -i

install-arch: build
	dh_testdir
	dh_testroot
	dh_clean -k -a
	dh_installdirs -a

	for p in $(PYTHONS) ; do \
		$(MAKE) -f debian/rules install-arch-$$p;\
	done

	dh_install -a --sourcedir=$(CURDIR)/debian/tmp

	for i in $$(find debian/python-*-dbg -name '*.so'); do \
	  b=$$(basename $$i .so); \
	  mv $$i $$(dirname $$i)/$${b}_d.so; \
	done
	find debian/python-*-dbg ! -type d \
                ! \( -name '*.so' -o -name '*config_d.py' \) | xargs rm -f
	find debian/python-*-dbg -depth -type d -empty -exec rmdir {} \;

	for i in $$(find debian/python3-*-dbg -name '*.so'); do \
	  b=$$(basename $$i .so); \
	  mv $$i $$(dirname $$i)/$${b}_d.so; \
	done
	find debian/python3-*-dbg ! -type d \
                ! \( -name '*.so' -o -name '*config_d.py' \) | xargs rm -f
	find debian/python3-*-dbg -depth -type d -empty -exec rmdir {} \;

install-arch-3.%:
	$(MAKE) -C build-3.$* install DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) -C dbg-build-3.* install DESTDIR=$(CURDIR)/debian/python3-tqt-dbg
	mkdir -p debian/python3-tqt/usr/lib/python3.$*/$(call py_sitename,$$version)/python_tqt
	cp -a debian/tmp/usr/lib/python3.$*/$(call py_sitename,$$version)/python_tqt/__init__.py \
	      debian/python3-tqt/usr/lib/python3.$*/$(call py_sitename,$$version)/python_tqt/__init__.py
	mkdir -p debian/python3-tqt-gl-dbg/usr/lib/python3.$*/$(call py_sitename,$$version)/python_tqt
	mv debian/python3-tqt-dbg/usr/lib/python3.$*/$(call py_sitename,$$version)/python_tqt/qtgl.so \
	   debian/python3-tqt-gl-dbg/usr/lib/python3.$*/$(call py_sitename,$$version)/python_tqt/
	mkdir -p debian/python3-tqtext-dbg/usr/lib/python3.$*/$(call py_sitename,$$version)/python_tqt
	mv debian/python3-tqt-dbg/usr/lib/python3.$*/$(call py_sitename,$$version)/python_tqt/qtext.so \
	   debian/python3-tqtext-dbg/usr/lib/python3.$*/$(call py_sitename,$$version)/python_tqt/

install-arch-%:
	$(MAKE) -C build-$* install DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) -C dbg-build-$* install DESTDIR=$(CURDIR)/debian/python-tqt-dbg
	mkdir -p debian/python-tqt/usr/lib/python$*/$(call py_sitename,$$version)/python_tqt
	cp -a debian/tmp/usr/lib/python$*/$(call py_sitename,$$version)/python_tqt/__init__.py \
	      debian/python-tqt/usr/lib/python$*/$(call py_sitename,$$version)/python_tqt/__init__.py
	mkdir -p debian/python-tqt-gl-dbg/usr/lib/python$*/$(call py_sitename,$$version)/python_tqt
	mv debian/python-tqt-dbg/usr/lib/python$*/$(call py_sitename,$$version)/python_tqt/qtgl.so \
	   debian/python-tqt-gl-dbg/usr/lib/python$*/$(call py_sitename,$$version)/python_tqt/
	mkdir -p debian/python-tqtext-dbg/usr/lib/python$*/$(call py_sitename,$$version)/python_tqt
	mv debian/python-tqt-dbg/usr/lib/python$*/$(call py_sitename,$$version)/python_tqt/qtext.so \
	   debian/python-tqtext-dbg/usr/lib/python$*/$(call py_sitename,$$version)/python_tqt/

clean:
	dh_testdir
	dh_testroot
	rm -rf $(PYTHONS:%=build-%) $(PYTHONS:%=dbg-build-%) 
	rm -f *-stamp
	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 ChangeLog
	dh_installdocs -A NEWS THANKS
	dh_installexamples
	dh_link
ifeq (,$(findstring -i, $(DH_OPTIONS)))
	DH_OPTIONS= dh_strip -ppytqt-tools
	set -e; \
	for p in python-tqt python-tqt-gl python-tqtext; do \
	  DH_OPTIONS= dh_strip -p$$p --dbg-package=$$p-dbg; \
	  rm -rf debian/$$p-dbg/usr/share/doc/$$p-dbg; \
	  ln -s $$p debian/$$p-dbg/usr/share/doc/$$p-dbg; \
	done
endif
#	dh_strip
	dh_compress -X.py -X.bmp -X.ui -X.sql
	dh_fixperms
ifneq (dh_pysupport,${DH_PYTHON2})
	${DH_PYTHON2} --no-dbg-cleaning
else
	${DH_PYTHON2}
endif
	dh_python3 --no-dbg-cleaning
	dh_sip_tqt
	dh_sip3_tqt
	dh_lintian
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb $(DEB_DH_BUILDDEB_ARGS)

# Build architecture independant packages using the common target.
binary-indep: install-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 build-arch clean binary-indep binary-arch binary configure