Skip to content

Commit 5497170

Browse files
kkoehneQt Cherry-pick Bot
authored andcommitted
macdeployqt: Make sure the app binary is signed after any other binarie
This avoids a codesign verification error that may appear as "nested code is modified or invalid". This commit was originally created by https://github.com/tsteven4 #125 Pick-to: 6.8 6.5 Change-Id: Ifa0b4ed9da1d7b36cb54f9d2fa6aee48c1fe519c Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]> (cherry picked from commit 5984048) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
1 parent d576700 commit 5497170

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/tools/macdeployqt/shared/shared.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,17 @@ QSet<QString> codesignBundle(const QString &identity,
14481448
QString appBundleAbsolutePath = QFileInfo(appBundlePath).absoluteFilePath();
14491449
QString rootBinariesPath = appBundleAbsolutePath + "/Contents/MacOS/";
14501450
QStringList foundRootBinaries = QDir(rootBinariesPath).entryList(QStringList() << "*", QDir::Files);
1451+
1452+
// The app binary must be signed last.
1453+
QString appBinary = findAppBinary(appBundleAbsolutePath);
1454+
QString appBinaryName = QFileInfo(appBinary).fileName();
1455+
if (int appBinaryIdx = foundRootBinaries.indexOf(appBinaryName); appBinaryIdx > 0) {
1456+
foundRootBinaries.swapItemsAt(0, appBinaryIdx);
1457+
LogDebug() << "swapped appBinary to start of list";
1458+
}
1459+
LogDebug() << "App binary is" << appBinaryName;
1460+
LogDebug() << "Binaries in" << rootBinariesPath << "are" << foundRootBinaries;
1461+
14511462
for (const QString &binary : foundRootBinaries) {
14521463
QString binaryPath = rootBinariesPath + binary;
14531464
pendingBinaries.push(binaryPath);

0 commit comments

Comments
 (0)