diff mbox series

[v2,10/13] meson: prevent finding sed(1) in a loop

Message ID 20250130-b4-pks-meson-improvements-v2-10-2f05581ffb44@pks.im (mailing list archive)
State New
Headers show
Series meson: cleanups, improvements, smallish fixes | expand

Commit Message

Patrick Steinhardt Jan. 30, 2025, 2:44 p.m. UTC
We're searching for the sed(1) executable in a loop, which will make us
try to find it multiple times. Starting with the preceding commit we
already declare a variable for that program in the top-level build file.
Use it so that we only need to search for the program once.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 Documentation/howto/meson.build | 2 +-
 meson.build                     | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/howto/meson.build b/Documentation/howto/meson.build
index c023c10416..92a08b13ee 100644
--- a/Documentation/howto/meson.build
+++ b/Documentation/howto/meson.build
@@ -41,7 +41,7 @@  custom_target(
 foreach howto : howto_sources
   howto_stripped = custom_target(
     command: [
-      find_program('sed'),
+      sed,
       '-e',
       '1,/^$/d',
       '@INPUT@',
diff --git a/meson.build b/meson.build
index 7180fd58fd..b5e8aca288 100644
--- a/meson.build
+++ b/meson.build
@@ -201,11 +201,12 @@  endif
 cygpath = find_program('cygpath', dirs: program_path, required: false)
 diff = find_program('diff', dirs: program_path)
 git = find_program('git', dirs: program_path, required: false)
+sed = find_program('sed', dirs: program_path)
 shell = find_program('sh', dirs: program_path)
 tar = find_program('tar', dirs: program_path)
 
 # Sanity-check that programs required for the build exist.
-foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname']
+foreach tool : ['cat', 'cut', 'grep', 'sort', 'tr', 'uname']
   find_program(tool, dirs: program_path)
 endforeach