diff --git a/configure b/configure index 09966e8e1bf..78ff04a474c 100755 --- a/configure +++ b/configure @@ -129,26 +129,6 @@ DEVICE_VARS_FILE=.device.vars # utility functions #------------------------------------------------------------------------------- -makeabs() -{ - local FILE="$1" - local RES="$FILE" - if [ -z "${FILE##/*}" ]; then - true - elif [ "$OSTYPE" = "msys" -a -z "${FILE##[a-zA-Z]:[/\\]*}" ]; then - true - else - RES=$PWD/$FILE - fi - RES=$RES/ - while true; do - nres=`echo "$RES" | sed 's,/[^/][^/]*/\.\./,/,g; s,/\./,/,g'` - test x"$nres" = x"$RES" && break - RES=$nres - done - echo "$RES" | sed 's,//,/,g; s,/$,,' -} - # Helper function for getQMakeConf. It parses include statements in # qmake.conf and prints out the expanded file expandQMakeConf() @@ -443,29 +423,6 @@ CFG_SILENT=no OPT_MAC_SDK= CFG_DEV=no -# initalize variables used for installation -QT_INSTALL_PREFIX= -QT_INSTALL_DOCS= -QT_INSTALL_HEADERS= -QT_INSTALL_LIBS= -QT_INSTALL_BINS= -QT_INSTALL_LIBEXECS= -QT_INSTALL_PLUGINS= -QT_INSTALL_IMPORTS= -QT_INSTALL_QML= -QT_INSTALL_ARCHDATA= -QT_INSTALL_DATA= -QT_INSTALL_TRANSLATIONS= -QT_INSTALL_SETTINGS= -QT_INSTALL_EXAMPLES= -QT_INSTALL_TESTS= -CFG_SYSROOT= -QT_HOST_PREFIX= -QT_HOST_BINS= -QT_HOST_LIBS= -QT_HOST_DATA= -QT_EXT_PREFIX= - # Android vars CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT @@ -590,72 +547,9 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=no case "$VAR" in - prefix) - QT_INSTALL_PREFIX="$VAL" - ;; - hostprefix) - QT_HOST_PREFIX="$VAL" - ;; - hostdatadir) - QT_HOST_DATA="$VAL" - ;; - hostbindir) - QT_HOST_BINS="$VAL" - ;; - hostlibdir) - QT_HOST_LIBS="$VAL" - ;; - extprefix) - QT_EXT_PREFIX="$VAL" - ;; - docdir) - QT_INSTALL_DOCS="$VAL" - ;; - headerdir) - QT_INSTALL_HEADERS="$VAL" - ;; - plugindir) - QT_INSTALL_PLUGINS="$VAL" - ;; - importdir) - QT_INSTALL_IMPORTS="$VAL" - ;; - qmldir) - QT_INSTALL_QML="$VAL" - ;; - archdatadir) - QT_INSTALL_ARCHDATA="$VAL" - ;; - datadir) - QT_INSTALL_DATA="$VAL" - ;; - libdir) - QT_INSTALL_LIBS="$VAL" - ;; - translationdir) - QT_INSTALL_TRANSLATIONS="$VAL" - ;; - sysconfdir|settingsdir) - QT_INSTALL_SETTINGS="$VAL" - ;; - examplesdir) - QT_INSTALL_EXAMPLES="$VAL" - ;; - testsdir) - QT_INSTALL_TESTS="$VAL" - ;; - sysroot) - CFG_SYSROOT="$VAL" - ;; external-hostbindir) CFG_HOST_QT_TOOLS_PATH="$VAL" ;; - bindir) - QT_INSTALL_BINS="$VAL" - ;; - libexecdir) - QT_INSTALL_LIBEXECS="$VAL" - ;; sdk) if [ "$BUILD_ON_MAC" = "yes" ]; then DeviceVar set QMAKE_MAC_SDK "$VAL" @@ -1090,274 +984,6 @@ if [ "$XPLATFORM_ANDROID" = "no" ]; then fi fi -#------------------------------------------------------------------------------- -# postprocess installation and deployment paths -#------------------------------------------------------------------------------- - -if [ -z "$QT_INSTALL_PREFIX" ]; then - if [ "$CFG_DEV" = "yes" ]; then - QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default - else - QT_INSTALL_PREFIX="/usr/local/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Qt-$QT_VERSION - fi -fi -QT_INSTALL_PREFIX=`makeabs "$QT_INSTALL_PREFIX"` - -if [ -z "$QT_EXT_PREFIX" ]; then - QT_EXT_PREFIX=$QT_INSTALL_PREFIX - if [ -n "$CFG_SYSROOT" ]; then - QMAKE_SYSROOTIFY=true - else - QMAKE_SYSROOTIFY=false - fi -else - QT_EXT_PREFIX=`makeabs "$QT_EXT_PREFIX"` - QMAKE_SYSROOTIFY=false -fi - -if [ -z "$QT_HOST_PREFIX" ]; then - if $QMAKE_SYSROOTIFY; then - QT_HOST_PREFIX=$CFG_SYSROOT$QT_EXT_PREFIX - else - QT_HOST_PREFIX=$QT_EXT_PREFIX - fi - HAVE_HOST_PATH=false -else - QT_HOST_PREFIX=`makeabs "$QT_HOST_PREFIX"` - HAVE_HOST_PATH=true -fi - -#------- make the paths relative to the prefixes -------- - -PREFIX_COMPLAINTS= -PREFIX_REMINDER=false -while read basevar baseoption var option; do - eval path=\$QT_${basevar}_$var - [ -z "$path" ] && continue - path=`makeabs "$path"` - eval base=\$QT_${basevar}_PREFIX - rel=${path##$base} - if [ x"$rel" = x"$path" ]; then - if [ x"$option" != x"sysconf" ]; then - PREFIX_COMPLAINTS="$PREFIX_COMPLAINTS - NOTICE: -${option}dir is not a subdirectory of ${baseoption}prefix." - eval \$HAVE_${basevar}_PATH || PREFIX_REMINDER=true - fi - eval QT_REL_${basevar}_$var=\$rel - elif [ -z "$rel" ]; then - eval QT_REL_${basevar}_$var=. - else - eval QT_REL_${basevar}_$var=\${rel#/} - fi -done < "$outpath/src/corelib/global/qconfig.cpp.new" < "$QTCONFFILE" <> "$QTCONFFILE" <> "$QTCONFFILE" <> "$QTCONFFILE" <reloadProperties(); +#endif + return ReturnTrue; default: evalError(fL1S("Function '%1' is not implemented.").arg(function.toQString(m_tmp1))); return ReturnFalse; diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h index 96c39fa168e..1bb86328831 100644 --- a/qmake/library/qmakeglobals.h +++ b/qmake/library/qmakeglobals.h @@ -125,6 +125,7 @@ public: void setDirectories(const QString &input_dir, const QString &output_dir); #ifdef QT_BUILD_QMAKE void setQMakeProperty(QMakeProperty *prop) { property = prop; } + void reloadProperties() { property->reload(); } ProString propertyValue(const ProKey &name) const { return property->value(name); } #else # ifdef PROEVALUATOR_INIT_PROPS diff --git a/qmake/option.cpp b/qmake/option.cpp index fb49f5a1003..b8102ecf06b 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -638,6 +638,11 @@ qmakeAddCacheClear(qmakeCacheClearFunc func, void **data) cache_items.append(new QMakeCacheClearItem(func, data)); } +QString qmake_absoluteLocation() +{ + return Option::globals->qmake_abslocation; +} + QString qmake_libraryInfoFile() { if (!Option::globals->qtconf.isEmpty()) diff --git a/qmake/property.cpp b/qmake/property.cpp index d17d62481ae..9a8db8904d1 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -70,6 +70,12 @@ static const struct { QMakeProperty::QMakeProperty() : settings(0) { + reload(); +} + +void QMakeProperty::reload() +{ + QLibraryInfo::reload(); for (unsigned i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) { QString name = QString::fromLatin1(propList[i].name); if (!propList[i].singular) { diff --git a/qmake/property.h b/qmake/property.h index cd04e4bc03f..b0129196eb7 100644 --- a/qmake/property.h +++ b/qmake/property.h @@ -50,6 +50,8 @@ public: QMakeProperty(); ~QMakeProperty(); + void reload(); + bool hasValue(const ProKey &); ProString value(const ProKey &); diff --git a/qmake/qmake-aux.pro b/qmake/qmake-aux.pro index 33a7fbfd2d6..357ebc73674 100644 --- a/qmake/qmake-aux.pro +++ b/qmake/qmake-aux.pro @@ -6,6 +6,24 @@ QMAKE_DOCS = $$PWD/doc/qmake.qdocconf # qmake binary win32: EXTENSION = .exe + +!build_pass { + qmake_exe.target = $$OUT_PWD/qmake$$EXTENSION + qmake_exe.depends = ../bin/qmake$$EXTENSION builtin-qt.conf + equals(QMAKE_DIR_SEP, /): \ + qmake_exe.commands = cat ../bin/qmake$$EXTENSION builtin-qt.conf > qmake$$EXTENSION && chmod +x qmake$$EXTENSION + else: \ + qmake_exe.commands = copy /B ..\bin\qmake$$EXTENSION + builtin-qt.conf qmake$$EXTENSION + QMAKE_EXTRA_TARGETS += qmake_exe + + QMAKE_CLEAN += builtin-qt.conf + QMAKE_DISTCLEAN += qmake$$EXTENSION + + first.depends += qmake_exe + QMAKE_EXTRA_TARGETS += first +} + qmake.path = $$[QT_HOST_BINS] -qmake.files = $$OUT_PWD/../bin/qmake$$EXTENSION +qmake.files = $$OUT_PWD/qmake$$EXTENSION +qmake.CONFIG = no_check_exist executable INSTALLS += qmake diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 27fe10a79ea..87ee75fa455 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -41,15 +41,18 @@ #include "qdir.h" #include "qstringlist.h" #include "qfile.h" +#include "qtemporaryfile.h" #include "qsettings.h" #include "qlibraryinfo.h" #include "qscopedpointer.h" #ifdef QT_BUILD_QMAKE QT_BEGIN_NAMESPACE +extern QString qmake_absoluteLocation(); extern QString qmake_libraryInfoFile(); QT_END_NAMESPACE #else +# include "qconfig.cpp" # include "qcoreapplication.h" #endif @@ -57,7 +60,6 @@ QT_END_NAMESPACE # include "private/qcore_mac_p.h" #endif -#include "qconfig.cpp" #include "archdetect.cpp" QT_BEGIN_NAMESPACE @@ -70,9 +72,16 @@ struct QLibrarySettings { QLibrarySettings(); void load(); +#ifdef QT_BUILD_QMAKE + void loadBuiltinValues(QSettings *config); +#endif QScopedPointer settings; #ifdef QT_BUILD_QMAKE + QString builtinValues[QLibraryInfo::LastHostPath + 1]; +# ifndef Q_OS_WIN + QString builtinSettingsPath; +# endif bool haveDevicePaths; bool haveEffectiveSourcePaths; bool haveEffectivePaths; @@ -88,6 +97,11 @@ class QLibraryInfoPrivate public: static QSettings *findConfiguration(); #ifdef QT_BUILD_QMAKE + static void reload() + { + if (qt_library_settings.exists()) + qt_library_settings->load(); + } static bool haveGroup(QLibraryInfo::PathGroup group) { QLibrarySettings *ls = qt_library_settings(); @@ -99,6 +113,25 @@ public: ? ls->haveDevicePaths : ls->havePaths) : false; } + static bool sysrootify() + { + // This is actually bogus, as it does not consider post-configure settings. + QLibrarySettings *ls = qt_library_settings(); + return ls ? (!ls->builtinValues[QLibraryInfo::SysrootPath].isEmpty() + && ls->builtinValues[QLibraryInfo::ExtPrefixPath].isEmpty()) : false; + } + static QString builtinValue(int loc) + { + QLibrarySettings *ls = qt_library_settings(); + return ls ? ls->builtinValues[loc] : QString(); + } +# ifndef Q_OS_WIN + static QString builtinSettingsPath() + { + QLibrarySettings *ls = qt_library_settings(); + return ls ? ls->builtinSettingsPath : QString(); + } +# endif #endif static QSettings *configuration() { @@ -122,6 +155,20 @@ QLibrarySettings::QLibrarySettings() load(); } +#ifdef QT_BUILD_QMAKE +static QByteArray qtconfSeparator() +{ +# ifdef Q_OS_WIN + QByteArray header = QByteArrayLiteral("\r\n===========================================================\r\n"); +# else + QByteArray header = QByteArrayLiteral("\n===========================================================\n"); +# endif + QByteArray content = QByteArrayLiteral("==================== qt.conf beginning ===================="); + // Assemble from pieces to avoid that the string appears in a raw executable + return header + content + header; +} +#endif + void QLibrarySettings::load() { // If we get any settings here, those won't change when the application shows up. @@ -159,6 +206,27 @@ void QLibrarySettings::load() havePaths = false; #endif } + +#ifdef QT_BUILD_QMAKE + // Try to use an embedded qt.conf appended to the QMake executable. + QFile qmakeFile(qmake_absoluteLocation()); + if (!qmakeFile.open(QIODevice::ReadOnly)) + return; + qmakeFile.seek(qmakeFile.size() - 10000); + QByteArray tail = qmakeFile.read(10000); + QByteArray separator = qtconfSeparator(); + int qtconfOffset = tail.lastIndexOf(separator); + if (qtconfOffset < 0) + return; + tail.remove(0, qtconfOffset + separator.size()); + // If QSettings had a c'tor taking a QIODevice, we'd pass a QBuffer ... + QTemporaryFile tmpFile; + tmpFile.open(); + tmpFile.write(tail); + tmpFile.close(); + QSettings builtinSettings(tmpFile.fileName(), QSettings::IniFormat); + loadBuiltinValues(&builtinSettings); +#endif } QSettings *QLibraryInfoPrivate::findConfiguration() @@ -420,10 +488,30 @@ static const struct { { "HostData", "." }, { "TargetSpec", "" }, { "HostSpec", "" }, + { "ExtPrefix", "" }, { "HostPrefix", "" }, #endif }; +#ifdef QT_BUILD_QMAKE +void QLibrarySettings::loadBuiltinValues(QSettings *config) +{ + config->beginGroup(QLatin1String("Paths")); + for (int i = 0; i <= QLibraryInfo::LastHostPath; i++) + builtinValues[i] = config->value(QLatin1String(qtConfEntries[i].key), + QLatin1String(qtConfEntries[i].value)).toString(); +# ifndef Q_OS_WIN + builtinSettingsPath = config->value(QLatin1String("Settings")).toString(); +# endif + config->endGroup(); +} + +void QLibraryInfo::reload() +{ + QLibraryInfoPrivate::reload(); +} +#endif + /*! Returns the location specified by \a loc. */ @@ -434,7 +522,7 @@ QLibraryInfo::location(LibraryLocation loc) QString ret = rawLocation(loc, FinalPaths); // Automatically prepend the sysroot to target paths - if ((loc < SysrootPath || loc > LastHostPath) && QT_CONFIGURE_SYSROOTIFY_PREFIX) { + if ((loc < SysrootPath || loc > LastHostPath) && QLibraryInfoPrivate::sysrootify()) { QString sysroot = rawLocation(SysrootPath, FinalPaths); if (!sysroot.isEmpty() && ret.length() > 2 && ret.at(1) == QLatin1Char(':') && (ret.at(2) == QLatin1Char('/') || ret.at(2) == QLatin1Char('\\'))) @@ -528,28 +616,32 @@ QLibraryInfo::rawLocation(LibraryLocation loc, PathGroup group) #endif // QT_NO_SETTINGS if (!fromConf) { +#ifdef QT_BUILD_QMAKE + if ((unsigned)loc <= (unsigned)LastHostPath) { + if (loc == PrefixPath && group != DevicePaths) + ret = QLibraryInfoPrivate::builtinValue(ExtPrefixPath); + else + ret = QLibraryInfoPrivate::builtinValue(loc); +# ifndef Q_OS_WIN // On Windows we use the registry + } else if (loc == SettingsPath) { + ret = QLibraryInfoPrivate::builtinSettingsPath(); +# endif + } +#else // QT_BUILD_QMAKE const char * volatile path = 0; if (loc == PrefixPath) { - path = -#ifdef QT_BUILD_QMAKE - (group != DevicePaths) ? - QT_CONFIGURE_EXT_PREFIX_PATH : -#endif - QT_CONFIGURE_PREFIX_PATH; + path = QT_CONFIGURE_PREFIX_PATH; } else if (unsigned(loc) <= sizeof(qt_configure_str_offsets)/sizeof(qt_configure_str_offsets[0])) { path = qt_configure_strs + qt_configure_str_offsets[loc - 1]; #ifndef Q_OS_WIN // On Windows we use the registry } else if (loc == SettingsPath) { path = QT_CONFIGURE_SETTINGS_PATH; -#endif -#ifdef QT_BUILD_QMAKE - } else if (loc == HostPrefixPath) { - path = QT_CONFIGURE_HOST_PREFIX_PATH; #endif } if (path) ret = QString::fromLocal8Bit(path); +#endif } #ifdef QT_BUILD_QMAKE diff --git a/src/corelib/global/qlibraryinfo.h b/src/corelib/global/qlibraryinfo.h index 55be7063824..9d794ce1da9 100644 --- a/src/corelib/global/qlibraryinfo.h +++ b/src/corelib/global/qlibraryinfo.h @@ -96,6 +96,7 @@ public: HostDataPath, TargetSpecPath, HostSpecPath, + ExtPrefixPath, HostPrefixPath, LastHostPath = HostPrefixPath, #endif @@ -105,6 +106,7 @@ public: #ifdef QT_BUILD_QMAKE enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths, DevicePaths }; static QString rawLocation(LibraryLocation, PathGroup); + static void reload(); #endif static QStringList platformPluginArguments(const QString &platformName); diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 49dab2fcd49..630e58d8189 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -48,14 +48,6 @@ QT_BEGIN_NAMESPACE -enum Platforms { - WINDOWS, - WINDOWS_RT, - QNX, - ANDROID, - OTHER -}; - std::ostream &operator<<(std::ostream &s, const QString &val) { s << val.toLocal8Bit().data(); return s; @@ -84,19 +76,12 @@ Configure::Configure(int& argc, char** argv) sourceDir = sourcePathInfo.dir(); } buildPath = QDir::currentPath(); -#if 0 - const QString installPath = QString("C:\\Qt\\%1").arg(QT_VERSION_STR); -#else - const QString installPath = buildPath; -#endif if (sourceDir != buildDir) { //shadow builds! QDir(buildPath).mkpath("bin"); buildDir.mkpath("mkspecs"); } - dictionary[ "QT_INSTALL_PREFIX" ] = installPath; - if (dictionary[ "QMAKESPEC" ].size() == 0) { dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec(); dictionary[ "QMAKESPEC_FROM" ] = "detected"; @@ -104,9 +89,6 @@ Configure::Configure(int& argc, char** argv) dictionary[ "SYNCQT" ] = "auto"; - //Only used when cross compiling. - dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg"; - QString tmp = dictionary[ "QMAKESPEC" ]; if (tmp.contains("\\")) { tmp = tmp.mid(tmp.lastIndexOf("\\") + 1); @@ -197,148 +179,6 @@ void Configure::parseCmdLine() else if (configCmdLine.at(i) == "-no-syncqt") dictionary[ "SYNCQT" ] = "no"; - // Directories ---------------------------------------------- - else if (configCmdLine.at(i) == "-prefix") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_PREFIX" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-bindir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_BINS" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-libexecdir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_LIBEXECS" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-libdir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_LIBS" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-docdir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_DOCS" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-headerdir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_HEADERS" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-plugindir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-importdir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-qmldir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_QML" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-archdatadir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_ARCHDATA" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-datadir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_DATA" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-translationdir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_TRANSLATIONS" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-examplesdir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-testsdir") { - ++i; - if (i == argCount) - break; - 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" ] = buildPath; - else - dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-hostbindir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_HOST_BINS" ] = configCmdLine.at(i); - } - - else if (configCmdLine.at(i) == "-hostlibdir") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_HOST_LIBS" ] = 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) == "-extprefix") { - ++i; - if (i == argCount) - break; - dictionary[ "QT_EXT_PREFIX" ] = configCmdLine.at(i); - } - else if (configCmdLine.at(i) == "-make-tool") { ++i; if (i == argCount) @@ -346,13 +186,6 @@ void Configure::parseCmdLine() dictionary[ "MAKE" ] = configCmdLine.at(i); } - else if (configCmdLine.at(i) == "-sysconfdir") { - ++i; - if (i == argCount) - break; - dictionary["QT_INSTALL_SETTINGS"] = configCmdLine.at(i); - } - else if (configCmdLine.at(i) == "-android-ndk") { ++i; if (i == argCount) @@ -531,219 +364,6 @@ void Configure::generateHeaders() } } -void Configure::addConfStr(int group, const QString &val) -{ - confStrOffsets[group] += ' ' + QString::number(confStringOff) + ','; - confStrings[group] += " \"" + val + "\\0\"\n"; - confStringOff += val.length() + 1; -} - -void Configure::generateQConfigCpp() -{ - QString hostSpec = dictionary["QMAKESPEC"]; - QString targSpec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : hostSpec; - - dictionary["CFG_SYSROOT"] = QDir::cleanPath(dictionary["CFG_SYSROOT"]); - - bool qipempty = false; - if (dictionary["QT_INSTALL_PREFIX"].isEmpty()) - qipempty = true; - else - dictionary["QT_INSTALL_PREFIX"] = QDir::cleanPath(dictionary["QT_INSTALL_PREFIX"]); - - bool sysrootifyPrefix; - if (dictionary["QT_EXT_PREFIX"].isEmpty()) { - dictionary["QT_EXT_PREFIX"] = dictionary["QT_INSTALL_PREFIX"]; - sysrootifyPrefix = !dictionary["CFG_SYSROOT"].isEmpty(); - } else { - dictionary["QT_EXT_PREFIX"] = QDir::cleanPath(dictionary["QT_EXT_PREFIX"]); - sysrootifyPrefix = false; - } - - bool haveHpx; - if (dictionary["QT_HOST_PREFIX"].isEmpty()) { - dictionary["QT_HOST_PREFIX"] = (sysrootifyPrefix ? dictionary["CFG_SYSROOT"] : QString()) - + dictionary["QT_INSTALL_PREFIX"]; - haveHpx = false; - } else { - dictionary["QT_HOST_PREFIX"] = QDir::cleanPath(dictionary["QT_HOST_PREFIX"]); - haveHpx = true; - } - - static const struct { - const char *basevar, *baseoption, *var, *option; - } varmod[] = { - { "INSTALL_", "-prefix", "DOCS", "-docdir" }, - { "INSTALL_", "-prefix", "HEADERS", "-headerdir" }, - { "INSTALL_", "-prefix", "LIBS", "-libdir" }, - { "INSTALL_", "-prefix", "LIBEXECS", "-libexecdir" }, - { "INSTALL_", "-prefix", "BINS", "-bindir" }, - { "INSTALL_", "-prefix", "PLUGINS", "-plugindir" }, - { "INSTALL_", "-prefix", "IMPORTS", "-importdir" }, - { "INSTALL_", "-prefix", "QML", "-qmldir" }, - { "INSTALL_", "-prefix", "ARCHDATA", "-archdatadir" }, - { "INSTALL_", "-prefix", "DATA", "-datadir" }, - { "INSTALL_", "-prefix", "TRANSLATIONS", "-translationdir" }, - { "INSTALL_", "-prefix", "EXAMPLES", "-examplesdir" }, - { "INSTALL_", "-prefix", "TESTS", "-testsdir" }, - { "INSTALL_", "-prefix", "SETTINGS", "-sysconfdir" }, - { "HOST_", "-hostprefix", "BINS", "-hostbindir" }, - { "HOST_", "-hostprefix", "LIBS", "-hostlibdir" }, - { "HOST_", "-hostprefix", "DATA", "-hostdatadir" }, - }; - - bool prefixReminder = false; - for (uint i = 0; i < sizeof(varmod) / sizeof(varmod[0]); i++) { - QString path = QDir::cleanPath( - dictionary[QLatin1String("QT_") + varmod[i].basevar + varmod[i].var]); - if (path.isEmpty()) - continue; - QString base = dictionary[QLatin1String("QT_") + varmod[i].basevar + "PREFIX"]; - if (!path.startsWith(base)) { - if (i != 13) { - dictionary["PREFIX_COMPLAINTS"] += QLatin1String("\n NOTICE: ") - + varmod[i].option + " is not a subdirectory of " + varmod[i].baseoption + "."; - if (i < 13 ? qipempty : !haveHpx) - prefixReminder = true; - } - } else { - path.remove(0, base.size()); - if (path.startsWith('/')) - path.remove(0, 1); - } - dictionary[QLatin1String("QT_REL_") + varmod[i].basevar + varmod[i].var] - = path.isEmpty() ? "." : path; - } - if (prefixReminder) { - dictionary["PREFIX_COMPLAINTS"] - += "\n Maybe you forgot to specify -prefix/-hostprefix?"; - } - - if (!qipempty) { - // If QT_INSTALL_* have not been specified on the command line, - // default them here, unless prefix is empty (WinCE). - - if (dictionary["QT_REL_INSTALL_HEADERS"].isEmpty()) - dictionary["QT_REL_INSTALL_HEADERS"] = "include"; - - if (dictionary["QT_REL_INSTALL_LIBS"].isEmpty()) - dictionary["QT_REL_INSTALL_LIBS"] = "lib"; - - if (dictionary["QT_REL_INSTALL_BINS"].isEmpty()) - dictionary["QT_REL_INSTALL_BINS"] = "bin"; - - if (dictionary["QT_REL_INSTALL_ARCHDATA"].isEmpty()) - dictionary["QT_REL_INSTALL_ARCHDATA"] = "."; - if (dictionary["QT_REL_INSTALL_ARCHDATA"] != ".") - dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] = dictionary["QT_REL_INSTALL_ARCHDATA"] + '/'; - - if (dictionary["QT_REL_INSTALL_LIBEXECS"].isEmpty()) { - if (targSpec.startsWith("win")) - dictionary["QT_REL_INSTALL_LIBEXECS"] = dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] + "bin"; - else - dictionary["QT_REL_INSTALL_LIBEXECS"] = dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] + "libexec"; - } - - if (dictionary["QT_REL_INSTALL_PLUGINS"].isEmpty()) - dictionary["QT_REL_INSTALL_PLUGINS"] = dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] + "plugins"; - - if (dictionary["QT_REL_INSTALL_IMPORTS"].isEmpty()) - dictionary["QT_REL_INSTALL_IMPORTS"] = dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] + "imports"; - - if (dictionary["QT_REL_INSTALL_QML"].isEmpty()) - dictionary["QT_REL_INSTALL_QML"] = dictionary["QT_REL_INSTALL_ARCHDATA_PREFIX"] + "qml"; - - if (dictionary["QT_REL_INSTALL_DATA"].isEmpty()) - dictionary["QT_REL_INSTALL_DATA"] = "."; - if (dictionary["QT_REL_INSTALL_DATA"] != ".") - dictionary["QT_REL_INSTALL_DATA_PREFIX"] = dictionary["QT_REL_INSTALL_DATA"] + '/'; - - if (dictionary["QT_REL_INSTALL_DOCS"].isEmpty()) - dictionary["QT_REL_INSTALL_DOCS"] = dictionary["QT_REL_INSTALL_DATA_PREFIX"] + "doc"; - - if (dictionary["QT_REL_INSTALL_TRANSLATIONS"].isEmpty()) - dictionary["QT_REL_INSTALL_TRANSLATIONS"] = dictionary["QT_REL_INSTALL_DATA_PREFIX"] + "translations"; - - if (dictionary["QT_REL_INSTALL_EXAMPLES"].isEmpty()) - dictionary["QT_REL_INSTALL_EXAMPLES"] = "examples"; - - if (dictionary["QT_REL_INSTALL_TESTS"].isEmpty()) - dictionary["QT_REL_INSTALL_TESTS"] = "tests"; - } - - if (dictionary["QT_REL_HOST_BINS"].isEmpty()) - dictionary["QT_REL_HOST_BINS"] = haveHpx ? "bin" : dictionary["QT_REL_INSTALL_BINS"]; - - if (dictionary["QT_REL_HOST_LIBS"].isEmpty()) - dictionary["QT_REL_HOST_LIBS"] = haveHpx ? "lib" : dictionary["QT_REL_INSTALL_LIBS"]; - - if (dictionary["QT_REL_HOST_DATA"].isEmpty()) - dictionary["QT_REL_HOST_DATA"] = haveHpx ? "." : dictionary["QT_REL_INSTALL_ARCHDATA"]; - - confStringOff = 0; - addConfStr(0, dictionary["QT_REL_INSTALL_DOCS"]); - addConfStr(0, dictionary["QT_REL_INSTALL_HEADERS"]); - addConfStr(0, dictionary["QT_REL_INSTALL_LIBS"]); - addConfStr(0, dictionary["QT_REL_INSTALL_LIBEXECS"]); - addConfStr(0, dictionary["QT_REL_INSTALL_BINS"]); - addConfStr(0, dictionary["QT_REL_INSTALL_PLUGINS"]); - addConfStr(0, dictionary["QT_REL_INSTALL_IMPORTS"]); - addConfStr(0, dictionary["QT_REL_INSTALL_QML"]); - addConfStr(0, dictionary["QT_REL_INSTALL_ARCHDATA"]); - addConfStr(0, dictionary["QT_REL_INSTALL_DATA"]); - addConfStr(0, dictionary["QT_REL_INSTALL_TRANSLATIONS"]); - addConfStr(0, dictionary["QT_REL_INSTALL_EXAMPLES"]); - addConfStr(0, dictionary["QT_REL_INSTALL_TESTS"]); - addConfStr(1, dictionary["CFG_SYSROOT"]); - addConfStr(1, dictionary["QT_REL_HOST_BINS"]); - addConfStr(1, dictionary["QT_REL_HOST_LIBS"]); - addConfStr(1, dictionary["QT_REL_HOST_DATA"]); - addConfStr(1, targSpec); - addConfStr(1, hostSpec); - - // Generate the new qconfig.cpp file - { - FileWriter tmpStream(buildPath + "/src/corelib/global/qconfig.cpp"); - tmpStream << "/* Build date */" << endl - << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=2012-12-20\";" << endl - << endl - << "/* Installation Info */" << endl - << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << dictionary["QT_INSTALL_PREFIX"] << "\";" << endl - << "#ifdef QT_BUILD_QMAKE" << endl - << "static const char qt_configure_ext_prefix_path_str [512 + 12] = \"qt_epfxpath=" << dictionary["QT_EXT_PREFIX"] << "\";" << endl - << "static const char qt_configure_host_prefix_path_str [512 + 12] = \"qt_hpfxpath=" << dictionary["QT_HOST_PREFIX"] << "\";" << endl - << "#endif" << endl - << endl - << "static const short qt_configure_str_offsets[] = {\n" - << " " << confStrOffsets[0] << endl - << "#ifdef QT_BUILD_QMAKE\n" - << " " << confStrOffsets[1] << endl - << "#endif\n" - << "};\n" - << "static const char qt_configure_strs[] =\n" - << confStrings[0] << "#ifdef QT_BUILD_QMAKE\n" - << confStrings[1] << "#endif\n" - << ";\n" - << endl; - if ((platform() != WINDOWS) && (platform() != WINDOWS_RT)) - tmpStream << "#define QT_CONFIGURE_SETTINGS_PATH \"" << dictionary["QT_REL_INSTALL_SETTINGS"] << "\"" << endl; - - tmpStream << endl - << "#ifdef QT_BUILD_QMAKE\n" - << "# define QT_CONFIGURE_SYSROOTIFY_PREFIX " << (sysrootifyPrefix ? "true" : "false") << endl - << "#endif\n\n" - << endl - << "#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12\n" - << "#ifdef QT_BUILD_QMAKE\n" - << "# define QT_CONFIGURE_EXT_PREFIX_PATH qt_configure_ext_prefix_path_str + 12\n" - << "# define QT_CONFIGURE_HOST_PREFIX_PATH qt_configure_host_prefix_path_str + 12\n" - << "#endif\n"; - - if (!tmpStream.flush()) - dictionary[ "DONE" ] = "error"; - } -} - void Configure::buildQmake() { { @@ -841,7 +461,11 @@ void Configure::buildQmake() if (confFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file. QTextStream confStream(&confFile); confStream << "[EffectivePaths]" << endl - << "Prefix=.." << endl; + << "Prefix=.." << endl + << "[Paths]" << endl + << "TargetSpec=" << (dictionary.contains("XQMAKESPEC") + ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"]) << endl + << "HostSpec=" << dictionary["QMAKESPEC"] << endl; if (sourcePath != buildPath) confStream << "[EffectiveSourcePaths]" << endl << "Prefix=" << sourcePath << endl; @@ -897,25 +521,6 @@ bool Configure::isOk() return (dictionary[ "DONE" ] != "error"); } -int Configure::platform() const -{ - const QString xQMakeSpec = dictionary.value("XQMAKESPEC"); - - if ((xQMakeSpec.startsWith("winphone") || xQMakeSpec.startsWith("winrt"))) - return WINDOWS_RT; - - if (xQMakeSpec.contains("qnx")) - return QNX; - - if (xQMakeSpec.contains("android")) - return ANDROID; - - if (!xQMakeSpec.isEmpty()) - return OTHER; - - return WINDOWS; -} - FileWriter::FileWriter(const QString &name) : QTextStream() , m_name(name) diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index 755a2e26966..32ba7d34441 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -44,7 +44,6 @@ public: void parseCmdLine(); - void generateQConfigCpp(); void buildQmake(); void prepareConfigureInput(); @@ -56,8 +55,6 @@ public: bool isDone(); bool isOk(); - int platform() const; - private: int verbose; @@ -72,11 +69,6 @@ private: QString sourcePathMangled, buildPathMangled; QDir sourceDir, buildDir; - QString confStrOffsets[2]; - QString confStrings[2]; - int confStringOff; - - void addConfStr(int group, const QString &val); QString formatPath(const QString &path); bool reloadCmdLine(int idx); diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp index 3fce934da58..e4b9c12e3d7 100644 --- a/tools/configure/main.cpp +++ b/tools/configure/main.cpp @@ -45,9 +45,6 @@ int runConfigure( int argc, char** argv ) if (!app.isOk()) return 3; - // Source file with path settings. Needed by qmake. - app.generateQConfigCpp(); - // Bootstrapped includes. Needed by qmake. app.generateHeaders(); if (!app.isOk())