Merge pull request #473 from flatcar-linux/coreos-overlay

Apply rust changes by pothos
This commit is contained in:
Kai Lüke 2020-07-15 18:10:01 +02:00
commit 0167e577cf

View File

@ -60,7 +60,7 @@ LLVM_MAX_SLOT=10
BOOTSTRAP_DEPEND="|| ( >=dev-lang/rust-1.$(($(ver_cut 2) - 1)) >=dev-lang/rust-bin-1.$(($(ver_cut 2) - 1)) )" BOOTSTRAP_DEPEND="|| ( >=dev-lang/rust-1.$(($(ver_cut 2) - 1)) >=dev-lang/rust-bin-1.$(($(ver_cut 2) - 1)) )"
# libgit2 should be at least same as bungled into libgit-sys #707746 # libgit2 should be at least same as bundled into libgit-sys #707746
COMMON_DEPEND=" COMMON_DEPEND="
>=dev-libs/libgit2-0.99:= >=dev-libs/libgit2-0.99:=
net-libs/libssh2:= net-libs/libssh2:=
@ -181,7 +181,13 @@ src_configure() {
done done
if use wasm; then if use wasm; then
rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" rust_targets="${rust_targets},\"wasm32-unknown-unknown\""
if use system-llvm; then
# un-hardcode rust-lld linker for this target
# https://bugs.gentoo.org/715348
sed -i '/linker:/ s/rust-lld/wasm-ld/' src/librustc_target/spec/wasm32_base.rs || die
fi fi
fi
# Auto-enable cross-building only if the cross-compiler is available
if [ -f /usr/bin/aarch64-cros-linux-gnu-gcc ]; then if [ -f /usr/bin/aarch64-cros-linux-gnu-gcc ]; then
rust_targets="${rust_targets},\"aarch64-unknown-linux-gnu\"" rust_targets="${rust_targets},\"aarch64-unknown-linux-gnu\""
fi fi
@ -291,10 +297,21 @@ src_configure() {
EOF EOF
fi fi
done done
# Could soon be replaced by the "experimental cross support" below
if [ -f /usr/bin/aarch64-cros-linux-gnu-gcc ]; then if [ -f /usr/bin/aarch64-cros-linux-gnu-gcc ]; then
printf '#!/bin/sh\naarch64-cros-linux-gnu-gcc --sysroot=/usr/aarch64-cros-linux-gnu "$@"' > ${S}/cc.sh cat <<- 'EOF' > "${S}/cc.sh"
printf '#!/bin/sh\naarch64-cros-linux-gnu-g++ --sysroot=/usr/aarch64-cros-linux-gnu "$@"' > ${S}/cxx.sh #!/bin/bash
chmod +x ${S}/cc.sh ${S}/cxx.sh 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 cat <<- EOF >> "${S}"/config.toml
[target.aarch64-unknown-linux-gnu] [target.aarch64-unknown-linux-gnu]
cc = "${S}/cc.sh" cc = "${S}/cc.sh"
@ -303,7 +320,6 @@ src_configure() {
ar = "aarch64-cros-linux-gnu-ar" ar = "aarch64-cros-linux-gnu-ar"
EOF EOF
fi fi
if use wasm; then if use wasm; then
cat <<- EOF >> "${S}"/config.toml cat <<- EOF >> "${S}"/config.toml
[target.wasm32-unknown-unknown] [target.wasm32-unknown-unknown]