summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 2b4e2326ee2760da88c3e83163c3095d61c04823 (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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#!/usr/bin/make -f

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

# Qt upstream version (e.g.: 4.5.2)
QTVERSION := $(shell ls changes-* | cut -f2 -d '-')
# Current debian version (e.g.: 4:4.5.2-1)
CURRENTVERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/makefile.mk
include /usr/share/cdbs/1/rules/patchsys-quilt.mk
include /usr/share/cdbs/1/rules/utils.mk

DEB_MAKE_INVOKE := $(MAKE)
DEB_MAKE_BUILD_TARGET := sub-src
DEB_MAKE_INSTALL_TARGET := INSTALL_ROOT=$(DEB_DESTDIR) install
DEB_DH_INSTALL_SOURCEDIR := debian/tmp

# Ensure the *.debug files aren't included in any package other than *-dbg
DEB_DH_INSTALL_ARGS := --exclude=.debug

DEB_MAKE_CLEAN_TARGET := confclean distclean

# Shlibs of the current upstream version
#DEB_DH_MAKESHLIBS_ARGS_ALL := -V
# Specific shlibs version (e.g.: 4:4.5.2)
SHLIBSVERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p' | cut -f1 -d '-')
$(foreach libpkg,$(filter-out %-dev %-dbg,$(filter lib%,$(DEB_ARCH_PACKAGES))),$(eval DEB_DH_MAKESHLIBS_ARGS_$(libpkg) := -V'$(libpkg) (>= $(SHLIBSVERSION))'))

DEB_DH_STRIP_ARGS_libqt4-dbg := --exclude=.debug
DEB_DH_STRIP_ARGS_libqt4-webkit-dbg := --exclude=.debug
DEB_DH_STRIP_ARGS_libqt4-xmlpatterns-dbg := --exclude=.debug
DEB_DH_STRIP_ARGS_phonon-dbg := --exclude=.debug
DEB_DH_STRIP_ARGS_qt4-demos-dbg := --exclude=.debug

DEB_DH_SHLIBDEPS_ARGS_ALL := --exclude=.debug

# Disable for rc
DEB_INSTALL_CHANGELOGS_ALL := changes-$(QTVERSION)

DEB_INSTALL_DOCS_ALL := LGPL_EXCEPTION.txt

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)
        PLATFORM_ARG = linux-g++
else
        PLATFORM_ARG = glibc-g++
endif

common-build-arch::  debian/stamp-makefile-build-tools

debian/stamp-makefile-build-tools: debian/stamp-makefile-build
	$(MAKE) sub-tools
	# Test current version is a snapshot
ifeq (snapshot, $(findstring snapshot, $(CURRENTVERSION)))
	# Build documentations
	$(MAKE) docs
	# Workaround: It's a known qmake limitation.
	# It can't generate install rules for files that don't exist yet like docs.
	./config.status
endif
	touch $@

common-configure-arch:: config.status

config.status:
	# 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++

	./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" \
	            -platform $(PLATFORM_ARG) \
	            -opensource \
	            -fast \
	            -optimized-qmake \
	            -no-rpath \
	            -system-zlib \
	            -system-libtiff \
	            -system-libpng \
	            -system-libjpeg \
	            -system-nas-sound \
	            -qt-gif \
	            -plugin-sql-mysql \
	            -plugin-sql-odbc \
	            -plugin-sql-psql \
	            -plugin-sql-sqlite \
	            -plugin-sql-sqlite2 \
	            -system-sqlite \
	            -I/usr/include/freetype2 \
	            -lfontconfig \
	            -cups \
	            -exceptions \
	            -dbus \
	            -pch \
	            -phonon \
	            -no-phonon-backend \
	            -svg \
	            -webkit \
	            -xmlpatterns \
	            $(EXTRA_CONFIGURE_OPTS)

clean::
# 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 -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 -exec file -i '{}' \; | grep \
	  -e application/x-executable \
	| cut -d ':' -f 1 | xargs rm -f

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

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

install/libqtcore4::
	$(CURDIR)/bin/lrelease-qt4 debian/translations/qt_ca.ts \
		-qm $(DEB_DESTDIR)/usr/share/qt4/translations/qt_ca.qm

install/qt4-demos::
	mkdir -p debian/$(cdbs_curpkg)/usr/lib/qt4/demos/qtdemo
	uudecode -o debian/$(cdbs_curpkg)/usr/lib/qt4/demos/qtdemo/qtdemo.qhc \
		debian/collection/qtdemo.qhc.uu

install/qt4-designer::
	install -D -p -m0644 debian/desktop/designer-qt4.desktop \
		debian/$(cdbs_curpkg)/usr/share/applications/designer-qt4.desktop
	mkdir -p debian/$(cdbs_curpkg)/usr/share/pixmaps
	uudecode -o debian/$(cdbs_curpkg)/usr/share/pixmaps/designer.png \
		debian/desktop/designer.png.uu

install/qt4-dev-tools::
	install -D -p -m0644 debian/desktop/assistant-qt4.desktop \
		debian/$(cdbs_curpkg)/usr/share/applications/assistant-qt4.desktop
	install -D -p -m0644 debian/desktop/linguist-qt4.desktop \
		debian/$(cdbs_curpkg)/usr/share/applications/linguist-qt4.desktop
	mkdir -p debian/$(cdbs_curpkg)/usr/share/pixmaps
	uudecode -o debian/$(cdbs_curpkg)/usr/share/pixmaps/assistant.png \
		debian/desktop/assistant.png.uu
	uudecode -o debian/$(cdbs_curpkg)/usr/share/pixmaps/linguist.png \
		debian/desktop/linguist.png.uu

install/qt4-qtconfig::
	install -D -p -m0644 debian/desktop/qt4config.desktop \
		debian/$(cdbs_curpkg)/usr/share/applications/qt4config.desktop
	mkdir -p debian/$(cdbs_curpkg)/usr/share/pixmaps
	uudecode -o debian/$(cdbs_curpkg)/usr/share/pixmaps/qtconfig.png \
		debian/desktop/qtconfig.png.uu

binary-install/libqt4-dbg::
# Run dh_install without the default DEB_DH_INSTALL_ARGS to install the *.debug files
	dh_install -plibqt4-dbg --sourcedir=$(DEB_DH_INSTALL_SOURCEDIR)

binary-install/libqt4-webkit-dbg::
# Run dh_install without the default DEB_DH_INSTALL_ARGS to install the *.debug files
	dh_install -plibqt4-webkit-dbg --sourcedir=$(DEB_DH_INSTALL_SOURCEDIR)

binary-install/libqt4-xmlpatterns-dbg::
# Run dh_install without the default DEB_DH_INSTALL_ARGS to install the *.debug files
	dh_install -plibqt4-xmlpatterns-dbg --sourcedir=$(DEB_DH_INSTALL_SOURCEDIR)

binary-install/phonon-dbg::
# Run dh_install without the default DEB_DH_INSTALL_ARGS to install the *.debug files
	dh_install -pphonon-dbg --sourcedir=$(DEB_DH_INSTALL_SOURCEDIR)

binary-install/qt4-demos-dbg::
# Run dh_install without the default DEB_DH_INSTALL_ARGS to install the *.debug files
	dh_install -pqt4-demos-dbg --sourcedir=$(DEB_DH_INSTALL_SOURCEDIR)

binary-post-install/libqt4-dev::
	install -D -p -m0644 doc/html/qt.tags \
		$(DEB_DESTDIR)/usr/share/qt4/doc/html/qt.tags

binary-strip/libphonon4::
	pkgkde-symbolshelper symbolfile -p libphonon4 -o debian/libphonon4.symbols

# Automatically install lintian overrides, stolen from debian-qt-kde.mk
$(patsubst %,binary-install/%,$(DEB_PACKAGES)) :: binary-install/%:
	if test -e debian/$(cdbs_curpkg).lintian; then \
	    install -p -D -m644 debian/$(cdbs_curpkg).lintian \
	    debian/$(cdbs_curpkg)/usr/share/lintian/overrides/$(cdbs_curpkg); \
        fi

# Generate shlibs local files
$(patsubst %,binary-fixup/%,$(DEB_ALL_PACKAGES)) :: binary-fixup/%: binary-strip/%
	if test -e debian/$(cdbs_curpkg)/DEBIAN/shlibs ; then \
		sed 's/>=[^)]*/= $(CURRENTVERSION)/' debian/$(cdbs_curpkg)/DEBIAN/shlibs >> debian/shlibs.local ;\
	fi