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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
#!/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)
export QT_PLUGIN_PATH := $(QTDIR)/plugins
export DH_VERBOSE=1
# Only present in official source package
#QTVERSION := $(shell ls changes-* | cut -f2 -d '-')
CURRENTVERSION := $(shell head -1 debian/changelog | sed 's/[^(]*(\([^)]*\)).*/\1/')
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
# Find out how many parallel threads to run
TMP_BUILD_OPTS = $(subst $(comma),$(space),$(DEB_BUILD_OPTIONS))
ifneq (,$(filter parallel=%,$(TMP_BUILD_OPTS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(TMP_BUILD_OPTS)))
PARALLEL_MAKEFLAGS += -j$(NUMJOBS)
endif
BUILD_NOOPT := no
ifneq (,$(filter noopt,$(TMP_BUILD_OPTS)))
BUILD_NOOPT := yes
endif
BUILD_DOCS := yes
ifneq (,$(filter nodoc,$(TMP_BUILD_OPTS)))
BUILD_DOCS := no
endif
ifneq (,$(filter nodocs,$(TMP_BUILD_OPTS)))
BUILD_DOCS := no
endif
TRY_TARGET_BUILD := no
ifneq (,$(filter native-tools,$(TMP_BUILD_OPTS)))
TRY_TARGET_BUILD := yes
endif
DEB_MAKE_INVOKE := $(MAKE) $(PARALLEL_MAKEFLAGS)
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 libqt4-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
DEB_DH_SHLIBDEPS_ARGS_ALL := --exclude=.debug -Xusr/bin/host-
# Only present in official source package
#DEB_INSTALL_CHANGELOGS_ALL := changes-$(QTVERSION)
QT_MAEMO_TESTDIR := debian/tests
export QMAKEFEATURES=$(CURDIR)/debian/tests
export QMAKE_INVOKE=$(CURDIR)/bin/qmake
export QMAKE_BUILD_ROOT=$(CURDIR)
#Test packages that will run using -style option
QT_AUTOTESTS_GUI_STYLE := "libqt4-gui-tests"
# Select OpenGL backend driver
# Enable multituch support
ifeq ($(DEB_HOST_ARCH),arm)
CONFIG_ARCH_OPT = armv6
else
ifeq ($(DEB_HOST_ARCH),armel)
CONFIG_ARCH_OPT = armv6
else
CONFIG_ARCH_OPT = i386
endif
endif
EXTRA_CONFIGURE_OPTS += -DQT_QLOCALE_USES_FCVT -DQT_EXPERIMENTAL_CLIENT_DECORATIONS -DQT_MEEGO_EXPERIMENTAL_SHADERCACHE -DQT_MEEGO_EXPERIMENTAL_SHADERCACHE_TRACE
# Check if running inside scratchbox, and that host-gcc works
IN_SBOX = $(shell if [ -f /targets/links/scratchbox.config ]; then echo yes; else echo no; fi)
HOST_GCC_WORKS = $(shell if host-gcc --version > /dev/null; then echo yes; else echo no; fi)
TARGET_BUILD = no
ifeq ($(TRY_TARGET_BUILD),yes)
ifeq ($(IN_SBOX),yes)
ifeq ($(HOST_GCC_WORKS),yes)
TARGET_BUILD = yes
endif
endif
# Except don't use host-gcc if building for i386
ifeq ($(DEB_HOST_ARCH),i386)
TARGET_BUILD = no
endif
endif
TARGET_PLATFORM = linux-g++-maemo
HOST_PLATFORM = unsupported/linux-host-g++
PLATFORM_FLAG = -platform $(TARGET_PLATFORM)
FORCE_PKG_CONFIG_FLAG =
HOST_EXLUDES =
ifeq ($(TARGET_BUILD),yes)
PLATFORM_FLAG = -platform $(HOST_PLATFORM) \
-xplatform $(TARGET_PLATFORM)
FORCE_PKG_CONFIG_FLAG = -force-pkg-config
HOST_EXCLUDES := usr/bin/host- usr/bin/qmake
endif
DEB_STRIP_EXCLUDE := $(HOST_EXCLUDES)
# Determine target architecture
ifeq ($(DEB_HOST_ARCH_OS),linux)
ifeq ($(CONFIG_ARCH_OPT),armv6)
GL_BACKEND=es2
EXTRA_CONFIGURE_OPTS += -graphicssystem runtime \
-runtimegraphicssystem meego
CONFIG_BUILD_OPT = -release
else
GL_BACKEND=desktop
CONFIG_BUILD_OPT = -debug
endif
else
TARGET_PLATFORM = glibc-g++
endif
#If noopt is selected, force -debug and some compilation flags
ifeq ($(BUILD_NOOPT),yes)
CONFIG_BUILD_OPT = -debug
CFLAGS = -g
CXXFLAGS = -g
export CFLAGS
export CXXFLAGS
endif
MAKE_DOCS := -make docs
DOCS_EXCLUDE :=
ifeq ($(BUILD_DOCS),no)
MAKE_DOCS := -nomake docs
endif
common-build-arch:: debian/stamp-makefile-build-tools
debian/stamp-makefile-build-tools: debian/stamp-makefile-build
$(DEB_MAKE_INVOKE) sub-tools
touch $@
common-configure-arch:: config.status
config.status:
# 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 -opensource \
-confirm-license \
$(CONFIG_BUILD_OPT) \
-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" \
-importdir "/usr/lib/qt4/imports" \
-translationdir "/usr/share/qt4/translations" \
-sysconfdir "/etc/xdg" \
$(PLATFORM_FLAG) \
$(FORCE_PKG_CONFIG_FLAG) \
-arch $(CONFIG_ARCH_OPT) \
-fast \
-no-optimized-qmake \
-reduce-relocations \
-no-separate-debug-info \
-no-rpath \
-system-zlib \
-system-libtiff \
-system-libpng \
-system-libjpeg \
-no-nas-sound \
-qt-gif \
-no-qt3support \
-no-libmng \
-opengl $(GL_BACKEND) \
-accessibility \
-make tools \
$(MAKE_DOCS) \
-nomake examples \
-nomake demos \
-little-endian \
-no-cups \
-no-gtkstyle \
-exceptions \
-no-xinerama \
-no-xcursor \
-dbus-linked \
-glib \
-no-pch \
-gstreamer \
-svg \
-no-webkit \
-no-sql-ibase \
-xmlpatterns \
-system-sqlite \
-plugin-sql-sqlite \
-openssl \
-phonon \
-xinput2 \
-icu \
$(EXTRA_CONFIGURE_OPTS)
BINARY_NAMES := qmake moc lrelease rcc uic
HOST_BINARIES := $(addprefix $(CURDIR)/bin/, $(addprefix host-, $(BINARY_NAMES)))
# host-prefixed binaries are to be copied anyway regardless of the platform
common-build-arch:: $(HOST_BINARIES) debian/stamp-makefile-build-target-binaries
$(HOST_BINARIES):
cp "$(subst host-,,$@)" "$@"
if [ -n "$(HOST_EXCLUDES)" ]; then host-strip --strip-all "$@"; fi
debian/stamp-makefile-build-target-binaries: $(HOST_BINARIES)
# Build target-platform tools when cross-compiling
# First make sure qdoc3 is built
if [ "x$(BUILD_DOCS)" = "xyes" ]; then $(DEB_MAKE_INVOKE) -C tools/qdoc3; fi
# Keep qmake as is while building the rest, build into native-qmake
(cd qmake && $(DEB_MAKE_INVOKE) clean && $(QMAKE_INVOKE) -spec "$(CURDIR)/mkspecs/$(TARGET_PLATFORM)" && $(DEB_MAKE_INVOKE) "TARGET=$(QTDIR)/bin/native-qmake")
# bootstrap needs to be first
for dir in src/tools/bootstrap src/tools/moc tools/linguist/lrelease src/tools/rcc src/tools/uic; do \
(cd "$$dir" && $(DEB_MAKE_INVOKE) clean && $(QMAKE_INVOKE) -spec "$(CURDIR)/mkspecs/$(TARGET_PLATFORM)" && $(DEB_MAKE_INVOKE)) \
done
#Use the host binaries for the rest of the Qt build
for binary in moc rcc uic lrelease; do \
mv "$(CURDIR)/bin/$$binary" "$(CURDIR)/bin/native-$$binary" ; \
cp "$(CURDIR)/bin/host-$$binary" "$(CURDIR)/bin/$$binary"; \
done
touch $@
#Build the auto tests
TEST_PACKAGES := $(filter %-tests, $(DEB_PACKAGES))
common-build-arch:: $(addprefix debian/stamp-makefile-build-autotest-,$(TEST_PACKAGES))
BUILD_TEST_PACKAGE_NAME = $(subst debian/stamp-makefile-build-autotest-,,$@)
BUILD_TEST_DIR = build_tests/$(BUILD_TEST_PACKAGE_NAME)
$(addprefix debian/stamp-makefile-build-autotest-,$(TEST_PACKAGES)) :
rm -f tests/auto/$(BUILD_TEST_PACKAGE_NAME).pro
cp debian/tests/$(BUILD_TEST_PACKAGE_NAME).pro tests/auto
mkdir -p $(BUILD_TEST_DIR)
cd $(BUILD_TEST_DIR) && $(QMAKE_INVOKE) -recursive $(CURDIR)/tests/auto/$(BUILD_TEST_PACKAGE_NAME).pro CONFIG+=maemo_tests
$(DEB_MAKE_INVOKE) -C $(BUILD_TEST_DIR)
touch $@
clean::
# Extra stuff missed by confclean/distclean
# Misc. files
rm -f \
config.status \
config.tests/.qmake.cache \
.qmake.cache \
examples/dbus/*/Makefile.* \
mkspecs/qconfig.pri \
src/corelib/global/qconfig.* \
src/tools/uic/qclass_lib_map.h \
lib/*.so.* \
lib/*.la \
tests/auto/libqt4-gui-tests.pri \
tests/auto/maemo-auto.pro \
tests/auto/qt4-acceptance-tests.pri \
tests/auto/qt4-maemo-auto-tests.pri \
;
# Misc. directories
rm -rf \
examples/tools/plugandpaint/plugins/ \
examples/tools/styleplugin/styles/ \
mkspecs/glibc-g++/ \
plugins/ \
include/ \
doc-build/ \
doc/html/ \
doc/qch/ \
;
# 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 except those in .git
find \( -false \
-o \( -name \*.a -a ! -path \*/tests/auto/qdir/types/\*.a \) \
-o -name Makefile.Debug \
-o -name Makefile.Release \
-o -name \*.o \
-o -name \*.prl \
-o \( -name \*.so -a ! -path \*/tests/auto/qlibrary/library_path/invalid.so \) \
-o -name \*.so.debug \
-o -type l \
\! -path ./.git/\* \
\) -print0 | xargs -0 rm -rf
# 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/\* \
! -path $(CURDIR)/src/3rdparty/ptmalloc/Makefile \
! -path $(CURDIR)/util/gencmap/Makefile \
-print0 | xargs -0 rm -rf
# Any remaining executables
find $(CURDIR) -type f -perm +111 -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
rm -f debian/stamp-makefile-build-docs
rm -f debian/stamp-makefile-build-target-binaries
rm -f $(addprefix debian/stamp-makefile-build-autotest-,$(TEST_PACKAGES))
rm -f $(addprefix debian/,$(addsuffix .install, $(TEST_PACKAGES)))
rm -f $(addprefix tests/auto/,$(addsuffix .pro, $(TEST_PACKAGES)))
rm -rf build_tests/
common-install-arch::
mkdir -p $(DEB_DESTDIR)/usr/share/qt4/translations/
cp $(CURDIR)/translations/*.ts $(DEB_DESTDIR)/usr/share/qt4/translations/.
find $(DEB_DESTDIR)/usr/share/qt4/translations/ -type f -name "*.ts" | xargs $(CURDIR)/bin/lrelease
rm -rf $(DEB_DESTDIR)/usr/share/qt4/translations/*.ts
# 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 perl -pi -e "s, -L$(CURDIR)/\S+,,g" {} \;
find $(DEB_DESTDIR)/usr/lib -type f -name '*.prl' \
-exec sed -i -e "/^QMAKE_PRL_BUILD_DIR/d;s/\(QMAKE_PRL_LIBS =\).*/\1/" {} \;
install/qt4-declarative-qmlviewer::
install -p -D "debian/QMLViewer.desktop" "$(DEB_DESTDIR)/usr/share/applications/QMLViewer.desktop"
install -p -D "debian/QMLViewer.png" "$(DEB_DESTDIR)/usr/share/icons/hicolor/64x64/apps/QMLViewer.png"
$(patsubst %,install/%,$(TEST_PACKAGES)) :: install/%:
rm -f debian/$(cdbs_curpkg).install
$(DEB_MAKE_INVOKE) -C build_tests/$(cdbs_curpkg) $(DEB_MAKE_INSTALL_TARGET)
$(DEB_MAKE_INVOKE) -C build_tests/$(cdbs_curpkg) QTM_TEST_INSTALL_FILE=$(CURDIR)/debian/$(cdbs_curpkg).install installtests
if [ -z "$(findstring $(cdbs_curpkg),$(QT_AUTOTESTS_GUI_STYLE))" ]; then \
$(QT_MAEMO_TESTDIR)/create_tests_xml -t $(QT_MAEMO_TESTDIR) \
-i $(DEB_DESTDIR) -p $(CURDIR)/debian/$(cdbs_curpkg).install ;\
else \
$(QT_MAEMO_TESTDIR)/create_tests_xml -t $(QT_MAEMO_TESTDIR) -c "-style plastique" \
-i $(DEB_DESTDIR) -p $(CURDIR)/debian/$(cdbs_curpkg).install ;\
fi
common-install-arch::
find "$(CURDIR)/bin" -name "host-*" -exec install -p -D {} "$(DEB_DESTDIR)/usr/bin" \;
find "$(CURDIR)/bin" -name "native-*" -exec install -p -D {} "$(DEB_DESTDIR)/usr/bin" \;
install/libqt4-doc::
mkdir -p "$(DEB_DESTDIR)/usr/share/qt4/doc/html/"
if [ "x$(BUILD_DOCS)" = "xno" ]; then touch "$(DEB_DESTDIR)/usr/share/qt4/doc/html/BUILT_WITH_NODOCS"; fi
common-build-indep:: debian/stamp-makefile-build-docs
debian/stamp-makefile-build-docs:
if [ "x$(BUILD_DOCS)" = "xyes" ]; then $(DEB_MAKE_INVOKE) docs; fi
touch $@
binary-predeb/libqt4-dev::
sed -i -e 's/#PLATFORM_ARG#/$(TARGET_PLATFORM)/g' debian/$(cdbs_curpkg)/DEBIAN/postinst
# 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
|