enable linux framebuffer support for Qt
[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.6.2
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-multimedia
65 #  $(call Package/qt4/Default)
66 #  TITLE+=(multimedia)
67 #endef
68
69 #define Package/qt4-audio-backend
70 #  $(call Package/qt4/Default)
71 #  TITLE+=(audio-backend)
72 #endef
73
74 define Package/qt4-phonon
75   $(call Package/qt4/Default)
76   TITLE+=(phonon)
77   DEPENDS+=+qt4-gui
78 endef
79
80 #define Package/qt4-phonon-backend
81 #  $(call Package/qt4/Default)
82 #  TITLE+=(phonon-backend)
83 #endef
84
85 define Package/qt4-svg
86   $(call Package/qt4/Default)
87   TITLE+=(svg)
88   #DEPENDS+=+qt4-gui @BROKEN
89   DEPENDS+=+qt4-gui
90 endef
91
92 define Package/qt4-webkit
93   $(call Package/qt4/Default)
94   TITLE+=(webkit)
95   DEPENDS+=@USE_GLIBC||@USE_EGLIBC # until we do not have nptl-support within uclibc javascriptcore will fail to link against uclibc
96 endef
97
98 define Package/qt4-script
99   $(call Package/qt4/Default)
100   TITLE+=(script)
101   DEPENDS+=@USE_GLIBC||@USE_EGLIBC # until we do not have nptl-support within uclibc, javascriptcore will fail to link against uclibc
102 endef
103
104 define Package/qt4-scripttools
105   $(call Package/qt4/Default)
106   TITLE+=(scripttools)
107   DEPENDS+=+qt4-script
108 endef
109
110 #define Package/qt4-accessibility
111 #  $(call Package/qt4/Default)
112 #  TITLE+=(accessibility)
113 #endef
114
115 #define Package/qt4-javascript-jit
116 #  $(call Package/qt4/Default)
117 #  TITLE+=(javascript-jit)
118 #endef
119
120 #define Package/qt4-cups
121 #  $(call Package/qt4/Default)
122 #  TITLE+=(cups)
123 #endef
124
125 define Package/qt4-dbus
126   $(call Package/qt4/Default)
127   TITLE+=(dbus)
128   DEPENDS+=+libdbus
129 endef
130
131 #define Package/qt4-gtkstyle
132 #  $(call Package/qt4/Default)
133 #  TITLE+=(gtkstyle)
134 #endef
135
136 #define Package/qt4-glib
137 #  $(call Package/qt4/Default)
138 #  TITLE+=(glib)
139 #endef
140
141 define Package/qt4-qt3support
142   $(call Package/qt4/Default)
143   TITLE+=(qt3support)
144 endef
145
146 TARGET_CFLAGS+="-I$(STAGING_DIR)/usr/include/freetype2"
147
148 define Build/Configure
149         # demos/examples: which demos are going to be built depends on which features are going to to be compiled into qt
150         # 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
151         # linuxfb/directfb: since directfb is not much overhead compared to plain framebuffer, force using directfb
152         # do not use fontconfig as it doesn't work anyway for qte
153         ( \
154                 cd $(PKG_BUILD_DIR); \
155                 QPATH='mkspecs/qws/linux-openwrt-g++' ; \
156                 mkdir $$$$QPATH ; \
157                 echo '#include "../../linux-g++/qplatformdefs.h"' \
158                         >> $$$$QPATH/qplatformdefs.h ; \
159                 echo 'include(../../common/g++.conf)' \
160                         >> $$$$QPATH/qmake.conf ; \
161                 echo 'include(../../common/linux.conf)' \
162                         >> $$$$QPATH/qmake.conf ; \
163                 echo 'include(../../common/qws.conf)' \
164                         >> $$$$QPATH/qmake.conf ; \
165                 echo "QMAKE_CC                  = $(TARGET_CC)" \
166                         >> $$$$QPATH/qmake.conf ; \
167                 echo "QMAKE_CXX                 = $(TARGET_CXX)" \
168                         >> $$$$QPATH/qmake.conf ; \
169                 echo "QMAKE_AR                  = $(TARGET_CROSS)ar cqs" \
170                         >> $$$$QPATH/qmake.conf ; \
171                 echo "QMAKE_OBJCOPY             = $(TARGET_CROSS)objcopy" \
172                         >> $$$$QPATH/qmake.conf ; \
173                 echo "QMAKE_RANLIB              = $(TARGET_CROSS)ranlib" \
174                         >> $$$$QPATH/qmake.conf ; \
175                 echo "QMAKE_CFLAGS              = $(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
176                         >> $$$$QPATH/qmake.conf ; \
177                 echo "QMAKE_CXXFLAGS            = $(TARGET_CFLAGS) $(EXTRA_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CPPFLAGS)" \
178                         >> $$$$QPATH/qmake.conf ; \
179                 echo "QMAKE_LINK                = $(TARGET_CXX)" \
180                         >> $$$$QPATH/qmake.conf ; \
181                 echo "QMAKE_LINK_SHLIB          = $(TARGET_CXX)" \
182                         >> $$$$QPATH/qmake.conf ; \
183                 echo "QMAKE_LINK_C              = $(TARGET_CC)" \
184                         >> $$$$QPATH/qmake.conf ; \
185                 echo "QMAKE_LINK_C_SHLIB        = $(TARGET_CC)" \
186                         >> $$$$QPATH/qmake.conf ; \
187                 echo "QMAKE_LFLAGS              = -L$(PKG_BUILD_DIR)/lib $(TARGET_LDFLAGS) -Wl,-rpath-link=$(STAGING_DIR)/usr/lib" \
188                         >> $$$$QPATH/qmake.conf ; \
189                 echo "QMAKE_STRIP               = : " \
190                         >> $$$$QPATH/qmake.conf ; \
191                 echo "QMAKE_STRIPFLAGS_LIB      = " \
192                         >> $$$$QPATH/qmake.conf ; \
193                 echo 'load(qt_config)' \
194                         >> $$$$QPATH/qmake.conf ; \
195                 echo yes | ./configure \
196                         -prefix $(CONFIGURE_PREFIX) \
197                         -bindir $(CONFIGURE_PREFIX)/bin \
198                         -libdir $(CONFIGURE_PREFIX)/lib \
199                         -datadir $(CONFIGURE_PREFIX)/share/Qt \
200                         -plugindir $(CONFIGURE_PREFIX)/lib/Qt/plugins \
201                         -demosdir $(CONFIGURE_PREFIX)/share/Qt/demos \
202                         -examplesdir $(CONFIGURE_PREFIX)/share/Qt/examples \
203                         -sysconfdir /etc/Qt \
204                         -no-rpath \
205                         -force-pkg-config \
206                         -nomake tools \
207                         -$(if $(CONFIG_PACKAGE_qt4-demos),make demos,nomake demos) \
208                         -$(if $(CONFIG_PACKAGE_qt4-examples),make examples,nomake examples) \
209                         -nomake docs \
210                         -nomake translations \
211                         -embedded openwrt \
212                         -platform linux-g++ \
213                         -release \
214                         -opensource \
215                         -no-mmx \
216                         -no-3dnow \
217                         -no-sse \
218                         -no-sse2 \
219                         -system-zlib \
220                         -system-libtiff \
221                         -system-libpng \
222                         -system-libjpeg \
223                         -system-freetype \
224                         -system-sqlite \
225                         -no-decoration-styled \
226                         -no-decoration-windows \
227                         -no-decoration-default \
228                         -verbose \
229                         -$(if $(CONFIG_PACKAGE_qt4-multimedia),multimedia,no-multimedia) \
230                         -$(if $(CONFIG_PACKAGE_qt4-audio-backend),audio-backend,no-audio-backend) \
231                         -$(if $(CONFIG_PACKAGE_qt4-phonon),phonon,no-phonon) \
232                         -$(if $(CONFIG_PACKAGE_qt4-phonon-backend),phonon-backend,no-phonon-backend) \
233                         -svg \
234                         -$(if $(CONFIG_PACKAGE_qt4-webkit),webkit,no-webkit) \
235                         -$(if $(CONFIG_PACKAGE_qt4-javascript-jit),javascript-jit,no-javascript-jit) \
236                         -$(if $(CONFIG_PACKAGE_qt4-script),script,no-script) \
237                         -$(if $(CONFIG_PACKAGE_qt4-scripttools),scripttools,no-scripttools) \
238                         -$(if $(CONFIG_PACKAGE_qt4-accessibility),accessibility,no-accessibility) \
239                         -no-declarative \
240                         -no-openssl \
241                         -no-nis \
242                         -$(if $(CONFIG_PACKAGE_qt4-cups),cups,no-cups) \
243                         -no-iconv \
244                         -$(if $(CONFIG_PACKAGE_qt4-dbus),dbus,no-dbus) \
245                         -$(if $(CONFIG_PACKAGE_qt4-gtkstyle),gtkstyle,no-gtkstyle) \
246                         -no-nas-sound \
247                         -no-opengl \
248                         -no-openvg \
249                         -no-sm \
250                         -no-xshape \
251                         -no-xsync \
252                         -no-xinerama \
253                         -no-xcursor \
254                         -no-xfixes \
255                         -no-xrandr \
256                         -no-xrender \
257                         -no-mitshm \
258                         -no-fontconfig \
259                         -no-xinput \
260                         -no-xkb \
261                         -$(if $(CONFIG_PACKAGE_qt4-glib),glib,no-glib) \
262                         -$(if $(CONFIG_PACKAGE_qt4-qt3support),qt3support,no-qt3support) \
263                         -$(if $(CONFIG_FEATURE_drawing-backend_DirectFB),qt-gfx-directfb,) \
264                         -qt-gfx-linuxfb \
265                         -no-gfx-multiscreen \
266         )
267 endef
268
269 define Build/Compile
270         INSTALL_ROOT=$(PKG_INSTALL_DIR) \
271                 $(MAKE) -C $(PKG_BUILD_DIR) install
272 endef
273
274 define Build/InstallDev
275         $(INSTALL_DIR) \
276                 $(1)/usr/share/mkspecs \
277                 $(1)/usr/lib/pkgconfig \
278                 $(1)/usr/lib \
279                 $(1)/usr/include \
280                 $(1)/usr/lib/Qt/plugins
281
282         $(CP) \
283                 $(PKG_INSTALL_DIR)/usr/share/Qt/mkspecs/* \
284                 $(1)/usr/share/mkspecs/
285
286         $(INSTALL_DATA) \
287                 $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
288                 $(1)/usr/lib/pkgconfig/
289
290         $(CP) \
291                 $(PKG_INSTALL_DIR)/usr/include/* \
292                 $(1)/usr/include/
293
294         $(CP) \
295                 $(PKG_INSTALL_DIR)/usr/lib/*.so* \
296                 $(1)/usr/lib/
297
298         #$(CP) \
299         #       $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/* \
300         #       $(1)/usr/lib/Qt/plugins/
301 endef
302
303 define Package/qt4/install
304         $(INSTALL_DIR) \
305                 $(1)/usr/lib \
306                 $(1)/usr/lib/Qt/plugins
307
308         $(CP) \
309                 $(PKG_INSTALL_DIR)/usr/lib/libQtCore.so* \
310                 $(1)/usr/lib/
311
312         #$(CP) \
313         #       $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/codecs/*.so \
314         #       $(1)/usr/lib/Qt/plugins/codecs/
315 endef
316
317 define Package/qt4-gui/install
318         $(INSTALL_DIR) \
319                 $(1)/usr/lib \
320                 $(1)/usr/lib/Qt/plugins
321
322         $(CP) \
323                 $(PKG_INSTALL_DIR)/usr/lib/libQtGui.so* \
324                 $(1)/usr/lib/
325
326         #HACK: Qt4 requires having truetype fonts stored in /usr/lib/fonts - no subdirectories allowed, so use the dejavue set by default
327         ln -s \
328                 /usr/share/fonts/ttf-dejavu \
329                 $(1)/usr/lib/fonts
330
331         # we use the dejavue font package instead
332         #$(INSTALL_DATA) \
333         #       $(PKG_INSTALL_DIR)/usr/lib/fonts/*.ttf \
334         #       $(1)/usr/lib/fonts/
335
336         #$(CP) \
337         #       $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/accessible \
338         #       $(1)/usr/lib/Qt/plugins/
339
340         #$(CP) \
341         #       $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/imageformats \
342         #       $(1)/usr/lib/Qt/plugins/
343
344         #$(CP) \
345         #       $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/inputmethods \
346         #       $(1)/usr/lib/Qt/plugins/
347 endef
348
349 define Package/qt4-demos/install
350         $(INSTALL_DIR) \
351                 $(1)/usr/share/Qt
352
353         $(CP) \
354                 $(PKG_INSTALL_DIR)/usr/share/Qt/demos \
355                 $(1)/usr/share/Qt/
356
357         $(FIND) \
358                 $(1) \
359                 -name "*.cpp" -o \
360                 -name "*.h" -o \
361                 -name "*.pro" \
362                 | $(XARGS) rm
363 endef
364
365 define Package/qt4-examples/install
366         $(INSTALL_DIR) \
367                 $(1)/usr/share/Qt
368
369         $(CP) \
370                 $(PKG_INSTALL_DIR)/usr/share/Qt/examples \
371                 $(1)/usr/share/Qt/
372
373         $(FIND) \
374                 $(1) \
375                 -name "*.cpp" -o \
376                 -name "*.h" -o \
377                 -name "*.pro" \
378                 | $(XARGS) rm
379 endef
380
381 define Package/qt4-network/install
382         $(INSTALL_DIR) \
383                 $(1)/usr/lib
384
385         $(CP) \
386                 $(PKG_INSTALL_DIR)/usr/lib/libQtNetwork.so* \
387                 $(1)/usr/lib/
388 endef
389
390 #define Package/qt4-multimedia/install
391 #       $(INSTALL_DIR) \
392 #               $(1)/usr/bin
393 #
394 #       $(CP) \
395 #               $(PKG_INSTALL_DIR)/usr/bin/examples/* \
396 #               $(1)/usr/bin/
397 #endef
398
399 define Package/qt4-phonon/install
400         $(INSTALL_DIR) \
401                 $(1)/usr/lib
402
403         $(CP) \
404                 $(PKG_INSTALL_DIR)/usr/lib/libphonon.so* \
405                 $(1)/usr/lib/
406 endef
407
408 define Package/qt4-svg/install
409         $(INSTALL_DIR) \
410                 $(1)/usr/lib \
411                 $(1)/usr/lib/Qt/plugins
412
413         $(CP) \
414                 $(PKG_INSTALL_DIR)/usr/lib/libQtSvg.so* \
415                 $(1)/usr/lib/
416
417         #$(CP) \
418         #       $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/iconengines \
419         #       $(1)/usr/lib/Qt/plugins/
420
421         #$(CP) \
422         #       $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/imageformats \
423         #       $(1)/usr/lib/Qt/plugins/
424 endef
425
426 define Package/qt4-webkit/install
427         $(INSTALL_DIR) \
428                 $(1)/usr/lib \
429                 $(1)/usr/lib/Qt/plugins
430
431         $(CP) \
432                 $(PKG_INSTALL_DIR)/usr/lib/libQtWebKit.so* \
433                 $(1)/usr/lib/
434
435         #$(CP) \
436         #       $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/designer \
437         #       $(1)/usr/lib/Qt/plugins/
438 endef
439
440 define Package/qt4-script/install
441         $(INSTALL_DIR) \
442                 $(1)/usr/lib \
443                 $(1)/usr/lib/Qt/plugins
444
445         $(CP) \
446                 $(PKG_INSTALL_DIR)/usr/lib/libQtScript.so* \
447                 $(1)/usr/lib/
448
449         #$(CP) \
450         #       $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/script \
451         #       $(1)/usr/lib/Qt/plugins/
452 endef
453
454 define Package/qt4-scripttools/install
455         $(INSTALL_DIR) \
456                 $(1)/usr/lib
457
458         $(CP) \
459                 $(PKG_INSTALL_DIR)/usr/lib/libQtScriptTools.so* \
460                 $(1)/usr/lib/
461 endef
462
463 define Package/qt4-dbus/install
464         $(INSTALL_DIR) \
465                 $(1)/usr/lib
466
467         $(CP) \
468                 $(PKG_INSTALL_DIR)/usr/lib/libQtDBus.so* \
469                 $(1)/usr/lib/
470
471         #$(CP) \
472         #       $(PKG_INSTALL_DIR)/usr/bin/qdbus \
473         #       $(1)/usr/bin/
474 endef
475
476 define Package/qt4-qt3-support/install
477         $(INSTALL_DIR) \
478                 $(1)/usr/lib \
479                 $(1)/usr/lib/Qt/plugins
480
481         $(CP) \
482                 $(PKG_INSTALL_DIR)/usr/lib/libQt3Support.so* \
483                 $(1)/usr/lib/
484
485         #$(CP) \
486         #       $(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/accessible \
487         #       $(1)/usr/lib/Qt/plugins/
488 endef
489
490 $(eval $(call BuildPackage,qt4))
491 $(eval $(call BuildPackage,qt4-gui))
492 $(eval $(call BuildPackage,qt4-demos))
493 $(eval $(call BuildPackage,qt4-examples))
494 $(eval $(call BuildPackage,qt4-network))
495 #$(eval $(call BuildPackage,qt4-multimedia))
496 #$(eval $(call BuildPackage,qt4-audio-backend))
497 $(eval $(call BuildPackage,qt4-phonon))
498 #$(eval $(call BuildPackage,qt4-phonon-backend))
499 $(eval $(call BuildPackage,qt4-svg))
500 $(eval $(call BuildPackage,qt4-webkit))
501 $(eval $(call BuildPackage,qt4-script))
502 $(eval $(call BuildPackage,qt4-scripttools))
503 #$(eval $(call BuildPackage,qt4-accessibility))
504 #$(eval $(call BuildPackage,qt4-javascript-jit))
505 #$(eval $(call BuildPackage,qt4-cups))
506 $(eval $(call BuildPackage,qt4-dbus))
507 #$(eval $(call BuildPackage,qt4-gtkstyle))
508 #$(eval $(call BuildPackage,qt4-glib))
509 $(eval $(call BuildPackage,qt4-qt3support))