Skip to contentSkip to conversation

meson: look up cp and dtrace with find_program()

PATCH In review Paolo Bonzini 2 participants 3 messages Sep 7, 2021 – Sep 8, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: look up cp and dtrace with find_program()

Avoid that meson prints a "Program xyz found" test once per custom_target.

---
 pc-bios/keymaps/meson.build | 3 ++-
 trace/meson.build           | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)
pc-bios/keymaps/meson.build +2 -1
index 05eda6c0d2..44247a12b5 100644
@@ -38,6 +38,7 @@ if meson.is_cross_build() or 'CONFIG_XKBCOMMON' not in config_host
 else
   native_qemu_keymap = qemu_keymap
 endif
+cp = find_program('cp')
 
 t = []
 foreach km, args: keymaps
@@ -55,7 +56,7 @@ foreach km, args: keymaps
                        build_by_default: true,
                        input: km,
                        output: km,
-                       command: ['cp', '@INPUT@', '@OUTPUT@'],
+                       command: [cp, '@INPUT@', '@OUTPUT@'],
                        install: true,
                        install_dir: qemu_datadir / 'keymaps')
   endif
trace/meson.build +3 -2
index 74c3214a13..54e509c17c 100644
@@ -2,6 +2,7 @@
 specific_ss.add(files('control-target.c'))
 
 trace_events_files = []
+dtrace = find_program('dtrace')
 foreach dir : [ '.' ] + trace_events_subdirs
   trace_events_file = meson.project_source_root() / dir / 'trace-events'
   trace_events_files += [ trace_events_file ]
@@ -39,13 +40,13 @@ foreach dir : [ '.' ] + trace_events_subdirs
     trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
                                    output: fmt.format('trace-dtrace', 'h'),
                                    input: trace_dtrace,
-                                   command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
+                                   command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
     trace_ss.add(trace_dtrace_h)
     if host_machine.system() != 'darwin'
       trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
                                      output: fmt.format('trace-dtrace', 'o'),
                                      input: trace_dtrace,
-                                     command: [ 'dtrace', '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
+                                     command: [ dtrace, '-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
       trace_ss.add(trace_dtrace_o)
     endif
 
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw

Hi

Quoted 5 lines · Paolo Bonzini

Avoid that meson prints a "Program xyz found" test once per custom_target.

Is there a meson bug already?

Quoted 66 lines
---
 pc-bios/keymaps/meson.build | 3 ++-
 trace/meson.build           | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)
pc-bios/keymaps/meson.build +0 -0
index 05eda6c0d2..44247a12b5 100644
@@ -38,6 +38,7 @@ if meson.is_cross_build() or 'CONFIG_XKBCOMMON' not in

config_host
else
native_qemu_keymap = qemu_keymap
endif

pc-bios/keymaps/meson.build +2 -1
+cp = find_program('cp')
 
 t = []
 foreach km, args: keymaps
@@ -55,7 +56,7 @@ foreach km, args: keymaps
                        build_by_default: true,
                        input: km,
                        output: km,
-                       command: ['cp', '@INPUT@', '@OUTPUT@'],
+                       command: [cp, '@INPUT@', '@OUTPUT@'],
                        install: true,
                        install_dir: qemu_datadir / 'keymaps')
   endif
trace/meson.build +2 -2
index 74c3214a13..54e509c17c 100644
@@ -2,6 +2,7 @@
 specific_ss.add(files('control-target.c'))
 
 trace_events_files = []
+dtrace = find_program('dtrace')
 foreach dir : [ '.' ] + trace_events_subdirs
   trace_events_file = meson.project_source_root() / dir / 'trace-events'
   trace_events_files += [ trace_events_file ]
@@ -39,13 +40,13 @@ foreach dir : [ '.' ] + trace_events_subdirs
     trace_dtrace_h = custom_target(fmt.format('trace-dtrace', 'h'),
                                    output: fmt.format('trace-dtrace',
 'h'),
                                    input: trace_dtrace,
-                                   command: [ 'dtrace', '-DSTAP_SDT_V2',
 '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
+                                   command: [ dtrace, '-DSTAP_SDT_V2',
 '-o', '@OUTPUT@', '-h', '-s', '@INPUT@' ])
     trace_ss.add(trace_dtrace_h)
     if host_machine.system() != 'darwin'
       trace_dtrace_o = custom_target(fmt.format('trace-dtrace', 'o'),
                                      output: fmt.format('trace-dtrace',
 'o'),
                                      input: trace_dtrace,
-                                     command: [ 'dtrace',

'-DSTAP_SDT_V2', '-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
+ command: [ dtrace, '-DSTAP_SDT_V2',
'-o', '@OUTPUT@', '-G', '-s', '@INPUT@' ])
trace_ss.add(trace_dtrace_o)
endif

--
2.31.1

Signature · 1 line
Marc-André Lureau
#2 lore raw
Quoted 7 lines · Marc-André Lureau

Hi

On Tue, Sep 7, 2021 at 9:27 PM Paolo Bonzini <[email protected] <mailto:[email protected]>> wrote:

Avoid that meson prints a "Program xyz found" test once per custom_target.

Quoted 7 lines

<mailto:[email protected]>>

Is there a meson bug already?

I don't think it's a bug. It also prints the message a lot if the program is a Python installation however, and that is a bug that I'll look into later today.

Paolo