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>
This commit is contained in:
Jake Petroules 2018-01-04 23:45:42 -08:00
parent da81b01df8
commit fe72571da8

View File

@ -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) {