diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2024-11-20 00:33:45 +0100 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-02-03 20:01:37 -0500 |
| commit | 103501c2741f9ff919bc04a17cb057ace150526c (patch) | |
| tree | c97757a892e1c5ff25d95c0cea05f55316a29df5 /mesonbuild/compilers | |
| parent | 4276f1d482095ea003ec39de0fd17ab16dab4b95 (diff) | |
| download | meson-103501c2741f9ff919bc04a17cb057ace150526c.tar.gz | |
ninjabackend: unify building rpath args
Implement RustCompiler.build_rpath_args, so that more code can
be shared between non-Rust and Rust targets. Then, RustCompiler
can override it to convert the arguments to "-C link-arg=" and
add the rustup sysroot.
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/compilers')
| -rw-r--r-- | mesonbuild/compilers/rust.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 6b9edb05d..09a1d24de 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -196,6 +196,20 @@ class RustCompiler(Compiler): def get_optimization_args(self, optimization_level: str) -> T.List[str]: return rust_optimization_args[optimization_level] + def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str, + rpath_paths: T.Tuple[str, ...], build_rpath: str, + install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]: + args, to_remove = super().build_rpath_args(env, build_dir, from_dir, rpath_paths, + build_rpath, install_rpath) + + # ... but then add rustc's sysroot to account for rustup + # installations + rustc_rpath_args = [] + for arg in args: + rustc_rpath_args.append('-C') + rustc_rpath_args.append('link-arg=' + arg + ':' + self.get_target_libdir()) + return rustc_rpath_args, to_remove + def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]: for idx, i in enumerate(parameter_list): |
