summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2025-03-09 01:48:35 +0000
committerV3n3RiX <venerix@koprulu.sector>2025-03-09 01:48:35 +0000
commit0b832a429ecd6081aa9faa0eb262303b019d87ea (patch)
treec39bb9eaa7bc30cec17f3a3bdef0cf5ed27c6a75 /eclass
parent80e87db4d9ed551615eb2d0309bf370e79500716 (diff)
gentoo auto-resync : 09:03:2025 - 01:48:35
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin40195 -> 40187 bytes
-rw-r--r--eclass/cargo.eclass11
-rw-r--r--eclass/rust.eclass36
-rw-r--r--eclass/toolchain.eclass2
4 files changed, 33 insertions, 16 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index 745cf0bcddd8..a35968ff91d3 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index 25a2127f6391..dae2b93f24f3 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -181,7 +181,7 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
# functions will be exported.
#
# If you enable CARGO_OPTIONAL call at least cargo_gen_config manually
-# before using other src_functions or cargo_env of this eclass.
+# before using other src_* functions or cargo_env of this eclass.
# Note that cargo_gen_config is automatically called by cargo_src_unpack.
# @ECLASS_VARIABLE: myfeatures
@@ -745,10 +745,15 @@ cargo_env() {
# The default linker is "cc" so override by setting linker to CC in the
# RUSTFLAGS. The given linker cannot include any arguments, so split these
# into link-args along with LDFLAGS.
+ #
+ # Rust defaults to static linking (-C target-feature=+crt-static) on musl
+ # targets. We already patch dev-lang/rust to always prefer dynamic linking,
+ # but to ensure that behavior with dev-lang/rust-bin, set the opposite option
+ # (-C target-feature=-crt-static) in RUSTFLAGS.
local -x CARGO_BUILD_TARGET=$(rust_abi)
local TRIPLE=${CARGO_BUILD_TARGET//-/_}
local TRIPLE=${TRIPLE^^} LD_A=( $(tc-getCC) ${LDFLAGS} )
- local -Ix CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS+=" -C strip=none -C linker=${LD_A[0]}"
+ local -Ix CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS+=" -C strip=none -C linker=${LD_A[0]} -C target-feature=-crt-static"
[[ ${#LD_A[@]} -gt 1 ]] && local CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS+="$(printf -- ' -C link-arg=%s' "${LD_A[@]:1}")"
local CARGO_TARGET_"${TRIPLE}"_RUSTFLAGS+=" ${RUSTFLAGS}"
@@ -779,7 +784,7 @@ cargo_src_compile() {
# @FUNCTION: cargo_src_install
# @DESCRIPTION:
# Installs the binaries generated by cargo.
-# In come cases workspaces need an alternative --path parameter.
+# In some cases workspaces need an alternative --path parameter.
# Defaults to '--path ./' if no path is specified.
# '--path ./somedir' can be passed directly to cargo_src_install.
cargo_src_install() {
diff --git a/eclass/rust.eclass b/eclass/rust.eclass
index 9ead9d005706..41197ce4e3a3 100644
--- a/eclass/rust.eclass
+++ b/eclass/rust.eclass
@@ -12,12 +12,12 @@
# An eclass to reliably depend on a Rust or Rust/LLVM combination for
# a given Rust slot. To use the eclass:
#
-# 1. If required, set RUST_{MAX,MIN}_SLOT to the range of supported slots.
+# 1. If required, set RUST_{MAX,MIN}_VER to the range of supported slots.
#
# 2. If rust is optional, set RUST_OPTIONAL to a non-empty value then
-# appropriately gate ${RUST_DEPEND}
+# appropriately gate ${RUST_DEPEND}.
#
-# 3. Use rust_pkg_setup, get_rust_prefix or RUST_SLOT.
+# 3. Use rust_pkg_setup, get_rust_prefix, or RUST_SLOT.
# Example use for a package supporting Rust 1.72.0 to 1.82.0:
# @CODE
@@ -116,7 +116,7 @@ declare -a -g -r _RUST_SLOTS_ORDERED=(
# @USER_VARIABLE
# @DESCRIPTION:
# Specify the version (slot) of Rust to be used by the package. This is
-# useful for troubleshooting and debugging purposes; If unset, the newest
+# useful for troubleshooting and debugging purposes. If unset, the newest
# acceptable Rust version will be used. May be combined with ERUST_TYPE_OVERRIDE.
# This variable must not be set in ebuilds.
@@ -144,6 +144,18 @@ declare -a -g -r _RUST_SLOTS_ORDERED=(
# Lowest Rust slot supported by the package. Needs to be set before
# rust_pkg_setup is called. If unset, no lower bound is assumed.
+# @ECLASS_VARIABLE: RUST_SLOT
+# @OUTPUT_VARIABLE
+# @DESCRIPTION:
+# The selected Rust slot for building, from the range defined by
+# RUST_MAX_VER and RUST_MIN_VER. This is set by rust_pkg_setup.
+
+# @ECLASS_VARIABLE: RUST_TYPE
+# @OUTPUT_VARIABLE
+# @DESCRIPTION:
+# The selected Rust type for building, either 'source' or 'binary'.
+# This is set by rust_pkg_setup.
+
# @ECLASS_VARIABLE: RUST_NEEDS_LLVM
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -175,7 +187,7 @@ declare -a -g -r _RUST_SLOTS_ORDERED=(
# @DEFAULT_UNSET
# @DESCRIPTION:
# If set to a non-empty value, the Rust dependency will not be added
-# to BDEPEND. This is useful for where packages need to gate rust behind
+# to BDEPEND. This is useful for packages that need to gate rust behind
# certain USE themselves.
# @ECLASS_VARIABLE: RUST_REQ_USE
@@ -303,12 +315,12 @@ unset -f _rust_set_globals
# If -d is specified, the checks are performed relative to ESYSROOT,
# and ESYSROOT-path is returned.
#
-# If RUST_M{AX,IN}_SLOT is non-zero, then only Rust versions that
+# If RUST_M{AX,IN}_VER is non-zero, then only Rust versions that
# are not newer or older than the specified slot(s) will be considered.
-# Otherwise, all Rust versions are be considered acceptable.
+# Otherwise, all Rust versions are considered acceptable.
#
# If the `rust_check_deps()` function is defined within the ebuild, it
-# will be called to verify whether a particular slot is accepable.
+# will be called to verify whether a particular slot is acceptable.
# Within the function scope, RUST_SLOT and LLVM_SLOT will be defined.
#
# The function should return a true status if the slot is acceptable,
@@ -443,7 +455,7 @@ _get_rust_slot() {
# @FUNCTION: get_rust_path
# @USAGE: prefix slot rust_type
# @DESCRIPTION:
-# Given argument of slot and rust_type, return an appropriate path
+# Given arguments of prefix, slot, and rust_type, return an appropriate path
# for the Rust install. The rust_type should be either "source"
# or "binary". If the rust_type is not one of these, the function
# will die.
@@ -472,7 +484,7 @@ get_rust_path() {
# and print an absolute path to it. If both -bin and regular Rust
# are installed, the regular Rust is preferred.
#
-# The options and behavior are the same as get_rust_slot.
+# The options and behavior are the same as _get_rust_slot.
get_rust_prefix() {
debug-print-function ${FUNCNAME} "$@"
@@ -501,10 +513,10 @@ rust_prepend_path() {
# `llvm-r1_pkg_setup` call should be made in addition to this function.
# For path determination logic, please see the get_rust_prefix documentation.
#
-# The highest acceptable Rust slot can be set in RUST_MAX_VER variable.
+# The highest acceptable Rust slot can be set in the RUST_MAX_VER variable.
# If it is unset or empty, any slot is acceptable.
#
-# The lowest acceptable Rust slot can be set in RUST_MIN_VER variable.
+# The lowest acceptable Rust slot can be set in the RUST_MIN_VER variable.
# If it is unset or empty, any slot is acceptable.
#
# `CARGO` and `RUSTC` variables are set for the selected slot and exported.
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 693a356d54a8..5cffbd7428ca 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2104,7 +2104,7 @@ gcc_do_filter_flags() {
# https://gcc.gnu.org/PR100431
filter-flags -Werror=format-security
- if ver_test -lt 10.1 ; then
+ if ver_test -lt 11.1 ; then
filter-flags '-fdiagnostics-urls=*'
filter-flags '-Wstringop-overread'
fi