diff --git a/meson.build b/meson.build index 1651496800..8b61fdb4be 100644 --- a/meson.build +++ b/meson.build @@ -2507,8 +2507,7 @@ foreach target : target_dirs endif foreach exe: execs exe_name = exe['name'] - exe_sign = 'CONFIG_HVF' in config_target - if exe_sign + if targetos == 'darwin' exe_name += '-unsigned' endif @@ -2522,7 +2521,13 @@ foreach target : target_dirs link_args: link_args, gui_app: exe['gui']) - if exe_sign + if 'CONFIG_HVF' in config_target + entitlements = meson.current_source_dir() / 'accel/hvf/entitlements.plist' + else + entitlements = '/dev/null' + endif + if targetos == 'darwin' + icon = meson.current_source_dir() / 'pc-bios/qemu.rsrc' emulators += {exe['name'] : custom_target(exe['name'], depends: emulator, output: exe['name'], @@ -2530,14 +2535,14 @@ foreach target : target_dirs meson.current_source_dir() / 'scripts/entitlement.sh', meson.current_build_dir() / exe_name, meson.current_build_dir() / exe['name'], - meson.current_source_dir() / 'accel/hvf/entitlements.plist' + entitlements, icon ]) } meson.add_install_script('scripts/entitlement.sh', '--install', get_option('bindir') / exe_name, get_option('bindir') / exe['name'], - meson.current_source_dir() / 'accel/hvf/entitlements.plist') + entitlements, icon) else emulators += {exe['name']: emulator} endif diff --git a/scripts/entitlement.sh b/scripts/entitlement.sh index f7aaaf2766..d2a7079ce3 100755 --- a/scripts/entitlement.sh +++ b/scripts/entitlement.sh @@ -11,6 +11,7 @@ fi SRC="$1" DST="$2" ENTITLEMENT="$3" +ICON="$4" if $in_place; then trap 'rm "$DST.tmp"' exit @@ -20,6 +21,13 @@ else cd "$MESON_INSTALL_DESTDIR_PREFIX" fi -codesign --entitlements "$ENTITLEMENT" --force -s - "$SRC" +if test "$ENTITLEMENT" != '/dev/null'; 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