summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Blochberger <maximilian.blochberger@qt.io>2022-10-17 13:50:22 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2023-03-28 19:11:29 +0100
commitaaaa1e251ea43e4094e79b7161327c07db60d351 (patch)
tree643b99b0fa0787d0d8bee985aabf6cea837e2a62
parented346a9e11ed939f3f5dc11f8e45939d3755004b (diff)
Ensure proper format of Info.plist6.4
The Information Property List (Info.plist) is a property list that contains information about macOS and iOS application and framework bundles. There are multiple supported formats, those property lists can be stored in, most notably XML and binary. Problem If the Info.plist file is edited with an external editor, such as Xcode, it is possible that it is stored in binary format. A Makefile generated by the qmake tool contains a call to sed, which works on text but not binary files. Consequently, this call would fail. Solution Since Mac OS X 10.2, the plutil tool is available. It can be used to convert the property lists into a specific format. The plutil tool is now used to convert the plist to XML, so that the sed invocation succeeds. [ChangeLog][qmake] Fixed handling binary Info.plist files in generated Makefiles by always converting them to XML before substituting placeholders. Fixes: QTBUG-45357 Change-Id: I066039301c391a5034710458500a096f09e5ca24 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit bbad6440aecdba29d8808c4fa6e3e6353b39c887) Reviewed-by: Maximilian Blochberger <maximilian.blochberger@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--qmake/generators/unix/unixmake2.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 5557f99fda..3cc9f67949 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -803,7 +803,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString icon = fileFixify(var("ICON"));
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
- << "@sed ";
+ << "@plutil -convert xml1 -o - " << info_plist << " | "
+ << "sed ";
for (const ProString &arg : std::as_const(commonSedArgs))
t << arg;
const QString iconName = icon.section(Option::dir_sep, -1);
@@ -814,7 +815,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< "-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 << Qt::endl;
+ << ">" << info_plist_out << Qt::endl;
//copy the icon
if (!project->isEmpty("ICON")) {
QString dir = bundle_dir + "Contents/Resources/";
@@ -835,14 +836,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (!isShallowBundle)
symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources";
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
- << "@sed ";
+ << "@plutil -convert xml1 -o - " << info_plist << " | "
+ << "sed ";
for (const ProString &arg : std::as_const(commonSedArgs))
t << arg;
t << "-e \"s,@LIBRARY@," << lib_bundle_name << ",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 << Qt::endl;
+ << ">" << info_plist_out << Qt::endl;
}
break;
} // project->isActiveConfig("no_plist")