diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-02-10 10:57:05 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2011-02-10 11:23:31 (GMT) |
commit | 72e0778c9b5bdae58596090b114d5d0e7092f911 (patch) | |
tree | 53c31d9b61700c2c6db672767e24953192c5373c /tools/configure/environment.cpp | |
parent | abb425e3db6c20c5271788cb1ec4e1fe37b9ea5b (diff) | |
parent | 50bb35a5ca48816f7563d1055071b4caa7791056 (diff) | |
download | Qt-72e0778c9b5bdae58596090b114d5d0e7092f911.zip Qt-72e0778c9b5bdae58596090b114d5d0e7092f911.tar.gz Qt-72e0778c9b5bdae58596090b114d5d0e7092f911.tar.bz2 |
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
doc/src/development/qmake-manual.qdoc
mkspecs/symbian-gcce/qmake.conf
qmake/project.cpp
src/corelib/global/qnamespace.qdoc
src/declarative/graphicsitems/qdeclarativetext.cpp
src/gui/text/qtextdocumentlayout.cpp
src/gui/text/qtextdocumentlayout_p.h
tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
tests/auto/networkselftest/networkselftest.pro
tests/auto/qscriptengine/tst_qscriptengine.cpp
tools/designer/src/components/signalsloteditor/signalslot_utils.cpp
tools/designer/src/components/signalsloteditor/signalsloteditorwindow.cpp
tools/qdoc3/test/qt-build-docs.qdocconf
tools/qdoc3/test/qt-html-templates.qdocconf
tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf
tools/qdoc3/test/qt.qdocconf
tools/qdoc3/test/qt_ja_JP.qdocconf
tools/qdoc3/test/qt_zh_CN.qdocconf
Diffstat (limited to 'tools/configure/environment.cpp')
-rw-r--r-- | tools/configure/environment.cpp | 61 |
1 files changed, 57 insertions, 4 deletions
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 8040c7a..1885955 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -397,10 +397,25 @@ int Environment::execute(QStringList arguments, const QStringList &additionalEnv return exitCode; } -bool Environment::cpdir(const QString &srcDir, const QString &destDir) +/*! + 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) { 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; #endif @@ -411,21 +426,59 @@ bool Environment::cpdir(const QString &srcDir, const QString &destDir) 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())); + QString("%1/%2").arg(cleanDstName).arg(entry.fileName()), + newIncSrcDir); } 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); - intermediate = QFile::copy(entry.absoluteFilePath(), destFile); - SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL); + 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(¤tFile); + + 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); + } } if(!intermediate) { qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir(); |