kumquat-buildroot/package/rustc/Config.in.host
Romain Naour 4c051c65ee package/rustc: RUSTC_TARGET_NAME is needed to build host-rust
As reported on bugzilla [1], the host-rust package fail when
the target architecture or the target libc is not supported.

The error is the following:
failed to parse TOML configuration 'config.toml': expected a table key, found a right bracket at line 15

In such case BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS is
not set thus RUSTC_TARGET_NAME is also not set [2].

But RUSTC_TARGET_NAME is needed to generate the file config.toml [3]

Add BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS in the host-rust
dependency.

The commit [4] that allowed to select host-rust when the target
architecture or the target libc is not supported, should have
allowed to select only host-rustc-bin.

Fixes:
Bug #12691

[1] https://bugs.busybox.net/show_bug.cgi?id=12691
[2] https://git.buildroot.net/buildroot/tree/package/rustc/rustc.mk?h=2020.05-rc1#n10
[3] https://git.buildroot.net/buildroot/tree/package/rust/rust.mk?h=2020.05-rc1#n41
[4] 025b863e6f

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Sam Voss <sam.voss@gmail.com>
Reviewed-by: Sam Voss <sam.voss@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2020-05-17 21:06:31 +02:00

82 lines
2.5 KiB
Plaintext

# 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
default y if BR2_x86_64
default y if BR2_aarch64
default y if BR2_arm && !BR2_ARM_CPU_ARMV4 && !BR2_ARM_CPU_ARMV5 \
&& !(BR2_ARM_CPU_ARMV7A && BR2_ARM_EABI)
default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
default y if (BR2_mips || BR2_mipsel) && !BR2_MIPS_CPU_MIPS32R6
default y if (BR2_mips64 || BR2_mips64el) && !BR2_MIPS_CPU_MIPS64R6 \
&& BR2_MIPS_NABI64
depends on BR2_TOOLCHAIN_USES_GLIBC
depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
config BR2_PACKAGE_HOST_RUSTC_ARCH
string
default "armv7" if BR2_ARM_CPU_ARMV7A
default BR2_ARCH if !BR2_ARM_CPU_ARMV7A
config BR2_PACKAGE_HOST_RUSTC_ABI
string
default "eabi" if BR2_ARM_EABI
default "eabihf" if BR2_ARM_EABIHF
default "abi64" if BR2_MIPS_NABI64
config BR2_PACKAGE_HOST_RUSTC
bool "host rustc"
depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
help
Compiler for the Rust language
http://www.rust-lang.org
if BR2_PACKAGE_HOST_RUSTC
choice
prompt "Rust compiler variant"
default BR2_PACKAGE_HOST_RUST_BIN
help
Select a Rust compiler
config BR2_PACKAGE_HOST_RUST
bool "host rust"
# RUSTC_TARGET_NAME must be set for building host-rust
# otherwise config.toml is broken.
depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
# triggers ICE on trunc_int_for_mode, at explow.c:56
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5 || !BR2_aarch64
help
This package will build the compiler for the host as well as
two flavors of the standard library: one for the host, another
for the target. Both are installed in the host directory.
comment "host-rust needs a toolchain w/ gcc >= 5"
depends on BR2_aarch64
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5
config BR2_PACKAGE_HOST_RUST_BIN
bool "host rust (pre-built)"
help
This package will install pre-built versions of the compiler
for the host and the Rust standard library for the target.
endchoice
endif
config BR2_PACKAGE_PROVIDES_HOST_RUSTC
string
default "host-rust" if BR2_PACKAGE_HOST_RUST
# 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