diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/configure/configureapp.cpp | 189 | ||||
-rw-r--r-- | tools/configure/configureapp.h | 3 | ||||
-rw-r--r-- | tools/configure/main.cpp | 8 |
3 files changed, 103 insertions, 97 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 56d8d9f8c5..bcb597d72f 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -2579,43 +2579,6 @@ void Configure::generateOutputVars() // Directories and settings for .qmake.cache -------------------- - // if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX - // if prefix is empty (WINCE), make all of them empty, if they aren't set - bool qipempty = false; - if (dictionary[ "QT_INSTALL_PREFIX" ].isEmpty()) - qipempty = true; - - if (!dictionary[ "QT_INSTALL_DOCS" ].size()) - dictionary[ "QT_INSTALL_DOCS" ] = qipempty ? "" : dictionary[ "QT_INSTALL_PREFIX" ] + "/doc"; - if (!dictionary[ "QT_INSTALL_HEADERS" ].size()) - dictionary[ "QT_INSTALL_HEADERS" ] = qipempty ? "" : dictionary[ "QT_INSTALL_PREFIX" ] + "/include"; - if (!dictionary[ "QT_INSTALL_LIBS" ].size()) - dictionary[ "QT_INSTALL_LIBS" ] = qipempty ? "" : dictionary[ "QT_INSTALL_PREFIX" ] + "/lib"; - if (!dictionary[ "QT_INSTALL_BINS" ].size()) - dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : dictionary[ "QT_INSTALL_PREFIX" ] + "/bin"; - if (!dictionary[ "QT_INSTALL_PLUGINS" ].size()) - dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins"; - if (!dictionary[ "QT_INSTALL_IMPORTS" ].size()) - dictionary[ "QT_INSTALL_IMPORTS" ] = qipempty ? "" : dictionary[ "QT_INSTALL_PREFIX" ] + "/imports"; - if (!dictionary[ "QT_INSTALL_DATA" ].size()) - dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : dictionary[ "QT_INSTALL_PREFIX" ]; - if (!dictionary[ "QT_INSTALL_TRANSLATIONS" ].size()) - dictionary[ "QT_INSTALL_TRANSLATIONS" ] = qipempty ? "" : dictionary[ "QT_INSTALL_PREFIX" ] + "/translations"; - if (!dictionary[ "QT_INSTALL_EXAMPLES" ].size()) - dictionary[ "QT_INSTALL_EXAMPLES" ] = qipempty ? "" : dictionary[ "QT_INSTALL_PREFIX" ] + "/examples"; - if (!dictionary[ "QT_INSTALL_TESTS" ].size()) - dictionary[ "QT_INSTALL_TESTS" ] = qipempty ? "" : 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 ? 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" ]; @@ -3260,63 +3223,6 @@ void Configure::generateConfigfiles() || !copySpec("default-host", "host ", dictionary["QMAKESPEC"])) return; - // Generate the new qconfig.cpp file - QDir(buildPath).mkpath("src/corelib/global"); - outName = buildPath + "/src/corelib/global/qconfig.cpp"; - - QTemporaryFile tmpFile2; - if (tmpFile2.open()) { - tmpStream.setDevice(&tmpFile2); - tmpStream << "/* Licensed */" << endl - << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << licenseInfo["LICENSEE"] << "\";" << endl - << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl - << endl - << "/* Build date */" << endl - << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl - << endl - << "static const char qt_configure_prefix_path_strs[][12 + 512] = {" << endl - << " \"qt_prfxpath=" << formatPath(dictionary["QT_INSTALL_PREFIX"]) << "\"," << endl - << " \"qt_docspath=" << formatPath(dictionary["QT_INSTALL_DOCS"]) << "\"," << endl - << " \"qt_hdrspath=" << formatPath(dictionary["QT_INSTALL_HEADERS"]) << "\"," << endl - << " \"qt_libspath=" << formatPath(dictionary["QT_INSTALL_LIBS"]) << "\"," << endl - << " \"qt_binspath=" << formatPath(dictionary["QT_INSTALL_BINS"]) << "\"," << endl - << " \"qt_plugpath=" << formatPath(dictionary["QT_INSTALL_PLUGINS"]) << "\"," << endl - << " \"qt_impspath=" << formatPath(dictionary["QT_INSTALL_IMPORTS"]) << "\"," << endl - << " \"qt_datapath=" << formatPath(dictionary["QT_INSTALL_DATA"]) << "\"," << endl - << " \"qt_trnspath=" << formatPath(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\"," << endl - << " \"qt_xmplpath=" << formatPath(dictionary["QT_INSTALL_EXAMPLES"]) << "\"," << endl - << " \"qt_tstspath=" << formatPath(dictionary["QT_INSTALL_TESTS"]) << "\"," << endl - << "#ifdef QT_BUILD_QMAKE" << endl - << " \"qt_ssrtpath=" << formatPath(dictionary["CFG_SYSROOT"]) << "\"," << endl - << " \"qt_hpfxpath=" << formatPath(dictionary["QT_HOST_PREFIX"]) << "\"," << endl - << " \"qt_hbinpath=" << formatPath(dictionary["QT_HOST_BINS"]) << "\"," << endl - << " \"qt_hdatpath=" << formatPath(dictionary["QT_HOST_DATA"]) << "\"," << endl - << "#endif" << endl - << "};" << endl; - - if ((platform() != WINDOWS) && (platform() != WINDOWS_CE)) - tmpStream << "static const char qt_configure_settings_path_str [256 + 12] = \"qt_stngpath=" << formatPath(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl; - - tmpStream << 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; - - if ((platform() != WINDOWS) && (platform() != WINDOWS_CE)) - tmpStream << "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl; - - tmpStream << endl; - - tmpStream.flush(); - tmpFile2.flush(); - - // Replace old qconfig.cpp with new one - ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL); - QFile::remove(outName); - tmpFile2.copy(outName); - tmpFile2.close(); - } - QTemporaryFile tmpFile3; if (tmpFile3.open()) { tmpStream.setDevice(&tmpFile3); @@ -3555,6 +3461,101 @@ void Configure::generateHeaders() } } +void Configure::generateQConfigCpp() +{ + // if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX + // if prefix is empty (WINCE), make all of them empty, if they aren't set + bool qipempty = false; + if (dictionary["QT_INSTALL_PREFIX"].isEmpty()) + qipempty = true; + + if (!dictionary["QT_INSTALL_DOCS"].size()) + dictionary["QT_INSTALL_DOCS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/doc"; + if (!dictionary["QT_INSTALL_HEADERS"].size()) + dictionary["QT_INSTALL_HEADERS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/include"; + if (!dictionary["QT_INSTALL_LIBS"].size()) + dictionary["QT_INSTALL_LIBS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/lib"; + if (!dictionary["QT_INSTALL_BINS"].size()) + dictionary["QT_INSTALL_BINS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/bin"; + if (!dictionary["QT_INSTALL_PLUGINS"].size()) + dictionary["QT_INSTALL_PLUGINS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/plugins"; + if (!dictionary["QT_INSTALL_IMPORTS"].size()) + dictionary["QT_INSTALL_IMPORTS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/imports"; + if (!dictionary["QT_INSTALL_DATA"].size()) + dictionary["QT_INSTALL_DATA"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"]; + if (!dictionary["QT_INSTALL_TRANSLATIONS"].size()) + dictionary["QT_INSTALL_TRANSLATIONS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/translations"; + if (!dictionary["QT_INSTALL_EXAMPLES"].size()) + dictionary["QT_INSTALL_EXAMPLES"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/examples"; + if (!dictionary["QT_INSTALL_TESTS"].size()) + dictionary["QT_INSTALL_TESTS"] = qipempty ? "" : 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 ? 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"]; + + // Generate the new qconfig.cpp file + QDir(buildPath).mkpath("src/corelib/global"); + const QString outName(buildPath + "/src/corelib/global/qconfig.cpp"); + + QTemporaryFile tmpFile; + if (tmpFile.open()) { + QTextStream tmpStream(&tmpFile); + tmpStream << "/* Licensed */" << endl + << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << licenseInfo["LICENSEE"] << "\";" << endl + << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl + << endl + << "/* Build date */" << endl + << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl + << endl + << "static const char qt_configure_prefix_path_strs[][12 + 512] = {" << endl + << " \"qt_prfxpath=" << formatPath(dictionary["QT_INSTALL_PREFIX"]) << "\"," << endl + << " \"qt_docspath=" << formatPath(dictionary["QT_INSTALL_DOCS"]) << "\"," << endl + << " \"qt_hdrspath=" << formatPath(dictionary["QT_INSTALL_HEADERS"]) << "\"," << endl + << " \"qt_libspath=" << formatPath(dictionary["QT_INSTALL_LIBS"]) << "\"," << endl + << " \"qt_binspath=" << formatPath(dictionary["QT_INSTALL_BINS"]) << "\"," << endl + << " \"qt_plugpath=" << formatPath(dictionary["QT_INSTALL_PLUGINS"]) << "\"," << endl + << " \"qt_impspath=" << formatPath(dictionary["QT_INSTALL_IMPORTS"]) << "\"," << endl + << " \"qt_datapath=" << formatPath(dictionary["QT_INSTALL_DATA"]) << "\"," << endl + << " \"qt_trnspath=" << formatPath(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\"," << endl + << " \"qt_xmplpath=" << formatPath(dictionary["QT_INSTALL_EXAMPLES"]) << "\"," << endl + << " \"qt_tstspath=" << formatPath(dictionary["QT_INSTALL_TESTS"]) << "\"," << endl + << "#ifdef QT_BUILD_QMAKE" << endl + << " \"qt_ssrtpath=" << formatPath(dictionary["CFG_SYSROOT"]) << "\"," << endl + << " \"qt_hpfxpath=" << formatPath(dictionary["QT_HOST_PREFIX"]) << "\"," << endl + << " \"qt_hbinpath=" << formatPath(dictionary["QT_HOST_BINS"]) << "\"," << endl + << " \"qt_hdatpath=" << formatPath(dictionary["QT_HOST_DATA"]) << "\"," << endl + << "#endif" << endl + << "};" << endl; + + if ((platform() != WINDOWS) && (platform() != WINDOWS_CE)) + tmpStream << "static const char qt_configure_settings_path_str [256 + 12] = \"qt_stngpath=" << formatPath(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl; + + tmpStream << 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; + + if ((platform() != WINDOWS) && (platform() != WINDOWS_CE)) + tmpStream << "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl; + + tmpStream.flush(); + tmpFile.flush(); + + // Replace old qconfig.cpp with new one + ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL); + QFile::remove(outName); + tmpFile.copy(outName); + tmpFile.close(); + } +} + void Configure::buildQmake() { if (dictionary[ "BUILD_QMAKE" ] == "yes") { diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index c16b9e2ad3..ff5050ad8d 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -64,6 +64,8 @@ public: QString defaultTo(const QString &option); bool checkAvailability(const QString &part); + void generateQConfigCpp(); + void buildQmake(); void autoDetection(); bool verifyConfiguration(); @@ -73,7 +75,6 @@ public: void generateBuildKey(); void generateCachefile(); void displayConfig(); - void buildQmake(); #endif void generateMakefiles(); void appendMakeItem(int inList, const QString &item); diff --git a/tools/configure/main.cpp b/tools/configure/main.cpp index 794793b52f..e153cf1eb0 100644 --- a/tools/configure/main.cpp +++ b/tools/configure/main.cpp @@ -68,6 +68,12 @@ int runConfigure( int argc, char** argv ) if (!app.isOk()) return 3; + app.generateQConfigCpp(); + + app.buildQmake(); + if (!app.isOk()) + return 3; + // Auto-detect modules and settings. app.autoDetection(); @@ -88,8 +94,6 @@ int runConfigure( int argc, char** argv ) app.generateConfigfiles(); if( !app.isDone() ) app.generateHeaders(); - if( !app.isDone() ) - app.buildQmake(); // must be done after buildQmake() if (!app.isDone()) app.detectArch(); |