diff options
author | 2025-09-13 09:48:13 +0200 | |
---|---|---|
committer | 2025-10-10 20:29:36 +1000 | |
commit | f30ded34c4c08befbbfed980f64c67230a366f83 (patch) | |
tree | ba1d4332ac8cc8b47c9c9e13175ae90ef6c2ea79 /dev-lang/rust | |
parent | dev-qt/qtwebsockets: Stabilize 6.9.3 x86, #963987 (diff) | |
download | gentoo-f30ded34c4c08befbbfed980f64c67230a366f83.tar.gz gentoo-f30ded34c4c08befbbfed980f64c67230a366f83.tar.bz2 gentoo-f30ded34c4c08befbbfed980f64c67230a366f83.zip |
dev-lang/rust: Add `RUST_SYSROOTS` as `USE_EXPAND` variable
Add a new `USE_EXPAND` variable called `RUST_SYSROOTS` which allows to
specify additional Rust sysroots to build. Rust sysroot is a directory
which contains the prebuilt standard libraries (in form of `*.rlib`
files) and utility binaries (e.g. `rust-objcopy`).
This variable is limited to bare metal targets. Sysroot for targets not
falling into that category contain a local copy of compiler runtime,
libc and unwinder, so crossdev is a better fit for them.
In this change, the only `RUST_SYSROOT` option is `wasm`, which enables
build of a sysroot for `wasm32-unknown-unknown` target and replaces the
former `wasm` USE flag.
Signed-off-by: Michal Rostecki <[email protected]>
Signed-off-by: Matt Jolly <[email protected]>
Diffstat (limited to 'dev-lang/rust')
-rw-r--r-- | dev-lang/rust/rust-9999.ebuild | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild index b1aa0b11704c..a4cb917d4933 100644 --- a/dev-lang/rust/rust-9999.ebuild +++ b/dev-lang/rust/rust-9999.ebuild @@ -62,10 +62,15 @@ for _x in "${_ALL_RUST_EXPERIMENTAL_TARGETS[@]}"; do ALL_RUST_EXPERIMENTAL_TARGETS["llvm_targets_${_x}"]=0 done +# Bare metal targets which can be built on the host system and have no +# dependency on compiler runtime, libc and unwinder. +ALL_RUST_SYSROOTS=( bpf wasm ) +ALL_RUST_SYSROOTS=( "${ALL_RUST_SYSROOTS[@]/#/rust_sysroots_}" ) + LICENSE="|| ( MIT Apache-2.0 ) BSD BSD-1 BSD-2 BSD-4" SLOT="${PV%%_*}" # Beta releases get to share the same SLOT as the eventual stable -IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src +system-llvm test wasm ${ALL_LLVM_TARGETS[*]}" +IUSE="big-endian clippy cpu_flags_x86_sse2 debug dist doc llvm-libunwind lto rustfmt rust-analyzer rust-src system-llvm test ${ALL_LLVM_TARGETS[*]} ${ALL_RUST_SYSROOTS[*]}" if [[ ${PV} = *9999* ]]; then # These USE flags require nightly rust @@ -80,7 +85,7 @@ for _x in "${ALL_LLVM_TARGETS[@]}"; do ALL_RUST_EXPERIMENTAL_TARGETS["${_x}"]=1 fi done -LLVM_DEPEND+=( " wasm? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )" ) +LLVM_DEPEND+=( " rust_sysroots_wasm? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )" ) LLVM_DEPEND+=( " $(llvm_gen_dep 'llvm-core/llvm:${LLVM_SLOT}')" ) # dev-libs/oniguruma is used for documentation @@ -132,7 +137,8 @@ RDEPEND="${DEPEND} REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} ) rust-analyzer? ( rust-src ) test? ( ${ALL_LLVM_TARGETS[*]} ) - wasm? ( llvm_targets_WebAssembly ) + rust_sysroots_bpf? ( llvm_targets_BPF ) + rust_sysroots_wasm? ( llvm_targets_WebAssembly ) x86? ( cpu_flags_x86_sse2 ) " @@ -194,7 +200,8 @@ pre_build_checks() { M=$(( $(usex ${ltarget} 256 0) + ${M} )) done fi - M=$(( $(usex wasm 256 0) + ${M} )) + M=$(( $(usex rust_sysroots_bpf 256 0) + ${M} )) + M=$(( $(usex rust_sysroots_wasm 256 0) + ${M} )) M=$(( $(usex debug 2 1) * ${M} )) eshopts_push -s extglob if is-flagq '-g?(gdb)?([1-9])'; then @@ -355,7 +362,10 @@ src_configure() { for v in $(multilib_get_enabled_abi_pairs); do rust_targets+=",\"$(rust_abi $(get_abi_CHOST ${v##*.}))\"" done - if use wasm; then + if use rust_sysroots_bpf; then + rust_targets+=",\"bpfeb-unknown-none\",\"bpfel-unknown-none\"" + fi + if use rust_sysroots_wasm; then rust_targets+=",\"wasm32-unknown-unknown\"" if use system-llvm; then # un-hardcode rust-lld linker for this target @@ -505,14 +515,14 @@ src_configure() { omit-git-hash = false dist-src = false remap-debuginfo = true - lld = $(usex system-llvm false $(toml_usex wasm)) + lld = $(usex system-llvm false $(toml_usex rust_sysroots_wasm)) $(if use lto && tc-is-clang && ! tc-ld-is-mold; then echo "use-lld = true" fi) # only deny warnings if doc+wasm are NOT requested, documenting stage0 wasm std fails without it # https://github.com/rust-lang/rust/issues/74976 # https://github.com/rust-lang/rust/issues/76526 - deny-warnings = $(usex wasm $(usex doc false true) true) + deny-warnings = $(usex rust_sysroots_wasm $(usex doc false true) true) backtrace-on-ice = true jemalloc = false # See https://github.com/rust-lang/rust/issues/121124 @@ -552,7 +562,7 @@ src_configure() { _EOF_ fi done - if use wasm; then + if use rust_sysroots_wasm; then wasm_target="wasm32-unknown-unknown" export CFLAGS_${wasm_target//-/_}="$(filter-flags '-mcpu*' '-march*' '-mtune*'; echo "$CFLAGS")" cat <<- _EOF_ >> "${S}"/bootstrap.toml |