summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Luby <guibmacdev@gmail.com>2024-02-15 19:59:55 -0500
committerPatrick Luby <guibomacdev@gmail.com>2024-02-16 03:29:08 +0100
commitc2ebc77e636e9cdefad6cef446a2f8acec1580f1 (patch)
tree8ed3f6655272bb8ecdd337d5c5b1ebdc52005497
parentfb72dc2474e644b66f8de6557210a2f6dedcfcc3 (diff)
Related: tdf#159529 fix increasing failures when setting entitlements
Starting in one of the Xcode versions 15.2 or earlier, setting the entitlements without a certificate started failing on Mac Silicon. The hacky solution is to make a copy of the application's executable, set the entitlements on that binary only, and then move the copied binary back. Change-Id: I25c32cbe6f9aa87e2d6c2c554a8a9cf48d79e75d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163468 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
-rwxr-xr-xsolenv/bin/macosx-codesign-app-bundle14
1 files changed, 13 insertions, 1 deletions
diff --git a/solenv/bin/macosx-codesign-app-bundle b/solenv/bin/macosx-codesign-app-bundle
index 695b3ae97922..3f0003f9a4a2 100755
--- a/solenv/bin/macosx-codesign-app-bundle
+++ b/solenv/bin/macosx-codesign-app-bundle
@@ -59,7 +59,19 @@ if test -z "$MACOSX_CODESIGNING_IDENTITY"; then
# set entitlements to allow Xcode's Instruments application to connect to
# the application. Note: the following command fails on some Mac Intel
# machines, and since this not a release build, ignore any failures.
- codesign --force --identifier="${MACOSX_BUNDLE_IDENTIFIER}" --sign - $entitlements "$APP_BUNDLE"
+ # Related: tdf#159529 fix increasing failures when setting entitlements
+ # Starting in one of the Xcode versions 15.2 or earlier, setting the
+ # entitlements without a certificate started failing on Mac Silicon.
+ # The hacky solution is to make a copy of the application's executable,
+ # set the entitlements on that binary only, and then move the copied
+ # binary back.
+ rm -f "$APP_BUNDLE/Contents/MacOS/soffice.withentitlements"
+ cp "$APP_BUNDLE/Contents/MacOS/soffice" "$APP_BUNDLE/Contents/MacOS/soffice.withentitlements"
+ if codesign --force --identifier="${MACOSX_BUNDLE_IDENTIFIER}" --sign - $entitlements "$APP_BUNDLE/Contents/MacOS/soffice.withentitlements"; then
+ mv "$APP_BUNDLE/Contents/MacOS/soffice.withentitlements" "$APP_BUNDLE/Contents/MacOS/soffice"
+ else
+ rm "$APP_BUNDLE/Contents/MacOS/soffice.withentitlements"
+ fi
exit 0
fi