Adding configure option: -no-gcc-sysroot

This option is important if you want to use configure's
and qmake's -sysroot (e.g. PKG_CONFIG settings, device-files),
but the toolchain (in combination with the rootfs)
is not able to handle gcc's --sysroot.
One known case is freescale's ltib setup where the toolchain
itself comes with all the essential files (e.g. crt1.o),
while the rootfs has none of those files, so gcc's
--sysroot can't be used. The rootfs on the other hand contains
all kinds of "less important" files/packages (e.g. libdbus).
For those "less important" files/packages Qt needs pkg-config
to be able to include/link properly. Therefore one needs
configures -sysroot without gcc's --sysroot.

Change-Id: Iaec9b07012f2945f3ecb3ced0ed95176721b5ecd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Thomas Senyk 2012-07-12 13:03:16 +02:00 committed by Qt by Nokia
parent 019b97fc4f
commit 1865405826
2 changed files with 15 additions and 5 deletions

11
configure vendored
View File

@ -835,6 +835,7 @@ QT_INSTALL_SETTINGS=
QT_INSTALL_EXAMPLES=
QT_INSTALL_TESTS=
CFG_SYSROOT=
CFG_GCC_SYSROOT="yes"
QT_HOST_PREFIX=
QT_HOST_BINS=
QT_HOST_DATA=
@ -1173,6 +1174,9 @@ while [ "$#" -gt 0 ]; do
sysroot)
CFG_SYSROOT="$VAL"
;;
gcc-sysroot)
CFG_GCC_SYSROOT="$VAL"
;;
bindir)
QT_INSTALL_BINS="$VAL"
;;
@ -2536,7 +2540,7 @@ if [ -n "$GCC_MACHINE_DUMP" ]; then
DeviceVar set GCC_MACHINE_DUMP $($TEST_COMPILER -dumpmachine)
fi
if [ -n "$CFG_SYSROOT" ]; then
if [ -n "$CFG_SYSROOT" ] && [ "$CFG_GCC_SYSROOT" = "yes" ]; then
SYSROOT_FLAG="--sysroot=$CFG_SYSROOT"
else
SYSROOT_FLAG=
@ -3183,7 +3187,8 @@ Additional options:
-xplatform target ... The target platform when cross-compiling.
-sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot.
-sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths.
-no-gcc-sysroot ..... When using -sysroot, it disables the passing of --sysroot to the compiler
-no-feature-<feature> Do not compile in <feature>.
-feature-<feature> .. Compile in <feature>. The available features
@ -5910,7 +5915,7 @@ if [ -n "$PKG_CONFIG_SYSROOT_DIR" ] || [ -n "$PKG_CONFIG_LIBDIR" ]; then
echo >> "$QTCONFIG.tmp"
fi
if [ -n "$CFG_SYSROOT" ]; then
if [ -n "$CFG_SYSROOT" ] && [ "$CFG_GCC_SYSROOT" = "yes"]; then
echo "# sysroot" >>"$QTCONFIG.tmp"
echo "!host_build {" >>"$QTCONFIG.tmp"
echo " QMAKE_CFLAGS += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"

View File

@ -239,6 +239,7 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "QT_GLIB" ] = "no";
dictionary[ "QT_ICONV" ] = "auto";
dictionary[ "QT_CUPS" ] = "auto";
dictionary[ "CFG_GCC_SYSROOT" ] = "yes";
//Only used when cross compiling.
dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg";
@ -1090,6 +1091,9 @@ void Configure::parseCmdLine()
break;
dictionary[ "CFG_SYSROOT" ] = configCmdLine.at(i);
}
else if (configCmdLine.at(i) == "-no-gcc-sysroot") {
dictionary[ "CFG_GCC_SYSROOT" ] = "no";
}
else if (configCmdLine.at(i) == "-hostprefix") {
++i;
@ -1692,7 +1696,8 @@ bool Configure::displayHelp()
desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n");
desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n");
desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' ');
desc( "-sysroot <dir>", "Sets <dir> as the target compiler's and qmake's sysroot.");
desc( "-sysroot <dir>", "Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths.");
desc( "-no-gcc-sysroot", "When using -sysroot, it disables the passing of --sysroot to the compiler ");
desc("NIS", "no", "-no-nis", "Do not build NIS support.");
desc("NIS", "yes", "-nis", "Build NIS support.");
@ -2957,7 +2962,7 @@ void Configure::generateQConfigPri()
<< "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl
<< "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
if (!dictionary["CFG_SYSROOT"].isEmpty()) {
if (!dictionary["CFG_SYSROOT"].isEmpty() && dictionary["CFG_GCC_SYSROOT"] == "yes") {
configStream << endl
<< "# sysroot" << endl
<< "!host_build {" << endl