Increase dvbapp PR.
[vuplus_openembedded] / recipes / qt4 / qt4.inc
1 inherit qmake_base
2
3 DEPENDS += "qt4-tools-native freetype jpeg libpng zlib dbus openssl glib-2.0 gstreamer gst-plugins-base mysql5 postgresql sqlite sqlite3"
4
5 require qt4_arch.inc
6 QT_ARCH := "${@qt_arch(d)}"
7 QT_ENDIAN = "${@qt_endian(d)}"
8
9 QT_CONFIG_FLAGS += "-release -no-cups -no-accessibility -reduce-relocations \
10                     -shared -no-nas-sound -no-sm -no-nis \
11                     -qt-gif -system-libjpeg -system-libpng -system-zlib \
12                     -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 \
13                     -no-pch -qdbus -stl -glib -no-phonon -webkit"
14
15 EXTRA_OEMAKE = "-e"
16
17 EXTRA_ENV = 'QMAKE="${STAGING_BINDIR_NATIVE}/qmake2 -after \
18              INCPATH+=${STAGING_INCDIR}/freetype2 LIBS+=-L${STAGING_LIBDIR}" \
19              QMAKESPEC="${QMAKESPEC}" LINK="${CXX} -Wl,-rpath-link,${STAGING_LIBDIR}" \
20              AR="${TARGET_PREFIX}ar cqs" QMAKE_LRELEASE="${STAGING_BINDIR_NATIVE}/lrelease4" \
21              QMAKE_RCC="${STAGING_BINDIR_NATIVE}/rcc4" QMAKE_MOC="${STAGING_BINDIR_NATIVE}/moc4" \
22              QMAKE_UIC="${STAGING_BINDIR_NATIVE}/uic4" MAKE="make -e"'
23
24 export QT_CONF_PATH="${WORKDIR}/qt.conf"
25
26 # Library packages
27 QT_LIB_NAMES = "Qt3Support QtAssistantClient QtCLucene QtCore QtDBus QtDesigner QtDesignerComponents QtGui QtHelp QtNetwork QtOpenGL QtScript QtScriptTools QtSql QtSvg QtTest QtUiTools QtWebKit QtXml QtXmlPatterns phonon QtMultimedia QtOpenVG QtMediaServices QtDeclarative"
28
29 QT_EXTRA_LIBS = "pvrQWSWSEGL"
30
31 python __anonymous () {
32     import bb
33
34     lib_packages = []
35     dev_packages = []
36     dbg_packages = []
37     for name in bb.data.getVar("QT_LIB_NAMES", d, 1).split():
38         pkg = "${QT_BASE_LIB}" + name.lower().replace("qt", "").replace("_", "-") + "4"
39         # NOTE: the headers for QtAssistantClient are different
40         incname = name.replace("QtAssistantClient", "QtAssistant")
41         bb.data.setVar("FILES_%s" % pkg, "${libdir}/lib%(name)s${QT_LIBINFIX}.so.*" % locals(), d)
42         bb.data.setVar("FILES_%s-dev" % pkg, """${libdir}/lib%(name)s${QT_LIBINFIX}.prl
43                   ${libdir}/lib%(name)s${QT_LIBINFIX}.a
44                   ${libdir}/lib%(name)s${QT_LIBINFIX}.la
45                   ${libdir}/lib%(name)s${QT_LIBINFIX}.so
46                   ${includedir}/${QT_DIR_NAME}/%(incname)s
47                   ${libdir}/pkgconfig/%(name)s${QT_LIBINFIX}.pc""" % locals(), d)
48         bb.data.setVar("FILES_%s-dbg" % pkg, "${libdir}/.debug/lib%(name)s${QT_LIBINFIX}.so.*" % locals(), d)
49         lib_packages.append(pkg)
50         dev_packages.append("%s-dev" % pkg)
51         dbg_packages.append("%s-dbg" % pkg)
52     for name in bb.data.getVar("OTHER_PACKAGES", d, 1).split():
53         dbg_packages.append("%s-dbg" % name)
54
55     for name in bb.data.getVar("QT_EXTRA_LIBS", d, 1).split():
56         pkg = "${QT_BASE_LIB}" + name.lower().replace("qt", "").replace("_", "-") + "4"
57         bb.data.setVar("FILES_%s" % pkg, "${libdir}/lib%(name)s.so.*" % locals(), d)
58         bb.data.setVar("FILES_%s-dev" % pkg, """${libdir}/lib%(name)s.prl
59                   ${libdir}/lib%(name)s.a
60                   ${libdir}/lib%(name)s.la
61                   ${libdir}/lib%(name)s.so
62                   ${includedir}/${QT_DIR_NAME}/%(incname)s
63                   ${libdir}/pkgconfig/%(name)s.pc""" % locals(), d)
64         bb.data.setVar("FILES_%s-dbg" % pkg, "${libdir}/.debug/lib%(name)s.so.*" % locals(), d)
65         lib_packages.append(pkg)
66         dev_packages.append("%s-dev" % pkg)
67         dbg_packages.append("%s-dbg" % pkg)
68
69     bb.data.setVar("LIB_PACKAGES", " ".join(lib_packages), d)
70     bb.data.setVar("DEV_PACKAGES", " ".join(dev_packages), d)
71     bb.data.setVar("DBG_PACKAGES", " ".join(dbg_packages), d)
72 }
73
74 OTHER_PACKAGES = "\
75              ${QT_BASE_NAME}-tools \
76              ${QT_BASE_NAME}-assistant \
77              ${QT_BASE_NAME}-common \
78              ${QT_BASE_NAME}-dbus \
79              ${QT_BASE_NAME}-demos \
80              ${QT_BASE_NAME}-designer \
81              ${QT_BASE_NAME}-examples \
82              ${QT_BASE_NAME}-fonts \
83              ${QT_BASE_NAME}-fonts-ttf-vera \
84              ${QT_BASE_NAME}-fonts-ttf-dejavu \
85              ${QT_BASE_NAME}-fonts-pfa \
86              ${QT_BASE_NAME}-fonts-pfb \
87              ${QT_BASE_NAME}-fonts-qpf \
88              ${QT_BASE_NAME}-linguist \
89              ${QT_BASE_NAME}-makeqpf \
90              ${QT_BASE_NAME}-mkspecs \
91              ${QT_BASE_NAME}-pixeltool \
92              ${QT_BASE_NAME}-qmlviewer \
93              ${QT_BASE_NAME}-xmlpatterns \
94              ${QT_BASE_NAME}-qt3to4 \
95              ${QT_BASE_NAME}-qml-plugins"
96
97 PACKAGES += "${LIB_PACKAGES} ${DEV_PACKAGES} ${DBG_PACKAGES} ${OTHER_PACKAGES}"
98 PACKAGES_DYNAMIC = "${QT_BASE_NAME}-plugin-* ${QT_BASE_NAME}-translation-* ${QT_BASE_NAME}-fonts-*"
99
100 ALLOW_EMPTY_${PN} = "1"
101 ALLOW_EMPTY_${QT_BASE_NAME}-fonts = "1"
102 FILES_${PN}     = ""
103 FILES_${PN}-dev = "${includedir}/${QT_DIR_NAME}/Qt/*"
104 FILES_${PN}-dbg = ""
105 RRECOMMENDS_${PN} = "${LIB_PACKAGES} ${OTHER_PACKAGES}"
106 RRECOMMENDS_${PN}-dev = "${DEV_PACKAGES}"
107 RRECOMMENDS_${PN}-dbg = "${DBG_PACKAGES}"
108 RRECOMMENDS_${QT_BASE_NAME}-fonts = " \
109              ${QT_BASE_NAME}-fonts-ttf-vera \
110              ${QT_BASE_NAME}-fonts-ttf-dejavu \
111              ${QT_BASE_NAME}-fonts-pfa \
112              ${QT_BASE_NAME}-fonts-pfb \
113              ${QT_BASE_NAME}-fonts-qpf"
114
115 FILES_${QT_BASE_NAME}-tools                = "${bindir}/uic* ${bindir}/moc ${bindir}/rcc ${bindir}/qttracereplay ${bindir}/qdoc*"
116 FILES_${QT_BASE_NAME}-tools-dbg            = "${bindir}/.debug/uic* ${bindir}/.debug/moc ${bindir}/.debug/rcc ${bindir}/.debug/qttracereplay ${bindir}/.debug/qdoc*"
117 FILES_${QT_BASE_NAME}-assistant            = "${bindir}/*assistant* ${bindir}/qcollectiongenerator ${bindir}/qhelpconverter ${bindir}/qhelpgenerator"
118 FILES_${QT_BASE_NAME}-assistant-dbg        = "${bindir}/.debug/*assistant* ${bindir}/.debug/qcollectiongenerator ${bindir}/.debug/qhelpconverter ${bindir}/.debug/qhelpgenerator"
119 FILES_${QT_BASE_NAME}-common               = "${bindir}/qtconfig"
120 FILES_${QT_BASE_NAME}-common-dbg           = "${bindir}/.debug/qtconfig"
121 FILES_${QT_BASE_NAME}-dbus                 = "${bindir}/qdbus ${bindir}/qdbusxml2cpp ${bindir}/qdbuscpp2xml ${bindir}/qdbusviewer"
122 FILES_${QT_BASE_NAME}-dbus-dbg             = "${bindir}/.debug/qdbus ${bindir}/.debug/qdbusxml2cpp ${bindir}/.debug/qdbuscpp2xml ${bindir}/.debug/qdbusviewer"
123 FILES_${QT_BASE_NAME}-demos                = "${bindir}/qtdemo* ${bindir}/${QT_DIR_NAME}/demos/*"
124 FILES_${QT_BASE_NAME}-demos-dbg            = "${bindir}/.debug/qtdemo* ${bindir}/${QT_DIR_NAME}/demos/.debug/*  ${bindir}/${QT_DIR_NAME}/demos/*/.debug  ${bindir}/${QT_DIR_NAME}/demos/*/*/.debug  ${bindir}/${QT_DIR_NAME}/demos/*/*/*/.debug"
125 FILES_${QT_BASE_NAME}-designer             = "${bindir}/*designer*"
126 FILES_${QT_BASE_NAME}-designer-dbg         = "${bindir}/.debug/*designer*"
127 FILES_${QT_BASE_NAME}-examples             = "${bindir}/${QT_DIR_NAME}/examples/*"
128 FILES_${QT_BASE_NAME}-examples-dbg         = "${bindir}/${QT_DIR_NAME}/examples/.debug ${bindir}/${QT_DIR_NAME}/examples/*/.debug ${bindir}/${QT_DIR_NAME}/examples/*/*/.debug ${bindir}/${QT_DIR_NAME}/examples/*/*/*/.debug ${bindir}/${QT_DIR_NAME}/examples/*/*/*/*/.debug ${bindir}/${QT_DIR_NAME}/examples/declarative/*/*/*/*/*/.debug/* ${bindir}/${QT_DIR_NAME}/examples/declarative/*/*/*/*/.debug/*"
129 FILES_${QT_BASE_NAME}-fonts-ttf-vera       = "${libdir}/fonts/Vera*.ttf"
130 FILES_${QT_BASE_NAME}-fonts-ttf-dejavu     = "${libdir}/fonts/DejaVu*.ttf"
131 FILES_${QT_BASE_NAME}-fonts-pfa            = "${libdir}/fonts/*.pfa"
132 FILES_${QT_BASE_NAME}-fonts-pfb            = "${libdir}/fonts/*.pfb"
133 FILES_${QT_BASE_NAME}-fonts-qpf            = "${libdir}/fonts/*.qpf"
134 FILES_${QT_BASE_NAME}-linguist             = "${bindir}/*linguist* ${bindir}/lrelease ${bindir}/lupdate ${bindir}/lconvert ${bindir}/qm2ts"
135 FILES_${QT_BASE_NAME}-linguist-dbg         = "${bindir}/.debug/*linguist* ${bindir}/.debug/lrelease ${bindir}/.debug/lupdate ${bindir}/.debug/lconvert ${bindir}/.debug/qm2ts"
136 FILES_${QT_BASE_NAME}-pixeltool            = "${bindir}/pixeltool"
137 FILES_${QT_BASE_NAME}-pixeltool-dbg        = "${bindir}/.debug/pixeltool"
138 FILES_${QT_BASE_NAME}-qt3to4               = "${bindir}/qt3to4 ${datadir}/${QT_DIR_NAME}/q3porting.xml"
139 FILES_${QT_BASE_NAME}-qt3to4-dbg           = "${bindir}/.debug/qt3to4"
140 FILES_${QT_BASE_NAME}-qmlviewer            = "${bindir}/qmlviewer"
141 FILES_${QT_BASE_NAME}-qmlviewer-dbg        = "${bindir}/.debug/qmlviewer"
142 FILES_${QT_BASE_NAME}-makeqpf              = "${bindir}/makeqpf"
143 FILES_${QT_BASE_NAME}-makeqpf-dbg          = "${bindir}/.debug/makeqpf"
144 FILES_${QT_BASE_NAME}-mkspecs              = "${datadir}/${QT_DIR_NAME}/mkspecs/*"
145 FILES_${QT_BASE_NAME}-xmlpatterns          = "${bindir}/xmlpatterns*"
146 FILES_${QT_BASE_NAME}-xmlpatterns-dbg      = "${bindir}/.debug/xmlpatterns*"
147 FILES_${QT_BASE_NAME}-qml-plugins          = "${libdir}/${QT_DIR_NAME}/imports/*"
148 FILES_${QT_BASE_NAME}-qml-plugins-dbg      = "${libdir}/${QT_DIR_NAME}/imports/*/*/*/.debug/* ${libdir}/${QT_DIR_NAME}/imports/*/.debug"
149
150 do_configure() {
151     unset QMAKESPEC
152     unset QTDIR
153
154     if [ ! -e bin/qmake ]; then
155         ln -sf ${STAGING_BINDIR_NATIVE}/qmake2 bin/qmake
156     fi
157
158     if [ ! -e mkspecs/${TARGET_OS}-oe-g++ ]; then
159         ln -sf linux-g++ mkspecs/${TARGET_OS}-oe-g++
160     fi
161
162     cp -f ${WORKDIR}/g++.conf ${WORKDIR}/linux.conf mkspecs/common/
163
164     echo "[Paths]"                                 > $QT_CONF_PATH
165     echo "Prefix=${prefix}/"                      >> $QT_CONF_PATH
166     echo "Documentation=${docdir}/${QT_DIR_NAME}" >> $QT_CONF_PATH
167     echo "Headers=${includedir}/${QT_DIR_NAME}"   >> $QT_CONF_PATH
168     echo "Libraries=${libdir}"                    >> $QT_CONF_PATH
169     echo "Binaries=${bindir}"                     >> $QT_CONF_PATH
170     echo "Plugins=${libdir}/${QT_DIR_NAME}/plugins" >> $QT_CONF_PATH
171     echo "Imports=${libdir}/${QT_DIR_NAME}/imports" >> $QT_CONF_PATH
172     echo "Data=${datadir}/${QT_DIR_NAME}"         >> $QT_CONF_PATH
173     echo "Translations=${datadir}/${QT_DIR_NAME}/translations" >> $QT_CONF_PATH
174     echo "Settings=${sysconfdir}/${QT_DIR_NAME}"  >> $QT_CONF_PATH
175     echo "Examples=${bindir}/${QT_DIR_NAME}/examples" >> $QT_CONF_PATH
176     echo "Demos=${bindir}/${QT_DIR_NAME}/demos"   >> $QT_CONF_PATH
177
178     ${EXTRA_QMAKE_MUNGE}|| true
179
180     (echo o; echo yes) | ./configure -v \
181             -prefix ${prefix}/ \
182             -bindir ${bindir} \
183             -libdir ${libdir} \
184             -datadir ${datadir}/${QT_DIR_NAME} \
185             -sysconfdir ${sysconfdir}/${QT_DIR_NAME} \
186             -docdir ${docdir}/${QT_DIR_NAME} \
187             -headerdir ${includedir}/${QT_DIR_NAME} \
188             -plugindir ${libdir}/${QT_DIR_NAME}/plugins \
189             -importdir ${libdir}/${QT_DIR_NAME}/imports \
190             -translationdir ${datadir}/${QT_DIR_NAME}/translations \
191             -examplesdir ${bindir}/${QT_DIR_NAME}/examples \
192             -demosdir ${bindir}/${QT_DIR_NAME}/demos \
193             -platform ${TARGET_OS}-oe-g++ \
194             -xplatform ${TARGET_OS}-oe-g++ \
195             -embedded ${QT_ARCH} ${QT_ENDIAN} \
196             -crossarch ${QT_ARCH} \
197             ${QT_CONFIG_FLAGS} -no-fast \
198             -L${STAGING_LIBDIR} -I${STAGING_INCDIR} \
199             -I${STAGING_INCDIR}/freetype2 \
200             -I${STAGING_INCDIR}/mysql \
201             -I${STAGING_INCDIR}/postgresql
202 }
203
204 do_compile() {
205     unset CFLAGS CXXFLAGS
206     install -m 0755 ${STAGING_BINDIR_NATIVE}/rcc4 ${S}/bin/rcc
207     install -m 0755 ${STAGING_BINDIR_NATIVE}/moc4 ${S}/bin/moc
208     install -m 0755 ${STAGING_BINDIR_NATIVE}/uic4 ${S}/bin/uic
209
210     oe_runmake ${EXTRA_ENV}
211 }
212
213 python populate_packages_prepend() {
214         translation_dir = bb.data.expand('${datadir}/${QT_DIR_NAME}/translations/', d)
215         translation_name = bb.data.expand('${QT_BASE_NAME}-translation-%s', d)
216         do_split_packages(d, translation_dir, '^(assistant|designer|linguist|qt|qtconfig|qvfb)_(.*)\.qm$', translation_name, '${PN} translation for %s', extra_depends='' )
217  
218         phrasebook_dir = bb.data.expand('${datadir}/${QT_DIR_NAME}/phrasebooks/', d)
219         phrasebook_name = bb.data.expand('${QT_BASE_NAME}-phrasebook-%s', d)
220         do_split_packages(d, phrasebook_dir, '^(.*)\.qph$', phrasebook_name, '${PN} phrasebook for %s', extra_depends='' )
221  
222         # Package all the plugins and their -dbg version and create a meta package
223         import os
224         def qtopia_split(path, name, glob):
225                 """
226                 Split the package into a normal and -dbg package and then add the
227                 new packages to the meta package.
228                 """
229                 plugin_dir = bb.data.expand('${libdir}/${QT_DIR_NAME}/plugins/%s/' % path, d)
230                 if not os.path.exists("%s%s" % (bb.data.expand('${D}',d), plugin_dir)):
231                         bb.note("The path does not exist:", bb.data.expand('${D}', d), plugin_dir)
232                         return
233  
234                 plugin_name = bb.data.expand('${QT_BASE_NAME}-plugin-%s-%%s' % name, d)
235                 dev_packages = []
236                 dev_hook = lambda file,pkg,b,c,d:dev_packages.append((file,pkg))
237                 do_split_packages(d, plugin_dir, glob, plugin_name, '${PN} %s for %%s' % name, extra_depends='', hook=dev_hook)
238                 # Create a -dbg package as well
239                 plugin_dir_dbg = bb.data.expand('${libdir}/${QT_DIR_NAME}/plugins/%s/.debug' % path, d)
240                 packages = bb.data.getVar('PACKAGES',d)
241                 for (file,package) in dev_packages:
242                         packages = "%s %s-dbg" % (packages, package)
243                         file_name = os.path.join(plugin_dir_dbg, os.path.basename(file))
244                         bb.data.setVar("FILES_%s-dbg" % package, file_name, d)
245                         bb.data.setVar("DESCRIPTION_%s-dbg" % package, "${PN} %s for %s" % (name, package), d)
246
247                 bb.data.setVar('PACKAGES', packages, d)
248  
249         qtopia_split('accessible',    'accessible',    '^libq(.*)\.so$')
250         qtopia_split('codecs',        'codec',         '^libq(.*)\.so$')
251         qtopia_split('decorations',   'decoration',    '^libqdecoration(.*)\.so$')
252         qtopia_split('designer',      'designer',      '^lib(.*)\.so$')
253         qtopia_split('gfxdrivers',    'gfxdriver',     '^libq(.*)\.so$')
254         qtopia_split('graphicssystems','graphicssystems', '^libq(.*)\.so$')
255         qtopia_split('mousedrivers',  'mousedriver',   '^libq(.*)mousedriver\.so$')
256         qtopia_split('iconengines',   'iconengine',    '^libq(.*)\.so$')
257         qtopia_split('imageformats',  'imageformat',   '^libq(.*)\.so$')
258         qtopia_split('inputmethods',  'inputmethod',   '^libq(.*)\.so$')
259         qtopia_split('sqldrivers',    'sqldriver',     '^libq(.*)\.so$')
260         qtopia_split('script',        'script',        '^libqtscript(.*)\.so$')
261         qtopia_split('styles',        'style',         '^libq(.*)\.so$')
262         qtopia_split('phonon_backend','phonon-backend','^libphonon_(.*)\.so$')
263         qtopia_split('bearer',        'bearer',        '^libq(.*)bearer\.so$')
264 }
265
266 do_install() {
267     oe_runmake install INSTALL_ROOT=${D}
268         
269     # These are host binaries, we should only use them in staging
270     rm -rf ${D}/${bindir}/qmake
271
272     # fix pkgconfig, libtool and prl files
273     sed -i -e s#-L${S}/lib##g \
274            -e s#-L${STAGING_LIBDIR}##g \
275            -e 's#STAGING_LIBDIR}#libdir}'#g \ 
276            -e s#-L${libdir}##g \
277            -e s#'$(OE_QMAKE_LIBS_X11)'#"${OE_QMAKE_LIBS_X11}"#g \
278            -e s#" -Wl,-rpath-link,${S}/lib"##g \
279            -e s#" -Wl,-rpath-link,${libdir}"##g \
280            -e 's#I/usr/include#Iincludedir}#g' \ 
281            -e 's#Iin#I${in#g' \
282            ${D}${libdir}/*.la ${D}${libdir}/*.prl ${D}${libdir}/pkgconfig/*.pc
283
284     sed -i -e s#" -Wl,-rpath-link,${S}/lib"##g \
285             ${D}${datadir}/${QT_DIR_NAME}/mkspecs/common/linux.conf
286
287     # fix pkgconfig files
288     sed -i -e s#"moc_location=.*$"#"moc_location=${bindir}/moc4"# \
289            -e s#"uic_location=.*$"#"uic_location=${bindir}/uic4"# \
290            ${D}${libdir}/pkgconfig/*.pc
291     for name in ${QT_LIB_NAMES}; do
292            sed -i -e /Requires/s#"${name}"#"${name}${QT_LIBINFIX}"#g ${D}${libdir}/pkgconfig/*.pc
293            if [ -f ${D}${libdir}/pkgconfig/${name}${QT_LIBINFIX}.pc ]; then
294                sed -i -e /^includedir=/s#"/${name}"## \
295                       -e /^Cflags:/s#"${QT_DIR_NAME}"#"${name}"# \
296                          ${D}${libdir}/pkgconfig/${name}${QT_LIBINFIX}.pc
297            fi
298     done
299
300     install -d ${D}/${libdir}/fonts
301     touch ${D}/${libdir}/fonts/fontdir
302 }
303
304