diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2023-06-08 15:03:47 +0300 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2023-07-12 11:14:17 +0300 |
commit | 89002b45626c251bc2b8d8bad5b2e37016991868 (patch) | |
tree | 78d7829765bde3688d68eb26cde7de229e4b9a2b /cargo_wrapper.py | |
parent | bbd3d9ffe04081f0ac8d44374dd123fe301dd310 (diff) |
meson: Don't override RUSTFLAGS in the env
Meson does not add RUSTFLAGS to rustc.cmd_array(), so the effect of
this code is to override that value in the env.
This is hacky, since the env has to match during setup and compile
now, and rust_args added in the cross / native file will be ignored.
But at least it fixes this regression:
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/372
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1237>
Diffstat (limited to 'cargo_wrapper.py')
-rw-r--r-- | cargo_wrapper.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cargo_wrapper.py b/cargo_wrapper.py index c13a7b05e..dadd09842 100644 --- a/cargo_wrapper.py +++ b/cargo_wrapper.py @@ -7,6 +7,7 @@ import os import shutil import subprocess import sys +import shlex from argparse import ArgumentParser from pathlib import Path as P @@ -83,14 +84,16 @@ if __name__ == "__main__": env['PKG_CONFIG_PATH'] = os.pathsep.join(pkg_config_path) rustc_target = None - if 'RUSTFLAGS' in env: + if 'RUSTC' in env: + rustc_cmdline = shlex.split(env['RUSTC']) # grab target from RUSTFLAGS - rust_flags = env['RUSTFLAGS'].split() + rust_flags = rustc_cmdline[1:] + shlex.split(env.get('RUSTFLAGS', '')) if '--target' in rust_flags: rustc_target_idx = rust_flags.index('--target') _ = rust_flags.pop(rustc_target_idx) # drop '--target' rustc_target = rust_flags.pop(rustc_target_idx) - env['RUSTFLAGS'] = ' '.join(rust_flags) + env['RUSTFLAGS'] = shlex.join(rust_flags) + env['RUSTC'] = rustc_cmdline[0] features = opts.features if opts.command == 'build': |