summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPatrick Luby <plubius@neooffice.org>2023-05-18 13:47:40 -0400
committerPatrick Luby <plubius@neooffice.org>2023-05-18 21:53:08 +0200
commitff95984c8e3475b7ff7832683d621bd09896852e (patch)
tree453ed8e9f534a753b14d5cfec482f941f10fafb1 /bin
parentfdd06037e0cf902d71270c4bf7a867efc7c9c1f4 (diff)
Script that adds "com.apple.security.get-task-allow" entitlement to soffice
To connect Xcode's Instruments application to profile LibreOffice, the "com.apple.security.get-task-allow" entitlement must be added to the soffice executable. This script will set the "com.apple.security.get-task-allow" entitlement instdir/LibreOfficeDev.app/Contents/MacOS/soffice executable so that profiling can be done using a local build. Credit for documenting this Xcode requirement goes to the following blog: https://cocoaphony.micro.blog/2022/10/29/solving-required-kernel.html Change-Id: I547edf7c1ad340267e9ed4c396fc723b7ea719be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151981 Tested-by: Jenkins Reviewed-by: Patrick Luby <plubius@neooffice.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/macos-add-entitlements-for-instruments.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/macos-add-entitlements-for-instruments.sh b/bin/macos-add-entitlements-for-instruments.sh
new file mode 100755
index 000000000000..e22b4ae6db50
--- /dev/null
+++ b/bin/macos-add-entitlements-for-instruments.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Script that adds "com.apple.security.get-task-allow" entitlement to soffice
+#
+# To connect Xcode's Instruments application to profile LibreOffice, the
+# "com.apple.security.get-task-allow" entitlement must be added to the
+# soffice executable.
+#
+# This script will set the "com.apple.security.get-task-allow" entitlement
+# instdir/LibreOfficeDev.app/Contents/MacOS/soffice executable so that
+# profiling can be done using a local build.
+#
+# Credit for documenting this Xcode requirement goes to the following blog:
+# https://cocoaphony.micro.blog/2022/10/29/solving-required-kernel.html
+
+SOFFICE=`dirname "$0"`/../instdir/LibreOfficeDev.app/Contents/MacOS/soffice
+if [ ! -f "$SOFFICE" -o ! -x "$SOFFICE" ] ; then
+ echo "Error: '$SOFFICE' is not an executable file" >&2
+ exit 1
+fi
+
+codesign -s - -v -f --entitlements /dev/stdin "$SOFFICE" << !
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"\>
+<plist version="1.0">
+ <dict>
+ <key>com.apple.security.get-task-allow</key>
+ <true/>
+ </dict>
+</plist>
+!
+
+exit 0