dev-lang/rust: Apply Flatcar patch

- Added crossdev patch
- Removed Python 3.8 support which we don't have yet
This commit is contained in:
Kai Lüke 2020-07-15 13:51:36 +02:00
parent 34c2cdcc8e
commit 54ab97589b

View File

@ -3,7 +3,7 @@
EAPI=7
PYTHON_COMPAT=( python3_{6,7,8} )
PYTHON_COMPAT=( python3_{6,7} )
inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing multilib-build python-any-r1 rust-toolchain toolchain-funcs
@ -187,6 +187,10 @@ src_configure() {
sed -i '/linker:/ s/rust-lld/wasm-ld/' src/librustc_target/spec/wasm32_base.rs || die
fi
fi
# Auto-enable cross-building only if the cross-compiler is available
if [ -f /usr/bin/aarch64-cros-linux-gnu-gcc ]; then
rust_targets="${rust_targets},\"aarch64-unknown-linux-gnu\""
fi
rust_targets="${rust_targets#,}"
local tools="\"cargo\","
@ -293,6 +297,29 @@ src_configure() {
EOF
fi
done
# Could soon be replaced by the "experimental cross support" below
if [ -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]