[PATCH 08/11] meson: simplify setup of PATH environment variable
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 29, 2025, 07:12 UTC
- Message-ID
- <20250129-b4-pks-meson-improvements-v1-8-ab709f0be12c@pks.im>
- In-Reply-To
- <20250129-b4-pks-meson-improvements-v1-0-ab709f0be12c@pks.im>
We're setting up the PATH environment variable such that a set of necessary build tools can be found at build time. Make this step a bit less repetitive by only looping through the set of found programs once.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- meson.build | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/meson.build b/meson.build index 48eb068fd8..e3829f2365 100644 --- a/meson.build +++ b/meson.build @@ -181,22 +181,21 @@ if host_machine.system() == 'windows' program_path += [ 'C:/Program Files/Git/bin', 'C:/Program Files/Git/usr/bin' ] endif +cat = find_program('cat', dirs: program_path) 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) +grep = find_program('grep', dirs: program_path) +sed = find_program('sed', dirs: program_path) shell = find_program('sh', dirs: program_path) tar = find_program('tar', dirs: program_path) script_environment = environment() -foreach tool : ['cat', 'grep', 'sed'] - program = find_program(tool, dirs: program_path) - script_environment.prepend('PATH', fs.parent(program.full_path())) +foreach program : [cat, cygpath, diff, git, grep, sed, shell, tar] + if program.found() + script_environment.prepend('PATH', fs.parent(program.full_path())) + endif endforeach - -git = find_program('git', dirs: program_path, required: false) -if git.found() - script_environment.prepend('PATH', fs.parent(git.full_path())) -endif - if get_option('sane_tool_path') != '' script_environment.prepend('PATH', get_option('sane_tool_path')) endif
-- 2.48.1.362.g079036d154.dirty