qt4: heavily cleanup Makefile and add a generic way for configuring projects using...
[openwrt/svn-archive/archive.git] / Xorg / lib / qt4 / Makefile
1 #
2 # Copyright (C) 2008-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 # TODO:
9 # - test/add X11/xcb support
10 # - handle plugins in a granular way (find out which packages should provide which plugins)
11
12 include $(TOPDIR)/rules.mk
13
14 PKG_NAME:=qt4
15 PKG_VERSION:=4.7.0-beta2
16 PKG_RELEASE:=1
17
18 PKG_SOURCE:=qt-everywhere-opensource-src-$(PKG_VERSION).tar.gz
19 PKG_SOURCE_URL:=ftp://ftp.qt.nokia.com/qt/source
20 PKG_BUILD_DIR=$(BUILD_DIR)/qt-everywhere-opensource-src-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 # this should be moved to a more generic place later, as other packages are configured different as well depending on available nptl support
25 ifeq ($(CONFIG_USE_GLIBC),y)
26 NPTL:=y
27 endif
28 ifeq ($(CONFIG_USE_EGLIBC),y)
29 NPTL:=y
30 endif
31 ifeq ($(CONFIG_UCLIBC_VERSION_0_9_32),y)
32 NPTL:=y
33 endif
34
35 define Package/qt4/Default
36 SECTION:=xorg-framework
37 CATEGORY:=Xorg
38 SUBMENU:=framework
39 TITLE:=qt4
40 DEPENDS:=qt4
41 URL:=http://qt.nokia.com/
42 endef
43
44 define Package/qt4
45 $(call Package/qt4/Default)
46 DEPENDS:=@FEATURE_drawing-backend_DirectFB +FEATURE_drawing-backend_DirectFB:directfb +zlib +libstdcpp +libsqlite3 +tslib # require directfb for now, as other systems (libX11, xcb) are untested
47 endef
48
49 define Package/qt4-gui
50 $(call Package/qt4/Default)
51 #DEPENDS+=+FEATURE_drawing-backend_DirectFB:directfb +libpng +libtiff +libjpeg +libfreetype
52 DEPENDS+=+libpng +libtiff +libjpeg +libfreetype +qt4-network
53 TITLE+=(gui)
54 endef
55
56 define Package/qt4-demos
57 $(call Package/qt4/Default)
58 TITLE+=(demos)
59 DEPENDS+=+qt4-gui
60 endef
61
62 define Package/qt4-examples
63 $(call Package/qt4/Default)
64 TITLE+=(examples)
65 DEPENDS+=+qt4-gui
66 endef
67
68 define Package/qt4-network
69 $(call Package/qt4/Default)
70 TITLE+=(network)
71 endef
72
73 define Package/qt4-sqlite
74 $(call Package/qt4/Default)
75 TITLE+=(sqlite)
76 DEPENDS+=+libsqlite3
77 endef
78
79 define Package/qt4-mysql
80 $(call Package/qt4/Default)
81 TITLE+=(mysql)
82 DEPENDS+=+libmysqlclient
83 endef
84
85 #define Package/qt4-multimedia
86 # $(call Package/qt4/Default)
87 # TITLE+=(multimedia)
88 #endef
89
90 #define Package/qt4-audio-backend
91 # $(call Package/qt4/Default)
92 # TITLE+=(audio-backend)
93 #endef
94
95 define Package/qt4-phonon
96 $(call Package/qt4/Default)
97 TITLE+=(phonon)
98 DEPENDS+=+qt4-gui +qt4-xml +qt4-dbus +qt4-network
99 endef
100
101 #define Package/qt4-phonon-backend
102 # $(call Package/qt4/Default)
103 # TITLE+=(phonon-backend)
104 #endef
105
106 define Package/qt4-svg
107 $(call Package/qt4/Default)
108 TITLE+=(svg)
109 #DEPENDS+=+qt4-gui @BROKEN
110 DEPENDS+=+qt4-gui +qt4-network
111 endef
112
113 define Package/qt4-webkit
114 $(call Package/qt4/Default)
115 TITLE+=(webkit)
116 DEPENDS+=@USE_GLIBC||@USE_EGLIBC||@UCLIBC_VERSION_0_9_32 +libsqlite3 +qt4-phonon +qt4-dbus +qt4-xml +qt4-gui +qt4-network # versions of uclibc prior 0.9.32 do not have nptl support
117 endef
118
119 define Package/qt4-script
120 $(call Package/qt4/Default)
121 TITLE+=(script)
122 DEPENDS+=@USE_GLIBC||@USE_EGLIBC||@UCLIBC_VERSION_0_9_32 # versions of uclibc prior 0.9.32 do not have nptl support
123 endef
124
125 define Package/qt4-scripttools
126 $(call Package/qt4/Default)
127 TITLE+=(scripttools)
128 DEPENDS+=+qt4-script +qt4-gui +qt4-network
129 endef
130
131 #define Package/qt4-accessibility
132 # $(call Package/qt4/Default)
133 # TITLE+=(accessibility)
134 #endef
135
136 #define Package/qt4-javascript-jit
137 # $(call Package/qt4/Default)
138 # TITLE+=(javascript-jit)
139 #endef
140
141 #define Package/qt4-cups
142 # $(call Package/qt4/Default)
143 # TITLE+=(cups)
144 #endef
145
146 define Package/qt4-dbus
147 $(call Package/qt4/Default)
148 TITLE+=(dbus)
149 DEPENDS+=+libdbus +qt4-xml
150 endef
151
152 #define Package/qt4-gtkstyle
153 # $(call Package/qt4/Default)
154 # TITLE+=(gtkstyle)
155 #endef
156
157 #define Package/qt4-glib
158 # $(call Package/qt4/Default)
159 # TITLE+=(glib)
160 #endef
161
162 define Package/qt4-qt3support
163 $(call Package/qt4/Default)
164 TITLE+=(qt3support)
165 DEPENDS+=+qt4-gui +qt4-xml
166 endef
167
168 define Package/qt4-declarative
169 $(call Package/qt4/Default)
170 TITLE+=(declarative)
171 DEPENDS+=+qt4-script +qt4-xml +qt4-gui +qt4-network
172 endef
173
174 define Package/qt4-xml
175 $(call Package/qt4/Default)
176 TITLE+=(xml)
177 endef
178
179 TARGET_INCDIRS+=$(STAGING_DIR)/include $(STAGING_DIR)/usr/include $(TOOLCHAIN_DIR)/include $(TOOLCHAIN_DIR)/usr/include
180 TARGET_LIBDIRS+=$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib $(TOOLCHAIN_DIR)/lib $(TOOLCHAIN_DIR)/usr/lib
181 TARGET_LDFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib,-rpath-link=$(PKG_BUILD_DIR)/lib
182 TARGET_CFLAGS+=-I$(STAGING_DIR)/usr/include/freetype2 -I$(PKG_BUILD_DIR)/include
183
184 define Build/Configure
185 # NOTES:
186 # demos/examples: which demos are going to be built depends on which features are going to to be compiled into qt
187 # svg: always compile in svg-support, as once qt is built without, strange include errors occur when we're going to compile qt4-svg afterwards
188 # linuxfb/directfb: since directfb is not much overhead compared to plain framebuffer, force using directfb
189 # do not use fontconfig as it doesn't work anyway for qte
190 # bindir: bindir is where the host tools (qmake, moc, rcc, uic) will get installed into - they are just used on the host and not goig to be packaged
191 mkdir -p $(PKG_BUILD_DIR)/mkspecs/qws/linux-openwrt-g++
192 cp -a ./files/{qmake.conf,qplatformdefs.h} $(PKG_BUILD_DIR)/mkspecs/qws/linux-openwrt-g++/
193 ( cd $(PKG_BUILD_DIR) ; \
194 TARGET_CC="$(TARGET_CROSS)gcc" \
195 TARGET_CXX="$(TARGET_CROSS)g++" \
196 TARGET_AR="$(TARGET_CROSS)ar cqs" \
197 TARGET_OBJCOPY="$(TARGET_CROSS)objcopy" \
198 TARGET_RANLIB="$(TARGET_CROSS)ranlib" \
199 TARGET_CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
200 TARGET_CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
201 TARGET_LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
202 TARGET_INCDIRS="$(TARGET_INCDIRS)" \
203 TARGET_LIBDIRS="$(TARGET_LIBDIRS)" \
204 STAGING_DIR="$(STAGING_DIR)" \
205 STAGING_DIR_HOST="$(STAGING_DIR)/../host" \
206 ./configure \
207 -prefix $(CONFIGURE_PREFIX) \
208 -bindir $(CONFIGURE_PREFIX)/bin \
209 -libdir $(CONFIGURE_PREFIX)/lib \
210 -datadir $(CONFIGURE_PREFIX)/share/Qt \
211 -plugindir $(CONFIGURE_PREFIX)/lib/Qt/plugins \
212 -demosdir $(CONFIGURE_PREFIX)/share/Qt/demos \
213 -examplesdir $(CONFIGURE_PREFIX)/share/Qt/examples \
214 -sysconfdir /etc/Qt \
215 -no-rpath \
216 -force-pkg-config \
217 -nomake tools \
218 -make demos \
219 -make examples \
220 -nomake docs \
221 -nomake translations \
222 -xplatform qws/linux-openwrt-g++ \
223 -platform linux-g++ \
224 -embedded \
225 -release \
226 -confirm-license \
227 -opensource \
228 -no-mmx \
229 -no-3dnow \
230 -no-sse \
231 -no-sse2 \
232 -system-zlib \
233 -system-libtiff \
234 -system-libpng \
235 -system-libjpeg \
236 -system-freetype \
237 -system-sqlite \
238 -plugin-sql-sqlite \
239 -plugin-sql-mysql \
240 -no-decoration-styled \
241 -no-decoration-windows \
242 -no-decoration-default \
243 -verbose \
244 -no-multimedia \
245 -no-audio-backend \
246 -phonon \
247 -no-phonon-backend \
248 -svg \
249 -$(if $(NPTL),webkit,-no-webkit) \
250 -no-javascript-jit \
251 -$(if $(NPTL),script,-no-script) \
252 -$(if $(NPTL),scripttools,-no-scripttools) \
253 -no-accessibility \
254 -$(if $(NPTL),declarative,-no-declarative) \
255 -no-openssl \
256 -no-nis \
257 -no-cups \
258 -no-iconv \
259 -dbus \
260 -no-gtkstyle \
261 -no-nas-sound \
262 -no-opengl \
263 -no-openvg \
264 -no-sm \
265 -no-xshape \
266 -no-xsync \
267 -no-xinerama \
268 -no-xcursor \
269 -no-xfixes \
270 -no-xrandr \
271 -no-xrender \
272 -no-mitshm \
273 -no-fontconfig \
274 -no-xinput \
275 -no-xkb \
276 -no-glib \
277 -qt3support \
278 -no-gfx-transformed \
279 -no-gfx-qvfb \
280 -no-gfx-vnc \
281 -no-gfx-multiscreen \
282 -no-gfx-qnx \
283 -plugin-gfx-directfb \
284 -plugin-gfx-linuxfb \
285 -no-mouse-qvfb \
286 -no-mouse-qnx \
287 -qt-mouse-linuxinput \
288 -plugin-mouse-linuxtp \
289 -plugin-mouse-pc \
290 -plugin-mouse-tslib \
291 -no-kbd-qvfb \
292 -no-kbd-qnx \
293 -qt-kbd-tty \
294 -plugin-kbd-linuxinput \
295 )
296 endef
297
298 define Build/Compile
299 # just passing <make install> results in not building 3rdparty/webkit/JavaScriptCore
300 # unfortunately in this particular case, <make> makes further <qmake> calls, therewith
301 # uses the qmake.conf which needs get the cross-compiling vars passed once again
302 TARGET_CC="$(TARGET_CROSS)gcc" \
303 TARGET_CXX="$(TARGET_CROSS)g++" \
304 TARGET_AR="$(TARGET_CROSS)ar cqs" \
305 TARGET_OBJCOPY="$(TARGET_CROSS)objcopy" \
306 TARGET_RANLIB="$(TARGET_CROSS)ranlib" \
307 TARGET_CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
308 TARGET_CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
309 TARGET_LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
310 TARGET_INCDIRS="$(TARGET_INCDIRS)" \
311 TARGET_LIBDIRS="$(TARGET_LIBDIRS)" \
312 STAGING_DIR="$(STAGING_DIR)" \
313 STAGING_DIR_HOST="$(STAGING_DIR)/../host" \
314 $(MAKE) -C $(PKG_BUILD_DIR)
315 INSTALL_ROOT=$(PKG_INSTALL_DIR) \
316 $(MAKE) -C $(PKG_BUILD_DIR) install
317 endef
318
319 define Build/InstallDev
320 $(INSTALL_DIR) \
321 $(STAGING_DIR_HOST)/bin
322
323 # host tools (qmake, moc, rcc, uic)
324 $(CP) \
325 $(PKG_INSTALL_DIR)/usr/bin/{qmake,moc,rcc,uic} \
326 $(STAGING_DIR_HOST)/bin/
327
328 $(INSTALL_DIR) \
329 $(1)/mk \
330 $(1)/usr/share/mkspecs \
331 $(1)/usr/lib/pkgconfig \
332 $(1)/usr/lib \
333 $(1)/usr/include \
334 $(1)/usr/lib/Qt/plugins
335
336 $(CP) \
337 ./files/qmake.mk \
338 $(1)/mk/
339
340 $(CP) \
341 $(PKG_INSTALL_DIR)/usr/share/Qt/mkspecs/* \
342 $(1)/usr/share/mkspecs/
343
344 $(INSTALL_DATA) \
345 $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
346 $(1)/usr/lib/pkgconfig/
347
348 $(CP) \
349 $(PKG_INSTALL_DIR)/usr/include/* \
350 $(1)/usr/include/
351
352 $(CP) \
353 $(PKG_INSTALL_DIR)/usr/lib/*.so* \
354 $(1)/usr/lib/
355
356 #$(CP) \
357 # $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/* \
358 # $(1)/usr/lib/Qt/plugins/
359 endef
360
361 define Package/qt4/install
362 $(INSTALL_DIR) \
363 $(1)/usr/lib \
364 $(1)/usr/lib/Qt/plugins
365
366 $(CP) \
367 $(PKG_INSTALL_DIR)/usr/lib/libQtCore.so* \
368 $(1)/usr/lib/
369
370 #$(CP) \
371 # $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/codecs/*.so \
372 # $(1)/usr/lib/Qt/plugins/codecs/
373 endef
374
375 define Package/qt4-gui/install
376 $(INSTALL_DIR) \
377 $(1)/usr/lib \
378 $(1)/usr/lib/Qt/plugins
379
380 $(CP) \
381 $(PKG_INSTALL_DIR)/usr/lib/libQtGui.so* \
382 $(1)/usr/lib/
383
384 #HACK: Qt4 requires having truetype fonts stored in /usr/lib/fonts - no subdirectories allowed, so use the dejavue set by default
385 ln -s \
386 /usr/share/fonts/ttf-dejavu \
387 $(1)/usr/lib/fonts
388
389 # we use the dejavue font package instead
390 #$(INSTALL_DATA) \
391 # $(PKG_INSTALL_DIR)/usr/lib/fonts/*.ttf \
392 # $(1)/usr/lib/fonts/
393
394 #$(CP) \
395 # $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/accessible \
396 # $(1)/usr/lib/Qt/plugins/
397
398 #$(CP) \
399 # $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/imageformats \
400 # $(1)/usr/lib/Qt/plugins/
401
402 #$(CP) \
403 # $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/inputmethods \
404 # $(1)/usr/lib/Qt/plugins/
405 endef
406
407 define Package/qt4-demos/install
408 $(INSTALL_DIR) \
409 $(1)/usr/share/Qt
410
411 $(CP) \
412 $(PKG_INSTALL_DIR)/usr/share/Qt/demos \
413 $(1)/usr/share/Qt/
414
415 $(FIND) \
416 $(1) \
417 -name "*.cpp" -o \
418 -name "*.h" -o \
419 -name "*.pro" \
420 | $(XARGS) rm
421 endef
422
423 define Package/qt4-examples/install
424 $(INSTALL_DIR) \
425 $(1)/usr/share/Qt
426
427 $(CP) \
428 $(PKG_INSTALL_DIR)/usr/share/Qt/examples \
429 $(1)/usr/share/Qt/
430
431 $(FIND) \
432 $(1) \
433 -name "*.cpp" -o \
434 -name "*.h" -o \
435 -name "*.pro" \
436 | $(XARGS) rm
437 endef
438
439 define Package/qt4-network/install
440 $(INSTALL_DIR) \
441 $(1)/usr/lib
442
443 $(CP) \
444 $(PKG_INSTALL_DIR)/usr/lib/libQtNetwork.so* \
445 $(1)/usr/lib/
446 endef
447
448 define Package/qt4-sqlite/install
449 $(INSTALL_DIR) \
450 $(1)/usr/lib/Qt/plugins/sqldrivers
451
452 $(CP) \
453 $(PKG_INSTALL_DIR)/usr/lib/libQtSql.so* \
454 $(1)/usr/lib/
455
456 $(CP) \
457 $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/sqldrivers/libqsqlite.so \
458 $(1)/usr/lib/Qt/plugins/sqldrivers/
459 endef
460
461 define Package/qt4-mysql/install
462 $(INSTALL_DIR) \
463 $(1)/usr/lib/Qt/plugins/sqldrivers
464
465 $(CP) \
466 $(PKG_INSTALL_DIR)/usr/lib/libQtSql.so* \
467 $(1)/usr/lib/
468
469 $(CP) \
470 $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/sqldrivers/libqsqlmysql.so \
471 $(1)/usr/lib/Qt/plugins/sqldrivers/
472 endef
473
474 #define Package/qt4-multimedia/install
475 # $(INSTALL_DIR) \
476 # $(1)/usr/bin
477 #
478 # $(CP) \
479 # $(PKG_INSTALL_DIR)/usr/bin/examples/* \
480 # $(1)/usr/bin/
481 #endef
482
483 define Package/qt4-phonon/install
484 $(INSTALL_DIR) \
485 $(1)/usr/lib
486
487 $(CP) \
488 $(PKG_INSTALL_DIR)/usr/lib/libphonon.so* \
489 $(1)/usr/lib/
490 endef
491
492 define Package/qt4-svg/install
493 $(INSTALL_DIR) \
494 $(1)/usr/lib \
495 $(1)/usr/lib/Qt/plugins
496
497 $(CP) \
498 $(PKG_INSTALL_DIR)/usr/lib/libQtSvg.so* \
499 $(1)/usr/lib/
500
501 #$(CP) \
502 # $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/iconengines \
503 # $(1)/usr/lib/Qt/plugins/
504
505 #$(CP) \
506 # $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/imageformats \
507 # $(1)/usr/lib/Qt/plugins/
508 endef
509
510 define Package/qt4-webkit/install
511 $(INSTALL_DIR) \
512 $(1)/usr/lib \
513 $(1)/usr/lib/Qt/plugins
514
515 $(CP) \
516 $(PKG_INSTALL_DIR)/usr/lib/libQtWebKit.so* \
517 $(1)/usr/lib/
518
519 #$(CP) \
520 # $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/designer \
521 # $(1)/usr/lib/Qt/plugins/
522 endef
523
524 define Package/qt4-script/install
525 $(INSTALL_DIR) \
526 $(1)/usr/lib \
527 $(1)/usr/lib/Qt/plugins
528
529 $(CP) \
530 $(PKG_INSTALL_DIR)/usr/lib/libQtScript.so* \
531 $(1)/usr/lib/
532
533 #$(CP) \
534 # $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/script \
535 # $(1)/usr/lib/Qt/plugins/
536 endef
537
538 define Package/qt4-scripttools/install
539 $(INSTALL_DIR) \
540 $(1)/usr/lib
541
542 $(CP) \
543 $(PKG_INSTALL_DIR)/usr/lib/libQtScriptTools.so* \
544 $(1)/usr/lib/
545 endef
546
547 define Package/qt4-dbus/install
548 $(INSTALL_DIR) \
549 $(1)/usr/lib
550
551 $(CP) \
552 $(PKG_INSTALL_DIR)/usr/lib/libQtDBus.so* \
553 $(1)/usr/lib/
554
555 #$(CP) \
556 # $(PKG_INSTALL_DIR)/usr/bin/qdbus \
557 # $(1)/usr/bin/
558 endef
559
560 define Package/qt4-qt3-support/install
561 $(INSTALL_DIR) \
562 $(1)/usr/lib \
563 $(1)/usr/lib/Qt/plugins
564
565 $(CP) \
566 $(PKG_INSTALL_DIR)/usr/lib/libQt3Support.so* \
567 $(1)/usr/lib/
568
569 #$(CP) \
570 # $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/accessible \
571 # $(1)/usr/lib/Qt/plugins/
572 endef
573
574 define Package/qt4-declarative/install
575 $(INSTALL_DIR) \
576 $(1)/usr/lib
577
578 $(CP) \
579 $(PKG_INSTALL_DIR)/usr/lib/libQtDeclarative.so* \
580 $(1)/usr/lib/
581 endef
582
583 define Package/qt4-xml/install
584 $(INSTALL_DIR) \
585 $(1)/usr/lib
586
587 $(CP) \
588 $(PKG_INSTALL_DIR)/usr/lib/libQtXml.so* \
589 $(1)/usr/lib/
590 endef
591
592
593 $(eval $(call BuildPackage,qt4))
594 $(eval $(call BuildPackage,qt4-gui))
595 $(eval $(call BuildPackage,qt4-demos))
596 $(eval $(call BuildPackage,qt4-examples))
597 $(eval $(call BuildPackage,qt4-network))
598 $(eval $(call BuildPackage,qt4-sqlite))
599 $(eval $(call BuildPackage,qt4-mysql))
600 #$(eval $(call BuildPackage,qt4-multimedia))
601 #$(eval $(call BuildPackage,qt4-audio-backend))
602 $(eval $(call BuildPackage,qt4-phonon))
603 #$(eval $(call BuildPackage,qt4-phonon-backend))
604 $(eval $(call BuildPackage,qt4-svg))
605 $(eval $(call BuildPackage,qt4-webkit))
606 $(eval $(call BuildPackage,qt4-script))
607 $(eval $(call BuildPackage,qt4-scripttools))
608 #$(eval $(call BuildPackage,qt4-accessibility))
609 #$(eval $(call BuildPackage,qt4-javascript-jit))
610 #$(eval $(call BuildPackage,qt4-cups))
611 $(eval $(call BuildPackage,qt4-dbus))
612 #$(eval $(call BuildPackage,qt4-gtkstyle))
613 #$(eval $(call BuildPackage,qt4-glib))
614 $(eval $(call BuildPackage,qt4-qt3support))
615 $(eval $(call BuildPackage,qt4-declarative))
616 $(eval $(call BuildPackage,qt4-xml))