diff mbox series

[RFC,17/18] meson: Allow symlinking system emulation binaries

Message ID 20250305153929.43687-18-philmd@linaro.org
State New
Headers show
Series hw/microblaze: Quick single binary proof of concept | expand

Commit Message

Philippe Mathieu-Daudé March 5, 2025, 3:39 p.m. UTC
The 'legacy binary' API allows checking target specific
features at runtime by comparing the argv[0] binary name.

Add few lines to easily symlink indentical targets (see
next commit).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
This is ugly meson, but the point is to show a prototype.

One problem is we can not run 'make check-$suite-$target'
anymore :(
---
 meson.build | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index e4ede6ba06f..c2b7ec57739 100644
--- a/meson.build
+++ b/meson.build
@@ -3251,6 +3251,9 @@  host_kconfig = \
 
 ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
 
+aliased_targets = []
+aliased_target = {}
+
 default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
 actual_target_dirs = []
 fdt_required = []
@@ -3273,6 +3276,9 @@  foreach target : target_dirs
     endif
     config_target += { 'CONFIG_BSD_USER': 'y' }
   elif target.endswith('softmmu')
+    if config_target['TARGET_NAME'] in aliased_targets
+      continue
+    endif
     config_target += { 'CONFIG_SYSTEM_ONLY': 'y' }
     config_target += { 'CONFIG_SOFTMMU': 'y' }
   endif
@@ -4307,6 +4313,16 @@  foreach target : target_dirs
                link_args: link_args,
                win_subsystem: exe['win_subsystem'])
 
+    if target_name in aliased_target
+      exe_alias = 'qemu-system-' + aliased_target[target_name]
+      emulators += {exe_alias : custom_target(exe_alias,
+                                              input: [emulator],
+                                              output: exe_alias,
+                                              command: ['ln', '-f', '@INPUT@', '@OUTPUT@'],
+                                              install : true,
+                                              install_dir : get_option('bindir'))}
+    endif
+
     if host_os == 'darwin'
       icon = 'pc-bios/qemu.rsrc'
       build_input = [emulator, files(icon)]