From 3648eeddaed0cf31fba226ec713d2321f398974f Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Sat, 6 Apr 2013 13:15:07 +0200 Subject: [PATCH 03/14] Add -external-hostbindir option * when cross-compiling it's sometimes useful to use existing tools from machine (or in OpenEmbedded built with separate native recipe) when building for target * this way we can skip bootstraping tools we already have * qt_functions: temporary remove isEmpty check * now we assume that every build will provide QT_EXTERNAL_HOST_BINS value * isEmpty works correctly only with qmake variables (e.g. $$FOO - isEmpty(FOO)), but doesn't work with system properties like $$[FOO]. Upstream-Status: Pending Signed-off-by: Martin Jansa --- configure | 15 +++++++++++++++ mkspecs/features/qt_functions.prf | 9 ++++++++- mkspecs/features/qt_tool.prf | 3 +-- qmake/property.cpp | 1 + qtbase.pro | 12 +++++++++--- src/corelib/global/qlibraryinfo.cpp | 3 ++- src/corelib/global/qlibraryinfo.h | 1 + tools/configure/configureapp.cpp | 8 ++++++++ 8 files changed, 45 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 0e74f29..7f3f2f0 100755 --- a/configure +++ b/configure @@ -788,6 +788,7 @@ QT_HOST_BINS= QT_HOST_LIBS= QT_HOST_DATA= QT_EXT_PREFIX= +QT_EXTERNAL_HOST_BINS= #flags for SQL drivers QT_CFLAGS_PSQL= @@ -907,6 +908,7 @@ while [ "$#" -gt 0 ]; do -testsdir| \ -hostdatadir| \ -hostbindir| \ + -external-hostbindir| \ -hostlibdir| \ -extprefix| \ -sysroot| \ @@ -1120,6 +1122,9 @@ while [ "$#" -gt 0 ]; do extprefix) QT_EXT_PREFIX="$VAL" ;; + external-hostbindir) + QT_EXTERNAL_HOST_BINS="$VAL" + ;; pkg-config) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_PKGCONFIG="$VAL" @@ -2236,6 +2241,10 @@ Installation options: -hostdatadir . Data used by qmake will be installed to (default HOSTPREFIX) + -external-hostbindir Use external host executables instead of building them + (not used by defaut) + + Configure options: The defaults (*) are usually acceptable. A plus (+) denotes a default value @@ -3151,6 +3160,11 @@ fi # command line and environment validation #------------------------------------------------------------------------------- +# default is empty, don't call makeabs if it is empty +if [ ! -z "$QT_EXTERNAL_HOST_BINS" ]; then + QT_EXTERNAL_HOST_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_EXTERNAL_HOST_BINS"` +fi + # update QT_CONFIG to show our current predefined configuration CFG_QCONFIG_PATH=$relpath/src/corelib/global/qconfig-${CFG_QCONFIG}.h case "$CFG_QCONFIG" in @@ -3838,6 +3852,7 @@ static const char qt_configure_prefix_path_strs[][256 + 12] = { "qt_hbinpath=$QT_HOST_BINS", "qt_hlibpath=$QT_HOST_LIBS", "qt_hdatpath=$QT_HOST_DATA", + "qt_ebinpath=$QT_EXTERNAL_HOST_BINS", "qt_targspec=$shortxspec", "qt_hostspec=$shortspec", #endif diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 1dacfed..7229845 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -193,7 +193,14 @@ defineTest(qtAddRpathLink) { defineTest(qtPrepareTool) { $$1 = $$eval(QT_TOOL.$${2}.binary) isEmpty($$1) { - $$1 = $$[QT_HOST_BINS]/$$2 + $$1 = $$[QT_EXTERNAL_HOST_BINS]/$$2 + # for some reason isEmpty does not work here, FIXME before submitting upstream + # DEBUG 1: mkspecs/features/qt_functions.prf:198: calling built-in isEmpty(/OE/oe-core/tmp-eglibc/sysroots/x86_64-linux/usr/bin/qt5) + # DEBUG 1: mkspecs/features/qt_functions.prf:198: test function returned true + # DEBUG 1: mkspecs/features/qt_functions.prf:198: taking 'then' branch + !exists($$[QT_EXTERNAL_HOST_BINS]/$$2) { + $$1 = $$[QT_HOST_BINS]/$$2 + } exists($$eval($$1).pl) { $$1 = perl -w $$eval($$1).pl } else: contains(QMAKE_HOST.os, Windows) { diff --git a/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf index f0864f9..50bfac8 100644 --- a/mkspecs/features/qt_tool.prf +++ b/mkspecs/features/qt_tool.prf @@ -15,8 +15,7 @@ CONFIG += console # If we are doing a prefix build, create a "module" pri which enables # qtPrepareTool() to work with the non-installed build. -# Non-bootstrapped tools always need this because of the environment setup. -!build_pass:if(!host_build|!force_bootstrap|force_independent) { +!build_pass:if(!host_build|!force_bootstrap|force_independent):!exists($$[QT_EXTERNAL_HOST_BINS]) { isEmpty(MODULE):MODULE = $$TARGET !host_build|!force_bootstrap: MODULE_DEPENDS = $$replace(QT, -private$, _private) diff --git a/qmake/property.cpp b/qmake/property.cpp index e50485c..71291ad 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -75,6 +75,7 @@ static const struct { { "QT_HOST_DATA", QLibraryInfo::HostDataPath, true }, { "QT_HOST_BINS", QLibraryInfo::HostBinariesPath, true }, { "QT_HOST_LIBS", QLibraryInfo::HostLibrariesPath, true }, + { "QT_EXTERNAL_HOST_BINS", QLibraryInfo::ExternalHostBinariesPath, true }, { "QMAKE_SPEC", QLibraryInfo::HostSpecPath, true }, { "QMAKE_XSPEC", QLibraryInfo::TargetSpecPath, true }, }; diff --git a/qtbase.pro b/qtbase.pro index 140a137..4e01d5b 100644 --- a/qtbase.pro +++ b/qtbase.pro @@ -70,16 +70,22 @@ CONFIG -= qt #qmake qmake.path = $$[QT_HOST_BINS] +qmake.files = $$OUT_PWD/bin/qmake +!isEmpty($$[QT_EXTERNAL_HOST_BINS]) { + qmake.files = $$[QT_EXTERNAL_HOST_BINS]/bin/qmake +} equals(QMAKE_HOST.os, Windows) { - qmake.files = $$OUT_PWD/bin/qmake.exe -} else { - qmake.files = $$OUT_PWD/bin/qmake + qmake.files = $${qmake.files}.exe } INSTALLS += qmake #syncqt syncqt.path = $$[QT_HOST_BINS] syncqt.files = $$PWD/bin/syncqt.pl +syncqt.files = $$PWD/bin/syncqt.pl +!isEmpty($$[QT_EXTERNAL_HOST_BINS]) { + syncqt.files = $$[QT_EXTERNAL_HOST_BINS]/bin/syncqt.pl +} INSTALLS += syncqt # If we are doing a prefix build, create a "module" pri which enables diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index c647a16..da82913 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -281,7 +281,7 @@ QLibraryInfo::isDebugBuild() */ static const struct { - char key[19], value[13]; + char key[21], value[13]; } qtConfEntries[] = { { "Prefix", "." }, { "Documentation", "doc" }, // should be ${Data}/doc @@ -307,6 +307,7 @@ static const struct { { "HostBinaries", "bin" }, { "HostLibraries", "lib" }, { "HostData", "." }, + { "ExternalHostBinaries", "" }, { "TargetSpec", "" }, { "HostSpec", "" }, #endif diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 17864b5..a14bc0f 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -84,6 +84,7 @@ public: HostBinariesPath, HostLibrariesPath, HostDataPath, + ExternalHostBinariesPath, TargetSpecPath, HostSpecPath, LastHostPath = HostSpecPath, diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 5ab413a..50a192b 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1186,6 +1186,13 @@ void Configure::parseCmdLine() dictionary[ "QT_EXT_PREFIX" ] = configCmdLine.at(i); } + else if (configCmdLine.at(i) == "-external-hostbindir") { + ++i; + if (i == argCount) + break; + dictionary[ "QT_EXTERNAL_HOST_BINS" ] = configCmdLine.at(i); + } + else if (configCmdLine.at(i) == "-make-tool") { ++i; if (i == argCount) @@ -3852,6 +3859,7 @@ void Configure::generateQConfigCpp() << " \"qt_hbinpath=" << formatPath(dictionary["QT_HOST_BINS"]) << "\"," << endl << " \"qt_hlibpath=" << formatPath(dictionary["QT_HOST_LIBS"]) << "\"," << endl << " \"qt_hdatpath=" << formatPath(dictionary["QT_HOST_DATA"]) << "\"," << endl + << " \"qt_ebinpath=" << formatPath(dictionary["QT_EXTERNAL_HOST_BINS"]) << "\"," << endl << " \"qt_targspec=" << targSpec << "\"," << endl << " \"qt_hostspec=" << hostSpec << "\"," << endl << "#endif" << endl -- 1.8.5.3