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