From 012f799254eedc610e2e33842e62d2a184b14fcc Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 28 Feb 2012 20:57:38 +0100 Subject: revamp -sysroot and -hostprefix handling 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 --- configure | 103 +++++++++++++++++++++------------ dist/changes-5.0.0 | 6 +- mkspecs/features/default_pre.prf | 4 +- mkspecs/features/module.prf | 2 +- mkspecs/features/qt_config.prf | 2 +- mkspecs/features/qt_functions.prf | 4 +- mkspecs/features/qt_module.prf | 2 +- mkspecs/features/qt_module_config.prf | 22 +++---- qmake/generators/makefile.cpp | 2 +- qmake/generators/win32/msvc_vcproj.cpp | 10 ++-- qmake/project.cpp | 6 +- qmake/property.cpp | 48 ++++++++++----- qtbase.pro | 8 +-- src/corelib/global/qlibraryinfo.cpp | 44 ++++++++++++-- src/corelib/global/qlibraryinfo.h | 12 ++++ src/tools/moc/moc.pro | 2 +- src/tools/rcc/rcc.pro | 2 +- src/tools/uic/uic.pro | 2 +- tools/configure/configureapp.cpp | 78 +++++++++++++++++-------- 19 files changed, 243 insertions(+), 116 deletions(-) diff --git a/configure b/configure index 7aa8adaa43..de65cdc7bc 100755 --- 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 < ....... Tests will be installed to (default PREFIX/tests) +EOF +if [ "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "yes" ]; then +cat < .. Host executables will be installed to + (default HOSTPREFIX/bin) + -hostdatadir . Data used by qmake will be installed to + (default HOSTPREFIX) +EOF +fi +cat <> "$outpath/src/corelib/global/qconfig.cpp.new" <> "$outpath/src/corelib/global/qconfig.cpp.new" <> "$outpath/src/corelib/global/qconfig.cpp.new" <> "$outpath/src/corelib/global/qconfig.cpp.new" <>"$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 diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index e1f1f07203..ca9047b682 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -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. diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf index 1a56787d15..aa706393a5 100644 --- a/mkspecs/features/default_pre.prf +++ b/mkspecs/features/default_pre.prf @@ -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) diff --git a/mkspecs/features/module.prf b/mkspecs/features/module.prf index 85639f0345..d95c7a418d 100644 --- a/mkspecs/features/module.prf +++ b/mkspecs/features/module.prf @@ -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 { diff --git a/mkspecs/features/qt_config.prf b/mkspecs/features/qt_config.prf index 8441728815..8d0dcce92c 100644 --- a/mkspecs/features/qt_config.prf +++ b/mkspecs/features/qt_config.prf @@ -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) { diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 65eec35bfc..31b28156e8 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -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)") diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index aee95295e8..b71ef61252 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -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) { diff --git a/mkspecs/features/qt_module_config.prf b/mkspecs/features/qt_module_config.prf index a8439198df..ad6990657b 100644 --- a/mkspecs/features/qt_module_config.prf +++ b/mkspecs/features/qt_module_config.prf @@ -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 } diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 59a615e63a..45cb250fe1 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -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 diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 109b50fd94..434d4b4559 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -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; diff --git a/qmake/project.cpp b/qmake/project.cpp index 52f2206410..bfd4511f2f 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -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 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); } diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index f6234d1eb4..d180e63198 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -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(); diff --git a/src/tools/moc/moc.pro b/src/tools/moc/moc.pro index 3ee507855c..5c96c96a4c 100644 --- a/src/tools/moc/moc.pro +++ b/src/tools/moc/moc.pro @@ -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) diff --git a/src/tools/rcc/rcc.pro b/src/tools/rcc/rcc.pro index 6c78642406..e87ef605b9 100644 --- a/src/tools/rcc/rcc.pro +++ b/src/tools/rcc/rcc.pro @@ -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) diff --git a/src/tools/uic/uic.pro b/src/tools/uic/uic.pro index 7a95db861f..0acc6e77c8 100644 --- a/src/tools/uic/uic.pro +++ b/src/tools/uic/uic.pro @@ -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) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index e4c9bb2010..504728abc8 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -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 -- cgit v1.2.3