From 54ab97589b24fab3fd418a642c1a474374e279f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Wed, 15 Jul 2020 13:51:36 +0200 Subject: [PATCH] dev-lang/rust: Apply Flatcar patch - Added crossdev patch - Removed Python 3.8 support which we don't have yet --- .../dev-lang/rust/rust-1.44.1.ebuild | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/rust/rust-1.44.1.ebuild b/sdk_container/src/third_party/coreos-overlay/dev-lang/rust/rust-1.44.1.ebuild index b22d273aed..bce1569089 100644 --- a/sdk_container/src/third_party/coreos-overlay/dev-lang/rust/rust-1.44.1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/rust/rust-1.44.1.ebuild @@ -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]