diff options
author | Maximilian Blochberger <maximilian.blochberger@qt.io> | 2022-10-17 13:50:22 +0200 |
---|---|---|
committer | Maximilian Blochberger <maximilian.blochberger@qt.io> | 2022-10-19 12:06:09 +0200 |
commit | bbad6440aecdba29d8808c4fa6e3e6353b39c887 (patch) | |
tree | 6a7b98af7f0465983f121ab36e12c850234ed6c6 /qmake/generators | |
parent | 665d727a28017fc64724a4cf3e31361fd031d481 (diff) |
Ensure proper format of Info.plist
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
Pick-to: 6.2 6.4
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'qmake/generators')
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 6c9424804d..8532a90364 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -804,7 +804,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); @@ -815,7 +816,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/"; @@ -836,14 +837,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") |