Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sdroege/gst-plugin-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLily Foster <lily@lily.flowers>2023-04-21 17:50:22 +0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2023-04-21 19:55:37 +0300
commit8e4fd2c1678cd29641d2a085eb7b2edd28232184 (patch)
treee20ed9b476799870b7b6b83ae4224709ecf226e3 /cargo_wrapper.py
parent41ba4b2bc32e30e86f4f80d918eddc00d9b5f396 (diff)
meson: support rust cross-compiling with cargo wrapper
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1188>
Diffstat (limited to 'cargo_wrapper.py')
-rw-r--r--cargo_wrapper.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/cargo_wrapper.py b/cargo_wrapper.py
index e04ad39f..c13a7b05 100644
--- a/cargo_wrapper.py
+++ b/cargo_wrapper.py
@@ -82,6 +82,16 @@ if __name__ == "__main__":
pkg_config_path.append(str(opts.root_dir / 'meson-uninstalled'))
env['PKG_CONFIG_PATH'] = os.pathsep.join(pkg_config_path)
+ rustc_target = None
+ if 'RUSTFLAGS' in env:
+ # grab target from RUSTFLAGS
+ rust_flags = env['RUSTFLAGS'].split()
+ 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)
+
features = opts.features
if opts.command == 'build':
cargo_cmd = ['cargo']
@@ -100,6 +110,8 @@ if __name__ == "__main__":
print("Unknown command:", opts.command, file=logfile)
sys.exit(1)
+ if rustc_target:
+ cargo_cmd += ['--target', rustc_target]
if features:
cargo_cmd += ['--features', ','.join(features)]
cargo_cmd += ['--target-dir', cargo_target_dir]