summaryrefslogtreecommitdiffstats
path: root/scripts/entitlement.sh
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2025-06-06 10:05:23 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2025-06-06 10:05:23 +0000
commit755cc582a2473d06f3a2131d506d0311cc70e9f9 (patch)
tree3efb1ddb8d57bbb4539ac0d229b384871c57820f /scripts/entitlement.sh
parentInitial commit. (diff)
downloadqemu-upstream.tar.xz
qemu-upstream.zip
Adding upstream version 1:7.2+dfsg.upstream/1%7.2+dfsgupstream
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'scripts/entitlement.sh')
-rwxr-xr-xscripts/entitlement.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/entitlement.sh b/scripts/entitlement.sh
new file mode 100755
index 00000000..0f412949
--- /dev/null
+++ b/scripts/entitlement.sh
@@ -0,0 +1,33 @@
+#!/bin/sh -e
+#
+# Helper script for the build process to apply entitlements
+
+in_place=:
+if [ "$1" = --install ]; then
+ shift
+ in_place=false
+fi
+
+DST="$1"
+SRC="$2"
+ICON="$3"
+ENTITLEMENT="$4"
+
+if $in_place; then
+ trap 'rm "$DST.tmp"' exit
+ cp -pPf "$SRC" "$DST.tmp"
+ SRC="$DST.tmp"
+else
+ cd "$MESON_INSTALL_DESTDIR_PREFIX"
+fi
+
+if test -n "$ENTITLEMENT"; then
+ codesign --entitlements "$ENTITLEMENT" --force -s - "$SRC"
+fi
+
+# Add the QEMU icon to the binary on Mac OS
+Rez -append "$ICON" -o "$SRC"
+SetFile -a C "$SRC"
+
+mv -f "$SRC" "$DST"
+trap '' exit