blob: dc98713fd2e8f2009ff0b67467aa124bfdf257e3 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001QMAKE_MKSPEC_PATH ?= "${STAGING_DATADIR_NATIVE}/qmake"
2
3OE_QMAKE_PLATFORM = "${TARGET_OS}-oe-g++"
4QMAKESPEC := "${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}"
5
6# We override this completely to eliminate the -e normally passed in
7EXTRA_OEMAKE = ""
8
9export OE_QMAKE_CC="${CC}"
10export OE_QMAKE_CFLAGS="${CFLAGS}"
11export OE_QMAKE_CXX="${CXX}"
12export OE_QMAKE_LDFLAGS="${LDFLAGS}"
13export OE_QMAKE_AR="${AR}"
14export OE_QMAKE_STRIP="echo"
15export OE_QMAKE_RPATH="-Wl,-rpath-link,"
16
17# default to qte2 via bb.conf, inherit qt3x11 to configure for qt3x11
18
19oe_qmake_mkspecs () {
20 mkdir -p mkspecs/${OE_QMAKE_PLATFORM}
21 for f in ${QMAKE_MKSPEC_PATH}/${OE_QMAKE_PLATFORM}/*; do
22 if [ -L $f ]; then
23 lnk=`readlink $f`
24 if [ -f mkspecs/${OE_QMAKE_PLATFORM}/$lnk ]; then
25 ln -s $lnk mkspecs/${OE_QMAKE_PLATFORM}/`basename $f`
26 else
27 cp $f mkspecs/${OE_QMAKE_PLATFORM}/
28 fi
29 else
30 cp $f mkspecs/${OE_QMAKE_PLATFORM}/
31 fi
32 done
33}
34
35do_generate_qt_config_file() {
36 export QT_CONF_PATH=${WORKDIR}/qt.conf
37 cat > ${WORKDIR}/qt.conf <<EOF
38[Paths]
39Prefix =
40Binaries = ${STAGING_BINDIR_NATIVE}
41Headers = ${STAGING_INCDIR}/${QT_DIR_NAME}
42Plugins = ${STAGING_LIBDIR}/${QT_DIR_NAME}/plugins/
43Mkspecs = ${STAGING_DATADIR}/${QT_DIR_NAME}/mkspecs/
44EOF
45}
46
47addtask generate_qt_config_file after do_patch before do_configure
48
49qmake_base_do_configure() {
50 case ${QMAKESPEC} in
51 *linux-oe-g++|*linux-uclibc-oe-g++|*linux-gnueabi-oe-g++|*linux-uclibceabi-oe-g++|*linux-gnuspe-oe-g++|*linux-uclibcspe-oe-g++|*linux-gnun32-oe-g++)
52 ;;
53 *-oe-g++)
54 die Unsupported target ${TARGET_OS} for oe-g++ qmake spec
55 ;;
56 *)
57 bbnote Searching for qmake spec file
58 paths="${QMAKE_MKSPEC_PATH}/qws/${TARGET_OS}-${TARGET_ARCH}-g++"
59 paths="${QMAKE_MKSPEC_PATH}/${TARGET_OS}-g++ $paths"
60
61 if (echo "${TARGET_ARCH}"|grep -q 'i.86'); then
62 paths="${QMAKE_MKSPEC_PATH}/qws/${TARGET_OS}-x86-g++ $paths"
63 fi
64 for i in $paths; do
65 if test -e $i; then
66 export QMAKESPEC=$i
67 break
68 fi
69 done
70 ;;
71 esac
72
73 bbnote "using qmake spec in ${QMAKESPEC}, using profiles '${QMAKE_PROFILES}'"
74
75 if [ -z "${QMAKE_PROFILES}" ]; then
76 PROFILES="`ls *.pro`"
77 else
78 PROFILES="${QMAKE_PROFILES}"
79 fi
80
81 if [ -z "$PROFILES" ]; then
82 die "QMAKE_PROFILES not set and no profiles found in $PWD"
83 fi
84
85 if [ ! -z "${EXTRA_QMAKEVARS_POST}" ]; then
86 AFTER="-after"
87 QMAKE_VARSUBST_POST="${EXTRA_QMAKEVARS_POST}"
88 bbnote "qmake postvar substitution: ${EXTRA_QMAKEVARS_POST}"
89 fi
90
91 if [ ! -z "${EXTRA_QMAKEVARS_PRE}" ]; then
92 QMAKE_VARSUBST_PRE="${EXTRA_QMAKEVARS_PRE}"
93 bbnote "qmake prevar substitution: ${EXTRA_QMAKEVARS_PRE}"
94 fi
95
96 # Hack .pro files to use OE utilities
97 LCONVERT_NAME=$(basename ${OE_QMAKE_LCONVERT})
98 LRELEASE_NAME=$(basename ${OE_QMAKE_LRELEASE})
99 LUPDATE_NAME=$(basename ${OE_QMAKE_LUPDATE})
100 XMLPATTERNS_NAME=$(basename ${OE_QMAKE_XMLPATTERNS})
101 find -name '*.pro' \
102 -exec sed -i -e "s|\(=\s*.*\)/$LCONVERT_NAME|\1/lconvert|g" \
103 -e "s|\(=\s*.*\)/$LRELEASE_NAME|\1/lrelease|g" \
104 -e "s|\(=\s*.*\)/$LUPDATE_NAME|\1/lupdate|g" \
105 -e "s|\(=\s*.*\)/$XMLPATTERNS_NAME|\1/xmlpatterns|g" \
106 -e "s|\(=\s*.*\)/lconvert|\1/$LCONVERT_NAME|g" \
107 -e "s|\(=\s*.*\)/lrelease|\1/$LRELEASE_NAME|g" \
108 -e "s|\(=\s*.*\)/lupdate|\1/$LUPDATE_NAME|g" \
109 -e "s|\(=\s*.*\)/xmlpatterns|\1/$XMLPATTERNS_NAME|g" \
110 '{}' ';'
111
112#bbnote "Calling '${OE_QMAKE_QMAKE} -makefile -spec ${QMAKESPEC} -o Makefile $QMAKE_VARSUBST_PRE $AFTER $PROFILES $QMAKE_VARSUBST_POST'"
113 unset QMAKESPEC || true
114 ${OE_QMAKE_QMAKE} -makefile -spec ${QMAKESPEC} -o Makefile $QMAKE_VARSUBST_PRE $AFTER $PROFILES $QMAKE_VARSUBST_POST || die "Error calling ${OE_QMAKE_QMAKE} on $PROFILES"
115}
116
117EXPORT_FUNCTIONS do_configure
118
119addtask configure after do_unpack do_patch before do_compile