diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-02-04 00:44:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-04 00:44:09 +0200 |
commit | bfa6c8d0747b4fb355f8e953448385c51574a965 (patch) | |
tree | 7941592be47ca899144e5d6868164d1f399add70 /mesonbuild/compilers/rust.py | |
parent | 8fe816101467e66792251b4f57e0ddddb537764a (diff) | |
parent | 281294286e1126ef0945ddedd4f577b01f28bc8b (diff) | |
download | meson-bfa6c8d0747b4fb355f8e953448385c51574a965.zip meson-bfa6c8d0747b4fb355f8e953448385c51574a965.tar.gz meson-bfa6c8d0747b4fb355f8e953448385c51574a965.tar.bz2 |
Merge pull request #2938 from acfoltzer/rust-cross-merge
Add cross-compilation support for `rustc`
Diffstat (limited to 'mesonbuild/compilers/rust.py')
-rw-r--r-- | mesonbuild/compilers/rust.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index b93289f..d1a05ed 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -19,9 +19,11 @@ from ..mesonlib import EnvironmentException, Popen_safe from .compilers import Compiler, rust_buildtype_args class RustCompiler(Compiler): - def __init__(self, exelist, version): + def __init__(self, exelist, version, is_cross, exe_wrapper=None): self.language = 'rust' super().__init__(exelist, version) + self.is_cross = is_cross + self.exe_wrapper = exe_wrapper self.id = 'rustc' def needs_static_linker(self): @@ -41,7 +43,16 @@ class RustCompiler(Compiler): pc.wait() if pc.returncode != 0: raise EnvironmentException('Rust compiler %s can not compile programs.' % self.name_string()) - if subprocess.call(output_name) != 0: + if self.is_cross: + if self.exe_wrapper is None: + # Can't check if the binaries run so we have to assume they do + return + cmdlist = self.exe_wrapper + [output_name] + else: + cmdlist = [output_name] + pe = subprocess.Popen(cmdlist, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + pe.wait() + if pe.returncode != 0: raise EnvironmentException('Executables created by Rust compiler %s are not runnable.' % self.name_string()) def get_dependency_gen_args(self, outfile): |