diff options
author | Jake Petroules <jake.petroules@qt.io> | 2018-01-04 23:45:42 -0800 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2018-01-05 21:19:21 +0000 |
commit | fe72571da885499739f723e054e1ba5433fb36e8 (patch) | |
tree | dae4fa295744f7d4cf285680e6d7ad3e72feb305 /qmake/generators/unix | |
parent | da81b01df856e532a8cabb99949232de1b23327d (diff) |
qmake: replace invalid characters in generated bundle identifiers
This problem does not affect the Xcode generator.
Task-number: QTBUG-65477
Change-Id: I6194edc5b679edad9ae1a25e35b71e5df9bd4c95
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'qmake/generators/unix')
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index f7097e58dc..6b08a2dd28 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) { @@ -826,7 +840,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\" "; if (!isFramework) { |