diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-09-24 23:12:45 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-10-01 10:50:49 +0200 |
commit | d9cafeb0f1a097997a82aeb2e5cccac1d24750cc (patch) | |
tree | 4c65b082fe4cff33d8dbbcb1246cf748f344b972 | |
parent | 00c9b3d863e3b28aaf166925aaffdc5e1a0102f1 (diff) | |
download | qttools-d9cafeb0f1a097997a82aeb2e5cccac1d24750cc.tar.gz |
Work around legacy framework structures.
Existing versions of qmake produce application bundles
which are incompatible with OS X code signing.
Deploy framework Info.plist files to the correct
location. Patch them to remove any "_debug" suffix
on the value for CFBundleExecutable.
Task-number: QTBUG-32896
Change-Id: Id657e394f3bf919713a43e395e716bf46488c644
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
-rw-r--r-- | src/macdeployqt/shared/shared.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index c31bc7fe3..3e581a9db 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -154,6 +154,19 @@ bool linkFilePrintStatus(const QString &file, const QString &link) } } +void patch_debugInInfoPlist(const QString &infoPlistPath) +{ + // Older versions of qmake may have the "_debug" binary as + // the value for CFBundleExecutable. Remove it. + QFile infoPlist(infoPlistPath); + infoPlist.open(QIODevice::ReadOnly); + QByteArray contents = infoPlist.readAll(); + infoPlist.close(); + infoPlist.open(QIODevice::WriteOnly | QIODevice::Truncate); + contents.replace("_debug", ""); // surely there are no legit uses of "_debug" in an Info.plist + infoPlist.write(contents); +} + FrameworkInfo parseOtoolLibraryLine(const QString &line, bool useDebugLibs) { FrameworkInfo info; @@ -525,6 +538,14 @@ QString copyFramework(const FrameworkInfo &framework, const QString path) linkFilePrintStatus("Versions/Current/Resources", frameworkDestinationDirectory + "/Resources"); linkFilePrintStatus(framework.version, frameworkDestinationDirectory + "/Versions/Current"); + // Correct Info.plist location for frameworks produced by older versions of qmake + // Contents/Info.plist should be Versions/5/Resources/Info.plist + const QString legacyInfoPlistPath = framework.frameworkPath + "/Contents/Info.plist"; + const QString correctInfoPlistPath = frameworkDestinationDirectory + "/Resources/Info.plist"; + if (QFile(legacyInfoPlistPath).exists()) { + copyFilePrintStatus(legacyInfoPlistPath, correctInfoPlistPath); + patch_debugInInfoPlist(correctInfoPlistPath); + } return frameworkDestinationBinaryPath; } |