Skip to contentSkip to conversation

Set icon for QEMU binary on Mac OS

PATCH In review John Arbuckle 3 participants 4 messages Feb 2, 2021 – Feb 4, 2021 1 message not in the archive Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set icon for QEMU binary on Mac OS

Before switching the build system over to Meson, an icon was added to the QEMU binary on Mac OS. This patch adds back that feature.

---
 meson.build | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
meson.build +20 -0
index f00b7754fd..7f534f4e75 100644
@@ -2183,6 +2183,26 @@ foreach target : target_dirs
                link_args: link_args,
                gui_app: exe['gui'])
 
+# 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)
+
+    custom_target('Icon for ' + exe_name + ' - part 2',
+          depends : newiconpart1,
+          input : emulator,
+          output : 'new icon for ' + exe_name + ' - 2',
+          command : ['SetFile', '-a', 'C',
+           meson.current_build_dir() / exe['name']],
+          build_by_default : true)
+endif
+
     if exe_sign
       emulators += {exe['name'] : custom_target(exe['name'],
                    install: true,
Signature · 1 line
2.24.3 (Apple Git-128)
#2 lore raw
In reply to a message not in the archive
Quoted 45 lines · Paolo Bonzini
Quoted 27 lines · John Arbuckle

Before switching the build system over to Meson, an icon was added to the QEMU binary on Mac OS. This patch adds back that feature.

---
 meson.build | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
meson.build +12 -0
index f00b7754fd..7f534f4e75 100644
@@ -2183,6 +2183,26 @@ foreach target : target_dirs
                link_args: link_args,
                gui_app: exe['gui'])
 +# 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)
+
+    custom_target('Icon for ' + exe_name + ' - part 2',
+          depends : newiconpart1,

meson.build foreach target : target_dirs · line 2207

Quoted 10 lines
meson.build +7 -0
+          input : emulator,
+          output : 'new icon for ' + exe_name + ' - 2',
+          command : ['SetFile', '-a', 'C',
+           meson.current_build_dir() / exe['name']],
+          build_by_default : true)
+endif
+
     if exe_sign
       emulators += {exe['name'] : custom_target(exe['name'],
                    install: true,

Maybe you can do it on install, using add_install_script instead?

Quoted 1 line

Paolo

The script would only be two lines long:

    Rez -append ./pc-bios/qemu.rsrc -o $(QEMU_BINARY)
    SetFile -a C $(QEMU_BINARY)

Is a separate script file still preferred?

#3 lore raw
Quoted 37 lines · Programmingkid
Quoted 37 lines · Paolo Bonzini
Quoted 31 lines · John Arbuckle

Before switching the build system over to Meson, an icon was added to the QEMU binary on Mac OS. This patch adds back that feature.

---
 meson.build | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
meson.build +16 -0
index f00b7754fd..7f534f4e75 100644
@@ -2183,6 +2183,26 @@ foreach target : target_dirs
                link_args: link_args,
                gui_app: exe['gui'])
 +# 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)
+
+    custom_target('Icon for ' + exe_name + ' - part 2',
+          depends : newiconpart1,
+          input : emulator,
+          output : 'new icon for ' + exe_name + ' - 2',
+          command : ['SetFile', '-a', 'C',
+           meson.current_build_dir() / exe['name']],
Quoted 8 lines
Quoted 8 lines

meson.build foreach target : target_dirs · line 2208

Quoted 6 lines
meson.build +3 -0
+          build_by_default : true)
+endif
+
     if exe_sign
       emulators += {exe['name'] : custom_target(exe['name'],
                    install: true,

Maybe you can do it on install, using add_install_script instead?

Why would we want to only do it on install? A QEMU which you run from the build tree ought to still have its icon, surely ?

-- PMM

#4 lore raw
Quoted 47 lines · Peter Maydell
Quoted 37 lines · Programmingkid
Quoted 37 lines · Paolo Bonzini
Quoted 31 lines · John Arbuckle

Before switching the build system over to Meson, an icon was added to the QEMU binary on Mac OS. This patch adds back that feature.

---
  meson.build | 20 ++++++++++++++++++++
  1 file changed, 20 insertions(+)
meson.build +16 -0
index f00b7754fd..7f534f4e75 100644
@@ -2183,6 +2183,26 @@ foreach target : target_dirs
                 link_args: link_args,
                 gui_app: exe['gui'])
  +# 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)
+
+    custom_target('Icon for ' + exe_name + ' - part 2',
+          depends : newiconpart1,
+          input : emulator,
+          output : 'new icon for ' + exe_name + ' - 2',
+          command : ['SetFile', '-a', 'C',
+           meson.current_build_dir() / exe['name']],
Quoted 8 lines
Quoted 8 lines

meson.build foreach target : target_dirs · line 2208

Quoted 6 lines
meson.build +3 -0
+          build_by_default : true)
+endif
+
      if exe_sign
        emulators += {exe['name'] : custom_target(exe['name'],
                     install: true,

Maybe you can do it on install, using add_install_script instead?

Quoted 3 lines

Why would we want to only do it on install? A QEMU which you run from the build tree ought to still have its icon, surely ?

Mostly because edit-in-place commands are not very well suited to a "make" workflow, while they're common at install time (e.g. strip).

But since we already have scripts/entitlement.sh, and it's only Apple that like in-place build steps it is even better to combine all the in-place adjustment to the executable in scripts/entitlement.sh. For example if no entitlements are needed, you pass an empty third argument and scripts/entitlement.sh (now scripts/postprocess-darwin-executable.sh or something like that?) can do Rez+SetFile but not codesign. The existing "if exe_sign" becomes an "if targetos == 'darwin'".

Paolo