mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-25 15:41:04 +02:00
eclass/cargo: Sync with Gentoo
It's from Gentoo commit 33cf31d11d5c81d59cc4ae36f44eaf0886547c16.
This commit is contained in:
parent
ab3ad51fa2
commit
a837f7869e
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user