summaryrefslogtreecommitdiff
path: root/debian/rules
blob: e04e4fb66e058799163a66988032152f9e7b7198 (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
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
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export QTDIR := $(shell pwd)
export PATH := $(QTDIR)/bin:$(PATH)
# workaround to use lrelease.
export LD_LIBRARY_PATH := $(QTDIR)/lib:$(LD_LIBRARY_PATH)
# workaround to use qhelpgenerator.
export QT_PLUGIN_PATH := $(QTDIR)/plugins

pkgs_dbg := $(shell dh_listpackages | grep dbg | sed -e '/libqt4-dbg/d; s|-dbg||')
# Library package list for override_dh_makeshlibs, excludes libqt4-phonon
pkgs_lib := $(filter-out %-dev %-dbg libqt4-phonon,$(filter lib%,$(shell dh_listpackages)))
# Upstream changelog
upstream_changes := $(wildcard changes-*)
# Current debian version (e.g.: 4:4.5.2-1)
current_version := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')
# Specific shlibs version (e.g.: 4:4.5.2)
shlibs_version := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p' | cut -f1 -d '-')
# libqt4-phonon shlibs. Minimum libphonon4 version may need adjusting for new
# Qt upstream release
libqt4phonon_shlibs := libphonon4 (>= 4:4.6.0) | libqt4-phonon (= $(current_version))

ibase_architectures := i386 kfreebsd-i386 kfreebsd-amd64 knetbsd-i386 netbsd-i386 amd64 sparc powerpc
ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(ibase_architectures)))
	extra_configure_opts += -plugin-sql-ibase
else
	extra_configure_opts += -no-sql-ibase
endif

ifeq ($(DEB_HOST_ARCH),arm)
	extra_configure_opts += -DQT_QLOCALE_USES_FCVT
endif

ifeq ($(DEB_HOST_ARCH_OS),linux)
  ifeq ($(DEB_HOST_ARCH),amd64)
	platform_arg = linux-g++-64
  else
    ifeq ($(DEB_HOST_ARCH),sparc64)
	platform_arg = linux-g++-64
    else
	platform_arg = linux-g++
    endif # sparc64
  endif # amd64
else
	platform_arg = glibc-g++
endif

%:
	dh $@ --parallel --with pkgkde_symbolshelper

override_dh_auto_configure:
	# Test broken hppa kernel with glibc >= 2.5
ifeq ($(DEB_HOST_ARCH),hppa)
	mkdir -p debian/hppa-tmp
	echo "Testing whether getdents kernel bug is present on this buildd - see #433768"
	gcc -o debian/hppa-tmp/hppa-test-program debian/readdir-hppa-test.c
	cd $(CURDIR)/doc/html && $(CURDIR)/debian/hppa-tmp/hppa-test-program | sort > $(CURDIR)/debian/hppa-tmp/readdir_r-out
	cd $(CURDIR)/doc/html && ls -a | sort > $(CURDIR)/debian/hppa-tmp/ls-a-out
	@if ! diff -q $(CURDIR)/debian/hppa-tmp/readdir_r-out $(CURDIR)/debian/hppa-tmp/ls-a-out ; \
		then \
		echo "Kernel bug present. This will misbuild qt4 if proceeding. Failing" ; \
		echo "Please update kernel and test again" ; \
		exit 5 ; \
	fi
endif

	# Create mkspecs/glibc-g++ from mkspecs/linux-g++, needed by GNU/kFreeBSD
	# we cannot use directly linux-g++ due to src/corelib/io/io.pri
	rm -rf mkspecs/glibc-g++
	cp -a mkspecs/linux-g++ mkspecs/glibc-g++

	# Generate include
	rm -rf include && QTDIR="." perl bin/syncqt

	./configure -confirm-license \
	            -prefix "/usr" \
	            -bindir "/usr/bin" \
	            -libdir "/usr/lib" \
	            -docdir "/usr/share/qt4/doc" \
	            -headerdir "/usr/include/qt4" \
	            -datadir "/usr/share/qt4" \
	            -plugindir "/usr/lib/qt4/plugins" \
	            -translationdir "/usr/share/qt4/translations" \
	            -sysconfdir "/etc/xdg" \
	            -demosdir "/usr/lib/qt4/demos" \
	            -examplesdir "/usr/lib/qt4/examples" \
	            -opensource \
	            -fast \
	            -plugin-sql-mysql \
	            -plugin-sql-odbc \
	            -plugin-sql-psql \
	            -plugin-sql-sqlite \
	            -plugin-sql-sqlite2 \
	            -plugin-sql-tds \
	            -system-sqlite \
	            -xmlpatterns \
	            -multimedia \
	            -audio-backend \
	            -phonon \
	            -no-phonon-backend \
	            -svg \
	            -webkit \
	            -script \
	            -scripttools \
	            -platform $(platform_arg) \
	            -system-zlib \
	            -qt-gif \
	            -system-libtiff \
	            -system-libpng \
	            -system-libjpeg \
	            -no-rpath \
	            -optimized-qmake \
	            -dbus \
	            -no-separate-debug-info \
	            -verbose \
	            -gtkstyle \
	            -system-nas-sound \
	            -lfontconfig \
	            -I/usr/include/freetype2 \
	            -qvfb \
	            $(extra_configure_opts)

override_dh_auto_build:
	dh_auto_build
	# Build documentations
	$(MAKE) docs
	# Build translations
	$(MAKE) ts
	# Workaround: It's a known qmake limitation.
	# It can't generate install rules for files that don't exist yet like docs.
	./config.status

override_dh_auto_clean:
	[ ! -f Makefile ] || $(MAKE) confclean distclean

	# Extra stuff missed by confclean/distclean

	# Misc. files
	rm -f \
	  config.status \
	  config.tests/.qmake.cache \
	  examples/dbus/*/Makefile.* \
	  mkspecs/qconfig.pri \
	  src/corelib/global/qconfig.* \
	;

	# Misc. directories
	rm -rf \
	  doc-build/ \
	  examples/tools/plugandpaint/plugins/ \
	  examples/tools/styleplugin/styles/ \
	  lib/ \
	  mkspecs/glibc-g++/ \
	  plugins/ \
	;

	# hppa test directory
	rm -rf debian/hppa-tmp

	# Leftover dirs
	find -depth -type d \( -false \
	  -o -name debug-shared \
	  -o -name debug-static \
	  -o -name \*.gch \
	  -o -name .moc\* \
	  -o -name .obj\* \
	  -o -name .pch \
	  -o -name pkgconfig \
	  -o -name .rcc \
	  -o -name release-shared \
	  -o -name release-static \
	  -o -name .uic \
	\) -print0 | xargs -0 rm -rf

	# Leftover files and all symlinks
	find \( -false \
	  -o -type f -name \*.a \
	  -o -name Makefile.Debug \
	  -o -name Makefile.Release \
	  -o -name \*.o \
	  -o -name \*.prl \
	  -o -name \*.so \
	  -o -name \*.so.debug \
	  -o -type l \
	\) -delete

	# Delete all Makefiles, excluding some from src/3rdparty
	find $(CURDIR) -name Makefile \
	  ! -path $(CURDIR)/src/3rdparty/Makefile \
	  ! -path $(CURDIR)/src/3rdparty/freetype/\* \
	  ! -path $(CURDIR)/src/3rdparty/zlib/\* \
	-delete

	# Any remaining executables
	find $(CURDIR) -type f -executable -exec file -i '{}' \; | grep \
	  -e application/x-executable \
	| cut -d ':' -f 1 | xargs rm -f

	# Generated on build
	rm -f debian/shlibs.local
	rm -f debian/stamp-makefile-build-tools

override_dh_auto_install:
	$(MAKE) install INSTALL_ROOT=$(CURDIR)/debian/tmp/

	# Fix wrong path in pkgconfig files
	find $(CURDIR)/debian/tmp/usr/lib/pkgconfig -type f -name '*.pc' \
		-exec perl -pi -e "s, -L$(CURDIR)/?\S+,,g" {} \;
	# Fix wrong path in prl files
	find $(CURDIR)/debian/tmp/usr/lib -type f -name '*.prl' \
		-exec sed -i -e "/^QMAKE_PRL_BUILD_DIR/d;s/\(QMAKE_PRL_LIBS =\).*/\1/" {} \;

	mkdir -p debian/libqtcore4/usr/share/qt4/translations
	$(CURDIR)/bin/lrelease-qt4 debian/translations/qt_ca.ts \
		-qm $(CURDIR)/debian/libqtcore4/usr/share/qt4/translations/qt_ca.qm

	install -D -p -m0644 debian/collection/qtdemo.qhc \
		debian/qt4-demos/usr/lib/qt4/demos/qtdemo/qtdemo.qhc

	install -D -p -m0644 debian/desktop/designer-qt4.desktop \
		debian/qt4-designer/usr/share/applications/designer-qt4.desktop
	install -D -p -m0644 debian/desktop/designer.png \
		debian/qt4-designer/usr/share/pixmaps/designer.png

	install -D -p -m0644 debian/desktop/assistant-qt4.desktop \
		debian/qt4-dev-tools/usr/share/applications/assistant-qt4.desktop
	install -D -p -m0644 debian/desktop/linguist-qt4.desktop \
		debian/qt4-dev-tools/usr/share/applications/linguist-qt4.desktop
	install -D -p -m0644 debian/desktop/assistant.png \
		debian/qt4-dev-tools/usr/share/pixmaps/assistant.png
	install -D -p -m0644 debian/desktop/linguist.png \
		debian/qt4-dev-tools/usr/share/pixmaps/linguist.png

	install -D -p -m0644 debian/desktop/qt4config.desktop \
		debian/qt4-qtconfig/usr/share/applications/qt4config.desktop
	install -D -p -m0644 debian/desktop/qtconfig.png \
		debian/qt4-qtconfig/usr/share/pixmaps/qtconfig.png

	# Remove phonon development files
	rm -f debian/tmp/usr/lib/libphonon.la
	rm -f debian/tmp/usr/lib/libphonon.prl
	rm -f debian/tmp/usr/lib/libphonon.so
	rm -f debian/tmp/usr/lib/pkgconfig/phonon.pc
	rm -rf debian/tmp/usr/include/qt4/phonon

override_dh_install:
	dh_install --list-missing --sourcedir=debian/tmp

override_dh_installdocs:
	dh_installdocs --all LGPL_EXCEPTION.txt

override_dh_installchangelogs:
	dh_installchangelogs $(upstream_changes)

override_dh_strip:
	$(foreach pkg,$(pkgs_dbg),dh_strip -p$(pkg) --dbg-package=$(pkg)-dbg;)
	dh_strip -plibqt4-phonon
	dh_strip --remaining-packages --dbg-package=libqt4-dbg

override_dh_makeshlibs:
	# Specific shlibs version (e.g.: 4:4.5.2)
	$(foreach pkg,$(pkgs_lib),dh_makeshlibs -p$(pkg) -V '$(pkg) (>= $(shlibs_version))' -- -c0;)
	dh_makeshlibs -plibqt4-phonon -V'$(libqt4phonon_shlibs)'
	# Generate shlibs local files
	for pkg in $(pkgs_lib); do \
		if test -e debian/$${pkg}/DEBIAN/shlibs ; then \
			sed 's/>=[^)]*/= $(current_version)/' debian/$${pkg}/DEBIAN/shlibs >> debian/shlibs.local ;\
		fi \
	done

override_dh_shlibdeps:
	# Exclude phonon deps from libqt4-phonon itself (they get injected there somehow)
	dh_shlibdeps -plibqt4-phonon -- -xlibphonon4 -xlibqt4-phonon
	dh_shlibdeps --remaining-packages

.PHONY: override_dh_auto_test