aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Cross-compilation.md7
-rw-r--r--docs/markdown/Reference-manual.md12
-rw-r--r--docs/markdown/snippets/can_run_host_binaries.md5
-rw-r--r--mesonbuild/interpreter.py14
-rw-r--r--test cases/common/36 tryrun/meson.build2
-rw-r--r--test cases/common/93 selfbuilt custom/meson.build2
-rw-r--r--test cases/unit/36 exe_wrapper behaviour/meson.build2
7 files changed, 29 insertions, 15 deletions
diff --git a/docs/markdown/Cross-compilation.md b/docs/markdown/Cross-compilation.md
index 4c4b7bf..1c53dcf 100644
--- a/docs/markdown/Cross-compilation.md
+++ b/docs/markdown/Cross-compilation.md
@@ -231,13 +231,10 @@ The main *meson* object provides two functions to determine cross
compilation status.
```meson
-meson.is_cross_build() # returns true when cross compiling
-meson.has_exe_wrapper() # returns true if an exe wrapper has been defined
+meson.is_cross_build() # returns true when cross compiling
+meson.can_run_host_binaries() # returns true if the host binaries can be run, either with a wrapper or natively
```
-Note that the latter gives undefined return value when doing a native
-build.
-
You can run system checks on both the system compiler or the cross
compiler. You just have to specify which one to use.
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 97d3e83..1bd5ff0 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -1836,10 +1836,14 @@ the following methods.
If `native: false` or not specified, variable is retrieved from the
cross-file if cross-compiling, and from the native-file when not cross-compiling.
-- `has_exe_wrapper()` returns true when doing a cross build if there
- is a wrapper command that can be used to execute cross built
- binaries (for example when cross compiling from Linux to Windows,
- one can use `wine` as the wrapper).
+- `can_run_host_binaries()` returns true if the build machine can run
+ binaries compiled for the host. This returns true unless you are
+ cross compiling, need a helper to run host binaries, and don't have one.
+ For example when cross compiling from Linux to Windows, one can use `wine`
+ as the helper. *New in 0.55.0*
+
+- `has_exe_wrapper()` alias of `can_run_host_binaries`
+ *Deprecated since 0.55.0*
- `install_dependency_manifest(output_name)` installs a manifest file
containing a list of all subprojects, their versions and license
diff --git a/docs/markdown/snippets/can_run_host_binaries.md b/docs/markdown/snippets/can_run_host_binaries.md
new file mode 100644
index 0000000..0108184
--- /dev/null
+++ b/docs/markdown/snippets/can_run_host_binaries.md
@@ -0,0 +1,5 @@
+## Rename has_exe_wrapper -> can_run_host_binaries
+
+The old name was confusing as it didn't really match the behavior of the
+function. The old name remains as an alias (the behavior hasn't changed), but
+is now deprecated.
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 7901e5a..8c7a82c 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1873,6 +1873,7 @@ class MesonMain(InterpreterObject):
self.methods.update({'get_compiler': self.get_compiler_method,
'is_cross_build': self.is_cross_build_method,
'has_exe_wrapper': self.has_exe_wrapper_method,
+ 'can_run_host_binaries': self.can_run_host_binaries_method,
'is_unity': self.is_unity_method,
'is_subproject': self.is_subproject_method,
'current_source_dir': self.current_source_dir_method,
@@ -2023,9 +2024,16 @@ class MesonMain(InterpreterObject):
@noPosargs
@permittedKwargs({})
- def has_exe_wrapper_method(self, args, kwargs):
- if self.is_cross_build_method(None, None) and \
- self.build.environment.need_exe_wrapper():
+ @FeatureDeprecated('meson.has_exe_wrapper', '0.55.0', 'use meson.can_run_host_binaries instead.')
+ def has_exe_wrapper_method(self, args: T.Tuple[object, ...], kwargs: T.Dict[str, object]) -> bool:
+ return self.can_run_host_binaries_method(args, kwargs)
+
+ @noPosargs
+ @permittedKwargs({})
+ @FeatureNew('meson.can_run_host_binaries', '0.55.0')
+ def can_run_host_binaries_method(self, args: T.Tuple[object, ...], kwargs: T.Dict[str, object]) -> bool:
+ if (self.is_cross_build_method(None, None) and
+ self.build.environment.need_exe_wrapper()):
if self.build.environment.exe_wrapper is None:
return False
# We return True when exe_wrap is defined, when it's not needed, and
diff --git a/test cases/common/36 tryrun/meson.build b/test cases/common/36 tryrun/meson.build
index 261adf2..5580974 100644
--- a/test cases/common/36 tryrun/meson.build
+++ b/test cases/common/36 tryrun/meson.build
@@ -2,7 +2,7 @@ project('tryrun', 'c', 'cpp')
# Complex to exercise all code paths.
if meson.is_cross_build()
- if meson.has_exe_wrapper()
+ if meson.can_run_host_binaries()
compilers = [meson.get_compiler('c', native : false), meson.get_compiler('cpp', native : false)]
else
compilers = [meson.get_compiler('c', native : true), meson.get_compiler('cpp', native : true)]
diff --git a/test cases/common/93 selfbuilt custom/meson.build b/test cases/common/93 selfbuilt custom/meson.build
index 3cc3906..b536352 100644
--- a/test cases/common/93 selfbuilt custom/meson.build
+++ b/test cases/common/93 selfbuilt custom/meson.build
@@ -26,7 +26,7 @@ ctlib = custom_target('ctlib',
build_by_default : true,
)
-if meson.is_cross_build() and meson.has_exe_wrapper()
+if meson.is_cross_build() and meson.can_run_host_binaries()
checkarg_host = executable('checkarg_host', 'checkarg.cpp')
ctlib_host = custom_target(
diff --git a/test cases/unit/36 exe_wrapper behaviour/meson.build b/test cases/unit/36 exe_wrapper behaviour/meson.build
index 16a44d5..d0817ba 100644
--- a/test cases/unit/36 exe_wrapper behaviour/meson.build
+++ b/test cases/unit/36 exe_wrapper behaviour/meson.build
@@ -1,7 +1,7 @@
project('exe wrapper behaviour', 'c')
assert(meson.is_cross_build(), 'not setup as cross build')
-assert(meson.has_exe_wrapper(), 'exe wrapper not defined?')
+assert(meson.has_exe_wrapper(), 'exe wrapper not defined?') # intentionally not changed to can_run_host_binaries,
exe = executable('prog', 'prog.c')