diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-11-20 23:49:34 -0800 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2018-01-06 19:46:00 +0000 |
commit | 0749ba2c5eacc4822cf9c7a31edf8d70c4ef6064 (patch) | |
tree | 623467618278ab61ca74bbacdc22b9cc1eca1143 /qmake/generators/unix | |
parent | b739b3a0402e71041d99fa138630b806059b19b2 (diff) |
Rewrite the Info.plist variable replacement handling
This ensures that the same set of variables can be successfully replaced
in both the Makefile and Xcode generators. It also switches the default
templates to use the Xcode-style ${var} syntax instead of the @var@
syntax for better Info.plist compatibility across generators.
Change-Id: Iff330bafd152773aafac9143c4a34e34f92f0ce6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'qmake/generators/unix')
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 48 |
1 files changed, 35 insertions, 13 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index f7097e58dc..15ba4f0309 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -806,14 +806,23 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << mkdir_p_asstring(destdir) << "\n\t"; ProStringList commonSedArgs; if (!project->values("VERSION").isEmpty()) { - commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." - << project->first("VER_MIN") << ",g\" "; - commonSedArgs << "-e \"s,@FULL_VERSION@," << project->first("VER_MAJ") << "." - << project->first("VER_MIN") << "." - << project->first("VER_PAT") << ",g\" "; + const ProString shortVersion = + project->first("VER_MAJ") + "." + + project->first("VER_MIN"); + commonSedArgs << "-e \"s,@SHORT_VERSION@," << shortVersion << ",g\" "; + commonSedArgs << "-e \"s,\\$${QMAKE_SHORT_VERSION}," << shortVersion << ",g\" "; + const ProString fullVersion = + project->first("VER_MAJ") + "." + + project->first("VER_MIN") + "." + + project->first("VER_PAT"); + commonSedArgs << "-e \"s,@FULL_VERSION@," << fullVersion << ",g\" "; + commonSedArgs << "-e \"s,\\$${QMAKE_FULL_VERSION}," << fullVersion << ",g\" "; } - commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? - QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "; + const ProString typeInfo = project->isEmpty("QMAKE_PKGINFO_TYPEINFO") + ? QString::fromLatin1("????") + : project->first("QMAKE_PKGINFO_TYPEINFO").left(4); + commonSedArgs << "-e \"s,@TYPEINFO@," << typeInfo << ",g\" "; + commonSedArgs << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO}," << typeInfo << ",g\" "; QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString(); if (bundlePrefix.isEmpty()) @@ -828,6 +837,16 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) // replace invalid bundle id characters bundleIdentifier.replace('_', '-'); commonSedArgs << "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" "; + commonSedArgs << "-e \"s,\\$${PRODUCT_BUNDLE_IDENTIFIER}," << bundleIdentifier << ",g\" "; + + commonSedArgs << "-e \"s,\\$${MACOSX_DEPLOYMENT_TARGET}," + << project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET").toQString() << ",g\" "; + commonSedArgs << "-e \"s,\\$${IPHONEOS_DEPLOYMENT_TARGET}," + << project->first("QMAKE_IPHONEOS_DEPLOYMENT_TARGET").toQString() << ",g\" "; + commonSedArgs << "-e \"s,\\$${TVOS_DEPLOYMENT_TARGET}," + << project->first("QMAKE_TVOS_DEPLOYMENT_TARGET").toQString() << ",g\" "; + commonSedArgs << "-e \"s,\\$${WATCHOS_DEPLOYMENT_TARGET}," + << project->first("QMAKE_WATCHOS_DEPLOYMENT_TARGET").toQString() << ",g\" "; if (!isFramework) { ProString app_bundle_name = var("QMAKE_APPLICATION_BUNDLE_NAME"); @@ -843,11 +862,14 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "@sed "; for (const ProString &arg : qAsConst(commonSedArgs)) t << arg; - t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" " + const QString iconName = icon.section(Option::dir_sep, -1); + t << "-e \"s,@ICON@," << iconName << ",g\" " + << "-e \"s,\\$${ASSETCATALOG_COMPILER_APPICON_NAME}," << iconName << ",g\" " << "-e \"s,@EXECUTABLE@," << app_bundle_name << ",g\" " << "-e \"s,@LIBRARY@," << plugin_bundle_name << ",g\" " - << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? - QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " + << "-e \"s,\\$${EXECUTABLE_NAME}," << (app_bundle_name.isEmpty() ? app_bundle_name : plugin_bundle_name) << ",g\" " + << "-e \"s,@TYPEINFO@,"<< typeInfo << ",g\" " + << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO},"<< typeInfo << ",g\" " << "" << info_plist << " >" << info_plist_out << endl; //copy the icon if (!project->isEmpty("ICON")) { @@ -873,9 +895,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) for (const ProString &arg : qAsConst(commonSedArgs)) t << arg; t << "-e \"s,@LIBRARY@," << lib_bundle_name << ",g\" " - << "-e \"s,@TYPEINFO@," - << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? - QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " + << "-e \"s,\\$${EXECUTABLE_NAME}," << lib_bundle_name << ",g\" " + << "-e \"s,@TYPEINFO@," << typeInfo << ",g\" " + << "-e \"s,\\$${QMAKE_PKGINFO_TYPEINFO}," << typeInfo << ",g\" " << "" << info_plist << " >" << info_plist_out << endl; } break; |