mirror of
https://github.com/flatcar/scripts.git
synced 2025-10-01 10:31:37 +02:00
overlay dev-lang/rust: Apply Flatcar modifications
- Apply cross-compiling changes. - Remove dependency on sys-apps/lsb-release, which conflicts with sys-apps/baselayout of Flatcar. - Remove rust-src to keep the SDK size minimal. - Add a comment about keeping the patchlevel 0 of stage0. - Update Rust version in overlay profiles. Based on commit ec8e7e8f87108f9b6a7a47dc2f66844e172280ba
This commit is contained in:
parent
75c670ec27
commit
0cbb08719b
@ -22,6 +22,8 @@ else
|
||||
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
|
||||
fi
|
||||
|
||||
# Flatcar: keep the patchlevel "0", no matter what it changes from Gentoo.
|
||||
# That is necessary for automatic package updates of Flatcar to work correctly.
|
||||
RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0"
|
||||
|
||||
DESCRIPTION="Systems programming language from Mozilla"
|
||||
@ -117,15 +119,16 @@ DEPEND="
|
||||
)
|
||||
"
|
||||
|
||||
# Flatcar: lsb-release must be removed, as it conflicts with baselayout
|
||||
# of Flatcar.
|
||||
RDEPEND="${DEPEND}
|
||||
app-eselect/eselect-rust
|
||||
sys-apps/lsb-release
|
||||
"
|
||||
|
||||
# Flatcar: rust-src must be removed for keeping the SDK size minimal.
|
||||
REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
|
||||
miri? ( nightly )
|
||||
parallel-compiler? ( nightly )
|
||||
rust-analyzer? ( rust-src )
|
||||
test? ( ${ALL_LLVM_TARGETS[*]} )
|
||||
wasm? ( llvm_targets_WebAssembly )
|
||||
x86? ( cpu_flags_x86_sse2 )
|
||||
@ -324,10 +327,14 @@ src_configure() {
|
||||
sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm_base.rs || die
|
||||
fi
|
||||
fi
|
||||
# Flatcar: Auto-enable cross-building only if the cross-compiler is available
|
||||
if [ "${CBUILD}" != "aarch64-unknown-linux-gnu" ] && [ -f /usr/bin/aarch64-cros-linux-gnu-gcc ]; then
|
||||
rust_targets="${rust_targets},\"aarch64-unknown-linux-gnu\""
|
||||
fi
|
||||
rust_targets="${rust_targets#,}"
|
||||
|
||||
# cargo and rustdoc are mandatory and should always be included
|
||||
local tools='"cargo","rustdoc"'
|
||||
# Flatcar: Remove rustdoc to keep the SDK size minimal.
|
||||
local tools='"cargo"'
|
||||
use clippy && tools+=',"clippy"'
|
||||
use miri && tools+=',"miri"'
|
||||
use profiler && tools+=',"rust-demangler"'
|
||||
@ -478,6 +485,30 @@ src_configure() {
|
||||
_EOF_
|
||||
fi
|
||||
done
|
||||
# Flatcar: workaround for cross-compile. Could soon be replaced
|
||||
# by the "experimental cross support" below
|
||||
if [ "${CBUILD}" != "aarch64-unknown-linux-gnu" ] && [ -f /usr/bin/aarch64-cros-linux-gnu-gcc ]; then
|
||||
cat <<- 'EOF' > "${S}/cc.sh"
|
||||
#!/bin/bash
|
||||
args=("$@")
|
||||
filtered=()
|
||||
for i in "${args[@]}"; do
|
||||
if [ "$i" != "-mindirect-branch-register" ] && [ "$i" != "-mindirect-branch=thunk" ]; then
|
||||
filtered+=("$i")
|
||||
fi
|
||||
done
|
||||
aarch64-cros-linux-gnu-gcc --sysroot=/usr/aarch64-cros-linux-gnu "${filtered[@]}"
|
||||
EOF
|
||||
sed 's/gcc/g++/g' "${S}/cc.sh" > "${S}/cxx.sh"
|
||||
chmod +x "${S}/cc.sh" "${S}/cxx.sh"
|
||||
cat <<- EOF >> "${S}"/config.toml
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
cc = "${S}/cc.sh"
|
||||
cxx = "${S}/cxx.sh"
|
||||
linker = "${S}/cc.sh"
|
||||
ar = "aarch64-cros-linux-gnu-ar"
|
||||
EOF
|
||||
fi
|
||||
if use wasm; then
|
||||
cat <<- _EOF_ >> "${S}"/config.toml
|
||||
[target.wasm32-unknown-unknown]
|
||||
|
@ -45,7 +45,7 @@
|
||||
=dev-lang/python-3.11.6 ~amd64
|
||||
|
||||
# Accept unstable host Rust compilers.
|
||||
=dev-lang/rust-1.73.0 ~amd64 ~arm64
|
||||
=dev-lang/rust-1.74.1 ~amd64 ~arm64
|
||||
|
||||
# Needed by arm64-native SDK.
|
||||
=dev-lang/yasm-1.3.0-r1 ~arm64
|
||||
@ -102,4 +102,4 @@
|
||||
=sys-process/procps-4.0.4 ~amd64 ~arm64
|
||||
|
||||
# Accept unstable host Rust compilers.
|
||||
=virtual/rust-1.73.0 ~amd64 ~arm64
|
||||
=virtual/rust-1.74.1 ~amd64 ~arm64
|
||||
|
Loading…
x
Reference in New Issue
Block a user