revamp -sysroot and -hostprefix handling
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Tue, 28 Feb 2012 19:57:38 +0000 (20:57 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 1 Mar 2012 22:18:23 +0000 (23:18 +0100)
instead of being a variable added to the makespec (via qconfig.pri),
QT_SYSROOT is now a property.

the QT_INSTALL_... properties are now automatically prefixed with the
sysroot; the raw values are available as QT_RAW_INSTALL_... - this is
expected to cause the least migration effort for existing projects.

-hostprefix and the new -hostbindir & -hostdatadir now feed the new
QT_HOST_... properties.

adapted the qmake feature files and the qtbase build system accordingly.

Change-Id: Iaa9b65bc10d9fe9c4988d620c70a8ce72177f8d4
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
19 files changed:
configure
dist/changes-5.0.0
mkspecs/features/default_pre.prf
mkspecs/features/module.prf
mkspecs/features/qt_config.prf
mkspecs/features/qt_functions.prf
mkspecs/features/qt_module.prf
mkspecs/features/qt_module_config.prf
qmake/generators/makefile.cpp
qmake/generators/win32/msvc_vcproj.cpp
qmake/project.cpp
qmake/property.cpp
qtbase.pro
src/corelib/global/qlibraryinfo.cpp
src/corelib/global/qlibraryinfo.h
src/tools/moc/moc.pro
src/tools/rcc/rcc.pro
src/tools/uic/uic.pro
tools/configure/configureapp.cpp

index 7aa8ada..de65cdc 100755 (executable)
--- a/configure
+++ b/configure
@@ -825,7 +825,10 @@ QT_INSTALL_TRANSLATIONS=
 QT_INSTALL_SETTINGS=
 QT_INSTALL_EXAMPLES=
 QT_INSTALL_TESTS=
+CFG_SYSROOT=
 QT_HOST_PREFIX=
+QT_HOST_BINS=
+QT_HOST_DATA=
 
 #flags for SQL drivers
 QT_CFLAGS_PSQL=
@@ -978,7 +981,7 @@ while [ "$#" -gt 0 ]; do
         shift
         VAL=$1
         ;;
-    -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-sdk|-arch|-host-arch|-mysql_config|-sysroot)
+    -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir)
         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
         shift
         VAL="$1"
@@ -1169,6 +1172,12 @@ while [ "$#" -gt 0 ]; do
     hostprefix)
        QT_HOST_PREFIX="$VAL"
        ;;
+    hostdatadir)
+        QT_HOST_DATA="$VAL"
+        ;;
+    hostbindir)
+        QT_HOST_BINS="$VAL"
+        ;;
     force-pkg-config)
         QT_FORCE_PKGCONFIG=yes
         ;;
@@ -3116,6 +3125,40 @@ if [ -z "$QT_INSTALL_TESTS" ]; then #default
 fi
 QT_INSTALL_TESTS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_TESTS"`
 
+#------- host paths --------
+
+if [ -z "$QT_HOST_PREFIX" ]; then
+    QT_HOST_PREFIX=$QT_INSTALL_PREFIX
+    haveHpx=false
+else
+    QT_HOST_PREFIX=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_PREFIX"`
+    haveHpx=true
+fi
+
+if [ -z "$QT_HOST_BINS" ]; then #default
+    if $haveHpx; then
+        if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
+            if [ "$BUILD_ON_MAC" = "yes" ]; then
+                QT_HOST_BINS="/Developer/Applications/Qt"
+            fi
+        fi
+        [ -z "$QT_HOST_BINS" ] && QT_HOST_BINS="$QT_HOST_PREFIX/bin" #fallback
+    else
+        QT_HOST_BINS="$QT_INSTALL_BINS"
+    fi
+fi
+QT_HOST_BINS=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_BINS"`
+
+if [ -z "$QT_HOST_DATA" ]; then #default
+    if $haveHpx; then
+        QT_HOST_DATA="$QT_HOST_PREFIX"
+    else
+        QT_HOST_DATA="$QT_INSTALL_DATA"
+    fi
+else
+    QT_HOST_DATA=`"$relpath/config.tests/unix/makeabs" "$QT_HOST_DATA"`
+fi
+
 #-------------------------------------------------------------------------------
 # help - interactive parts of the script _after_ this section please
 #-------------------------------------------------------------------------------
@@ -3233,6 +3276,7 @@ cat <<EOF
     -hostprefix [dir] .. Tools and libraries needed when developing
                          applications are installed in [dir]. If [dir] is
                          not given, the current build directory will be used.
+                         (default PREFIX)
 EOF
 fi
 cat <<EOF
@@ -3269,6 +3313,17 @@ cat <<EOF
                             (default PREFIX/examples)
     -testsdir <dir> ....... Tests will be installed to <dir>
                             (default PREFIX/tests)
+EOF
+if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then
+cat <<EOF
+
+    -hostbindir <dir> .. Host executables will be installed to <dir>
+                         (default HOSTPREFIX/bin)
+    -hostdatadir <dir> . Data used by qmake will be installed to <dir>
+                         (default HOSTPREFIX)
+EOF
+fi
+cat <<EOF
 
 Configure options:
 
@@ -3987,33 +4042,7 @@ static const char qt_configure_licensed_products_str [256 + 12] = "qt_lcnsprod=$
 
 /* Installation date */
 static const char qt_configure_installation          [12+11]    = "qt_instdate=`date +%Y-%m-%d`";
-EOF
 
-
-if [ ! -z "$QT_HOST_PREFIX" ]; then
-    cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
-
-#if defined(QT_BOOTSTRAPPED) || defined(QT_BUILD_QMAKE)
-/* Installation Info */
-static const char qt_configure_prefix_path_strs[][256 + 12] = {
-    "qt_prfxpath=$QT_HOST_PREFIX",
-    "qt_docspath=$QT_HOST_PREFIX/doc",
-    "qt_hdrspath=$QT_HOST_PREFIX/include",
-    "qt_libspath=$QT_HOST_PREFIX/lib",
-    "qt_binspath=$QT_HOST_PREFIX/bin",
-    "qt_plugpath=$QT_HOST_PREFIX/plugins",
-    "qt_impspath=$QT_HOST_PREFIX/IMPORTS",
-    "qt_datapath=$QT_HOST_PREFIX",
-    "qt_trnspath=$QT_HOST_PREFIX/translations",
-    "qt_xmplpath=$QT_INSTALL_EXAMPLES",
-    "qt_tstspath=$QT_INSTALL_TESTS",
-};
-static const char qt_configure_settings_path_str[256 + 12] = "qt_stngpath=$QT_INSTALL_SETTINGS";
-#else // QT_BOOTSTRAPPED
-EOF
-fi
-
-cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
 /* Installation Info */
 static const char qt_configure_prefix_path_strs[][256 + 12] = {
     "qt_prfxpath=$QT_INSTALL_PREFIX",
@@ -4027,17 +4056,16 @@ static const char qt_configure_prefix_path_strs[][256 + 12] = {
     "qt_trnspath=$QT_INSTALL_TRANSLATIONS",
     "qt_xmplpath=$QT_INSTALL_EXAMPLES",
     "qt_tstspath=$QT_INSTALL_TESTS",
+#ifdef QT_BUILD_QMAKE
+    "qt_ssrtpath=$CFG_SYSROOT",
+    "qt_hpfxpath=$QT_HOST_PREFIX",
+    "qt_hbinpath=$QT_HOST_BINS",
+    "qt_hdatpath=$QT_HOST_DATA",
+#endif
 };
 static const char qt_configure_settings_path_str[256 + 12] = "qt_stngpath=$QT_INSTALL_SETTINGS";
 EOF
 
-if [ ! -z "$QT_HOST_PREFIX" ]; then
-    cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
-#endif // QT_BOOTSTRAPPED
-
-EOF
-fi
-
 cat >> "$outpath/src/corelib/global/qconfig.cpp.new" <<EOF
 
 /* strlen( "qt_lcnsxxxx" ) == 12 */
@@ -6781,10 +6809,9 @@ EOF
 if [ -n "$CFG_SYSROOT" ]; then
     echo "# sysroot" >>"$QTCONFIG.tmp"
     echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
-    echo "  QT_SYSROOT      += \$\$quote($CFG_SYSROOT)" >>"$QTCONFIG.tmp"
-    echo "  QMAKE_CFLAGS    += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
-    echo "  QMAKE_CXXFLAGS  += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
-    echo "  QMAKE_LFLAGS    += --sysroot=\$\$QT_SYSROOT" >>"$QTCONFIG.tmp"
+    echo "    QMAKE_CFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
+    echo "    QMAKE_CXXFLAGS  += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
+    echo "    QMAKE_LFLAGS    += --sysroot=\$\$[QT_SYSROOT]" >>"$QTCONFIG.tmp"
     echo "}" >> "$QTCONFIG.tmp"
     echo >> "$QTCONFIG.tmp"
 fi
index e1f1f07..ca9047b 100644 (file)
@@ -202,7 +202,11 @@ information about a particular change.
 
 - qmake
   * Projects which explicitly set an empty TARGET are considered broken now.
-  * several functions and built-in variables were modified to return normalized paths.
+  * Configure's -sysroot and -hostprefix are now handled slightly differently.
+    The QT_INSTALL_... properties are now automatically prefixed with the sysroot;
+    the raw values are available as QT_RAW_INSTALL_... and the sysroot as QT_SYSROOT.
+    The new QT_HOST_... properties can be used to refer to the Qt host tools.
+  * Several functions and built-in variables were modified to return normalized paths.
 
 - QTextCodecPlugin has been removed since it is no longer used. All text codecs
   are now built into QtCore.
index 1a56787..aa70639 100644 (file)
@@ -26,10 +26,10 @@ CONFIG = lex yacc warn_on debug uic resources $$CONFIG
         # can we tell syncqt to do a -developer-build
         win32 {
             CMP_QDIR = $$upper($$QTDIR)
-            CMP_INSTALL_PREFIX = $$upper($$[QT_INSTALL_PREFIX])
+            CMP_INSTALL_PREFIX = $$upper($$[QT_HOST_PREFIX])
         } else {
             CMP_QDIR = $$QTDIR
-            CMP_INSTALL_PREFIX = $$[QT_INSTALL_PREFIX]
+            CMP_INSTALL_PREFIX = $$[QT_HOST_PREFIX]
         }
         contains(CMP_QDIR, $$CMP_INSTALL_PREFIX):QTFWD = -qtdir $$QTDIR -module-fwd $$QTDIR/mkspecs/modules -developer-build
         unset(CMP_QDIR)
index 85639f0..d95c7a4 100644 (file)
@@ -1,5 +1,5 @@
 !isEmpty(MODULE_PRI) {
-    pritarget.path = $$[QT_INSTALL_DATA]/mkspecs/modules
+    pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
     pritarget.files = $$MODULE_PRI
     INSTALLS += pritarget
 } else {
index 8441728..8d0dcce 100644 (file)
@@ -8,7 +8,7 @@ exists($$_QMAKE_CACHE_) {
 isEmpty(QMAKE_QT_CONFIG)|!exists($$QMAKE_QT_CONFIG) {
    !isEmpty(QT_BUILD_TREE):QMAKE_QT_CONFIG = $$QT_BUILD_TREE
    else:exists($$_QMAKE_CACHE_):QMAKE_QT_CONFIG = $$fromfile($$_QMAKE_CACHE_, QT_BUILD_TREE)
-   isEmpty(QMAKE_QT_CONFIG):QMAKE_QT_CONFIG = $$[QT_INSTALL_DATA]
+   isEmpty(QMAKE_QT_CONFIG):QMAKE_QT_CONFIG = $$[QT_HOST_DATA]
    QMAKE_QT_CONFIG = $$QMAKE_QT_CONFIG/mkspecs/qconfig.pri
 }
 !exists($$QMAKE_QT_CONFIG)|!include($$QMAKE_QT_CONFIG, "", true) {
index 65eec35..31b2815 100644 (file)
@@ -132,7 +132,7 @@ defineTest(qtAddModule) {
 
     isEmpty(LINKAGE) {
        # Make sure we can link to uninstalled libraries
-       !isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) {
+       !isEqual(MODULE_LIBS, $$[QT_INSTALL_LIBS]) { ### XXX
            QMAKE_LIBDIR *= $$MODULE_LIBS
            unix:!mac:QMAKE_LFLAGS *= "-Wl,-rpath-link,$$MODULE_LIBS"
        }
@@ -164,7 +164,7 @@ defineTest(qtAddModule) {
 
 # variable, default
 defineTest(qtPrepareTool) {
-    MODBASE = $$[QT_INSTALL_BINS]
+    MODBASE = $$[QT_HOST_BINS]
     !isEmpty(QT_BUILD_TREE):MODBASE = $$QT_BUILD_TREE/bin
     count(ARGS, 2, greaterThan) {
         isEmpty(QT.$${3}.bins):warning("No QT.$${3}.bins, module path ignored for qtPrepareTool($$1, $$2, $$3)")
index aee9529..b71ef61 100644 (file)
@@ -8,7 +8,7 @@ isEmpty(QMAKE_QT_MODULE)|!exists($$QMAKE_QT_MODULE) {
    !exists($$QMAKE_QT_MODULE):exists($$QMAKE_CACHE_DIR/mkspecs/qmodule.pri):QMAKE_QT_MODULE = $$QMAKE_CACHE_DIR/mkspecs/qmodule.pri
    !exists($$QMAKE_QT_MODULE):exists($$QMAKE_CACHE_DIR/qtbase/mkspecs/qmodule.pri):QMAKE_QT_MODULE = $$QMAKE_CACHE_DIR/qtbase/mkspecs/qmodule.pri
    !exists($$QMAKE_QT_MODULE):if(!isEmpty(QT_BUILD_TREE) & exists($$QT_BUILD_TREE/mkspecs/qmodule.pri)):QMAKE_QT_MODULE = $$QT_BUILD_TREE/mkspecs/qmodule.pri
-   !exists($$QMAKE_QT_MODULE):exists($$[QT_INSTALL_DATA]/mkspecs/qmodule.pri):QMAKE_QT_MODULE = $$[QT_INSTALL_DATA]/mkspecs/qmodule.pri
+   !exists($$QMAKE_QT_MODULE):exists($$[QT_HOST_DATA]/mkspecs/qmodule.pri):QMAKE_QT_MODULE = $$[QT_HOST_DATA]/mkspecs/qmodule.pri
 }
 
 !contains(QMAKE_INTERNAL_INCLUDED_FILES, .*qmodule\\.pri) {
index a843919..ad69906 100644 (file)
@@ -118,18 +118,18 @@ load(qt_installs)
 
 unix {
    CONFIG     += create_libtool create_pc explicitlib
-   QMAKE_LIBTOOL_LIBDIR = $$[QT_INSTALL_LIBS]
-   QMAKE_PRL_LIBDIR = $$[QT_INSTALL_LIBS]
-   QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
-   QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
-   QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
+   QMAKE_LIBTOOL_LIBDIR = $$[QT_RAW_INSTALL_LIBS]
+   QMAKE_PRL_LIBDIR = $$[QT_RAW_INSTALL_LIBS] ### XXX
+   QMAKE_PKGCONFIG_LIBDIR = $$[QT_RAW_INSTALL_LIBS]
+   QMAKE_PKGCONFIG_INCDIR = $$[QT_RAW_INSTALL_HEADERS]/$$TARGET
+   QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_RAW_INSTALL_HEADERS]
    QMAKE_PKGCONFIG_DESTDIR = pkgconfig
    include_replace.match = $$QMAKE_INCDIR_QT
-   include_replace.replace = $$[QT_INSTALL_HEADERS]
+   include_replace.replace = $$[QT_RAW_INSTALL_HEADERS]
    lib_replace.match = $$QMAKE_LIBDIR_QT
-   lib_replace.replace = $$[QT_INSTALL_LIBS]
+   lib_replace.replace = $$[QT_RAW_INSTALL_LIBS]
    prefix_replace.match = $$QT_BUILD_TREE
-   prefix_replace.replace = $$[QT_INSTALL_PREFIX]
+   prefix_replace.replace = $$[QT_RAW_INSTALL_PREFIX]
    QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
    QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace
    QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace
@@ -137,9 +137,9 @@ unix {
 
 win32-g++* {
    CONFIG += create_pc
-   QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
-   QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
-   QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
+   QMAKE_PKGCONFIG_LIBDIR = $$[QT_RAW_INSTALL_LIBS]
+   QMAKE_PKGCONFIG_INCDIR = $$[QT_RAW_INSTALL_HEADERS]/$$TARGET
+   QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_RAW_INSTALL_HEADERS]
    QMAKE_PKGCONFIG_DESTDIR = pkgconfig
 }
 
index 59a615e..45cb250 100644 (file)
@@ -3178,7 +3178,7 @@ MakefileGenerator::pkgConfigPrefix() const
 {
     if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX"))
         return project->first("QMAKE_PKGCONFIG_PREFIX");
-    return QLibraryInfo::location(QLibraryInfo::PrefixPath);
+    return QLibraryInfo::rawLocation(QLibraryInfo::PrefixPath);
 }
 
 QString
index 109b50f..434d4b4 100644 (file)
@@ -1575,11 +1575,11 @@ QString VcprojGenerator::findTemplate(QString file)
     QString ret;
     if(!exists((ret = file)) &&
        !exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) &&
-       !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc.net/" + file))) &&
-       !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2002/" + file))) &&
-       !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2003/" + file))) &&
-       !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2005/" + file))) &&
-       !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::DataPath) + "/win32-msvc2008/" + file))))
+       !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::HostDataPath) + "/win32-msvc.net/" + file))) &&
+       !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::HostDataPath) + "/win32-msvc2002/" + file))) &&
+       !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::HostDataPath) + "/win32-msvc2003/" + file))) &&
+       !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::HostDataPath) + "/win32-msvc2005/" + file))) &&
+       !exists((ret = QString(QLibraryInfo::location(QLibraryInfo::HostDataPath) + "/win32-msvc2008/" + file))))
         return "";
     debug_msg(1, "Generator: MSVC.NET: Found template \'%s\'", ret.toLatin1().constData());
     return ret;
index 52f2206..bfd4511 100644 (file)
@@ -592,7 +592,7 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0)
     }
     for(QStringList::Iterator concat_it = concat.begin();
         concat_it != concat.end(); ++concat_it)
-        feature_roots << (QLibraryInfo::location(QLibraryInfo::DataPath) +
+        feature_roots << (QLibraryInfo::location(QLibraryInfo::HostDataPath) +
                           mkspecs_concat + (*concat_it));
     return feature_roots;
 }
@@ -607,7 +607,7 @@ QStringList qmake_mkspec_paths()
         for(QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
             ret << ((*it) + concat);
     }
-    ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat;
+    ret << QLibraryInfo::location(QLibraryInfo::HostDataPath) + concat;
 
     return ret;
 }
@@ -3113,7 +3113,7 @@ QStringList &QMakeProject::values(const QString &_var, QHash<QString, QStringLis
             place[var] = QStringList(Option::fixPathToTargetOS(
                 !Option::qmake_abslocation.isEmpty()
                     ? Option::qmake_abslocation
-                    : QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmake",
+                    : QLibraryInfo::location(QLibraryInfo::HostBinariesPath) + "/qmake",
                 false));
     }
 #if defined(Q_OS_WIN32) && defined(Q_CC_MSVC)
index dec204c..7cb689e 100644 (file)
@@ -54,27 +54,45 @@ QStringList qmake_mkspec_paths(); //project.cpp
 static const struct {
     const char *name;
     QLibraryInfo::LibraryLocation loc;
+    bool raw;
 } propList[] = {
-    { "QT_INSTALL_PREFIX", QLibraryInfo::PrefixPath },
-    { "QT_INSTALL_DATA", QLibraryInfo::DataPath },
-    { "QT_INSTALL_DOCS", QLibraryInfo::DocumentationPath },
-    { "QT_INSTALL_HEADERS", QLibraryInfo::HeadersPath },
-    { "QT_INSTALL_LIBS", QLibraryInfo::LibrariesPath },
-    { "QT_INSTALL_BINS", QLibraryInfo::BinariesPath },
-    { "QT_INSTALL_TESTS", QLibraryInfo::TestsPath },
-    { "QT_INSTALL_PLUGINS", QLibraryInfo::PluginsPath },
-    { "QT_INSTALL_IMPORTS", QLibraryInfo::ImportsPath },
-    { "QT_INSTALL_TRANSLATIONS", QLibraryInfo::TranslationsPath },
-    { "QT_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath },
-    { "QT_INSTALL_EXAMPLES", QLibraryInfo::ExamplesPath },
-    { "QT_INSTALL_DEMOS", QLibraryInfo::ExamplesPath }, // Just backwards compat
+    { "QT_SYSROOT", QLibraryInfo::SysrootPath, true },
+    { "QT_INSTALL_PREFIX", QLibraryInfo::PrefixPath, false },
+    { "QT_INSTALL_DATA", QLibraryInfo::DataPath, false },
+    { "QT_INSTALL_DOCS", QLibraryInfo::DocumentationPath, false },
+    { "QT_INSTALL_HEADERS", QLibraryInfo::HeadersPath, false },
+    { "QT_INSTALL_LIBS", QLibraryInfo::LibrariesPath, false },
+    { "QT_INSTALL_BINS", QLibraryInfo::BinariesPath, false },
+    { "QT_INSTALL_TESTS", QLibraryInfo::TestsPath, false },
+    { "QT_INSTALL_PLUGINS", QLibraryInfo::PluginsPath, false },
+    { "QT_INSTALL_IMPORTS", QLibraryInfo::ImportsPath, false },
+    { "QT_INSTALL_TRANSLATIONS", QLibraryInfo::TranslationsPath, false },
+    { "QT_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath, false },
+    { "QT_INSTALL_EXAMPLES", QLibraryInfo::ExamplesPath, false },
+    { "QT_INSTALL_DEMOS", QLibraryInfo::ExamplesPath, false }, // Just backwards compat
+    { "QT_RAW_INSTALL_PREFIX", QLibraryInfo::PrefixPath, true },
+    { "QT_RAW_INSTALL_DATA", QLibraryInfo::DataPath, true },
+    { "QT_RAW_INSTALL_DOCS", QLibraryInfo::DocumentationPath, true },
+    { "QT_RAW_INSTALL_HEADERS", QLibraryInfo::HeadersPath, true },
+    { "QT_RAW_INSTALL_LIBS", QLibraryInfo::LibrariesPath, true },
+    { "QT_RAW_INSTALL_BINS", QLibraryInfo::BinariesPath, true },
+    { "QT_RAW_INSTALL_TESTS", QLibraryInfo::TestsPath, true },
+    { "QT_RAW_INSTALL_PLUGINS", QLibraryInfo::PluginsPath, true },
+    { "QT_RAW_INSTALL_IMPORTS", QLibraryInfo::ImportsPath, true },
+    { "QT_RAW_INSTALL_TRANSLATIONS", QLibraryInfo::TranslationsPath, true },
+    { "QT_RAW_INSTALL_CONFIGURATION", QLibraryInfo::SettingsPath, true },
+    { "QT_RAW_INSTALL_EXAMPLES", QLibraryInfo::ExamplesPath, true },
+    { "QT_HOST_PREFIX", QLibraryInfo::HostPrefixPath, true },
+    { "QT_HOST_DATA", QLibraryInfo::HostDataPath, true },
+    { "QT_HOST_BINS", QLibraryInfo::HostBinariesPath, true },
 };
 
 QMakeProperty::QMakeProperty() : settings(0)
 {
     for (int i = 0; i < sizeof(propList)/sizeof(propList[0]); i++)
-        m_values[QString::fromLatin1(propList[i].name)] =
-                QLibraryInfo::location(propList[i].loc);
+        m_values[QString::fromLatin1(propList[i].name)] = propList[i].raw
+                ? QLibraryInfo::rawLocation(propList[i].loc)
+                : QLibraryInfo::location(propList[i].loc);
 }
 
 QMakeProperty::~QMakeProperty()
index 5fc9cb3..01a5aa3 100644 (file)
@@ -98,7 +98,7 @@ CONFIG -= qt
 ### installations ####
 
 #qmake
-qmake.path=$$[QT_INSTALL_BINS]
+qmake.path = $$[QT_HOST_BINS]
 win32 {
    qmake.files=$$QT_BUILD_TREE/bin/qmake.exe
 } else {
@@ -107,18 +107,18 @@ win32 {
 INSTALLS += qmake
 
 #syncqt
-syncqt.path=$$[QT_INSTALL_BINS]
+syncqt.path = $$[QT_HOST_BINS]
 syncqt.files=$$QT_BUILD_TREE/bin/syncqt
 win32:syncqt.files=$$QT_BUILD_TREE/bin/syncqt.bat
 INSTALLS += syncqt
 
 #qtmodule-configtests
-configtests.path=$$[QT_INSTALL_BINS]
+configtests.path = $$[QT_HOST_BINS]
 configtests.files=$$QT_BUILD_TREE/bin/qtmodule-configtests
 INSTALLS += configtests
 
 #mkspecs
-mkspecs.path=$$[QT_INSTALL_DATA]/mkspecs
+mkspecs.path = $$[QT_HOST_DATA]/mkspecs
 mkspecs.files=$$QT_BUILD_TREE/mkspecs/qconfig.pri $$QT_BUILD_TREE/mkspecs/qmodule.pri $$files($$QT_SOURCE_TREE/mkspecs/*)
 mkspecs.files -= $$QT_SOURCE_TREE/mkspecs/modules
 unix { 
index c7f0cd1..4caacec 100644 (file)
@@ -228,16 +228,43 @@ static const struct {
     { "Translations", "translations" },
     { "Examples", "" },
     { "Tests", "tests" },
+#ifdef QT_BUILD_QMAKE
+    { "Sysroot", "" },
+    { "HostPrefix", "" },
+    { "HostBinaries", "bin" },
+    { "HostData", "" },
+#endif
 };
 
 /*!
   Returns the location specified by \a loc.
 
 */
-
 QString
 QLibraryInfo::location(LibraryLocation loc)
 {
+#ifdef QT_BUILD_QMAKE
+    QString ret = rawLocation(loc);
+
+    // Automatically prepend the sysroot to target paths
+    if (loc < SysrootPath || loc > LastHostPath) {
+        QString sysroot = rawLocation(SysrootPath);
+        if (!sysroot.isEmpty() && ret.length() > 2 && ret.at(1) == QLatin1Char(':')
+            && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\')))
+            ret.replace(0, 2, sysroot); // Strip out the drive on Windows targets
+        else
+            ret.prepend(sysroot);
+    }
+
+    return ret;
+}
+
+QString
+QLibraryInfo::rawLocation(LibraryLocation loc)
+{
+#else
+# define rawLocation location
+#endif
     QString ret;
     if(!QLibraryInfoPrivate::configuration()) {
         const char *path = 0;
@@ -284,11 +311,19 @@ QLibraryInfo::location(LibraryLocation loc)
 
     if (QDir::isRelativePath(ret)) {
         QString baseDir;
-        if (loc == PrefixPath) {
-            // we make the prefix path absolute to the executable's directory
 #ifdef QT_BUILD_QMAKE
+        if (loc == HostPrefixPath || loc == PrefixPath) {
+            // We make the prefix path absolute to the executable's directory.
+            // loc == PrefixPath while a sysroot is set would make no sense here.
             baseDir = QFileInfo(qmake_libraryInfoFile()).absolutePath();
+        } else if (loc == SysrootPath) {
+            // The sysroot is bare
+            return ret;
+        } else if (loc > SysrootPath && loc <= LastHostPath) {
+            // We make any other host path absolute to the host prefix directory.
+            baseDir = rawLocation(HostPrefixPath);
 #else
+        if (loc == PrefixPath) {
             if (QCoreApplication::instance()) {
 #ifdef Q_OS_MAC
                 CFBundleRef bundleRef = CFBundleGetMainBundle();
@@ -300,6 +335,7 @@ QLibraryInfo::location(LibraryLocation loc)
                     }
                 }
 #endif
+                // We make the prefix path absolute to the executable's directory.
                 baseDir = QCoreApplication::applicationDirPath();
             } else {
                 baseDir = QDir::currentPath();
@@ -307,7 +343,7 @@ QLibraryInfo::location(LibraryLocation loc)
 #endif
         } else {
             // we make any other path absolute to the prefix directory
-            baseDir = location(PrefixPath);
+            baseDir = rawLocation(PrefixPath);
         }
         ret = QDir::cleanPath(baseDir + QLatin1Char('/') + ret);
     }
index f6234d1..d180e63 100644 (file)
@@ -77,9 +77,21 @@ public:
         TranslationsPath,
         ExamplesPath,
         TestsPath,
+        // Insert new values above this line
+#ifdef QT_BUILD_QMAKE
+        // These are not subject to binary compatibility constraints
+        SysrootPath,
+        HostPrefixPath,
+        HostBinariesPath,
+        HostDataPath,
+        LastHostPath = HostDataPath,
+#endif
         SettingsPath = 100
     };
     static QString location(LibraryLocation); // ### Qt 5: consider renaming it to path()
+#ifdef QT_BUILD_QMAKE
+    static QString rawLocation(LibraryLocation);
+#endif
 
 private:
     QLibraryInfo();
index 3ee5078..5c96c96 100644 (file)
@@ -13,6 +13,6 @@ HEADERS += qdatetime_p.h
 SOURCES += main.cpp
 include(../bootstrap/bootstrap.pri)
 
-target.path=$$[QT_INSTALL_BINS]
+target.path = $$[QT_HOST_BINS]
 INSTALLS += target
 load(qt_targets)
index 6c78642..e87ef60 100644 (file)
@@ -11,6 +11,6 @@ HEADERS += ../../corelib/kernel/qcorecmdlineargs_p.h
 SOURCES += main.cpp
 include(../bootstrap/bootstrap.pri)
 
-target.path=$$[QT_INSTALL_BINS]
+target.path = $$[QT_HOST_BINS]
 INSTALLS += target
 load(qt_targets)
index 7a95db8..0acc6e7 100644 (file)
@@ -22,6 +22,6 @@ linux-g++-maemo {
 
 include(../bootstrap/bootstrap.pri)
 
-target.path=$$[QT_INSTALL_BINS]
+target.path = $$[QT_HOST_BINS]
 INSTALLS += target
 load(qt_targets)
index e4c9bb2..504728a 100644 (file)
@@ -1063,11 +1063,33 @@ void Configure::parseCmdLine()
             dictionary[ "QT_INSTALL_TESTS" ] = configCmdLine.at(i);
         }
 
+        else if (configCmdLine.at(i) == "-sysroot") {
+            ++i;
+            if (i == argCount)
+                break;
+            dictionary[ "CFG_SYSROOT" ] = configCmdLine.at(i);
+        }
+
         else if (configCmdLine.at(i) == "-hostprefix") {
             ++i;
+            if (i == argCount || configCmdLine.at(i).startsWith('-'))
+                dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_BUILD_TREE" ];
+            else
+                dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
+        }
+
+        else if (configCmdLine.at(i) == "-hostbindir") {
+            ++i;
             if (i == argCount)
                 break;
-            dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
+            dictionary[ "QT_HOST_BINS" ] = configCmdLine.at(i);
+        }
+
+        else if (configCmdLine.at(i) == "-hostdatadir") {
+            ++i;
+            if (i == argCount)
+                break;
+            dictionary[ "QT_HOST_DATA" ] = configCmdLine.at(i);
         }
 
         else if (configCmdLine.at(i) == "-make") {
@@ -2381,6 +2403,16 @@ void Configure::generateOutputVars()
     if (!dictionary[ "QT_INSTALL_TESTS" ].size())
         dictionary[ "QT_INSTALL_TESTS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/tests");
 
+    bool haveHpx = false;
+    if (dictionary[ "QT_HOST_PREFIX" ].isEmpty())
+        dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ];
+    else
+        haveHpx = true;
+    if (dictionary[ "QT_HOST_BINS" ].isEmpty())
+        dictionary[ "QT_HOST_BINS" ] = haveHpx ? fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin") : dictionary[ "QT_INSTALL_BINS" ];
+    if (dictionary[ "QT_HOST_DATA" ].isEmpty())
+        dictionary[ "QT_HOST_DATA" ] = haveHpx ? dictionary[ "QT_HOST_PREFIX" ] : dictionary[ "QT_INSTALL_DATA" ];
+
     if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
         dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ];
 
@@ -2599,6 +2631,17 @@ void Configure::generateCachefile()
                      << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl
                      << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
 
+        if (!dictionary["CFG_SYSROOT"].isEmpty()) {
+            QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
+            configStream << endl
+                         << "# sysroot" << endl
+                         << targetSpec << " {" << endl
+                         << "    QMAKE_CFLAGS    += --sysroot=$$[QT_SYSROOT]" << endl
+                         << "    QMAKE_CXXFLAGS  += --sysroot=$$[QT_SYSROOT]" << endl
+                         << "    QMAKE_LFLAGS    += --sysroot=$$[QT_SYSROOT]" << endl
+                         << "}" << endl;
+        }
+
         configStream.flush();
         configFile.close();
     }
@@ -2854,10 +2897,8 @@ void Configure::generateConfigfiles()
                   << endl
                   << "/* Build date */" << endl
                   << "static const char qt_configure_installation          [11  + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl
-                  << endl;
-        if (!dictionary[ "QT_HOST_PREFIX" ].isNull())
-            tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl;
-        tmpStream << "static const char qt_configure_prefix_path_strs[][12 + 512] = {" << endl
+                  << endl
+                  << "static const char qt_configure_prefix_path_strs[][12 + 512] = {" << endl
                   << "    \"qt_prfxpath=" << escapeSeparators(dictionary["QT_INSTALL_PREFIX"]) << "\"," << endl
                   << "    \"qt_docspath=" << escapeSeparators(dictionary["QT_INSTALL_DOCS"]) << "\","  << endl
                   << "    \"qt_hdrspath=" << escapeSeparators(dictionary["QT_INSTALL_HEADERS"]) << "\","  << endl
@@ -2869,27 +2910,16 @@ void Configure::generateConfigfiles()
                   << "    \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\"," << endl
                   << "    \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\","  << endl
                   << "    \"qt_tstspath=" << escapeSeparators(dictionary["QT_INSTALL_TESTS"]) << "\","  << endl
+                  << "#ifdef QT_BUILD_QMAKE" << endl
+                  << "    \"qt_ssrtpath=" << escapeSeparators(dictionary["CFG_SYSROOT"]) << "\"," << endl
+                  << "    \"qt_hpfxpath=" << escapeSeparators(dictionary["QT_HOST_PREFIX"]) << "\"," << endl
+                  << "    \"qt_hbinpath=" << escapeSeparators(dictionary["QT_HOST_BINS"]) << "\"," << endl
+                  << "    \"qt_hdatpath=" << escapeSeparators(dictionary["QT_HOST_DATA"]) << "\"," << endl
+                  << "#endif" << endl
                   << "};" << endl
                   //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << escapeSeparators(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl
-                  ;
-        if (!dictionary[ "QT_HOST_PREFIX" ].isNull()) {
-             tmpStream << "#else" << endl
-                       << "static const char qt_configure_prefix_path_strs[][12 + 512] = {" << endl
-                       << "    \"qt_prfxpath=" << escapeSeparators(dictionary[ "QT_HOST_PREFIX" ]) << "\";" << endl
-                       << "    \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc", true) <<"\","  << endl
-                       << "    \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include", true) <<"\","  << endl
-                       << "    \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib", true) <<"\","  << endl
-                       << "    \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin", true) <<"\","  << endl
-                       << "    \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins", true) <<"\","  << endl
-                       << "    \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports", true) <<"\","  << endl
-                       << "    \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ], true) <<"\","  << endl
-                       << "    \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations", true) <<"\"," << endl
-                       << "    \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example", true) <<"\","  << endl
-                       << "    \"qt_tstspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/tests", true) <<"\","  << endl
-                       << "};" << endl
-                       << "#endif //QT_BOOTSTRAPPED" << endl;
-        }
-        tmpStream << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
+                  << endl
+                  << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
                   << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl
                   << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl
                   //<< "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl