summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-06-29 09:05:36 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-06-29 09:06:37 +0200
commit1491065506eb97c9def93b908db1df9fcdf3fff0 (patch)
tree8241e72cc1016b41c08f9d14e81fb63c07e6a5ba /tools
parent551e1e63d9da18787ae72fc3f0e76f28dbe5f7e3 (diff)
parent61c775684fe38f3c1e1bc7599e21054aedba523c (diff)
Merge branch 'buildsystem' (second round)
refactoring and cleanup. fixes x-builds between different os families. Conflicts: mkspecs/features/qt.prf Change-Id: I0205e6f07f77c9b015cf055dd87a471883949a91
Diffstat (limited to 'tools')
-rw-r--r--tools/configure/configureapp.cpp18
-rw-r--r--tools/configure/environment.cpp55
-rw-r--r--tools/configure/environment.h4
3 files changed, 18 insertions, 59 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index bcb597d72f..fb666e221e 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -3011,7 +3011,7 @@ 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
+ // "Link" 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()) {
@@ -3022,10 +3022,18 @@ bool Configure::copySpec(const char *name, const char *pfx, const QString &spec)
}
}
- 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;
+ QDir::current().mkpath(defSpec);
+ QFile qfile(defSpec + "/qmake.conf");
+ if (qfile.open(QFile::WriteOnly | QFile::Text)) {
+ QTextStream fileStream;
+ fileStream.setDevice(&qfile);
+ QString srcSpec = buildPath + "/mkspecs/" + spec; // We copied it to the build dir
+ fileStream << "QMAKESPEC_ORIGINAL = " << formatPath(srcSpec) << endl;
+ fileStream << "include(" << formatPath(QDir(defSpec).relativeFilePath(srcSpec + "/qmake.conf")) << ")" << endl;
+ qfile.close();
+ }
+ if (qfile.error() != QFile::NoError) {
+ cout << "Couldn't update default " << pfx << "mkspec: " << qPrintable(qfile.errorString()) << endl;
dictionary["DONE"] = "error";
return false;
}
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp
index 0365340833..45dc9d9417 100644
--- a/tools/configure/environment.cpp
+++ b/tools/configure/environment.cpp
@@ -454,21 +454,12 @@ QString Environment::execute(const QString &command, int *returnCode)
/*!
Copies the \a srcDir contents into \a destDir.
- If \a includeSrcDir is not empty, any files with 'h', 'prf', or 'conf' suffixes
- will not be copied over from \a srcDir. Instead a new file will be created
- in \a destDir with the same name and that file will include a file with the
- same name from the \a includeSrcDir using relative path and appropriate
- syntax for the file type.
-
Returns true if copying was successful.
*/
-bool Environment::cpdir(const QString &srcDir,
- const QString &destDir,
- const QString &includeSrcDir)
+bool Environment::cpdir(const QString &srcDir, const QString &destDir)
{
QString cleanSrcName = QDir::cleanPath(srcDir);
QString cleanDstName = QDir::cleanPath(destDir);
- QString cleanIncludeName = QDir::cleanPath(includeSrcDir);
#ifdef CONFIGURE_DEBUG_CP_DIR
qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName;
@@ -480,59 +471,21 @@ bool Environment::cpdir(const QString &srcDir,
bool result = true;
QDir dir = QDir(cleanSrcName);
- QDir destinationDir = QDir(cleanDstName);
QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
for (int i = 0; result && (i < allEntries.count()); ++i) {
QFileInfo entry = allEntries.at(i);
bool intermediate = true;
if (entry.isDir()) {
- QString newIncSrcDir;
- if (!includeSrcDir.isEmpty())
- newIncSrcDir = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName());
-
intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()),
- QString("%1/%2").arg(cleanDstName).arg(entry.fileName()),
- newIncSrcDir);
+ QString("%1/%2").arg(cleanDstName).arg(entry.fileName()));
} else {
QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName());
#ifdef CONFIGURE_DEBUG_CP_DIR
qDebug() << "About to cp (file)" << entry.absoluteFilePath() << "->" << destFile;
#endif
QFile::remove(destFile);
- QString suffix = entry.suffix();
- if (!includeSrcDir.isEmpty() && (suffix == "prf" || suffix == "conf" || suffix == "h")) {
- QString relativeIncludeFilePath = QString("%1/%2").arg(cleanIncludeName).arg(entry.fileName());
- relativeIncludeFilePath = destinationDir.relativeFilePath(relativeIncludeFilePath);
-#ifdef CONFIGURE_DEBUG_CP_DIR
- qDebug() << "...instead generate relative include to" << relativeIncludeFilePath;
-#endif
- QFile currentFile(destFile);
- if (currentFile.open(QFile::WriteOnly | QFile::Text)) {
- QTextStream fileStream;
- fileStream.setDevice(&currentFile);
-
- if (suffix == "prf" || suffix == "conf") {
- if (entry.fileName() == "qmake.conf") {
- // While QMAKESPEC_ORIGINAL being relative or absolute doesn't matter for the
- // primary use of this variable by qmake to identify the original mkspec, the
- // variable is also used for few special cases where the absolute path is required.
- // Conversely, the include of the original qmake.conf must be done using relative path,
- // as some Qt binary deployments are done in a manner that doesn't allow for patching
- // the paths at the installation time.
- fileStream << "QMAKESPEC_ORIGINAL=" << cleanSrcName << endl << endl;
- }
- fileStream << "include(" << relativeIncludeFilePath << ")" << endl << endl;
- } else if (suffix == "h") {
- fileStream << "#include \"" << relativeIncludeFilePath << "\"" << endl << endl;
- }
-
- fileStream.flush();
- currentFile.close();
- }
- } else {
- intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
- SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
- }
+ intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
+ SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
}
if(!intermediate) {
qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir();
diff --git a/tools/configure/environment.h b/tools/configure/environment.h
index 979d538e8a..58e9c18137 100644
--- a/tools/configure/environment.h
+++ b/tools/configure/environment.h
@@ -67,9 +67,7 @@ public:
static int execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv);
static QString execute(const QString &command, int *returnCode = 0);
- static bool cpdir(const QString &srcDir,
- const QString &destDir,
- const QString &includeSrcDir = QString());
+ static bool cpdir(const QString &srcDir, const QString &destDir);
static bool rmdir(const QString &name);
private: