12f5a543bb1bc70e9cd8f80c146e50a16d9eb331
[scm/bb/tizen-distro.git] / meta-qt5 / recipes-qt / qt5 / nativesdk-qtbase.inc
1 DESCRIPTION = "SDK version of Qt/[X11|Mac|Embedded]"
2 DEPENDS = "nativesdk-zlib nativesdk-dbus qtbase-native"
3 SECTION = "libs"
4 HOMEPAGE = "http://qt-project.org"
5
6 QT_MODULE = "qtbase"
7
8 require nativesdk-qt5.inc
9
10 # it's already included with newer oe-core, but include it here for dylan
11 FILESEXTRAPATHS =. "${FILE_DIRNAME}/qtbase:"
12
13 # common for qtbase-native, qtbase-nativesdk and qtbase
14 SRC_URI += "\
15     file://0001-Add-linux-oe-g-platform.patch \
16     file://0002-qlibraryinfo-allow-to-set-qt.conf-from-the-outside-u.patch \
17     file://0003-Add-external-hostbindir-option.patch \
18     file://0004-configureapp-Prefix-default-LIBDIRS-and-INCDIRS-with.patch \
19     file://0005-qt_module-Fix-pkgconfig-and-libtool-replacements.patch \
20     file://0006-Revert-eglfs-Print-the-chosen-config-in-debug-mode.patch \
21     file://0007-qeglplatformintegration-Undefine-CursorShape-from-X..patch \
22     file://0008-configure-bump-path-length-from-256-to-512-character.patch \
23     file://0009-eglfs-fix-egl-error-for-platforms-only-supporting-on.patch \
24     file://0010-Revert-Use-the-gcc-feature-in-simd.prf.patch \
25     file://0011-QOpenGLPaintDevice-sub-area-support.patch \
26 "
27
28 # common for qtbase-native and nativesdk-qtbase
29 SRC_URI += " \
30     file://0012-Always-build-uic.patch \
31 "
32
33 # specific for nativesdk-qtbase
34 SRC_URI += " \
35     file://0013-configure-preserve-built-qmake-and-swap-with-native-.patch \
36 "
37
38 PACKAGES = "${PN}-tools-dbg ${PN}-tools-dev ${PN}-tools-staticdev ${PN}-tools"
39
40 PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"
41
42 FILES_${PN}-tools-dev = " \
43     ${includedir} \
44     ${FILES_SOLIBSDEV} ${libdir}/*.la \
45     ${OE_QMAKE_PATH_ARCHDATA}/mkspecs \
46 "
47
48 FILES_${PN}-tools-staticdev = " \
49     ${libdir}/libQt5Bootstrap.a \
50 "
51
52 FILES_${PN}-tools-dbg = " \
53     ${libdir}/.debug \
54     ${OE_QMAKE_PATH_BINS}/.debug \
55 "
56
57 FILES_${PN}-tools = " \
58     ${libdir}/lib*${SOLIBS} \
59     ${OE_QMAKE_PATH_BINS}/* \
60     ${SDKPATHNATIVE}/environment-setup.d \
61 "
62
63 # qttools binaries are placed in a subdir of bin in order to avoid
64 # collisions with qt4. This would trigger debian.bbclass to rename the
65 # package, since it doesn't detect binaries in subdirs. Explicitly
66 # disable package auto-renaming for the tools-package.
67 DEBIAN_NOAUTONAME_${PN}-tools = "1"
68
69 QT_CONFIG_FLAGS += " \
70     -shared \
71     -silent \
72     -no-pch \
73     -no-rpath \
74     -pkg-config \
75     ${EXTRA_OECONF} \
76 "
77
78 # qtbase is exception, as these are used as install path for sysroots
79 OE_QMAKE_PATH_HOST_DATA = "${libdir}/${QT_DIR_NAME}"
80 OE_QMAKE_PATH_HOST_LIBS = "${libdir}"
81
82 do_generate_qt_config_file() {
83     cat > ${QT_CONF_PATH} <<EOF
84 [Paths]
85 Prefix = ${OE_QMAKE_PATH_PREFIX}
86 Headers = ${OE_QMAKE_PATH_HEADERS}
87 Libraries = ${OE_QMAKE_PATH_LIBS}
88 ArchData = ${OE_QMAKE_PATH_ARCHDATA}
89 Data = ${OE_QMAKE_PATH_DATA}
90 Binaries = ${OE_QMAKE_PATH_BINS}
91 LibraryExecutables = ${OE_QMAKE_PATH_LIBEXECS}
92 Plugins = ${OE_QMAKE_PATH_PLUGINS}
93 Imports = ${OE_QMAKE_PATH_IMPORTS}
94 Qml2Imports = ${OE_QMAKE_PATH_QML}
95 Translations = ${OE_QMAKE_PATH_TRANSLATIONS}
96 Documentation = ${OE_QMAKE_PATH_DOCS}
97 Settings = ${OE_QMAKE_PATH_SETTINGS}
98 Examples = ${OE_QMAKE_PATH_EXAMPLES}
99 Tests = ${OE_QMAKE_PATH_TESTS}
100 HostBinaries = ${OE_QMAKE_PATH_HOST_BINS}
101 HostData = ${OE_QMAKE_PATH_HOST_DATA}
102 HostLibraries = ${OE_QMAKE_PATH_HOST_LIBS}
103 HostSpec = ${OE_QMAKESPEC}
104 TartgetSpec = ${OE_XQMAKESPEC}
105 ExternalHostBinaries = ${OE_QMAKE_PATH_EXTERNAL_HOST_BINS}
106 Sysroot =
107 EOF
108 }
109
110 do_generate_qt_config_file_append() {
111     cat >> ${QT_CONF_PATH} <<EOF
112
113 [EffectivePaths]
114 Prefix=..
115 EOF
116 }
117
118 # qtbase is exception, we need to use mkspecs from ${S}
119 QMAKE_MKSPEC_PATH = "${B}"
120
121 # qtbase is exception, configure script is using our get(X)QEvalMakeConf and setBootstrapEvalVariable functions to read it from shell
122 export OE_QMAKE_COMPILER
123 export OE_QMAKE_CC
124 export OE_QMAKE_CFLAGS
125 export OE_QMAKE_CXX
126 export OE_QMAKE_CXXFLAGS
127 export OE_QMAKE_LINK
128 export OE_QMAKE_LDFLAGS
129 export OE_QMAKE_AR
130 export OE_QMAKE_STRIP
131
132 # another exception is that we need to run bin/qmake, because EffectivePaths are relative to qmake location
133 OE_QMAKE_QMAKE_ORIG = "${STAGING_BINDIR_NATIVE}/${QT_DIR_NAME}/qmake"
134 OE_QMAKE_QMAKE = "bin/qmake"
135
136 do_configure() {
137     # we need symlink in path relative to source, because
138     # EffectivePaths:Prefix is relative to qmake location
139     # Also, configure expects qmake-native to swap with real one
140     if [ ! -e ${B}/bin/qmake-native ]; then
141         mkdir ${B}/bin
142         ln -sf ${OE_QMAKE_QMAKE_ORIG} ${B}/bin/qmake-native
143     fi
144
145     ${S}/configure -v \
146         -opensource -confirm-license \
147         -sysroot ${STAGING_DIR_NATIVE} \
148         -no-gcc-sysroot \
149         -system-zlib \
150         -no-libjpeg \
151         -no-libpng \
152         -no-gif \
153         -no-accessibility \
154         -no-cups \
155         -no-nis \
156         -no-gui \
157         -no-qml-debug \
158         -no-sql-mysql \
159         -no-sql-sqlite \
160         -no-opengl \
161         -no-openssl \
162         -no-xcb \
163         -verbose \
164         -release \
165         -prefix ${OE_QMAKE_PATH_PREFIX} \
166         -bindir ${OE_QMAKE_PATH_BINS} \
167         -libdir ${OE_QMAKE_PATH_LIBS} \
168         -datadir ${OE_QMAKE_PATH_DATA} \
169         -sysconfdir ${OE_QMAKE_PATH_SETTINGS} \
170         -docdir ${OE_QMAKE_PATH_DOCS} \
171         -headerdir ${OE_QMAKE_PATH_HEADERS} \
172         -archdatadir ${OE_QMAKE_PATH_ARCHDATA} \
173         -libexecdir ${OE_QMAKE_PATH_LIBEXECS} \
174         -plugindir ${OE_QMAKE_PATH_PLUGINS} \
175         -importdir ${OE_QMAKE_PATH_IMPORTS} \
176         -qmldir ${OE_QMAKE_PATH_QML} \
177         -translationdir ${OE_QMAKE_PATH_TRANSLATIONS} \
178         -testsdir ${OE_QMAKE_PATH_TESTS} \
179         -hostbindir ${OE_QMAKE_PATH_HOST_BINS} \
180         -hostdatadir ${OE_QMAKE_PATH_HOST_DATA} \
181         -external-hostbindir ${OE_QMAKE_PATH_EXTERNAL_HOST_BINS} \
182         -no-glib \
183         -no-iconv \
184         -silent \
185         -nomake examples \
186         -nomake tests \
187         -nomake libs \
188         -no-compile-examples \
189         -no-rpath \
190         -platform ${OE_QMAKESPEC} \
191         -xplatform linux-oe-g++ \
192         ${QT_CONFIG_FLAGS}
193
194     bin/qmake ${OE_QMAKE_DEBUG_OUTPUT} ${S} -o Makefile || die "Configuring qt with qmake failed. EXTRA_OECONF was ${EXTRA_OECONF}"
195 }
196
197 do_install() {
198     # Fix install paths for all
199     find -name "Makefile*" | xargs sed -i "s,(INSTALL_ROOT)${STAGING_DIR_NATIVE}${STAGING_DIR_NATIVE},(INSTALL_ROOT)${STAGING_DIR_NATIVE},g"
200
201     oe_runmake install INSTALL_ROOT=${D}
202
203     # replace the native qmake installed above with nativesdk version
204     rm -rf ${D}${OE_QMAKE_PATH_HOST_BINS}/qmake
205     install -m 755 ${B}/bin/qmake-real ${D}${OE_QMAKE_PATH_HOST_BINS}/qmake
206
207     # for modules which are still using syncqt and call qtPrepareTool(QMAKE_SYNCQT, syncqt)
208     # e.g. qt3d, qtwayland
209     ln -sf syncqt.pl ${D}${OE_QMAKE_PATH_QT_BINS}/syncqt
210
211     # remove things unused in nativesdk, we need the headers, Qt5Core
212     # and Qt5Bootstrap.
213     rm -rf ${D}${datadir} \
214            ${D}/${OE_QMAKE_PATH_PLUGINS} \
215            ${D}${libdir}/cmake \
216            ${D}${libdir}/pkgconfig
217     find ${D}${libdir} -maxdepth 1 -name 'lib*' -and \
218                                    -not -name 'libQt5Core.so*' -and \
219                                    -not -name 'libQt5Bootstrap.a' \
220                                    -exec rm '{}' ';'
221 }
222
223 do_generate_qt_environment_file() {
224     mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d/
225     script=${D}${SDKPATHNATIVE}/environment-setup.d/qt5.sh
226
227     echo 'export PATH=${OE_QMAKE_PATH_HOST_BINS}:$PATH' > $script
228     echo 'export OE_QMAKE_CFLAGS="$CFLAGS"' >> $script
229     echo 'export OE_QMAKE_CXXFLAGS="$CXXFLAGS"' >> $script
230     echo 'export OE_QMAKE_LDFLAGS="$LDFLAGS"' >> $script
231     echo 'export OE_QMAKE_CC=$CC' >> $script
232     echo 'export OE_QMAKE_CXX=$CXX' >> $script
233     echo 'export OE_QMAKE_LINK=$CXX' >> $script
234     echo 'export OE_QMAKE_AR=$AR' >> $script
235     echo 'export QT_CONF_PATH=${OE_QMAKE_PATH_HOST_BINS}/qt.conf' >> $script
236     echo 'export OE_QMAKE_LIBDIR_QT=`qmake -query QT_INSTALL_LIBS`' >> $script
237     echo 'export OE_QMAKE_INCDIR_QT=`qmake -query QT_INSTALL_HEADERS`' >> $script
238     echo 'export OE_QMAKE_MOC=${OE_QMAKE_PATH_HOST_BINS}/moc' >> $script
239     echo 'export OE_QMAKE_UIC=${OE_QMAKE_PATH_HOST_BINS}/uic' >> $script
240     echo 'export OE_QMAKE_RCC=${OE_QMAKE_PATH_HOST_BINS}/rcc' >> $script
241     echo 'export OE_QMAKE_QDBUSCPP2XML=${OE_QMAKE_PATH_HOST_BINS}/qdbuscpp2xml' >> $script
242     echo 'export OE_QMAKE_QDBUSXML2CPP=${OE_QMAKE_PATH_HOST_BINS}/qdbusxml2cpp' >> $script
243     echo 'export OE_QMAKE_QT_CONFIG=${OE_QMAKE_PATH_TARGET_LIBS}/${QT_DIR_NAME}/mkspecs/qconfig.pri' >> $script
244     echo 'export QMAKESPEC=`qmake -query QT_INSTALL_LIBS`/mkspecs/linux-oe-g++' >> $script
245
246     # Use relocable sysroot
247     sed -i -e 's:${SDKPATHNATIVE}:$OECORE_NATIVE_SYSROOT:g' $script
248 }
249
250 addtask generate_qt_environment_file after do_install before do_package