File: rules

package info (click to toggle)
python-qt4 4.7.3-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,504 kB
  • ctags: 4,680
  • sloc: python: 28,738; cpp: 8,897; sh: 245; xml: 243; makefile: 150
file content (211 lines) | stat: -rwxr-xr-x 6,594 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
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

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

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

export QMAKESPEC=linux-g++

GCCVER := $(shell gcc -dumpversion | sed -e 's/.[0-9]$$//')

LDFLAGS += -Wl,-O1

ifeq ($(DEB_BUILD_ARCH),alpha)
	LDFLAGS += -Wl,--no-relax
endif

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CXXFLAGS += -O0
else
ifneq (,$(filter $(GCCVER),4.2))
	CXXFLAGS += -O1
	SPLIT=40
else
	CXXFLAGS += -Os
	SPLIT=10
endif
endif

PYTHONS := $(shell pyversions -vr)

DEFAULT_PYTHON := $(shell pyversions -vd)

# 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 \
	-q /usr/bin/qmake-qt4 -c -j $(SPLIT) \
	LIBDIR_QT=/usr/lib STRIP="" MOC=moc-qt4 \
	LIBS_OPENGL="" LIBS_X11="" LIBS_THREAD="" \
	LFLAGS="" CXXFLAGS_RELEASE="${CXXFLAGS}" LFLAGS_RELEASE="${LDFLAGS}"


.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 $(SHARED_CONFIGURE_OPTIONS) \
			-m /usr/lib/python$*/config \
			-d /usr/lib/python$*/$(call py_sitename, $*) \
			$(if $(filter $(DEFAULT_PYTHON),$*),,--no-designer-plugin) 
	touch $@

dbg-build-%/configure-stamp:
	dh_testdir
	mkdir -p dbg-build-$*
	cd dbg-build-$* && python$*-dbg ../configure.py $(SHARED_CONFIGURE_OPTIONS) \
			-m /usr/lib/python$*/config_d \
			-l /usr/include/python$*_d \
			-d /usr/lib/python$*/$(call py_sitename, $*) \
			--no-designer-plugin
	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 $@

install-indep: build-$(DEFAULT_PYTHON)/build-stamp
	dh_testdir
	dh_testroot
	dh_prep -i
	dh_installdirs -i
	dh_install -i
	dh_installexamples -i
	$(CURDIR)/build-$(DEFAULT_PYTHON)/pyrcc/pyrcc4 -o $(CURDIR)/debian/python-qt4-doc/usr/share/doc/python-qt4-doc/examples/demos/qtdemo/qtdemo_rc.py $(CURDIR)/examples/demos/qtdemo/qtdemo.qrc 

install-arch: build
	dh_testdir
	dh_testroot
	dh_prep -a
	dh_installdirs -a
	sed -i -e '/strip/ d' $(CURDIR)/build-$(DEFAULT_PYTHON)/designer/Makefile
	rm -f $(CURDIR)/debian/python-qt4-dbus.install
	# 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

	dh_install -a

	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 {} \;

	#FIXME - copying the file to /usr/bin is not the best way,
	# it should be imported properly instead.
	# probably like ipython handles it.
	cp debian/pyuic4 debian/pyqt4-dev-tools/usr/bin/pyuic4

d_qt4_dbg = debian/python-qt4-dbg

install-arch-%:
	$(MAKE) -C build-$* install \
		INSTALL_ROOT=$(CURDIR)/debian/tmp DESTDIR=$(CURDIR)/debian/tmp

	$(MAKE) -C dbg-build-$* install DESTDIR=$(CURDIR)/$(d_qt4_dbg)

	# remove the Python 3 port for now
	rm -r $(CURDIR)/debian/tmp/usr/lib/python$*/$(call py_sitename,$*)/PyQt4/uic/port_v3

	# Don't initiate the uic/widget-plugins
	touch $(CURDIR)/debian/tmp/usr/lib/python$*/$(call py_sitename,$*)/PyQt4/uic/widget-plugins/.noinit

	mv $(d_qt4_dbg)/usr/lib/python$*/$(call py_sitename,$*)/PyQt4/pyqtconfig.py \
		$(d_qt4_dbg)/usr/lib/python$*/$(call py_sitename,$*)/PyQt4/pyqtconfig_d.py
	mkdir -p debian/python-qt4-gl-dbg/usr/lib/python$*/$(call py_sitename,$*)/PyQt4
	mv $(d_qt4_dbg)/usr/lib/python$*/$(call py_sitename,$*)/PyQt4/QtOpenGL.so \
		debian/python-qt4-gl-dbg/usr/lib/python$*/$(call py_sitename,$*)/PyQt4
	mkdir -p debian/python-qt4-sql-dbg/usr/lib/python$*/$(call py_sitename,$*)/PyQt4
	mv $(d_qt4_dbg)/usr/lib/python$*/$(call py_sitename,$*)/PyQt4/QtSql.so \
		debian/python-qt4-sql-dbg/usr/lib/python$*/$(call py_sitename,$*)/PyQt4
	mkdir -p debian/python-qt4-phonon-dbg/usr/lib/python$*/$(call py_sitename,$*)/PyQt4
	mv $(d_qt4_dbg)/usr/lib/python$*/$(call py_sitename,$*)/PyQt4/phonon.so \
		debian/python-qt4-phonon-dbg/usr/lib/python$*/$(call py_sitename,$*)/PyQt4

	if [ -e $(d_qt4_dbg)$(call py_dbusmoddir,$*)/qt.so ]; then \
		mkdir -p debian/python-qt4-dbus-dbg/$(call py_dbusmoddir,$*);\
		mv $(d_qt4_dbg)$(call py_dbusmoddir,$*)/qt.so \
			debian/python-qt4-dbus-dbg$(call py_dbusmoddir,$*);\
		echo '$(call py_dbusmoddir,$*)/*' >> $(CURDIR)/debian/python-qt4-dbus.install;\
	fi


clean: 
	dh_testdir
	dh_testroot
	-cd designer && make distclean
	rm -rf $(PYTHONS:%=build-%) $(PYTHONS:%=dbg-build-%) sip/Qt
	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 THANKS
	dh_link
	dh_sip
ifeq (,$(findstring -i, $(DH_OPTIONS)))
	DH_OPTIONS= dh_strip -ppyqt4-dev-tools
	set -e; \
	for p in python-qt4 python-qt4-dbus python-qt4-gl python-qt4-sql python-qt4-phonon ; 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_pysupport
	dh_fixperms
	dh_compress -X.py -X.bmp -X.ui -X.sql -X.xml
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb -- -Z bzip2

# 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 clean binary-indep binary-arch binary configure