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"
|
|
|
|
|
package/rustc: add support for Tier 1 and Tier 2 platforms
This commit reworks how BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS is
defined to more clearly map with the list of platforms supported by
Rust as listed at
https://doc.rust-lang.org/nightly/rustc/platform-support.html. Indeed,
the situation is not as simple as a list of architectures, all
supported for both glibc and musl.
So instead, we take the approach of directly mapping with what's
described at
https://doc.rust-lang.org/nightly/rustc/platform-support.html, which
means:
* A list of Tier 1 platforms (in fact just 3 platforms)
* A list of Tier 2 platforms with host tools (i.e where rustc and
cargo themselves are available for the target, something that isn't
relevant for Buildroot)
* A list of Tier 2 platforms with no host tools support.
For each platform, we add as a comment its Rust tuple name, as listed
at https://doc.rust-lang.org/nightly/rustc/platform-support.html, and
then the corresponding Buildroot architecture/libc dependency.
This is obviously more verbose than it was, but it is also a lot
easier to maintain.
With this, a total of 16 new platforms are supported, 13 of which are
musl-based. The additional non-musl platforms are ARMv5TE, RISC-V
64-bit and Sparc64.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-05-18 22:54:31 +02:00
|
|
|
# The pre-built Rust standard library is only available for a number
|
|
|
|
# of architectures/C libraries combinations, with different levels of
|
|
|
|
# support: Tier 1 platforms, Tier 2 platforms with host tools, Tier 2
|
|
|
|
# platforms, Tier 3 platforms. Below, we support Tier 1, Tier 2 with
|
|
|
|
# host tools and Tier 2 platforms.
|
|
|
|
|
|
|
|
# The below entries match Tier 1 platforms as described at
|
|
|
|
# https://doc.rust-lang.org/nightly/rustc/platform-support.html.
|
|
|
|
config BR2_PACKAGE_HOST_RUSTC_TARGET_TIER1_PLATFORMS
|
|
|
|
bool
|
|
|
|
# aarch64-unknown-linux-gnu
|
|
|
|
default y if BR2_aarch64 && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# i686-unknown-linux-gnu
|
|
|
|
default y if (BR2_i686 || BR2_x86_pentiumpro || BR2_X86_CPU_HAS_MMX) && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# x86_64-unknown-linux-gnu
|
|
|
|
default y if BR2_x86_64 && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
|
|
|
|
# The below entries match Tier 2 platforms with host tools as
|
|
|
|
# described at
|
|
|
|
# https://doc.rust-lang.org/nightly/rustc/platform-support.html.
|
|
|
|
config BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_HOST_TOOLS_PLATFORMS
|
|
|
|
bool
|
|
|
|
# aarch64-unknown-linux-musl
|
|
|
|
default y if BR2_aarch64 && BR2_TOOLCHAIN_USES_MUSL
|
|
|
|
# arm-unknown-linux-gnueabi
|
|
|
|
default y if BR2_ARM_CPU_ARMV6 && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# arm-unknown-linux-gnueabihf
|
|
|
|
default y if BR2_ARM_CPU_ARMV6 && BR2_ARM_EABIHF && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# armv7-unknown-linux-gnueabihf
|
|
|
|
default y if BR2_ARM_CPU_ARMV7A && BR2_ARM_EABIHF && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# mips-unknown-linux-gnu
|
|
|
|
default y if BR2_mips && BR2_TOOLCHAIN_USES_GLIBC && !BR2_MIPS_CPU_MIPS32R6
|
|
|
|
# mips64-unknown-linux-gnuabi64
|
|
|
|
default y if BR2_mips64 && BR2_TOOLCHAIN_USES_GLIBC && BR2_MIPS_NABI64 && !BR2_MIPS_CPU_MIPS32R6
|
|
|
|
# mipsel-unknown-linux-gnu
|
|
|
|
default y if BR2_mipsel && BR2_TOOLCHAIN_USES_GLIBC && !BR2_MIPS_CPU_MIPS32R6
|
|
|
|
# mips64el-unknown-linux-gnuabi64
|
|
|
|
default y if BR2_mips64el && BR2_TOOLCHAIN_USES_GLIBC && BR2_MIPS_NABI64 && !BR2_MIPS_CPU_MIPS32R6
|
|
|
|
# powerpc-unknown-linux-gnu
|
|
|
|
default y if BR2_powerpc && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# powerpc64-unknown-linux-gnu
|
|
|
|
default y if BR2_powerpc64 && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# powerpc64le-unknown-linux-gnu
|
|
|
|
default y if BR2_powerpc64le && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# riscv64gc-unknown-linux-gnu
|
|
|
|
# "g" stands for imafd, and we also need "c".
|
|
|
|
default y if BR2_riscv && BR2_RISCV_ISA_RVI && BR2_RISCV_ISA_RVM && \
|
|
|
|
BR2_RISCV_ISA_RVA && BR2_RISCV_ISA_RVF && \
|
|
|
|
BR2_RISCV_ISA_RVD && BR2_RISCV_ISA_RVC && \
|
|
|
|
BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# x86_64-unknown-linux-musl
|
|
|
|
default y if BR2_x86_64 && BR2_TOOLCHAIN_USES_MUSL
|
|
|
|
|
|
|
|
# The below entries match Tier 2 platforms without host tools as
|
|
|
|
# described at
|
|
|
|
# https://doc.rust-lang.org/nightly/rustc/platform-support.html.
|
|
|
|
config BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_PLATFORMS
|
|
|
|
bool
|
|
|
|
# arm-unknown-linux-musleabi
|
|
|
|
default y if BR2_ARM_CPU_ARMV6 && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_MUSL
|
|
|
|
# arm-unknown-linux-musleabihf
|
|
|
|
default y if BR2_ARM_CPU_ARMV6 && BR2_ARM_EABIHF && BR2_TOOLCHAIN_USES_MUSL
|
|
|
|
# armv5te-unknown-linux-gnueabi
|
|
|
|
default y if BR2_ARM_CPU_ARMV5 && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# armv5te-unknown-linux-musleabi
|
|
|
|
default y if BR2_ARM_CPU_ARMV5 && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_MUSL
|
|
|
|
# armv7-unknown-linux-gnueabi
|
|
|
|
default y if BR2_ARM_CPU_ARMV7A && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# armv7-unknown-linux-musleabi
|
|
|
|
default y if BR2_ARM_CPU_ARMV7A && BR2_ARM_EABI && BR2_TOOLCHAIN_USES_MUSL
|
|
|
|
# armv7-unknown-linux-musleabihf
|
|
|
|
default y if BR2_ARM_CPU_ARMV7A && BR2_ARM_EABIHF && BR2_TOOLCHAIN_USES_MUSL
|
|
|
|
# i586-unknown-linux-gnu
|
|
|
|
default y if BR2_i586 && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
# i586-unknown-linux-musl
|
|
|
|
default y if BR2_i586 && BR2_TOOLCHAIN_USES_MUSL
|
|
|
|
# i686-unknown-linux-musl
|
|
|
|
default y if (BR2_i686 || BR2_x86_pentiumpro || BR2_X86_CPU_HAS_MMX) && BR2_TOOLCHAIN_USES_MUSL
|
|
|
|
# mips-unknown-linux-musl
|
|
|
|
default y if BR2_mips && BR2_TOOLCHAIN_USES_MUSL && !BR2_MIPS_CPU_MIPS32R6
|
|
|
|
# mips64-unknown-linux-muslabi64
|
|
|
|
default y if BR2_mips64 && BR2_TOOLCHAIN_USES_MUSL && BR2_MIPS_NABI64 && !BR2_MIPS_CPU_MIPS32R6
|
|
|
|
# mips64el-unknown-linux-muslabi64
|
|
|
|
default y if BR2_mips64el && BR2_TOOLCHAIN_USES_MUSL && BR2_MIPS_NABI64 && !BR2_MIPS_CPU_MIPS32R6
|
|
|
|
# mipsel-unknown-linux-musl
|
|
|
|
default y if BR2_mipsel && BR2_TOOLCHAIN_USES_MUSL && !BR2_MIPS_CPU_MIPS32R6
|
|
|
|
# sparc64-unknown-linux-gnu
|
|
|
|
default y if BR2_sparc64 && BR2_TOOLCHAIN_USES_GLIBC
|
|
|
|
|
2018-08-23 00:33:50 +02:00
|
|
|
# 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
|
package/rustc: add support for Tier 1 and Tier 2 platforms
This commit reworks how BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS is
defined to more clearly map with the list of platforms supported by
Rust as listed at
https://doc.rust-lang.org/nightly/rustc/platform-support.html. Indeed,
the situation is not as simple as a list of architectures, all
supported for both glibc and musl.
So instead, we take the approach of directly mapping with what's
described at
https://doc.rust-lang.org/nightly/rustc/platform-support.html, which
means:
* A list of Tier 1 platforms (in fact just 3 platforms)
* A list of Tier 2 platforms with host tools (i.e where rustc and
cargo themselves are available for the target, something that isn't
relevant for Buildroot)
* A list of Tier 2 platforms with no host tools support.
For each platform, we add as a comment its Rust tuple name, as listed
at https://doc.rust-lang.org/nightly/rustc/platform-support.html, and
then the corresponding Buildroot architecture/libc dependency.
This is obviously more verbose than it was, but it is also a lot
easier to maintain.
With this, a total of 16 new platforms are supported, 13 of which are
musl-based. The additional non-musl platforms are ARMv5TE, RISC-V
64-bit and Sparc64.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-05-18 22:54:31 +02:00
|
|
|
default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER1_PLATFORMS
|
|
|
|
default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_HOST_TOOLS_PLATFORMS
|
|
|
|
default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_PLATFORMS
|
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"
|
2020-05-08 17:27:39 +02:00
|
|
|
# RUSTC_TARGET_NAME must be set for building host-rust
|
|
|
|
# otherwise config.toml is broken.
|
|
|
|
depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
|
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
|
|
|
# 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
|