diff options
author | Pasi Matilainen <pasi.matilainen@digia.com> | 2012-08-29 09:51:36 +0300 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2012-09-23 10:14:23 +0200 |
commit | 73b7eee3cd08971893a2c14830fe21099f56bfdb (patch) | |
tree | 1a1464fe52fceec6c715617cc153525baaf452d1 | |
parent | 31d634c402af68f4aa9d3900a5a6d5f0cb9bd5ad (diff) |
Store installer data in a separate file on Mac to support code signing
Code signing fails on Mac OS X if there's any extra data after the
link edit segment in a binary, so store the installer data in a separate
file inside the bundle.
Task-number: QTIFW-153
Change-Id: Ie1edf21212b4a3bc5b6f32eea3f5d61e8800a0d5
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simo Fält <simo.falt@digia.com>
Reviewed-by: Niels Weber <niels.weber@digia.com>
-rw-r--r-- | src/sdk/installerbase.cpp | 8 | ||||
-rw-r--r-- | tools/binarycreator/binarycreator.cpp | 17 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp index d73040e77..8dabbe92a 100644 --- a/src/sdk/installerbase.cpp +++ b/src/sdk/installerbase.cpp @@ -247,8 +247,16 @@ int main(int argc, char *argv[]) // the uninstaller for the recorded list of during the installation performed operations QInstaller::init(); +#ifdef Q_OS_MAC + // load the external binary resource + QDir resourcePath(QFileInfo(QCoreApplication::applicationFilePath()).dir()); + resourcePath.cdUp(); + resourcePath.cd(QLatin1String("Resources")); + BinaryContent content = BinaryContent::readAndRegisterFromBinary(resourcePath.filePath(QLatin1String("installer.dat"))); +#else // load and map the embedded binary resource, registers operations BinaryContent content = BinaryContent::readAndRegisterFromApplicationFile(); +#endif // instantiate the installer we are actually going to use QInstaller::PackageManagerCore core(content.magicMarker(), content.performedOperations()); diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp index ef3bd1fb0..0fa147c45 100644 --- a/tools/binarycreator/binarycreator.cpp +++ b/tools/binarycreator/binarycreator.cpp @@ -224,13 +224,30 @@ Q_UNUSED(settings) } #endif +#ifdef Q_OS_MAC + QDir resourcePath(QFileInfo(input.outputPath).dir()); + resourcePath.cdUp(); + resourcePath.cd(QLatin1String("Resources")); + KDSaveFile out(resourcePath.filePath(QLatin1String("installer.dat"))); +#else KDSaveFile out(input.outputPath); +#endif try { +#ifdef Q_OS_MAC + openForWrite(&out, out.fileName()); + + QFile exe(input.installerExePath); + if (!exe.copy(input.outputPath)) { + throw Error(QObject::tr("Could not copy %1 to %2: %3").arg(exe.fileName(), input.outputPath, + exe.errorString())); + } +#else openForWrite(&out, input.outputPath); QFile exe(input.installerExePath); openForRead(&exe, exe.fileName()); appendFileData(&out, &exe); +#endif const qint64 dataBlockStart = out.pos(); qDebug() << "Data block starts at" << dataBlockStart; |