summaryrefslogtreecommitdiffstats
path: root/qmake/generators/unix/unixmake2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmake/generators/unix/unixmake2.cpp')
-rw-r--r--qmake/generators/unix/unixmake2.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 15ba4f0309..8ecfa0bf31 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -155,6 +155,20 @@ UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::
}
}
+static QString rfc1034Identifier(const QString &str)
+{
+ QString s = str;
+ for (QChar &ch : s) {
+ const char c = ch.toLatin1();
+
+ const bool okChar = (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z')
+ || (c >= 'a' && c <= 'z') || c == '-' || c == '.';
+ if (!okChar)
+ ch = QChar::fromLatin1('-');
+ }
+ return s;
+}
+
void
UnixMakefileGenerator::writeMakeParts(QTextStream &t)
{
@@ -835,7 +849,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (bundleIdentifier.endsWith(".framework"))
bundleIdentifier.chop(10);
// replace invalid bundle id characters
- bundleIdentifier.replace('_', '-');
+ bundleIdentifier = rfc1034Identifier(bundleIdentifier);
commonSedArgs << "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" ";
commonSedArgs << "-e \"s,\\$${PRODUCT_BUNDLE_IDENTIFIER}," << bundleIdentifier << ",g\" ";