From a9822d39136a3f7912cc68320cfe030d95b4cb4f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 24 Aug 2011 15:56:02 +0300 Subject: Improved support for shadow builds in Symbian. It is now possible to make shadow builds in Symbian. Note that any relative host side paths specified via BLD_INF_RULES, MMP_RULES, or DEPLOYMENT pkg_*rules are NOT automatically converted to point to build directory. Task-number: QTBUG-10432 Rubber-stamped-by: ossi Reviewed-by: TrustMe --- doc/src/development/qmake-manual.qdoc | 12 ++++++++++++ mkspecs/features/symbian/application_icon.prf | 4 +--- qmake/generators/makefile.cpp | 13 ++++++++----- qmake/generators/symbian/symbiancommon.cpp | 6 ++++-- qmake/generators/symbian/symmake.cpp | 26 +++++++++++--------------- qmake/generators/symbian/symmake.h | 1 + qmake/generators/symbian/symmake_abld.cpp | 3 ++- qmake/generators/symbian/symmake_sbsv2.cpp | 19 ++++++++----------- 8 files changed, 47 insertions(+), 37 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 329bac5..2c7fda2 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1184,6 +1184,10 @@ Any rules you define will be added after automatically generated rules in each section. + \note Content specified using \c BLD_INF_RULES is inserted as-is into the \c bld.inf + file, so any rules that specify host side paths may not work correctly when doing + a shadow build. + \target CONFIG \section1 CONFIG @@ -1521,6 +1525,10 @@ override languages statement, you must override also package-header statement and all other statements which are language specific. + \note Custom deployments specified using \c pkg_postrules are inserted + as-is into the \c PKG file, so any rules that specify host side paths may not + work correctly when doing a shadow build. + On the Symbian platform, three separate PKG files are generated: \list @@ -1911,6 +1919,10 @@ \c TARGET.EPOCSTACKSIZE. Doing so could result in duplicate statements in the MMP file. + \note Content specified using \c MMP_RULES is inserted as-is into the \c MMP + file, so any rules that specify host side paths may not work correctly when doing + a shadow build. + \target MOC_DIR \section1 MOC_DIR diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index f058399..dc23428 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -45,9 +45,7 @@ contains(CONFIG, no_icon) { # Note: symbian-sbsv2 builds can't utilize extra compiler for mifconv, so ICON handling is done in code !symbian-sbsv2 { # Absolute path required for shadow builds. - # However, in older Symbian environments abld toolchain can't handle even moderately long - # paths, so don't force absolute there. - !symbian-abld:!contains(ICON, "^(/|\\\\|.:).*"):ICON = $$_PRO_FILE_PWD_/$$ICON + !contains(ICON, "^(/|\\\\|.:).*"):ICON = $$_PRO_FILE_PWD_/$$ICON #Makefile: requires paths with backslash ICON_backslashed = $$ICON diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 00f6b4a..b9de92d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1769,6 +1769,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) { QString clean_targets; const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); + QDir outputDir(Option::output_dir); for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { QString tmp_out = fileFixify(project->values((*it) + ".output").first(), Option::output_dir, Option::output_dir); @@ -1960,9 +1961,11 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) QString cmd; if (isForSymbianSbsv2()) { // In sbsv2 the command inputs and outputs need to use absolute paths - cmd = replaceExtraCompilerVariables(tmp_cmd, - fileFixify(escapeFilePaths(inputs), FileFixifyAbsolute), - fileFixify(QStringList(tmp_out), FileFixifyAbsolute)); + QStringList absoluteInputs; + for (int i = 0; i < inputs.size(); ++i) + absoluteInputs.append(escapeFilePath(outputDir.absoluteFilePath(inputs.at(i)))); + cmd = replaceExtraCompilerVariables(tmp_cmd, absoluteInputs, + QStringList(outputDir.absoluteFilePath(tmp_out))); } else { cmd = replaceExtraCompilerVariables(tmp_cmd, escapeFilePaths(inputs), QStringList(tmp_out)); } @@ -1996,8 +1999,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) if (isForSymbianSbsv2()) { // In sbsv2 the command inputs and outputs need to use absolute paths cmd = replaceExtraCompilerVariables(tmp_cmd, - fileFixify((*input), FileFixifyAbsolute), - fileFixify(out, FileFixifyAbsolute)); + outputDir.absoluteFilePath(*input), + outputDir.absoluteFilePath(out)); } else { cmd = replaceExtraCompilerVariables(tmp_cmd, (*input), out); } diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index d4db4b9..c9ffa11 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -503,9 +503,11 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, twf << wrapperStreamBuffer << endl; // Wrapped files deployment - QString currentPath = qmake_getpwd(); + QString currentPath = Option::output_dir; + if (!currentPath.endsWith(QLatin1Char('/'))) + currentPath += QLatin1Char('/'); QString sisName = QString("%1.sis").arg(fixedTarget); - twf << "\"" << currentPath << "/" << sisName << "\" - \"!:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; + twf << "\"" << currentPath << sisName << "\" - \"!:\\private\\2002CCCE\\import\\" << sisName << "\"" << endl; QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); bootStrapPath.append("/smartinstaller.sis"); diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index bdba329..694bbfb 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -126,8 +126,7 @@ QString SymbianMakefileGenerator::absolutizePath(const QString& origPath) if (resultPath.startsWith("/epoc32/", Qt::CaseInsensitive)) resultPath = QDir::fromNativeSeparators(qt_epocRoot()) + resultPath.mid(1); - QFileInfo fi(fileInfo(resultPath)); - + QFileInfo fi(outputDir, resultPath); // Since origPath can be something given in HEADERS, we need to check if we are dealing // with a file or a directory. In case the origPath doesn't yet exist, isFile() returns // false and we default to assuming it is a dir. @@ -271,6 +270,8 @@ void SymbianMakefileGenerator::init() MakefileGenerator::init(); SymbianCommonGenerator::init(); + outputDir = QDir(Option::output_dir); + if (0 != project->values("QMAKE_PLATFORM").size()) platform = varGlue("QMAKE_PLATFORM", "", " ", ""); @@ -338,7 +339,6 @@ void SymbianMakefileGenerator::initMmpVariables() srcpaths << project->values("UNUSED_SOURCES") << project->values("UI_SOURCES_DIR"); srcpaths << project->values("UI_DIR"); - QDir current = QDir::current(); QString absolutizedCurrent = absolutizePath("."); for (int j = 0; j < srcpaths.size(); ++j) { @@ -373,12 +373,12 @@ void SymbianMakefileGenerator::initMmpVariables() QStringList temporary; for (int i = 0; i < sysincspaths.size(); ++i) { QString origPath = sysincspaths.at(i); - QFileInfo origPathInfo(fileInfo(origPath)); + QFileInfo origPathInfo(outputDir, origPath); bool bFound = false; for (int j = 0; j < temporary.size(); ++j) { QString tmpPath = temporary.at(j); - QFileInfo tmpPathInfo(fileInfo(tmpPath)); + QFileInfo tmpPathInfo(outputDir, tmpPath); if (origPathInfo.absoluteFilePath() == tmpPathInfo.absoluteFilePath()) { bFound = true; @@ -515,14 +515,12 @@ void SymbianMakefileGenerator::writeMmpFile(QString &filename, const SymbianLoca writeMmpFileIncludePart(t); - QDir current = QDir::current(); - for (QMap::iterator it = sources.begin(); it != sources.end(); ++it) { QStringList values = it.value(); QString currentSourcePath = it.key(); if (values.size()) - t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, current) << endl; + t << "SOURCEPATH \t" << fixPathForMmp(currentSourcePath, Option::output_dir) << endl; for (int i = 0; i < values.size(); ++i) { QString sourceFileName = values.at(i); @@ -709,13 +707,11 @@ void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, const Sy void SymbianMakefileGenerator::writeMmpFileSystemIncludePart(QTextStream& t) { - QDir current = QDir::current(); - for (QMap::iterator it = systeminclude.begin(); it != systeminclude.end(); ++it) { QStringList values = it.value(); for (int i = 0; i < values.size(); ++i) { QString handledPath = values.at(i); - t << "SYSTEMINCLUDE\t\t" << fixPathForMmp(handledPath, current) << endl; + t << "SYSTEMINCLUDE\t\t" << fixPathForMmp(handledPath, Option::output_dir) << endl; } } @@ -1105,7 +1101,7 @@ void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) fromFile = item.endsWith(Option::pro_ext); fixedItem = item; } - QFileInfo fi(fileInfo(fixedItem)); + QFileInfo fi(outputDir, fixedItem); if (!fromFile) { t << "\t-$(MAKE) -f \"" << Option::fixPathToTargetOS(fi.absoluteFilePath() + "/Makefile") << "\" dodistclean" << endl; } else { @@ -1118,19 +1114,19 @@ void SymbianMakefileGenerator::generateDistcleanTargets(QTextStream& t) } - generatedFiles << Option::fixPathToTargetOS(fileInfo(Option::output.fileName()).absoluteFilePath()); // bld.inf + generatedFiles << Option::output.fileName(); // bld.inf generatedFiles << project->values("QMAKE_INTERNAL_PRL_FILE"); // Add generated prl files for cleanup generatedFiles << project->values("QMAKE_DISTCLEAN"); // Add any additional files marked for distclean QStringList fixedFiles; QStringList fixedDirs; foreach(QString item, generatedFiles) { - QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); + QString fixedItem = Option::fixPathToTargetOS(outputDir.absoluteFilePath(item)); if (!fixedFiles.contains(fixedItem)) { fixedFiles << fixedItem; } } foreach(QString item, generatedDirs) { - QString fixedItem = Option::fixPathToTargetOS(fileInfo(item).absoluteFilePath()); + QString fixedItem = Option::fixPathToTargetOS(outputDir.absoluteFilePath(item)); if (!fixedDirs.contains(fixedItem)) { fixedDirs << fixedItem; } diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 053b275..1dfb102 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -66,6 +66,7 @@ protected: // (output file) (source , command) QMap makmakeCommands; QStringList overriddenMmpKeywords; + QDir outputDir; QString fixPathForMmp(const QString& origPath, const QDir& parentDir); QString absolutizePath(const QString& origPath); diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index 7863dca..7026355 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -70,7 +70,8 @@ SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { } void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly) { - QFile ft(gnuMakefileName); + QString mkFullPath = Option::output_dir + QLatin1Char('/') + gnuMakefileName; + QFile ft(mkFullPath); if (ft.open(QIODevice::WriteOnly)) { generatedFiles << ft.fileName(); QTextStream t(&ft); diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 78a9024..cc32f8d 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -624,11 +624,11 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t // are not necessary. QStringList allPreDeps; foreach(QString item, project->values("PRE_TARGETDEPS")) { - allPreDeps.append(fileInfo(item).absoluteFilePath()); + allPreDeps.append(QDir::cleanPath(outputDir.absoluteFilePath(item))); } foreach (QString item, project->values("GENERATED_SOURCES")) { - allPreDeps.append(fileInfo(item).absoluteFilePath()); + allPreDeps.append(QDir::cleanPath(outputDir.absoluteFilePath(item))); } for (QMap::iterator it = sources.begin(); it != sources.end(); ++it) { @@ -638,7 +638,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t QString sourceFile = currentSourcePath + "/" + values.at(i); QStringList deps = findDependencies(QDir::toNativeSeparators(sourceFile)); foreach(QString depItem, deps) { - appendIfnotExist(allPreDeps, fileInfo(depItem).absoluteFilePath()); + appendIfnotExist(allPreDeps, QDir::cleanPath(outputDir.absoluteFilePath(depItem))); } } } @@ -649,7 +649,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t foreach(QString item, extraTargets) { foreach(QString targetItem, project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_TARGETS.") + item)) { // Make sure targetpath is absolute - QString absoluteTarget = fileInfo(targetItem).absoluteFilePath(); + QString absoluteTarget = QDir::cleanPath(outputDir.absoluteFilePath(targetItem)); if (allPreDeps.contains(absoluteTarget)) { QStringList deps = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + item + targetItem); QString commandItem = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + item + targetItem).join(" "); @@ -658,7 +658,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t QString absoluteDeps; foreach (QString depItem, deps) { if (!depItem.isEmpty()) { - absoluteDeps.append(fileInfo(depItem).absoluteFilePath()); + absoluteDeps.append(QDir::cleanPath(outputDir.absoluteFilePath(depItem))); absoluteDeps.append(" "); } } @@ -723,9 +723,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t QFileInfo iconInfo = fileInfo(icon); - QFileInfo bldinf(project->values("MAKEFILE").first()); - QString iconPath = bldinf.dir().relativeFilePath(iconInfo.path()); - + QString iconPath = outputDir.relativeFilePath(iconInfo.absolutePath()); QString iconFile = iconInfo.baseName(); QFileInfo iconTargetInfo = fileInfo(iconTargetFile); @@ -747,11 +745,10 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t if (!cleanFiles.isEmpty()) { QStringList absoluteCleanFiles; foreach (QString cleanFile, cleanFiles) { - QFileInfo fi(cleanFile); QString fileName = QLatin1String("\""); - fileName.append(fi.absoluteFilePath()); + fileName.append(QDir::cleanPath(outputDir.absoluteFilePath(cleanFile))); fileName.append(QLatin1String("\"")); - absoluteCleanFiles << fileName; + absoluteCleanFiles << fileName; } t << "START EXTENSION qt/qmake_clean" << endl; t << "OPTION CLEAN_FILES " << absoluteCleanFiles.join(" ") << endl; -- cgit v0.12