]> git.ipfire.org Git - thirdparty/git.git/commitdiff
meson: use is_cross_build() where possible
authorToon Claes <toon@iotcl.com>
Wed, 3 Dec 2025 14:53:31 +0000 (15:53 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Dec 2025 02:11:15 +0000 (11:11 +0900)
In previous commit the first use of meson.can_run_host_binaries() was
introduced. This is a guard around compiler.run() to ensure it's
actually possible to execute the provided.

In other places we've been having the same issue, but here `not
meson.is_cross_build()` is used as guard. This does the trick, but it
also prevents the code from running even when an exe_wrapper is
configured.

Switch to using meson.can_run_host_binaries() here as well.

There is another place left that still uses `not
meson.is_cross_build()`, but here it's a guard around fs.exists(). That
function will always run on the build machine, so checking for
cross-compilation is still in place here.

Signed-off-by: Toon Claes <toon@iotcl.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
meson.build

index 95348e69a413a928cb5017e111b8e3f110420245..00ad8a5c6011e559aa71e2d408f1ee2e6751d1e6 100644 (file)
@@ -1492,7 +1492,7 @@ if not has_bsd_sysctl
   endif
 endif
 
-if not meson.is_cross_build() and compiler.run('''
+if meson.can_run_host_binaries() and compiler.run('''
   #include <stdio.h>
 
   int main(int argc, const char **argv)