summaryrefslogtreecommitdiffstats
path: root/package/rustc
diff options
context:
space:
mode:
authorEric Le Bihan <eric.le.bihan.dev@free.fr>2018-02-04 19:07:43 +0100
committerPeter Korsgaard <peter@korsgaard.com>2018-02-05 14:57:47 +0100
commitb50522d838d8ddfef80bf8036e511319982da16e (patch)
treeb73c04580197033151202a5e42440a7936ac9f47 /package/rustc
parentc7a189c661acaabafb39d8e35dfd71393343a282 (diff)
downloadbuildroot-b50522d838d8ddfef80bf8036e511319982da16e.tar.gz
buildroot-b50522d838d8ddfef80bf8036e511319982da16e.zip
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>
Diffstat (limited to 'package/rustc')
-rw-r--r--package/rustc/Config.in.host19
1 files changed, 19 insertions, 0 deletions
diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
index 66c50c4579..d93ff05209 100644
--- a/package/rustc/Config.in.host
+++ b/package/rustc/Config.in.host
@@ -40,6 +40,24 @@ choice
help
Select a Rust compiler
+config BR2_PACKAGE_HOST_RUST
+ bool "host rust"
+ depends on BR2_HOST_GCC_AT_LEAST_4_7 # required by LLVM
+ # triggers ICE on trunc_int_for_mode, at explow.c:56
+ depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5 || !BR2_aarch64
+ select BR2_PACKAGE_HAS_HOST_RUSTC
+ 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
+
+comment "host-rust needs host gcc >= 4.7"
+ depends on !BR2_HOST_GCC_AT_LEAST_4_7
+
config BR2_PACKAGE_HOST_RUST_BIN
bool "host rust (pre-built)"
select BR2_PACKAGE_HAS_HOST_RUSTC
@@ -54,6 +72,7 @@ config BR2_PACKAGE_HAS_HOST_RUSTC
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
OpenPOWER on IntegriCloud