qtbase: mkspecs: add default toolchain options

While most mkspecs use hardcoded compiler names / options, qmake in
meta-qt5 is setup to get them from the environment. While this works
fine with openembedded, it does break normal workflows outside of it.
For example to get the SDK working with Qt Creator either the environmental
script most be sourced first, making it impossible to switch between
different Qt versions or the OE_QMAKE must be set for every project,
otherwise you get cryptic errors like 'make: c: Command not found',
since the compiler name is not set and hence an attempt is made to
execute only the arguments.

Likewise on the target itself, qmake doesn't work without first setting
the OE_QMAKE variables.

This patch adds default toolchains options, so it is no longer required
to set them, but keeps the flexibility to alter them from the environment.

Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Jeroen Hofstee
2017-11-21 10:51:23 +01:00
committed by Martin Jansa
parent d27c0199db
commit aeeaa939c7

View File

@@ -217,6 +217,28 @@ do_install_append() {
sed -i -e 's|${STAGING_DIR_NATIVE}|$$[QT_HOST_PREFIX/get]|g' \
-e 's|${STAGING_DIR_HOST}|$$[QT_SYSROOT]|g' \
${D}/${OE_QMAKE_PATH_QT_ARCHDATA}/mkspecs/*.pri
# Update the mkspecs to include the default OE toolchain config for the target
conf=${D}/${OE_QMAKE_PATH_QT_ARCHDATA}/mkspecs/${XPLATFORM}/qmake.conf
# qmake already knows the sysroot, see above $$[QT_SYSROOT], so remove the hardcoded sysroot
OE_QMAKE_CC_NO_SYSROOT=$(echo ${OE_QMAKE_CC} | sed -e 's!--sysroot=[^ ]*!!g')
OE_QMAKE_CXX_NO_SYSROOT=$(echo ${OE_QMAKE_CXX} | sed -e 's!--sysroot=[^ ]*!!g')
OE_QMAKE_LINK_NO_SYSROOT=$(echo ${OE_QMAKE_LINK} | sed -e 's!--sysroot=[^ ]*!!g')
echo "" >> $conf
echo "# default compiler options which can be overwritten from the environment" >> $conf
echo "isEmpty(QMAKE_AR): QMAKE_AR = ${OE_QMAKE_AR} cqs" >> $conf
echo "isEmpty(QMAKE_CC): QMAKE_CC = $OE_QMAKE_CC_NO_SYSROOT" >> $conf
echo "isEmpty(QMAKE_CFLAGS): QMAKE_CFLAGS = ${OE_QMAKE_CFLAGS}" >> $conf
echo "isEmpty(QMAKE_CXX): QMAKE_CXX = $OE_QMAKE_CXX_NO_SYSROOT" >> $conf
echo "isEmpty(QMAKE_CXXFLAGS): QMAKE_CXXFLAGS = ${OE_QMAKE_CXXFLAGS}" >> $conf
echo "isEmpty(QMAKE_LINK): QMAKE_LINK = $OE_QMAKE_LINK_NO_SYSROOT" >> $conf
echo "isEmpty(QMAKE_LINK_SHLIB): QMAKE_LINK_SHLIB = $OE_QMAKE_LINK_NO_SYSROOT" >> $conf
echo "isEmpty(QMAKE_LINK_C): QMAKE_LINK_C = $OE_QMAKE_LINK_NO_SYSROOT" >> $conf
echo "isEmpty(QMAKE_LINK_C_SHLIB): QMAKE_LINK_C_SHLIB = $OE_QMAKE_LINK_NO_SYSROOT" >> $conf
echo "isEmpty(QMAKE_LFLAGS): QMAKE_LFLAGS = ${OE_QMAKE_LDFLAGS}" >> $conf
echo "isEmpty(QMAKE_STRIP): QMAKE_STRIP = ${TARGET_PREFIX}strip" >> $conf
}
# mkspecs have mac specific scripts that depend on perl and bash