summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-20 17:58:24 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-06-27 14:35:24 +0200
commitbc05c9aee8af5f27d297e9b525d98d18129b29da (patch)
treececb8b83095ed80857f754cb912c51bcff14f295
parentdafc4a884c7ccbd7417bf190c83a2465fb829096 (diff)
don't copy files to default specs any more
now that the default specs really only forward to the real specs, it is not necessary to copy any auxiliary files. Change-Id: I169a61a045063b796062fe6af3a2afbe3f1c9da0 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
-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 f22519afdd..9086007093 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -3046,7 +3046,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()) {
@@ -3057,10 +3057,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: