diff options
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/rust/package.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/rust/package.py b/var/spack/repos/builtin/packages/rust/package.py index 990095c90f..abfd4e8e0b 100644 --- a/var/spack/repos/builtin/packages/rust/package.py +++ b/var/spack/repos/builtin/packages/rust/package.py @@ -55,6 +55,12 @@ class Rust(Package): default=True, description='Install Rust source files' ) + variant( + 'extra_targets', + default=(), + multi=True, + description='Triples for extra targets to enable. For supported targets, see: https://doc.rust-lang.org/nightly/rustc/platform-support.html' + ) depends_on('python@2.7:', type='build') depends_on('python@2.7:2.8', when='@:1.43', type='build') @@ -496,6 +502,14 @@ class Rust(Package): ar = which('ar', required=True) + extra_targets = list(self.spec.variants['extra_targets'].value) + targets = [self.get_rust_target()] + extra_targets + target_spec = 'target=[' + \ + ','.join('"{0}"'.format(target) for target in targets) + ']' + target_specs = '\n'.join( + '[target.{0}]\nar = "{1}"\n'.format(target, ar.path) + for target in targets) + # build.tools was introduced in Rust 1.25 tools_spec = \ 'tools={0}'.format(tools) if self.check_newer('1.25') else '' @@ -529,6 +543,7 @@ docs = false vendor = true extended = true verbose = 2 +{target_spec} {tools_spec} {rustfmt_spec} @@ -537,8 +552,7 @@ channel = "stable" rpath = true {deny_warnings_spec} -[target.{target}] -ar = "{ar}" +{target_specs} [install] prefix = "{prefix}" @@ -547,9 +561,9 @@ sysconfdir = "etc" cargo=join_path(boot_bin, 'cargo'), rustc=join_path(boot_bin, 'rustc'), prefix=prefix, - target=target, deny_warnings_spec=deny_warnings_spec, - ar=ar.path, + target_spec=target_spec, + target_specs=target_specs, tools_spec=tools_spec, rustfmt_spec=rustfmt_spec ) |