summaryrefslogtreecommitdiffstats
path: root/package/rustc
diff options
context:
space:
mode:
authorSam Voss <sam.voss@gmail.com>2018-08-22 17:33:50 -0500
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>2018-09-12 23:44:57 +0200
commit025b863e6facb7b219b82ee6ee7a7916c2c3c47e (patch)
treeeed4ad0f5d5b1ddb90dda9d5a2dea56d817762cd /package/rustc
parent1382738266464389e287b0f6fefabca2d1483312 (diff)
downloadbuildroot-025b863e6facb7b219b82ee6ee7a7916c2c3c47e.tar.gz
buildroot-025b863e6facb7b219b82ee6ee7a7916c2c3c47e.zip
rust: modify Rust packaging to be usable as host-tool only
This commit modifies the host-rust virtual package to default to host-rust-bin when no other selection has been made, as long as the host supports rust. This allows host only tools to still use rust when the target architecture does not support it. Add target-specific variable which is used to differentiate host and target arch requirements (BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS). A target package shall depend on this variable where a host package will use the previously defined BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS. The new "target" version is selectable for the same set of architectures as before, but now depends on the host variant. Signed-off-by: Sam Voss <sam.voss@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Reviewed-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'package/rustc')
-rw-r--r--package/rustc/Config.in.host16
-rw-r--r--package/rustc/rustc.mk2
2 files changed, 14 insertions, 4 deletions
diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
index 2ae8f89d3f..c58ffdf352 100644
--- a/package/rustc/Config.in.host
+++ b/package/rustc/Config.in.host
@@ -1,5 +1,11 @@
+# All host rust packages should depend on this option
config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
bool
+ default y if BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
+
+# All target rust packages should depend on this option
+config BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+ bool
# The pre-built Rust standard library is only available for the
# following architectures/ABIs, and is built against glibc.
default y if BR2_i386
@@ -12,7 +18,7 @@ config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
default y if (BR2_mips64 || BR2_mips64el) && !BR2_MIPS_CPU_MIPS64R6 \
&& BR2_MIPS_NABI64
depends on BR2_TOOLCHAIN_USES_GLIBC
- depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
+ depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
config BR2_PACKAGE_HOST_RUSTC_ARCH
string
@@ -66,9 +72,11 @@ config BR2_PACKAGE_HOST_RUST_BIN
endchoice
+endif
+
config BR2_PACKAGE_PROVIDES_HOST_RUSTC
string
default "host-rust" if BR2_PACKAGE_HOST_RUST
- default "host-rust-bin" if BR2_PACKAGE_HOST_RUST_BIN
-
-endif
+ # Default to host-rust-bin as long as host arch supports it
+ default "host-rust-bin" if !BR2_PACKAGE_HOST_RUST
+ depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
diff --git a/package/rustc/rustc.mk b/package/rustc/rustc.mk
index bed74f3c2c..6eea9b4fc5 100644
--- a/package/rustc/rustc.mk
+++ b/package/rustc/rustc.mk
@@ -7,7 +7,9 @@
RUSTC_ARCH = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ARCH))
RUSTC_ABI = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ABI))
+ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y)
RUSTC_TARGET_NAME = $(RUSTC_ARCH)-unknown-linux-gnu$(RUSTC_ABI)
+endif
ifeq ($(HOSTARCH),x86)
RUSTC_HOST_ARCH = i686
OpenPOWER on IntegriCloud