summaryrefslogtreecommitdiffstats
path: root/qmake/generators/symbian
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators/symbian')
-rw-r--r--qmake/generators/symbian/symbiancommon.cpp26
-rw-r--r--qmake/generators/symbian/symmake.cpp33
-rw-r--r--qmake/generators/symbian/symmake.h2
-rw-r--r--qmake/generators/symbian/symmake_abld.cpp21
-rw-r--r--qmake/generators/symbian/symmake_abld.h2
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp187
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.h7
7 files changed, 201 insertions, 77 deletions
diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp
index 3a4bdbc..d124b02 100644
--- a/qmake/generators/symbian/symbiancommon.cpp
+++ b/qmake/generators/symbian/symbiancommon.cpp
@@ -252,8 +252,30 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB
tw << languageRules.join("\n") << endl;
ts << languageRules.join("\n") << endl;
- // name of application, UID and version
- QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ',');
+ // Determine application version. If version has missing component values,
+ // those will default to zero.
+ // If VERSION is missing altogether or is invalid, use "1,0,0"
+ QStringList verNumList = project->first("VERSION").split('.');
+ uint major = 0;
+ uint minor = 0;
+ uint patch = 0;
+ bool success = false;
+
+ if (verNumList.size() > 0) {
+ major = verNumList[0].toUInt(&success);
+ if (success && verNumList.size() > 1) {
+ minor = verNumList[1].toUInt(&success);
+ if (success && verNumList.size() > 2) {
+ patch = verNumList[2].toUInt(&success);
+ }
+ }
+ }
+
+ QString applicationVersion("1,0,0");
+ if (success)
+ applicationVersion = QString("%1,%2,%3").arg(major).arg(minor).arg(patch);
+
+ // Package header
QString sisHeader = "; SIS header: name, uid, version\n#{\"%1\"},(%2),%3\n\n";
QString visualTarget = generator->escapeFilePath(project->first("TARGET"));
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index ff58270..cf6bd13 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -241,13 +241,8 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t)
writeMkFile(wrapperFileName, false);
- QString shortProFilename = project->projectFile();
- shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString(""));
- shortProFilename.replace(Option::pro_ext, QString(""));
-
- QString mmpFilename = Option::output_dir + QLatin1Char('/') + shortProFilename + QLatin1Char('_')
- + uid3 + Option::mmp_ext;
- writeMmpFile(mmpFilename, symbianLangCodes);
+ QString absoluteMmpFileName = Option::output_dir + QLatin1Char('/') + mmpFileName;
+ writeMmpFile(absoluteMmpFileName, symbianLangCodes);
if (targetType == TypeExe) {
if (!project->isActiveConfig("no_icon")) {
@@ -281,6 +276,15 @@ void SymbianMakefileGenerator::init()
project->values("MAKEFILE") += BLD_INF_FILENAME;
// .mmp
+ mmpFileName = fixedTarget;
+ if (targetType == TypeExe)
+ mmpFileName.append("_exe");
+ else if (targetType == TypeDll || targetType == TypePlugin)
+ mmpFileName.append("_dll");
+ else if (targetType == TypeLib)
+ mmpFileName.append("_lib");
+ mmpFileName.append(Option::mmp_ext);
+
initMmpVariables();
uid2 = project->first("TARGET.UID2");
@@ -480,7 +484,7 @@ void SymbianMakefileGenerator::writeMmpFileHeader(QTextStream &t)
t << QDateTime::currentDateTime().toString(Qt::ISODate) << endl;
t << "// This file is generated by qmake and should not be modified by the" << endl;
t << "// user." << endl;
- t << "// Name : " << escapeFilePath(fileFixify(project->projectFile().remove(project->projectFile().length() - 4, 4))) << Option::mmp_ext << endl;
+ t << "// Name : " << mmpFileName << endl;
t << "// ==============================================================================" << endl << endl;
}
@@ -890,8 +894,6 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
// Add includes of subdirs bld.inf files
- QString mmpfilename = escapeFilePath(fileFixify(project->projectFile()));
- mmpfilename = mmpfilename.replace(mmpfilename.lastIndexOf("."), 4, Option::mmp_ext);
QString currentPath = qmake_getpwd();
QDir directory(currentPath);
@@ -973,15 +975,8 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
t << endl << mmpTag << endl << endl;
writeBldInfMkFilePart(t, addDeploymentExtension);
- if (targetType != TypeSubdirs) {
- QString shortProFilename = project->projectFile();
- shortProFilename.replace(0, shortProFilename.lastIndexOf("/") + 1, QString(""));
- shortProFilename.replace(Option::pro_ext, QString(""));
-
- QString mmpFilename = shortProFilename + QString("_") + uid3 + Option::mmp_ext;
-
- t << mmpFilename << endl;
- }
+ if (targetType != TypeSubdirs)
+ t << mmpFileName << endl;
userItems = userBldInfRules.value(mmpTag);
foreach(QString item, userItems)
diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h
index 9853790..a1a8e88 100644
--- a/qmake/generators/symbian/symmake.h
+++ b/qmake/generators/symbian/symmake.h
@@ -59,6 +59,7 @@ class SymbianMakefileGenerator : public MakefileGenerator, public SymbianCommonG
protected:
QString platform;
QString uid2;
+ QString mmpFileName;
QMap<QString, QStringList> sources;
QMap<QString, QStringList> systeminclude;
QMap<QString, QStringList> library;
@@ -78,6 +79,7 @@ protected:
QString generateUID3();
void initMmpVariables();
+ void generateMmpFileName();
void handleMmpRulesOverrides(QString &checkString,
bool &inResourceBlock,
QStringList &restrictedMmpKeywords,
diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp
index d60528b..85dcab4 100644
--- a/qmake/generators/symbian/symmake_abld.cpp
+++ b/qmake/generators/symbian/symmake_abld.cpp
@@ -70,10 +70,6 @@ SymbianAbldMakefileGenerator::~SymbianAbldMakefileGenerator() { }
void SymbianAbldMakefileGenerator::writeMkFile(const QString& wrapperFileName, bool deploymentOnly)
{
- QString gnuMakefileName = QLatin1String("Makefile_") + uid3;
- removeEpocSpecialCharacters(gnuMakefileName);
- gnuMakefileName.append(".mk");
-
QFile ft(gnuMakefileName);
if (ft.open(QIODevice::WriteOnly)) {
generatedFiles << ft.fileName();
@@ -253,13 +249,17 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool
} else {
t << "all: debug release" << endl;
t << endl;
+
+ QString qmakeCmd = "\t$(QMAKE) \"" + project->projectFile() + "\" " + buildArgs();
+
t << "qmake:" << endl;
- t << "\t$(QMAKE) -spec symbian-abld -o \"" << fileInfo(Option::output.fileName()).fileName()
- << "\" \"" << project->projectFile() << "\"" << endl;
+ t << qmakeCmd << endl;
t << endl;
- t << BLD_INF_FILENAME ":" << endl;
- t << "\t$(QMAKE)" << endl;
+
+ t << BLD_INF_FILENAME ": " << project->projectFile() << endl;
+ t << qmakeCmd << endl;
t << endl;
+
t << "$(ABLD): " BLD_INF_FILENAME << endl;
t << "\tbldmake bldfiles" << endl;
t << endl;
@@ -471,9 +471,8 @@ void SymbianAbldMakefileGenerator::writeBldInfMkFilePart(QTextStream& t, bool ad
// Normally emulator deployment gets done via regular makefile, but since subdirs
// do not get that, special deployment only makefile is generated for them if needed.
if (targetType != TypeSubdirs || addDeploymentExtension) {
- QString gnuMakefileName = QLatin1String("Makefile_") + uid3;
- removeEpocSpecialCharacters(gnuMakefileName);
- gnuMakefileName.append(".mk");
+ gnuMakefileName = QLatin1String("Makefile_") + fileInfo(mmpFileName).completeBaseName()
+ + QLatin1String(".mk");
t << "gnumakefile " << gnuMakefileName << endl;
}
}
diff --git a/qmake/generators/symbian/symmake_abld.h b/qmake/generators/symbian/symmake_abld.h
index f998b28..214e0c5 100644
--- a/qmake/generators/symbian/symmake_abld.h
+++ b/qmake/generators/symbian/symmake_abld.h
@@ -58,7 +58,7 @@ protected:
virtual void appendAbldTempDirs(QStringList& sysincspaths, QString includepath);
bool writeDeploymentTargets(QTextStream &t, bool isRom);
-
+ QString gnuMakefileName;
public:
SymbianAbldMakefileGenerator();
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
index 78f6f85..036eb1d 100644
--- a/qmake/generators/symbian/symmake_sbsv2.cpp
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -56,6 +56,12 @@ SymbianSbsv2MakefileGenerator::~SymbianSbsv2MakefileGenerator() { }
#define FLM_DEST_DIR "epoc32/tools/makefile_templates/qt"
#define FLM_SOURCE_DIR "/mkspecs/symbian-sbsv2/flm/qt"
+#define UNDETECTED_GCCE_VERSION "0"
+#define PLATFORM_GCCE "gcce"
+#define PLATFORM_WINSCW "winscw"
+#define PLATFORM_ARMV5 "armv5"
+#define BUILD_DEBUG "udeb"
+#define BUILD_RELEASE "urel"
// Copies Qt FLMs to correct location under epocroot.
// This is not done by configure as it is possible to change epocroot after configure.
@@ -90,6 +96,67 @@ void SymbianSbsv2MakefileGenerator::exportFlm()
}
}
+QString SymbianSbsv2MakefileGenerator::gcceVersion()
+{
+ static QString gcceVersionStr;
+
+ if (gcceVersionStr.isEmpty()) {
+ // First check if QT_GCCE_VERSION has been set, and use that if it is
+ QByteArray qtGcceVersion = qgetenv("QT_GCCE_VERSION");
+ if (!qtGcceVersion.isEmpty()) {
+ // Check that QT_GCCE_VERSION is in proper format
+ QString check(qtGcceVersion);
+ check.replace(QRegExp("^\\d+\\.\\d+\\.\\d+$"),QString());
+ if (check.isEmpty()) {
+ gcceVersionStr = PLATFORM_GCCE + QString(qtGcceVersion).replace(".","_");
+ return gcceVersionStr;
+ } else {
+ fprintf(stderr, "Warning: Environment variable QT_GCCE_VERSION ('%s') is in incorrect "
+ "format, expected format is: '1.2.3'. Attempting to autodetect GCCE version.",
+ qtGcceVersion.constData());
+ }
+ }
+ // Sbsv2 has separate env variable defined for each gcce version, so try to determine
+ // which user is likely to want to use by checking version 4.0.0 to 9.9.9 and taking
+ // the highest found version that actually points to a valid path.
+ // This is kind of a kludge, but since qmake doesn't bootstrap QProcess, there
+ // is no Qt API available to get all environment variables.
+ for (int i = 9; i >= 4; i--) {
+ for (int j = 9; j >= 0; j--) {
+ for (int k = 9; k >= 0; k--) {
+ QByteArray gcceVar = qgetenv(qPrintable(QString("SBS_GCCE%1%2%3BIN").arg(i).arg(j).arg(k)));
+ if (!gcceVar.isEmpty() && fileInfo(QString::fromLocal8Bit(gcceVar.constData())).exists()) {
+ gcceVersionStr = QString(PLATFORM_GCCE "%1_%2_%3").arg(i).arg(j).arg(k);
+ return gcceVersionStr;
+ }
+ }
+ }
+ }
+ }
+
+ // Indicate undetected version to avoid rechecking multiple times
+ if (gcceVersionStr.isEmpty())
+ gcceVersionStr = UNDETECTED_GCCE_VERSION;
+
+ return gcceVersionStr;
+}
+
+QString SymbianSbsv2MakefileGenerator::configClause(QString &platform,
+ QString &build,
+ QString &winscwClauseTemplate,
+ QString &gcceClauseTemplate,
+ QString &genericClauseTemplate)
+{
+ QString retval;
+ if (QString::compare(platform, PLATFORM_WINSCW) == 0)
+ retval = winscwClauseTemplate.arg(build);
+ else if (QString::compare(platform, PLATFORM_GCCE) == 0)
+ retval = gcceClauseTemplate.arg(build);
+ else
+ retval = genericClauseTemplate.arg(platform).arg(build);
+ return retval;
+}
+
void SymbianSbsv2MakefileGenerator::writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t)
{
for (int i = 0; i < depList.size(); ++i) {
@@ -118,21 +185,45 @@ void SymbianSbsv2MakefileGenerator::writeMkFile(const QString& wrapperFileName,
void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool isPrimaryMakefile)
{
+ static QString debugBuild(BUILD_DEBUG);
+ static QString releaseBuild(BUILD_RELEASE);
+
QStringList allPlatforms;
foreach(QString platform, project->values("SYMBIAN_PLATFORMS")) {
allPlatforms << platform.toLower();
}
- QStringList debugPlatforms = allPlatforms;
- QStringList releasePlatforms = allPlatforms;
- releasePlatforms.removeAll("winscw"); // No release for emulator
-
QString testClause;
if (project->isActiveConfig(SYMBIAN_TEST_CONFIG))
testClause = QLatin1String(".test");
else
testClause = QLatin1String("");
+ QString genericClause = " -c %1_%2" + testClause;
+ QString winscwClause = " -c winscw_%1.mwccinc" + testClause;
+ QString gcceClause;
+ if (QString::compare(gcceVersion(), UNDETECTED_GCCE_VERSION) == 0)
+ allPlatforms.removeAll(PLATFORM_GCCE);
+ else
+ gcceClause = " -c arm.v5.%1." + gcceVersion() + ".release_gcce" + testClause;
+
+ QStringList allClauses;
+ QStringList debugClauses;
+ QStringList releaseClauses;
+
+ QStringList debugPlatforms = allPlatforms;
+ QStringList releasePlatforms = allPlatforms;
+ releasePlatforms.removeAll(PLATFORM_WINSCW); // No release for emulator
+
+ foreach(QString item, debugPlatforms) {
+ debugClauses << configClause(item, debugBuild, winscwClause, gcceClause, genericClause);
+ }
+ foreach(QString item, releasePlatforms) {
+ releaseClauses << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause);
+ }
+ allClauses << debugClauses << releaseClauses;
+
+
QTextStream t(&wrapperFile);
t << "# ==============================================================================" << endl;
@@ -172,9 +263,9 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo
}
t << endl;
t << "first: default" << endl;
- if (debugPlatforms.contains("winscw"))
+ if (debugPlatforms.contains(PLATFORM_WINSCW))
t << "default: debug-winscw";
- else if (debugPlatforms.contains("armv5"))
+ else if (debugPlatforms.contains(PLATFORM_ARMV5))
t << "default: debug-armv5";
else if (debugPlatforms.size())
t << "default: debug-" << debugPlatforms.first();
@@ -187,60 +278,61 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo
} else {
t << "all: debug release" << endl;
t << endl;
+
+ QString qmakeCmd = "\t$(QMAKE) \"" + project->projectFile() + "\" " + buildArgs();
+
t << "qmake:" << endl;
- t << "\t$(QMAKE) -spec symbian-sbsv2 -o \"" << fileInfo(Option::output.fileName()).fileName()
- << "\" \"" << project->projectFile() << "\"" << endl;
+ t << qmakeCmd << endl;
t << endl;
- t << BLD_INF_FILENAME ":" << endl;
- t << "\t$(QMAKE)" << endl;
+
+ t << BLD_INF_FILENAME ": " << project->projectFile() << endl;
+ t << qmakeCmd << endl;
t << endl;
- QString winscw("winscw");
+ QString currentClause;
+
t << "debug: " << BLD_INF_FILENAME << endl;
t << "\t$(SBS)";
- foreach(QString item, debugPlatforms) {
- if(QString::compare(item, winscw) == 0)
- t << " -c " << item << "_udeb.mwccinc" << testClause;
- else
- t << " -c " << item << "_udeb" << testClause;
+ foreach(QString item, debugClauses) {
+ t << item;
}
t << endl;
t << "release: " << BLD_INF_FILENAME << endl;
t << "\t$(SBS)";
- foreach(QString item, releasePlatforms) {
- if(QString::compare(item, winscw) == 0)
- t << " -c " << item << "_urel.mwccinc" << testClause;
- else
- t << " -c " << item << "_urel" << testClause;
+ foreach(QString item, releaseClauses) {
+ t << item;
}
t << endl;
// For more specific builds, targets are in this form: build-platform, e.g. release-armv5
foreach(QString item, debugPlatforms) {
t << "debug-" << item << ": " << BLD_INF_FILENAME << endl;
- if(QString::compare(item, winscw) == 0)
- t << "\t$(SBS) -c " << item << "_udeb.mwccinc" << testClause << endl;
- else
- t << "\t$(SBS) -c " << item << "_udeb" << testClause << endl;
+ t << "\t$(SBS)";
+ t << configClause(item, debugBuild, winscwClause, gcceClause, genericClause);
+ t << endl;
}
foreach(QString item, releasePlatforms) {
t << "release-" << item << ": " << BLD_INF_FILENAME << endl;
- if(QString::compare(item, winscw) == 0)
- t << "\t$(SBS) -c " << item << "_urel.mwccinc" << testClause << endl;
- else
- t << "\t$(SBS) -c " << item << "_urel" << testClause << endl;
+ t << "\t$(SBS)";
+ t << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause);
+ t << endl;
}
t << endl;
t << "export: " << BLD_INF_FILENAME << endl;
- t << "\t$(SBS) export" << endl;
- t << endl;
+ t << "\t$(SBS) export";
+ foreach(QString clause, allClauses) {
+ t << clause;
+ }
+ t << endl << endl;
t << "cleanexport: " << BLD_INF_FILENAME << endl;
- t << "\t$(SBS) cleanexport" << endl;
- t << endl;
-
+ t << "\t$(SBS) cleanexport";
+ foreach(QString clause, allClauses) {
+ t << clause;
+ }
+ t << endl << endl;
}
// Add all extra targets including extra compiler targest also to wrapper makefile,
@@ -258,30 +350,37 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo
generateDistcleanTargets(t);
t << "clean: " << BLD_INF_FILENAME << endl;
- t << "\t-$(SBS) reallyclean" << endl;
- t << endl;
+ t << "\t-$(SBS) reallyclean";
+ foreach(QString clause, allClauses) {
+ t << clause;
+ }
+ t << endl << endl;
t << "clean-debug: " << BLD_INF_FILENAME << endl;
t << "\t$(SBS) reallyclean";
- foreach(QString item, debugPlatforms) {
- t << " -c " << item << "_udeb" << testClause;
+ foreach(QString clause, debugClauses) {
+ t << clause;
}
- t << endl;
+ t << endl << endl;
t << "clean-release: " << BLD_INF_FILENAME << endl;
t << "\t$(SBS) reallyclean";
- foreach(QString item, releasePlatforms) {
- t << " -c " << item << "_urel" << testClause;
+ foreach(QString clause, releaseClauses) {
+ t << clause;
}
- t << endl;
+ t << endl << endl;
// For more specific builds, targets are in this form: clean-build-platform, e.g. clean-release-armv5
foreach(QString item, debugPlatforms) {
t << "clean-debug-" << item << ": " << BLD_INF_FILENAME << endl;
- t << "\t$(SBS) reallyclean -c " << item << "_udeb" << testClause << endl;
+ t << "\t$(SBS) reallyclean";
+ t << configClause(item, debugBuild, winscwClause, gcceClause, genericClause);
+ t << endl;
}
foreach(QString item, releasePlatforms) {
t << "clean-release-" << item << ": " << BLD_INF_FILENAME << endl;
- t << "\t$(SBS) reallyclean -c " << item << "_urel" << testClause << endl;
+ t << "\t$(SBS) reallyclean";
+ t << configClause(item, releaseBuild, winscwClause, gcceClause, genericClause);
+ t << endl;
}
t << endl;
}
diff --git a/qmake/generators/symbian/symmake_sbsv2.h b/qmake/generators/symbian/symmake_sbsv2.h
index 286c91c..6644a03 100644
--- a/qmake/generators/symbian/symmake_sbsv2.h
+++ b/qmake/generators/symbian/symmake_sbsv2.h
@@ -65,6 +65,13 @@ public:
private:
void exportFlm();
+ QString gcceVersion();
+ QString configClause(QString &platform,
+ QString &build,
+ QString &winscwClauseTemplate,
+ QString &gcceClauseTemplate,
+ QString &genericClauseTemplate);
+
void writeSbsDeploymentList(const DeploymentList& depList, QTextStream& t);
QString extraTargetsCache;