aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-qt/qt5/qt5.inc
blob: ee2175acd6b24ac5241b2b819426b27657cd1f68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Copyright (C) 2012 O.S. Systems Software LTDA.

inherit qmake5_base

SRC_URI += " \
  file://qmake-build.conf.sh \
  file://qmake.conf.sh \
  file://qplatformdefs.h \
"

# Qt5 is dependent on icu for localization
ICU = "icu "
ICU_powerpc = "pango"

DEPENDS += "qt5-tools-native virtual/libgl freetype jpeg libpng zlib openssl glib-2.0 ${ICU}"

require qt5_arch.inc

QT_MODULE ?= "${PN}"

QT_DISTRO_FLAGS ?= "-no-accessibility -no-sm"
QT_DISTRO_FLAGS_linuxstdbase = "-sm"

# Some can be used only for certain QT_MODULEs, so define them here, 
# but add them to QT_CONFIG_FLAGS e.g. in qtbase.inc
QT_SQL_DRIVER_FLAGS ?= "-no-sql-ibase -no-sql-mysql -no-sql-psql -no-sql-odbc -plugin-sql-sqlite"
QT_GLFLAGS ?= ""
QT_XML ?= "-xmlpatterns"
QT_WEBKIT ?= "-webkit"
QT_PHONON ?= "-phonon"
QT_DBUS ?= "-qdbus"
QT_MULTIMEDIA ?= "${@base_contains('DISTRO_FEATURES', 'pulseaudio', '-pulseaudio', '-no-pulseaudio', d)}"
QT_MODULE_FLAGS ?= ""
QT_NAS ?= "-no-nas-sound"
QT_NIS ?= "-no-nis"
QT_CUPS ?= "-no-cups"
QT_STL ?= "-stl"
QT_SYSTEM_LIBS ?= "-system-libjpeg -system-libpng -system-zlib"
QT_TESTS ?= "-nomake tests"
QT_EXAMPLES ?= "-nomake examples"
QT_DEMOS ?= "-nomake demos"

QT_CONFIG_FLAGS += " \
  -release \
  -reduce-relocations \
  -shared \
  -silent \
  -glib \
  -no-pch \
  -no-rpath \
  -no-fast \
  -pkg-config \
  ${QT_SYSTEM_LIBS} \
  ${QT_NIS} \
  ${QT_CUPS} \
  ${QT_SQL_DRIVER_FLAGS} \
  ${QT_DISTRO_FLAGS} \
  ${QT_MODULE_FLAGS} \
  ${QT_GLFLAGS} \
  ${QT_TESTS} \
  ${QT_EXAMPLES} \
  ${QT_DEMOS} \
"

EXTRA_ENV = 'QMAKE="${STAGING_BINDIR_NATIVE}/qmake -d -after \
             INCPATH+=${STAGING_INCDIR}/freetype2 LIBS+=-L${STAGING_LIBDIR}" \
             LINK="${CXX} -Wl,-rpath-link,${STAGING_LIBDIR}" \
             AR="${TARGET_PREFIX}ar cqs" \
             MOC="${STAGING_BINDIR_NATIVE}/moc" UIC="${STAGING_BINDIR_NATIVE}/uic" MAKE="make -e ${PARALLEL_MAKE}"'

export QT_CONF_PATH="${S}/qt.conf"

do_configure() {
    set_endian

    if [ ! -e bin/qmake ]; then
        ln -sf ${STAGING_BINDIR_NATIVE}/qmake bin/qmake
    fi

    # Avoid problems with the linkers, since we want the linker to be g++
    unset LD

    mkdir -p mkspecs/${TARGET_OS}-oe-g++
    cp -f ${WORKDIR}/qplatformdefs.h mkspecs/${TARGET_OS}-oe-g++
    bash ${WORKDIR}/qmake.conf.sh > mkspecs/${TARGET_OS}-oe-g++/qmake.conf

    ### This copying needs to take place every time as the installation will 
    ### change.. CHECK THIS
    mkdir -p ${STAGING_DATADIR}/${QT_DIR_NAME}
    cp -r ${STAGING_DATADIR_NATIVE}/${QT_DIR_NAME}/mkspecs ${STAGING_DATADIR}/${QT_DIR_NAME}/
    ### Make sure that modules are installed correctly
    sed -i '/pritarget/s/HOST_DATA/INSTALL_DATA/' ${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs/features/qt_installs.prf
    rm -rf ${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs/modules*
    rm ${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs/*.pri

    ### This will make sure that our mkspecs wil leventually end up in STAGING_DATADIR
    ### Consider doing this as a patch!!
    sed -i '/mkspecs\.path/s/HOST_DATA/INSTALL_DATA/' qtbase.pro
    sed -i '/pritarget/s/HOST_DATA/INSTALL_DATA/' mkspecs/features/qt_installs.prf

    echo "[Paths]"                                              > $QT_CONF_PATH
    echo "Binaries=${bindir}"                                   >> $QT_CONF_PATH
    echo "Headers=${includedir}/${QT_DIR_NAME}"                 >> $QT_CONF_PATH
    echo "Documentation=${docdir}/${QT_DIR_NAME}"               >> $QT_CONF_PATH
    echo "Libraries=${libdir}"                                  >> $QT_CONF_PATH
    echo "Plugins=${libdir}/${QT_DIR_NAME}/plugins"             >> $QT_CONF_PATH
    echo "Data=${datadir}/${QT_DIR_NAME}"                       >> $QT_CONF_PATH
    echo "Translations=${datadir}/${QT_DIR_NAME}/translations"  >> $QT_CONF_PATH
    echo "Settings=${sysconfdir}/${QT_DIR_NAME}"                >> $QT_CONF_PATH
    echo "Examples=${bindir}/${QT_DIR_NAME}/examples"           >> $QT_CONF_PATH
    echo "HostBinaries=${STAGING_BINDIR_NATIVE}"                >> $QT_CONF_PATH
    echo "HostData=${STAGING_DATADIR}/${QT_DIR_NAME}"    >> $QT_CONF_PATH

    ./configure -v \
        -dont-process \
        -opensource -confirm-license \
        -prefix ${prefix} \
        -bindir ${bindir} \
        -libdir ${libdir} \
        -datadir ${datadir}/${QT_DIR_NAME} \
        -sysconfdir ${sysconfdir}/${QT_DIR_NAME} \
        -docdir ${docdir}/${QT_DIR_NAME} \
        -headerdir ${includedir}/${QT_DIR_NAME} \
        -plugindir ${libdir}/${QT_DIR_NAME}/plugins \
        -importdir ${libdir}/${QT_DIR_NAME}/imports \
        -translationdir ${datadir}/${QT_DIR_NAME}/translations \
        -examplesdir ${bindir}/${QT_DIR_NAME}/examples \
        -platform ${TARGET_OS}-oe-g++ \
        -xplatform ${TARGET_OS}-oe-g++ \
        ${QT_CONFIG_FLAGS}

    ### Since we are pointing our host data we need to get them there before compile
    if [ ! -e ${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs/${TARGET_OS}-oe-g++ ]; then
        cp -rf mkspecs/${TARGET_OS}-oe-g++ ${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs/${TARGET_OS}-oe-g++
    fi
    ### qmodule.pri and qconfig.pri contain target specific stuff copy them over as well
    cp -f mkspecs/qmodule.pri ${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs/qmodule.pri
    cp -f mkspecs/qconfig.pri ${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs/qconfig.pri

    ### As we provided the '-dont-process' switch inorder to allow us to stage a few files
    ### generated by the configure we need to manually run qmake the generate _all_ the Makefiles (-r)
    ${OE_QMAKE_QMAKE} -r -d
}

do_compile() {

    unset CFLAGS CXXFLAGS AR

    oe_runmake ${EXTRA_ENV}

    # Build qmake for the target arch
    cd ${S}/qmake
    ${OE_QMAKE_QMAKE}
    oe_runmake CC="${CC}" CXX="${CXX}"
    cd ${S}
}

do_install() {
    oe_runmake install INSTALL_ROOT=${D}

    ### Fix up the binaries to the right location
    ### TODO: FIX
    install -d ${D}${bindir}/
    mv ${D}/${STAGING_BINDIR_NATIVE}/* ${D}${bindir}/
    rm -rf ${D}/${STAGING_BINDIR_NATIVE}/

    # Install the right arch qmake
    rm ${D}/${bindir}/qmake
    install -m 0755 bin/qmake2 ${D}${bindir}/qmake
}

FILES_${PN} = "${libdir}/*.so.*"
FILES_${PN}-dbg = "${libdir}/.debug/*.so.*"
FILES_${PN}-plugins = "${libdir}/${QT_DIR_NAME}/plugins/*"
FILES_${PN}-plugins-dbg = "${libdir}/${QT_DIR_NAME}/plugins/.debug/*"

FILES_${PN}-dev = " \
        ${libdir}/cmake/* \
        ${libdir}/pkgconfig/*.pc \
        ${libdir}/*.la \
        ${libdir}/*.prl \
        ${includedir}/qt5/* \
        ${datadir}/qt5/* \
"
FILES_${PN}-staticdev = "${libdir}/libQt*.a"
FILES_${PN}-tools = "${bindir}/*"
FILES_${PN}-doc = "${datadir}/doc/*"