meson: call find_program() once and reuse the variable everywhere
Meson 0.58 has gotten quite bad with emitting a message every time a quoted command is used: Program /home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh found: YES (/home/zbyszek/src/systemd-work/tools/meson-make-symlink.sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program sh found: YES (/usr/bin/sh) Program xsltproc found: YES (/usr/bin/xsltproc) Configuring custom-entities.ent using configuration Message: Skipping bootctl.1 because ENABLE_EFI is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Message: Skipping journal-remote.conf.5 because HAVE_MICROHTTPD is false Message: Skipping journal-upload.conf.5 because HAVE_MICROHTTPD is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Message: Skipping loader.conf.5 because ENABLE_EFI is false Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) Program ln found: YES (/usr/bin/ln) ... Let's suffer one message only for each command. Hopefully we can silence even this when https://github.com/mesonbuild/meson/issues/8642 is resolved.
This commit is contained in:
@@ -72,14 +72,14 @@ if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false'
|
||||
if efi_libdir == ''
|
||||
# New location first introduced with gnu-efi 3.0.11
|
||||
efi_libdir = join_paths('/usr/lib/gnuefi', EFI_MACHINE_TYPE_NAME)
|
||||
cmd = run_command('test', '-e', efi_libdir)
|
||||
cmd = run_command(test, '-e', efi_libdir)
|
||||
|
||||
if cmd.returncode() != 0
|
||||
# Fall back to the old approach
|
||||
cmd = run_command(efi_cc + ['-print-multi-os-directory'])
|
||||
if cmd.returncode() == 0
|
||||
path = join_paths('/usr/lib', cmd.stdout().strip())
|
||||
cmd = run_command('realpath', '-e', path)
|
||||
cmd = run_command(env, 'realpath', '-e', path)
|
||||
if cmd.returncode() == 0
|
||||
efi_libdir = cmd.stdout().strip()
|
||||
endif
|
||||
@@ -116,7 +116,8 @@ if have_gnu_efi
|
||||
foreach sbatvar : sbatvars
|
||||
value = get_option(sbatvar[0])
|
||||
if value == '' or value == 'auto'
|
||||
value = run_command('sh', '-c', 'if [ -e /etc/os-release ]; then . /etc/os-release; else . /usr/lib/os-release; fi; echo $' + sbatvar[1]).stdout().strip()
|
||||
cmd = 'if [ -e /etc/os-release ]; then . /etc/os-release; else . /usr/lib/os-release; fi; echo $@0@'.format(sbatvar[1])
|
||||
value = run_command(sh, '-c', cmd).stdout().strip()
|
||||
endif
|
||||
if value == ''
|
||||
error('Required @0@ option not set and autodetection failed'.format(sbatvar[0]))
|
||||
@@ -156,7 +157,7 @@ if have_gnu_efi
|
||||
efi_lds = ''
|
||||
foreach location : efi_location_map
|
||||
if efi_lds == ''
|
||||
cmd = run_command('test', '-f', location[0])
|
||||
cmd = run_command(test, '-f', location[0])
|
||||
if cmd.returncode() == 0
|
||||
efi_lds = location[0]
|
||||
efi_crt0 = location[1]
|
||||
|
||||
Reference in New Issue
Block a user