From 7300e4ed88286ed4fd1f3bf9f2b6b29a1f8768c0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 23 Sep 2024 19:33:30 +0100 Subject: [PATCH] env2mfile: Generalize detection of pkg-config to have a list of tools Cross-tools on Debian generally follow the naming convention set by Autotools AC_CHECK_TOOL, where the name is prefixed with the GNU architecture tuple for the host architecture. env2mfile was already using this for pkg-config, but there are many other tools that can be detected in the same way. Signed-off-by: Simon McVittie --- mesonbuild/scripts/env2mfile.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mesonbuild/scripts/env2mfile.py b/mesonbuild/scripts/env2mfile.py index b2c9a45b2..16ab1b980 100755 --- a/mesonbuild/scripts/env2mfile.py +++ b/mesonbuild/scripts/env2mfile.py @@ -230,10 +230,13 @@ def dpkg_architecture_to_machine_info(output: str, options: T.Any) -> MachineInf deb_detect_cmake(infos, data) except ValueError: pass - try: - infos.binaries['pkg-config'] = locate_path("%s-pkg-config" % host_arch) - except ValueError: - pass # pkg-config is optional + for tool in [ + 'pkg-config', + ]: + try: + infos.binaries[tool] = locate_path("%s-%s" % (host_arch, tool)) + except ValueError: + pass # optional try: infos.binaries['cups-config'] = locate_path("cups-config") except ValueError: