summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Sudwoj <mswoj61@gmail.com>2020-09-08 18:28:59 +0200
committerGitHub <noreply@github.com>2020-09-08 11:28:59 -0500
commit7205a7542767b3e461e54361a618ffd67120dbb7 (patch)
treece8386765faadee1c427db3ef9367ee6d97f8fac
parent92bf9493cf50ba0e645410d8239635d1ad2935c8 (diff)
downloadspack-7205a7542767b3e461e54361a618ffd67120dbb7.tar.gz
spack-7205a7542767b3e461e54361a618ffd67120dbb7.tar.bz2
spack-7205a7542767b3e461e54361a618ffd67120dbb7.tar.xz
spack-7205a7542767b3e461e54361a618ffd67120dbb7.zip
Added nvptx variant to rust (#18209)
Co-authored-by: Andrew Gaspar <andrew.gaspar@outlook.com> Co-authored-by: Andrew Gaspar <andrew.gaspar@outlook.com>
-rw-r--r--var/spack/repos/builtin/packages/rust/package.py22
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
)