summaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2023-06-21 12:15:07 -0700
committerDylan Baker <dylan@pnwbakers.com>2023-06-27 11:53:18 -0700
commitc5b16ab8b957d53b75c73bb24144a4f61c86234d (patch)
treed4ada77ecd56f09ea3996a39a60cae4dd6b156f4 /mesonbuild/modules
parent43f24060f3e0065b44b1909d88bcc8e2882e9e5e (diff)
downloadmeson-c5b16ab8b957d53b75c73bb24144a4f61c86234d.tar.gz
modules/rust: Add a machine file property for extra clang args with bindgen
It's currently impossible to inject extra clang arguments when using bindgen, which is problematic when cross compiling since you may need critical arguments like `--target=...`. Because such arguments must be passed after the `--` it's impossible to inject them currently without going to something like a wrapper script. Fixes: #11805
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/rust.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py
index 41536303f..faca9c06a 100644
--- a/mesonbuild/modules/rust.py
+++ b/mesonbuild/modules/rust.py
@@ -201,7 +201,10 @@ class RustModule(ExtensionModule):
else:
depends.append(d)
- clang_args: T.List[str] = []
+ # Copy to avoid subsequent calls mutating the original
+ # TODO: if we want this to be per-machine we'll need a native kwarg
+ clang_args = state.environment.properties.host.get_bindgen_clang_args().copy()
+
for i in state.process_include_dirs(kwargs['include_directories']):
# bindgen always uses clang, so it's safe to hardcode -I here
clang_args.extend([f'-I{x}' for x in i.to_string_list(