2018-08-23 00:33:50 +02:00
|
|
|
# All host rust packages should depend on this option
|
2018-02-04 19:07:40 +01:00
|
|
|
config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
|
2018-08-23 00:33:50 +02:00
|
|
|
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
|
2018-02-04 19:07:40 +01:00
|
|
|
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
|
2018-02-26 21:04:21 +01:00
|
|
|
default y if BR2_arm && !BR2_ARM_CPU_ARMV4 && !BR2_ARM_CPU_ARMV5 \
|
|
|
|
&& !(BR2_ARM_CPU_ARMV7A && BR2_ARM_EABI)
|
2018-05-16 08:29:09 +02:00
|
|
|
default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
|
2018-02-04 19:07:40 +01:00
|
|
|
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
|
2018-08-23 00:33:50 +02:00
|
|
|
depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
|
2018-02-04 19:07:40 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2018-02-04 19:07:41 +01:00
|
|
|
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
|
|
|
|
|
rust: new package
This new package provides rustc, the compiler for the Rust programming
language, built from source.
Currently, only the host variant is built.
The Rust compiler uses LLVM as its backend: a copy of LLVM source code
is provided and CMake is used to build it. It is possible to use a
pre-built external copy. When LLVM/clang will be available in Buildroot,
it would be possible to benefit from this feature and thus decrease
build time.
LLVM is configured to generate code for x86, ARM, PowerPC and MIPS
architectures.
The Rust compiler uses Cargo as its build system and is written in Rust.
Therefore this package depends on cargo-bin and rust-bin.
The internal build process is as follows:
1. stage0 compiler, provided by rust-bin, is used to build stage1
compiler.
2. stage1 compiler builds the final Rust compiler (stage2 compiler)
and the standard library for the host architecture.
3. the standard library for the target architecture is built.
The target architecture to support is given by the GNU/LLVM target
triple. Rust supports some predefined targets [1]. As the build system
expects the triple to be in the form of <arch>-unknown-<system> and
Buildroot toolchain wrapper uses <arch>-buildroot-<system>, the package
Makefile uses $(RUST_TARGET_NAME) defined in the rustc package and uses
it instead of $(GNU_TARGET_NAME).
When compiling Rust code with this compiler, the generated program only
depends on the target C library, as it is statically linked to the Rust
standard library and any other code from Rust packages (a.k.a.
"crates").
If the jemalloc package is selected, support for this memory allocator
will be enabled in the target standard library.
The menuconfig entry for rustc is also updated to expose this provider.
[1] https://forge.rust-lang.org/platform-support.html
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2018-02-04 19:07:43 +01:00
|
|
|
config BR2_PACKAGE_HOST_RUST
|
|
|
|
bool "host rust"
|
|
|
|
# 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
|
|
|
|
|
2018-02-04 19:07:41 +01:00
|
|
|
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
|
|
|
|
|
2018-08-23 00:33:50 +02:00
|
|
|
endif
|
|
|
|
|
2018-02-04 19:07:40 +01:00
|
|
|
config BR2_PACKAGE_PROVIDES_HOST_RUSTC
|
|
|
|
string
|
rust: new package
This new package provides rustc, the compiler for the Rust programming
language, built from source.
Currently, only the host variant is built.
The Rust compiler uses LLVM as its backend: a copy of LLVM source code
is provided and CMake is used to build it. It is possible to use a
pre-built external copy. When LLVM/clang will be available in Buildroot,
it would be possible to benefit from this feature and thus decrease
build time.
LLVM is configured to generate code for x86, ARM, PowerPC and MIPS
architectures.
The Rust compiler uses Cargo as its build system and is written in Rust.
Therefore this package depends on cargo-bin and rust-bin.
The internal build process is as follows:
1. stage0 compiler, provided by rust-bin, is used to build stage1
compiler.
2. stage1 compiler builds the final Rust compiler (stage2 compiler)
and the standard library for the host architecture.
3. the standard library for the target architecture is built.
The target architecture to support is given by the GNU/LLVM target
triple. Rust supports some predefined targets [1]. As the build system
expects the triple to be in the form of <arch>-unknown-<system> and
Buildroot toolchain wrapper uses <arch>-buildroot-<system>, the package
Makefile uses $(RUST_TARGET_NAME) defined in the rustc package and uses
it instead of $(GNU_TARGET_NAME).
When compiling Rust code with this compiler, the generated program only
depends on the target C library, as it is statically linked to the Rust
standard library and any other code from Rust packages (a.k.a.
"crates").
If the jemalloc package is selected, support for this memory allocator
will be enabled in the target standard library.
The menuconfig entry for rustc is also updated to expose this provider.
[1] https://forge.rust-lang.org/platform-support.html
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2018-02-04 19:07:43 +01:00
|
|
|
default "host-rust" if BR2_PACKAGE_HOST_RUST
|
2018-08-23 00:33:50 +02:00
|
|
|
# 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
|