Added nvptx variant to rust (#18209)
Co-authored-by: Andrew Gaspar <andrew.gaspar@outlook.com> Co-authored-by: Andrew Gaspar <andrew.gaspar@outlook.com>
This commit is contained in:
parent
92bf9493cf
commit
7205a75427
@ -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 @@ def configure(self, spec, prefix):
|
||||
|
||||
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 @@ def configure(self, spec, prefix):
|
||||
vendor = true
|
||||
extended = true
|
||||
verbose = 2
|
||||
{target_spec}
|
||||
{tools_spec}
|
||||
{rustfmt_spec}
|
||||
|
||||
@ -537,8 +552,7 @@ def configure(self, spec, prefix):
|
||||
rpath = true
|
||||
{deny_warnings_spec}
|
||||
|
||||
[target.{target}]
|
||||
ar = "{ar}"
|
||||
{target_specs}
|
||||
|
||||
[install]
|
||||
prefix = "{prefix}"
|
||||
@ -547,9 +561,9 @@ def configure(self, spec, prefix):
|
||||
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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user