mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-08 18:25:30 +00:00
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>
This commit is contained in:
parent
bbd3d9ffe0
commit
89002b4562
2 changed files with 8 additions and 14 deletions
|
@ -7,6 +7,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import shlex
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from pathlib import Path as P
|
from pathlib import Path as P
|
||||||
|
|
||||||
|
@ -83,14 +84,16 @@ if __name__ == "__main__":
|
||||||
env['PKG_CONFIG_PATH'] = os.pathsep.join(pkg_config_path)
|
env['PKG_CONFIG_PATH'] = os.pathsep.join(pkg_config_path)
|
||||||
|
|
||||||
rustc_target = None
|
rustc_target = None
|
||||||
if 'RUSTFLAGS' in env:
|
if 'RUSTC' in env:
|
||||||
|
rustc_cmdline = shlex.split(env['RUSTC'])
|
||||||
# grab target from RUSTFLAGS
|
# grab target from RUSTFLAGS
|
||||||
rust_flags = env['RUSTFLAGS'].split()
|
rust_flags = rustc_cmdline[1:] + shlex.split(env.get('RUSTFLAGS', ''))
|
||||||
if '--target' in rust_flags:
|
if '--target' in rust_flags:
|
||||||
rustc_target_idx = rust_flags.index('--target')
|
rustc_target_idx = rust_flags.index('--target')
|
||||||
_ = rust_flags.pop(rustc_target_idx) # drop '--target'
|
_ = rust_flags.pop(rustc_target_idx) # drop '--target'
|
||||||
rustc_target = rust_flags.pop(rustc_target_idx)
|
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
|
features = opts.features
|
||||||
if opts.command == 'build':
|
if opts.command == 'build':
|
||||||
|
|
13
meson.build
13
meson.build
|
@ -386,17 +386,8 @@ if pkg_config_path.length() > 0
|
||||||
extra_env += {'PKG_CONFIG_PATH': pathsep.join(pkg_config_path)}
|
extra_env += {'PKG_CONFIG_PATH': pathsep.join(pkg_config_path)}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# get compiler and flags for rust (if any)
|
# get cmdline for rust
|
||||||
rustc_cmd = ''
|
extra_env += {'RUSTC': ' '.join(rustc.cmd_array())}
|
||||||
rust_flags = []
|
|
||||||
foreach rustc_arg : rustc.cmd_array()
|
|
||||||
if rustc_cmd == ''
|
|
||||||
rustc_cmd = rustc_arg
|
|
||||||
else
|
|
||||||
rust_flags += [rustc_arg]
|
|
||||||
endif
|
|
||||||
endforeach
|
|
||||||
extra_env += {'RUSTC': rustc_cmd, 'RUSTFLAGS': ' '.join(rust_flags)}
|
|
||||||
|
|
||||||
rs_plugins = custom_target('gst-plugins-rs',
|
rs_plugins = custom_target('gst-plugins-rs',
|
||||||
build_by_default: true,
|
build_by_default: true,
|
||||||
|
|
Loading…
Reference in a new issue