All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Programmingkid <programmingkidx@gmail.com>,
	QEMU devel list <qemu-devel@nongnu.org>
Subject: Re: [PATCH] Set icon for QEMU binary on Mac OS
Date: Mon, 5 Jul 2021 18:56:46 +0200	[thread overview]
Message-ID: <f03b750f-819c-4ea0-c5fa-889afab71d17@redhat.com> (raw)
In-Reply-To: <325BA2AF-B4F5-4134-BF90-63282E0B2A46@gmail.com>

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



  reply	other threads:[~2021-07-05 16:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 13:54 [PATCH] Set icon for QEMU binary on Mac OS Programmingkid
2021-07-05 16:56 ` Paolo Bonzini [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-02-02 13:44 John Arbuckle
     [not found] ` <2cdac45d-6a4d-dca1-4f32-2fc6b549f8d5@redhat.com>
2021-02-04 15:39   ` Programmingkid
2021-02-04 15:42     ` Peter Maydell
2021-02-04 17:48       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f03b750f-819c-4ea0-c5fa-889afab71d17@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.