[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Set icon for QEMU binary on Mac OS
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH] Set icon for QEMU binary on Mac OS |
Date: |
Mon, 5 Jul 2021 18:56:46 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 05/07/21 15:54, Programmingkid wrote:
Hi Paolo, I was told you were the one who I should send this patch to. Please
let me know if you feel otherwise.
Absolutely, thanks. Removing the icon was mostly done out of lack of
a machine to test it on, and it's nice to add it back.
+# set QEMU's icon on Mac OS
+if targetos == 'darwin'
+ newiconpart1 = custom_target('Icon for ' + exe_name + ' - part 1',
+ depends : emulator,
+ input : emulator,
+ output : 'new icon for ' + exe_name + ' - 1',
+ command : ['Rez', '-append',
+ meson.source_root() + '/pc-bios/qemu.rsrc', '-o',
+ meson.current_build_dir() / exe['name']],
+ build_by_default : true)
I think having a command that never actually creates the "new icon for
... - 1" file will cause the command to be run over and over.
We already have scripts/entitlement.sh to do (possibly) in-place changes
to the executable on Darwin. I suggest something like this:
diff --git a/meson.build b/meson.build
index 380b40ba07..5313cf4a32 100644
--- a/meson.build
+++ b/meson.build
@@ -2505,8 +2505,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
@@ -2520,7 +2519,13 @@ foreach target : target_dirs
link_args: link_args,
win_subsystem: exe['win_subsystem'])
- if exe_sign
+ if 'CONFIG_HVF' in config_target
+ entitlement = meson.current_source_dir() / 'accel/hvf/entitlements.plist'
+ else
+ entitlement = '/dev/null'
+ endif
+ if targetos == 'darwin'
+ icon = '...'
emulators += {exe['name'] : custom_target(exe['name'],
depends: emulator,
output: exe['name'],
@@ -2528,14 +2534,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..573bed0c2f 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,9 @@ 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
+# icon stuff here
mv -f "$SRC" "$DST"
trap '' exit
Paolo