Don't make Info.plist for debug framework bundles

We do so by setting a 'no_plist' config property. Can be overridden
with 'force_debug_plist'.

The debug version of Info.plist would overwrite the release version,
and it also happens to contain invalid data. In particular,
CFBundleExecutable would contain the _debug suffixed libname, which
it shouldn't. See the entry about CFBundleExecutable on
https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

Task-number: QTBUG-32894
Change-Id: Ideb018e4768a7c4e276e1b07d77937451f6db6a2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Gabriel de Dietrich 2013-10-30 16:20:35 +01:00 committed by Oswald Buddenhagen
parent 59e8d430e9
commit 10bd8e2104
2 changed files with 62 additions and 57 deletions

View File

@ -25,10 +25,13 @@ CONFIG(static, static|shared) {
!macx-xcode: \ !macx-xcode: \
addExclusiveBuilds(shared, static) addExclusiveBuilds(shared, static)
CONFIG(debug, debug|release): \ CONFIG(debug, debug|release) {
CONFIG -= release CONFIG -= release
else: \ !force_debug_plist:debug_and_release: \
CONFIG += no_plist
} else {
CONFIG -= debug CONFIG -= debug
}
!macx-xcode { !macx-xcode {
addExclusiveBuilds(debug, release) addExclusiveBuilds(debug, release)

View File

@ -725,61 +725,63 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "@touch " << resources << "\n\t\n"; t << "@touch " << resources << "\n\t\n";
} }
//copy the plist //copy the plist
QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString())), if (!project->isActiveConfig("no_plist")) {
info_plist_out = escapeFilePath(project->first("QMAKE_INFO_PLIST_OUT").toQString()); QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString())),
if (info_plist.isEmpty()) info_plist_out = escapeFilePath(project->first("QMAKE_INFO_PLIST_OUT").toQString());
info_plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); if (info_plist.isEmpty())
bundledFiles << info_plist_out; info_plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
QString destdir = info_plist_out.section(Option::dir_sep, 0, -2); bundledFiles << info_plist_out;
t << info_plist_out << ": \n\t"; QString destdir = info_plist_out.section(Option::dir_sep, 0, -2);
if(!destdir.isEmpty()) t << info_plist_out << ": \n\t";
t << mkdir_p_asstring(destdir, false) << "\n\t"; if (!destdir.isEmpty())
ProStringList commonSedArgs; t << mkdir_p_asstring(destdir, false) << "\n\t";
if (!project->values("VERSION").isEmpty()) ProStringList commonSedArgs;
commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" "; if (!project->values("VERSION").isEmpty())
commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" ";
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "; commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
if(project->first("TEMPLATE") == "app") { QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" ";
QString icon = fileFixify(var("ICON")); if (project->first("TEMPLATE") == "app") {
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString(); QString icon = fileFixify(var("ICON"));
if (bundlePrefix.isEmpty()) QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
bundlePrefix = "com.yourcompany"; if (bundlePrefix.isEmpty())
if (bundlePrefix.endsWith(".")) bundlePrefix = "com.yourcompany";
bundlePrefix.chop(1); if (bundlePrefix.endsWith("."))
QString bundleIdentifier = bundlePrefix + "." + var("QMAKE_BUNDLE"); bundlePrefix.chop(1);
if (bundleIdentifier.endsWith(".app")) QString bundleIdentifier = bundlePrefix + "." + var("QMAKE_BUNDLE");
bundleIdentifier.chop(4); if (bundleIdentifier.endsWith(".app"))
t << "@$(DEL_FILE) " << info_plist_out << "\n\t" bundleIdentifier.chop(4);
<< "@sed "; t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
foreach (const ProString &arg, commonSedArgs) << "@sed ";
t << arg; foreach (const ProString &arg, commonSedArgs)
t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" " t << arg;
<< "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" " t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
<< "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" " << "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" "
<< "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? << "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" "
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" " << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
<< "" << info_plist << " >" << info_plist_out << endl; QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
//copy the icon << "" << info_plist << " >" << info_plist_out << endl;
if(!project->isEmpty("ICON")) { //copy the icon
QString dir = bundle_dir + "Contents/Resources/"; if (!project->isEmpty("ICON")) {
const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1)); QString dir = bundle_dir + "Contents/Resources/";
bundledFiles << icon_path; const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1));
t << icon_path << ": " << icon << "\n\t" bundledFiles << icon_path;
<< mkdir_p_asstring(dir) << "\n\t" t << icon_path << ": " << icon << "\n\t"
<< "@$(DEL_FILE) " << icon_path << "\n\t" << mkdir_p_asstring(dir) << "\n\t"
<< "@$(COPY_FILE) " << escapeFilePath(icon) << " " << icon_path << endl; << "@$(DEL_FILE) " << icon_path << "\n\t"
<< "@$(COPY_FILE) " << escapeFilePath(icon) << " " << icon_path << endl;
}
} else {
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
<< "@sed ";
foreach (const ProString &arg, commonSedArgs)
t << arg;
t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
<< "-e \"s,@TYPEINFO@,"
<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
<< "" << info_plist << " >" << info_plist_out << endl;
} }
} else { } // project->isActiveConfig("no_plist")
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
<< "@sed ";
foreach (const ProString &arg, commonSedArgs)
t << arg;
t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
<< "-e \"s,@TYPEINFO@,"
<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
<< "" << info_plist << " >" << info_plist_out << endl;
}
//copy other data //copy other data
if(!project->isEmpty("QMAKE_BUNDLE_DATA")) { if(!project->isEmpty("QMAKE_BUNDLE_DATA")) {
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
@ -1267,7 +1269,7 @@ void UnixMakefileGenerator::init2()
project->values("QMAKE_CXXFLAGS") += MD_flag; project->values("QMAKE_CXXFLAGS") += MD_flag;
} }
if(!project->isEmpty("QMAKE_BUNDLE")) { if (!project->isEmpty("QMAKE_BUNDLE") && !project->isActiveConfig("no_plist")) {
QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), qmake_getpwd()); QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), qmake_getpwd());
if(plist.isEmpty()) if(plist.isEmpty())
plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");