summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-02-24 20:32:08 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-29 00:05:38 +0100
commite05d5c36beb1116657e87d0088ee6153115f320a (patch)
tree3644d04b9f60c0f010196fbc427f38f8ca6381b0 /tools
parentfa1b9070af66edb81b2a3735c1951f78b22bd666 (diff)
factor out code to install default mkspec
Change-Id: I15f371df7bc24cd85c1c0924d1929da4dc3db16d Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/configure/configureapp.cpp41
-rw-r--r--tools/configure/configureapp.h1
2 files changed, 25 insertions, 17 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index b7eeea6b60..36c9501d5a 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -2638,6 +2638,29 @@ QString Configure::addDefine(QString def)
}
#if !defined(EVAL)
+bool Configure::copySpec(const char *name, const char *pfx, const QString &spec)
+{
+ // Copy configured mkspec to default directory, but remove the old one first, if there is any
+ QString defSpec = buildPath + "/mkspecs/" + name;
+ QFileInfo defSpecInfo(defSpec);
+ if (defSpecInfo.exists()) {
+ if (!Environment::rmdir(defSpec)) {
+ cout << "Couldn't update default " << pfx << "mkspec! Are files in " << qPrintable(defSpec) << " read-only?" << endl;
+ dictionary["DONE"] = "error";
+ return false;
+ }
+ }
+
+ QString pltSpec = sourcePath + "/mkspecs/" + spec;
+ QString includeSpec = buildPath + "/mkspecs/" + spec;
+ if (!Environment::cpdir(pltSpec, defSpec, includeSpec)) {
+ cout << "Couldn't update default " << pfx << "mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl;
+ dictionary["DONE"] = "error";
+ return false;
+ }
+ return true;
+}
+
void Configure::generateConfigfiles()
{
QDir(buildPath).mkpath("src/corelib/global");
@@ -2821,25 +2844,9 @@ void Configure::generateConfigfiles()
tmpFile.close();
}
- // Copy configured mkspec to default directory, but remove the old one first, if there is any
- QString defSpec = buildPath + "/mkspecs/default";
- QFileInfo defSpecInfo(defSpec);
- if (defSpecInfo.exists()) {
- if (!Environment::rmdir(defSpec)) {
- cout << "Couldn't update default mkspec! Are files in " << qPrintable(defSpec) << " read-only?" << endl;
- dictionary["DONE"] = "error";
- return;
- }
- }
-
QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"];
- QString pltSpec = sourcePath + "/mkspecs/" + spec;
- QString includeSpec = buildPath + "/mkspecs/" + spec;
- if (!Environment::cpdir(pltSpec, defSpec, includeSpec)) {
- cout << "Couldn't update default mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl;
- dictionary["DONE"] = "error";
+ if (!copySpec("default", "", spec))
return;
- }
// Generate the new qconfig.cpp file
QDir(buildPath).mkpath("src/corelib/global");
diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h
index c3838fb139..58544b5041 100644
--- a/tools/configure/configureapp.h
+++ b/tools/configure/configureapp.h
@@ -79,6 +79,7 @@ public:
void generateMakefiles();
void appendMakeItem(int inList, const QString &item);
#if !defined(EVAL)
+ bool copySpec(const char *name, const char *pfx, const QString &spec);
void generateConfigfiles();
#endif
void showSummary();