summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2011-01-27 10:40:33 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2011-01-27 13:40:35 (GMT)
commit4ec245a3e75470186557d00b2383af3872a720b0 (patch)
tree41f26e8350cf3755b8e251d8bb4c789a30fedba8
parent5c91e32a6238fd112a7282443214c8686cda51de (diff)
downloadQt-4ec245a3e75470186557d00b2383af3872a720b0.zip
Qt-4ec245a3e75470186557d00b2383af3872a720b0.tar.gz
Qt-4ec245a3e75470186557d00b2383af3872a720b0.tar.bz2
No longer replace dash and dot in TARGET with underscore in Symbian
There is no fundamental reason to not have dash or dot in binary names in Symbian, so do not replace them with underscore. One thing that doesn't work with a dot in the filename is launching an application via resources, so automatic resource generation is suppressed for applications that have a dot in filename portion of the TARGET value. Task-number: QTBUG-16888 Reviewed-by: axis
-rw-r--r--mkspecs/common/symbian/symbian.conf9
-rw-r--r--mkspecs/features/symbian/application_icon.prf106
-rw-r--r--qmake/generators/symbian/symbiancommon.cpp23
-rw-r--r--qmake/generators/symbian/symbiancommon.h1
-rw-r--r--qmake/generators/symbian/symmake.cpp31
5 files changed, 89 insertions, 81 deletions
diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf
index 5619d4f..0bb3a29 100644
--- a/mkspecs/common/symbian/symbian.conf
+++ b/mkspecs/common/symbian/symbian.conf
@@ -215,19 +215,14 @@ default_deployment.pkg_prerules += pkg_depends_webkit pkg_depends_qt pkg_platfor
DEPLOYMENT += default_deployment default_bin_deployment default_resource_deployment default_reg_deployment
defineReplace(symbianRemoveSpecialCharacters) {
- # Produce identical string to what SymbianCommonGenerator::removeSpecialCharacters and
- # SymbianCommonGenerator::removeEpocSpecialCharacters produce
+ # Produce identical string to what SymbianCommonGenerator::removeSpecialCharacters
fixedStr = $$1
fixedStr = $$replace(fixedStr, /,_)
fixedStr = $$replace(fixedStr, \\\\,_)
fixedStr = $$replace(fixedStr, " ",_)
- symbian-abld|symbian-sbsv2 {
- fixedStr = $$replace(fixedStr, -,_)
- fixedStr = $$replace(fixedStr, \\.,_)
- fixedStr = $$replace(fixedStr, :,_)
- }
+ fixedStr = $$replace(fixedStr, :,_)
return ($$fixedStr)
}
diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf
index 6e1aa8e..b6be89b 100644
--- a/mkspecs/features/symbian/application_icon.prf
+++ b/mkspecs/features/symbian/application_icon.prf
@@ -11,68 +11,74 @@ contains(CONFIG, no_icon) {
!contains(CONFIG, no_icon) {
baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET))
- symbian-abld|symbian-sbsv2 {
- resourceZDir = $$EPOCROOT$$HW_ZDIR$$APP_RESOURCE_DIR
- regZDir = $$EPOCROOT$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR
+ contains(baseTarget, "^.*\\..*$") {
+ CONFIG += no_icon
+ ICON =
+ warning("Symbian resources do not support '.' character in TARGET, skipping resource generation.")
} else {
- contains(DESTDIR, "/.*") {
- resourceZDir = $$DESTDIR
- } else:isEmpty(DESTDIR) {
- resourceZDir = $$OUT_PWD
+ symbian-abld|symbian-sbsv2 {
+ resourceZDir = $$EPOCROOT$$HW_ZDIR$$APP_RESOURCE_DIR
+ regZDir = $$EPOCROOT$$HW_ZDIR$$REG_RESOURCE_IMPORT_DIR
} else {
- resourceZDir = $$OUT_PWD/$$DESTDIR
+ contains(DESTDIR, "/.*") {
+ resourceZDir = $$DESTDIR
+ } else:isEmpty(DESTDIR) {
+ resourceZDir = $$OUT_PWD
+ } else {
+ resourceZDir = $$OUT_PWD/$$DESTDIR
+ }
+ regZDir = $$resourceZDir
}
- regZDir = $$resourceZDir
- }
- default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.rsc
- default_resource_deployment.path = $$APP_RESOURCE_DIR
- default_reg_deployment.sources += $$regZDir/$${baseTarget}_reg.rsc
- default_reg_deployment.path = $$REG_RESOURCE_IMPORT_DIR
+ default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.rsc
+ default_resource_deployment.path = $$APP_RESOURCE_DIR
+ default_reg_deployment.sources += $$regZDir/$${baseTarget}_reg.rsc
+ default_reg_deployment.path = $$REG_RESOURCE_IMPORT_DIR
- !isEmpty(ICON) {
- !count(ICON, 1) {
- ICON = $$first(ICON)
- warning("Only first icon specified in ICON variable is used: $$ICON")
- }
+ !isEmpty(ICON) {
+ !count(ICON, 1) {
+ ICON = $$first(ICON)
+ warning("Only first icon specified in ICON variable is used: $$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
+ # 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
- #Makefile: requires paths with backslash
- ICON_backslashed = $$ICON
+ #Makefile: requires paths with backslash
+ ICON_backslashed = $$ICON
- symbian-abld {
- # ${ZDIR} is defined in Makefile
- mifIconZDir = ${ZDIR}$$APP_RESOURCE_DIR
- } else {
- mifIconZDir = $$resourceZDir
- }
+ symbian-abld {
+ # ${ZDIR} is defined in Makefile
+ mifIconZDir = ${ZDIR}$$APP_RESOURCE_DIR
+ } else {
+ mifIconZDir = $$resourceZDir
+ }
- # Extra compiler rules for mifconv
- mifconv.target = $$mifIconZDir/$${baseTarget}.mif
- contains(QMAKE_HOST.os, "Windows") {
- ICON_backslashed = $$replace(ICON_backslashed, /, \\)
- mifconv.target = $$replace(mifconv.target, /, \\)
+ # Extra compiler rules for mifconv
+ mifconv.target = $$mifIconZDir/$${baseTarget}.mif
+ contains(QMAKE_HOST.os, "Windows") {
+ ICON_backslashed = $$replace(ICON_backslashed, /, \\)
+ mifconv.target = $$replace(mifconv.target, /, \\)
+ }
+ # Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library
+ # svg-t icons should always use /c32 depth
+ mifconv.commands = mifconv $$mifconv.target /c32 $$ICON_backslashed
+
+ mifconv.depends = $$ICON
+ PRE_TARGETDEPS += $$mifconv.target
+ QMAKE_EXTRA_TARGETS += mifconv
+ QMAKE_DISTCLEAN += $$mifconv.target
}
- # Based on: http://www.forum.nokia.com/document/Cpp_Developers_Library
- # svg-t icons should always use /c32 depth
- mifconv.commands = mifconv $$mifconv.target /c32 $$ICON_backslashed
+ # Rules to use generated MIF file from symbian resources
+ RSS_RULES.number_of_icons = $$size(ICON_backslashed)
+ RSS_RULES.icon_file = $$APP_RESOURCE_DIR/$${baseTarget}.mif
- mifconv.depends = $$ICON
- PRE_TARGETDEPS += $$mifconv.target
- QMAKE_EXTRA_TARGETS += mifconv
- QMAKE_DISTCLEAN += $$mifconv.target
+ default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.mif
}
- # Rules to use generated MIF file from symbian resources
- RSS_RULES.number_of_icons = $$size(ICON_backslashed)
- RSS_RULES.icon_file = $$APP_RESOURCE_DIR/$${baseTarget}.mif
-
- default_resource_deployment.sources += $$resourceZDir/$${baseTarget}.mif
}
}
diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp
index 2270c2e..96d7725 100644
--- a/qmake/generators/symbian/symbiancommon.cpp
+++ b/qmake/generators/symbian/symbiancommon.cpp
@@ -79,11 +79,7 @@ void SymbianCommonGenerator::init()
fixedTarget = project->first("TARGET");
fixedTarget = generator->unescapeFilePath(fixedTarget);
fixedTarget = removePathSeparators(fixedTarget);
- if (project->first("MAKEFILE_GENERATOR") == "SYMBIAN_ABLD"
- || project->first("MAKEFILE_GENERATOR") == "SYMBIAN_SBSV2")
- removeEpocSpecialCharacters(fixedTarget);
- else
- removeSpecialCharacters(fixedTarget);
+ removeSpecialCharacters(fixedTarget);
// This should not be empty since the mkspecs are supposed to set it if missing.
uid3 = project->first("TARGET.UID3").trimmed();
@@ -131,18 +127,11 @@ bool SymbianCommonGenerator::containsStartWithItem(const QChar &c, const QString
void SymbianCommonGenerator::removeSpecialCharacters(QString& str)
{
// When modifying this method check also symbianRemoveSpecialCharacters in symbian.conf
- str.replace(QString("/"), QString("_"));
- str.replace(QString("\\"), QString("_"));
- str.replace(QString(" "), QString("_"));
-}
-
-void SymbianCommonGenerator::removeEpocSpecialCharacters(QString& str)
-{
- // When modifying this method check also symbianRemoveSpecialCharacters in symbian.conf
- str.replace(QString("-"), QString("_"));
- str.replace(QString(":"), QString("_"));
- str.replace(QString("."), QString("_"));
- removeSpecialCharacters(str);
+ QString underscore = QLatin1String("_");
+ str.replace(QLatin1String("/"), underscore);
+ str.replace(QLatin1String("\\"), underscore);
+ str.replace(QLatin1String(" "), underscore);
+ str.replace(QLatin1String(":"), underscore);
}
QString romPath(const QString& path)
diff --git a/qmake/generators/symbian/symbiancommon.h b/qmake/generators/symbian/symbiancommon.h
index 0b5f53d..5182021 100644
--- a/qmake/generators/symbian/symbiancommon.h
+++ b/qmake/generators/symbian/symbiancommon.h
@@ -82,7 +82,6 @@ protected:
QString removePathSeparators(QString &file);
void removeSpecialCharacters(QString& str);
- void removeEpocSpecialCharacters(QString& str);
void generatePkgFile(const QString &iconFile,
bool epocBuild,
const SymbianLocalizationList &symbianLocalizationList);
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index a2b567d..4f9f22d 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -83,6 +83,8 @@
#define VAR_CFLAGS "QMAKE_CFLAGS"
#define VAR_LFLAGS "QMAKE_LFLAGS"
+#define DEFINE_REPLACE_REGEXP "[^A-Z0-9_]"
+
QString SymbianMakefileGenerator::fixPathForMmp(const QString& origPath, const QDir& parentDir)
{
static QString epocRootStr;
@@ -165,11 +167,15 @@ void SymbianMakefileGenerator::writeHeader(QTextStream &t)
QString bldinfDefine = shortProFilename;
bldinfDefine.append("_");
bldinfDefine.append(generate_uid(project->projectFile()));
+ bldinfDefine = bldinfDefine.toUpper();
+
+ // replace anything not alphanumeric with underscore
+ QRegExp replacementMask(DEFINE_REPLACE_REGEXP);
+ bldinfDefine.replace(replacementMask, QLatin1String("_"));
bldinfDefine.prepend("BLD_INF_");
- removeEpocSpecialCharacters(bldinfDefine);
- t << "#define " << bldinfDefine.toUpper() << endl << endl;
+ t << "#define " << bldinfDefine << endl << endl;
}
bool SymbianMakefileGenerator::writeMakefile(QTextStream &t)
@@ -902,13 +908,17 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
const QStringList &subdirs = project->values("SUBDIRS");
foreach(QString item, subdirs) {
+ bool fromFile = false;
QString fixedItem;
if (!project->isEmpty(item + ".file")) {
fixedItem = project->first(item + ".file");
+ fromFile = true;
} else if (!project->isEmpty(item + ".subdir")) {
fixedItem = project->first(item + ".subdir");
+ fromFile = false;
} else {
fixedItem = item;
+ fromFile = item.endsWith(Option::pro_ext);
}
QString condition;
@@ -917,9 +927,15 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
QFileInfo subdir(fileInfo(fixedItem));
QString relativePath = directory.relativeFilePath(fixedItem);
- QString subdirFileName = subdir.completeBaseName();
- QString fullProName = subdir.absoluteFilePath();;
+ QString fullProName = subdir.absoluteFilePath();
QString bldinfFilename;
+ QString subdirFileName;
+
+ if (fromFile) {
+ subdirFileName = subdir.completeBaseName();
+ } else {
+ subdirFileName = subdir.fileName();
+ }
if (subdir.isDir()) {
// Subdir is a regular project
@@ -941,7 +957,10 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy
QString uid = generate_uid(fullProName);
QString bldinfDefine = QString("BLD_INF_") + subdirFileName + QString("_") + uid;
bldinfDefine = bldinfDefine.toUpper();
- removeEpocSpecialCharacters(bldinfDefine);
+
+ // replace anything not alphanumeric with underscore
+ QRegExp replacementMask(DEFINE_REPLACE_REGEXP);
+ bldinfDefine.replace(replacementMask, QLatin1String("_"));
if (!condition.isEmpty())
t << "#if defined(" << condition << ")" << endl;
@@ -1124,4 +1143,4 @@ QString SymbianMakefileGenerator::generateLocFileTarget(QTextStream& t, const QS
}
return locFile;
-} \ No newline at end of file
+}