Hi,
I am developing on MacOSX 10.8 with Clang x86 64bit, with Qt 5.2.1 (and 5.2.0 before that).
Here is my problem : in my .app, in Info.plist, the key CFBundleIdentifier equals com.yourcompany.MyApp. It is a problem because I want to deploy my application, and I want to replace com.yourcompany by my own value.
I have looked for a solution, and I found that normally, this value is set by setting QMAKE_TARGET_BUNDLE_PREFIX in the .pro (https://bugreports.qt-project.org/browse/QTBUG-19006).
Unfortunately, after looking into Qt’s code, I realized that this solution was only available when compiling with pbuilder : when using Clang, “@BUNDLEIDENTIFIER@” is replaced automatically with com.yourcompany, and the value of QMAKE_TARGET_BUNDLE_PREFIX is not read.
Qt/5.2.1/Src/qtbase/qmake/generators/mac/pbuilder_pbx.cpp :
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
if (bundlePrefix.isEmpty())
bundlePrefix = "com.yourcompany";
plist_in_text = plist_in_text.replace("@BUNDLEIDENTIFIER@", bundlePrefix + "." + QLatin1String("${PRODUCT_NAME:rfc1034identifier}"));
Qt/5.2.1/Src/qtbase/qmake/generators/unix/unixmake2.cpp :
QString bundleIdentifier = "com.yourcompany." + var("QMAKE_BUNDLE");
if (bundleIdentifier.endsWith(".app"))
bundleIdentifier.chop(4);
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
<< "@sed ";
foreach (const ProString &arg, commonSedArgs)
t << arg;
t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
<< "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" "
For now, the only solutions I found are :
1. make my own Info.plist, but it would be complicated if it is just to change one key…
2. replace manually the default value. That is the solution that I chose, because I use a bash script to deploy my application by creating a .pkg file. This way, I just have to do :
sed -i '' -e 's/com.yourcompany/com.MyCompany/g' MyApp.app/Contents/Info.plist
I could keep going like this, but I came on this forum because I think that it deserved to be mentioned somewhere, and in case someone has a better solution. I didn’t report a bug, because I am not sure that it is one : it has already been reported but only fixed for the pbuilder compilation, so maybe there is a reason why it is not done for Clang.
I hope this will be useful for other people who might have the same problem.
If you know a better solution, please tell me !
Thanks ! :)
Kniebou
↧