summaryrefslogtreecommitdiffstats
path: root/tools/configure/configureapp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/configure/configureapp.cpp')
-rw-r--r--tools/configure/configureapp.cpp667
1 files changed, 7 insertions, 660 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index fc66220335..2ffec0707f 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,20 +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");
- buildDir.mkpath("config.tests");
}
- dictionary[ "QT_INSTALL_PREFIX" ] = installPath;
-
if (dictionary[ "QMAKESPEC" ].size() == 0) {
dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec();
dictionary[ "QMAKESPEC_FROM" ] = "detected";
@@ -105,13 +89,6 @@ Configure::Configure(int& argc, char** argv)
dictionary[ "SYNCQT" ] = "auto";
- //Only used when cross compiling.
- dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg";
-
- dictionary[ "REDO" ] = "no";
-
- dictionary[ "BUILDTYPE" ] = "none";
-
QString tmp = dictionary[ "QMAKESPEC" ];
if (tmp.contains("\\")) {
tmp = tmp.mid(tmp.lastIndexOf("\\") + 1);
@@ -125,17 +102,6 @@ Configure::~Configure()
{
}
-QString Configure::formatPath(const QString &path)
-{
- QString ret = QDir::cleanPath(path);
- // This amount of quoting is deemed sufficient.
- if (ret.contains(QLatin1Char(' '))) {
- ret.prepend(QLatin1Char('"'));
- ret.append(QLatin1Char('"'));
- }
- return ret;
-}
-
void Configure::parseCmdLine()
{
sourcePathMangled = sourcePath;
@@ -146,6 +112,7 @@ void Configure::parseCmdLine()
sourcePathMangled = QFileInfo(sourcePath).path();
buildPathMangled = QFileInfo(buildPath).path();
}
+ qmakeCmdLine = configCmdLine;
int argCount = configCmdLine.size();
int i = 0;
@@ -153,7 +120,6 @@ void Configure::parseCmdLine()
// Look first for -redo
for (int k = 0 ; k < argCount; ++k) {
if (configCmdLine.at(k) == "-redo") {
- dictionary["REDO"] = "yes";
configCmdLine.removeAt(k);
if (!reloadCmdLine(k)) {
dictionary["DONE"] = "error";
@@ -164,196 +130,18 @@ void Configure::parseCmdLine()
}
}
- // Then look for XQMAKESPEC
- bool isDeviceMkspec = false;
- for (int j = 0 ; j < argCount; ++j)
- {
- if ((configCmdLine.at(j) == "-xplatform") || (configCmdLine.at(j) == "-device")) {
- isDeviceMkspec = (configCmdLine.at(j) == "-device");
- ++j;
- if (j == argCount)
- break;
- dictionary["XQMAKESPEC"] = configCmdLine.at(j);
- break;
- }
- }
-
for (; i<configCmdLine.size(); ++i) {
- if (configCmdLine.at(i) == "-opensource") {
- dictionary[ "BUILDTYPE" ] = "opensource";
- }
- else if (configCmdLine.at(i) == "-commercial") {
- dictionary[ "BUILDTYPE" ] = "commercial";
- }
- else if (configCmdLine.at(i) == "-platform") {
+ if (configCmdLine.at(i) == "-platform") {
++i;
if (i == argCount)
break;
dictionary[ "QMAKESPEC" ] = configCmdLine.at(i);
dictionary[ "QMAKESPEC_FROM" ] = "commandline";
- } else if (configCmdLine.at(i) == "-xplatform"
- || configCmdLine.at(i) == "-device") {
- ++i;
- // do nothing
- } else if (configCmdLine.at(i) == "-device-option") {
- ++i;
- const QString option = configCmdLine.at(i);
- QString &devOpt = dictionary["DEVICE_OPTION"];
- if (!devOpt.isEmpty())
- devOpt.append("\n").append(option);
- else
- devOpt = option;
}
else if (configCmdLine.at(i) == "-no-syncqt")
dictionary[ "SYNCQT" ] = "no";
- else if (configCmdLine.at(i) == "-confirm-license") {
- dictionary["LICENSE_CONFIRMED"] = "yes";
- }
-
- // 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)
@@ -361,54 +149,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)
- break;
- dictionary[ "ANDROID_NDK_ROOT" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-android-sdk") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "ANDROID_SDK_ROOT" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-android-ndk-platform") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "ANDROID_PLATFORM" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-android-ndk-host") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "ANDROID_HOST" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-android-arch") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "ANDROID_TARGET_ARCH" ] = configCmdLine.at(i);
- }
-
- else if (configCmdLine.at(i) == "-android-toolchain-version") {
- ++i;
- if (i == argCount)
- break;
- dictionary[ "ANDROID_NDK_TOOLCHAIN_VERSION" ] = configCmdLine.at(i);
- }
}
// Ensure that QMAKESPEC exists in the mkspecs folder
@@ -449,95 +189,6 @@ void Configure::parseCmdLine()
dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
}
}
-
- if (isDeviceMkspec) {
- const QStringList devices = mkspecs.filter("devices/", Qt::CaseInsensitive);
- const QStringList family = devices.filter(dictionary["XQMAKESPEC"], Qt::CaseInsensitive);
-
- if (family.isEmpty()) {
- dictionary[ "DONE" ] = "error";
- cout << "Error: No device matching '" << dictionary["XQMAKESPEC"] << "'." << endl;
- } else if (family.size() > 1) {
- dictionary[ "DONE" ] = "error";
-
- cout << "Error: Multiple matches for device '" << dictionary["XQMAKESPEC"] << "'. Candidates are:" << endl;
-
- foreach (const QString &device, family)
- cout << "\t* " << device << endl;
- } else {
- Q_ASSERT(family.size() == 1);
- dictionary["XQMAKESPEC"] = family.at(0);
- }
-
- } else {
- // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well
- if (dictionary.contains("XQMAKESPEC") &&
- !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) {
- dictionary[ "DONE" ] = "error";
- cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
- }
- }
-}
-
-void Configure::prepareConfigTests()
-{
- // Generate an empty .qmake.cache file for config.tests
- QDir buildDir(buildPath);
- bool success = true;
- if (!buildDir.exists("config.tests"))
- success = buildDir.mkdir("config.tests");
-
- QString fileName(buildPath + "/config.tests/.qmake.cache");
- QFile cacheFile(fileName);
- success &= cacheFile.open(QIODevice::WriteOnly);
- cacheFile.close();
-
- if (!success) {
- cout << "Failed to create file " << qPrintable(QDir::toNativeSeparators(fileName)) << endl;
- dictionary[ "DONE" ] = "error";
- }
-}
-
-void Configure::generateQDevicePri()
-{
- FileWriter deviceStream(buildPath + "/mkspecs/qdevice.pri");
- if (dictionary.contains("DEVICE_OPTION")) {
- const QString devoptionlist = dictionary["DEVICE_OPTION"];
- const QStringList optionlist = devoptionlist.split(QStringLiteral("\n"));
- foreach (const QString &entry, optionlist)
- deviceStream << entry << "\n";
- }
- if (dictionary.contains("ANDROID_SDK_ROOT") && dictionary.contains("ANDROID_NDK_ROOT")) {
- deviceStream << "android_install {" << endl;
- deviceStream << " DEFAULT_ANDROID_SDK_ROOT = " << formatPath(dictionary["ANDROID_SDK_ROOT"]) << endl;
- deviceStream << " DEFAULT_ANDROID_NDK_ROOT = " << formatPath(dictionary["ANDROID_NDK_ROOT"]) << endl;
- if (dictionary.contains("ANDROID_HOST"))
- deviceStream << " DEFAULT_ANDROID_NDK_HOST = " << dictionary["ANDROID_HOST"] << endl;
- else if (QSysInfo::WordSize == 64)
- deviceStream << " DEFAULT_ANDROID_NDK_HOST = windows-x86_64" << endl;
- else
- deviceStream << " DEFAULT_ANDROID_NDK_HOST = windows" << endl;
- QString android_arch(dictionary.contains("ANDROID_TARGET_ARCH")
- ? dictionary["ANDROID_TARGET_ARCH"]
- : QString("armeabi-v7a"));
- QString android_tc_vers(dictionary.contains("ANDROID_NDK_TOOLCHAIN_VERSION")
- ? dictionary["ANDROID_NDK_TOOLCHAIN_VERSION"]
- : QString("4.9"));
-
- bool targetIs64Bit = android_arch == QString("arm64-v8a")
- || android_arch == QString("x86_64")
- || android_arch == QString("mips64");
- QString android_platform(dictionary.contains("ANDROID_PLATFORM")
- ? dictionary["ANDROID_PLATFORM"]
- : (targetIs64Bit ? QString("android-21") : QString("android-9")));
-
- deviceStream << " DEFAULT_ANDROID_PLATFORM = " << android_platform << endl;
- deviceStream << " DEFAULT_ANDROID_TARGET_ARCH = " << android_arch << endl;
- deviceStream << " DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION = " << android_tc_vers << endl;
- deviceStream << "}" << endl;
- }
- if (!deviceStream.flush())
- dictionary[ "DONE" ] = "error";
}
void Configure::generateHeaders()
@@ -565,219 +216,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()
{
{
@@ -875,7 +313,10 @@ 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=dummy" << endl
+ << "HostSpec=" << dictionary["QMAKESPEC"] << endl;
if (sourcePath != buildPath)
confStream << "[EffectiveSourcePaths]" << endl
<< "Prefix=" << sourcePath << endl;
@@ -891,7 +332,7 @@ void Configure::configure()
QStringList args;
args << buildPath + "/bin/qmake"
<< sourcePathMangled
- << "--" << configCmdLine;
+ << "--" << qmakeCmdLine;
QString pwd = QDir::currentPath();
QDir::setCurrent(buildPathMangled);
@@ -900,9 +341,6 @@ void Configure::configure()
dictionary[ "DONE" ] = "error";
}
QDir::setCurrent(pwd);
-
- if ((dictionary["REDO"] != "yes") && (dictionary["DONE"] != "error"))
- saveCmdLine();
}
bool Configure::reloadCmdLine(int idx)
@@ -924,35 +362,6 @@ bool Configure::reloadCmdLine(int idx)
return true;
}
-void Configure::saveCmdLine()
-{
- if (dictionary[ "REDO" ] != "yes") {
- if (dictionary["BUILDTYPE"] == "none") {
- bool openSource = false;
- QFile inFile(buildPath + "/mkspecs/qconfig.pri");
- if (inFile.open(QFile::ReadOnly | QFile::Text)) {
- QTextStream inStream(&inFile);
- while (!inStream.atEnd()) {
- if (inStream.readLine() == "QT_EDITION = OpenSource")
- openSource = true;
- }
- }
- configCmdLine.append(openSource ? "-opensource" : "-commercial");
- }
- if (dictionary["LICENSE_CONFIRMED"] != "yes")
- configCmdLine.append("-confirm-license");
- QFile outFile(buildPathMangled + "/config.opt");
- if (outFile.open(QFile::WriteOnly | QFile::Text)) {
- QTextStream outStream(&outFile);
- for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {
- outStream << (*it) << endl;
- }
- outStream.flush();
- outFile.close();
- }
- }
-}
-
bool Configure::isDone()
{
return !dictionary["DONE"].isEmpty();
@@ -963,66 +372,4 @@ 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)
-{
- m_buffer.open(QIODevice::WriteOnly);
- setDevice(&m_buffer);
-}
-
-bool FileWriter::flush()
-{
- QTextStream::flush();
- QFile oldFile(m_name);
- if (oldFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
- if (oldFile.readAll() == m_buffer.data())
- return true;
- oldFile.close();
- }
- QString dir = QFileInfo(m_name).absolutePath();
- if (!QDir().mkpath(dir)) {
- cout << "Cannot create directory " << qPrintable(QDir::toNativeSeparators(dir)) << ".\n";
- return false;
- }
- QFile file(m_name + ".new");
- if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- if (file.write(m_buffer.data()) == m_buffer.data().size()) {
- file.close();
- if (file.error() == QFile::NoError) {
- ::SetFileAttributes((wchar_t*)m_name.utf16(), FILE_ATTRIBUTE_NORMAL);
- QFile::remove(m_name);
- if (!file.rename(m_name)) {
- cout << "Cannot replace file " << qPrintable(QDir::toNativeSeparators(m_name)) << ".\n";
- return false;
- }
- return true;
- }
- }
- }
- cout << "Cannot create file " << qPrintable(QDir::toNativeSeparators(file.fileName()))
- << ": " << qPrintable(file.errorString()) << ".\n";
- file.remove();
- return false;
-}
-
QT_END_NAMESPACE