public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Toon Claes <toon@iotcl•com>
To: git@vger•kernel.org
Cc: toon@iotcl•com, ps@pks•im
Subject: [PATCH 3/2] meson: use is_cross_build() where possible
Date: Wed,  3 Dec 2025 15:53:31 +0100	[thread overview]
Message-ID: <20251203145331.621529-1-toon@iotcl.com> (raw)
In-Reply-To: <20251202-toon-cross-compile-v1-0-cabc8bce529f@iotcl.com>

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>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 95348e69a4..00ad8a5c60 100644
--- a/meson.build
+++ b/meson.build
@@ -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)
--
2.52.0

  parent reply	other threads:[~2025-12-03 14:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02 10:48 [PATCH 0/2] Few fixes for cross-compiling with Meson Toon Claes
2025-12-02 10:48 ` [PATCH 1/2] meson: ignore subprojects/.wraplock Toon Claes
2025-12-02 10:48 ` [PATCH 2/2] meson: only detect ICONV_OMITS_BOM if possible Toon Claes
2025-12-02 20:27   ` Patrick Steinhardt
2025-12-03 14:55     ` Toon Claes
2025-12-03 14:53 ` Toon Claes [this message]
2025-12-04  6:16   ` [PATCH 3/2] meson: use is_cross_build() where possible Patrick Steinhardt
2025-12-07 10:17 ` [PATCH 0/2] Few fixes for cross-compiling with Meson Carlo Marcelo Arenas Belón
2025-12-08 14:41   ` Toon Claes
2025-12-09  0:44     ` Carlo Arenas
2025-12-11 11:10       ` Toon Claes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251203145331.621529-1-toon@iotcl.com \
    --to=toon@iotcl$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=ps@pks$(echo .)im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox