|
22 | 22 | KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
|
23 | 23 | fi
|
24 | 24 |
|
| 25 | +# Flatcar: keep the patchlevel "0", no matter what it changes from Gentoo. |
| 26 | +# That is necessary for automatic package updates of Flatcar to work correctly. |
25 | 27 | RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0"
|
26 | 28 |
|
27 | 29 | DESCRIPTION="Systems programming language from Mozilla"
|
@@ -117,15 +119,16 @@ DEPEND="
|
117 | 119 | )
|
118 | 120 | "
|
119 | 121 |
|
| 122 | +# Flatcar: lsb-release must be removed, as it conflicts with baselayout |
| 123 | +# of Flatcar. |
120 | 124 | RDEPEND="${DEPEND}
|
121 | 125 | app-eselect/eselect-rust
|
122 |
| - sys-apps/lsb-release |
123 | 126 | "
|
124 | 127 |
|
| 128 | +# Flatcar: rust-src must be removed for keeping the SDK size minimal. |
125 | 129 | REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
|
126 | 130 | miri? ( nightly )
|
127 | 131 | parallel-compiler? ( nightly )
|
128 |
| - rust-analyzer? ( rust-src ) |
129 | 132 | test? ( ${ALL_LLVM_TARGETS[*]} )
|
130 | 133 | wasm? ( llvm_targets_WebAssembly )
|
131 | 134 | x86? ( cpu_flags_x86_sse2 )
|
@@ -324,10 +327,14 @@ src_configure() {
|
324 | 327 | sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm_base.rs || die
|
325 | 328 | fi
|
326 | 329 | fi
|
| 330 | + # Flatcar: Auto-enable cross-building only if the cross-compiler is available |
| 331 | + if [ "${CBUILD}" != "aarch64-unknown-linux-gnu" ] && [ -f /usr/bin/aarch64-cros-linux-gnu-gcc ]; then |
| 332 | + rust_targets="${rust_targets},\"aarch64-unknown-linux-gnu\"" |
| 333 | + fi |
327 | 334 | rust_targets="${rust_targets#,}"
|
328 | 335 |
|
329 |
| - # cargo and rustdoc are mandatory and should always be included |
330 |
| - local tools='"cargo","rustdoc"' |
| 336 | + # Flatcar: Remove rustdoc to keep the SDK size minimal. |
| 337 | + local tools='"cargo"' |
331 | 338 | use clippy && tools+=',"clippy"'
|
332 | 339 | use miri && tools+=',"miri"'
|
333 | 340 | use profiler && tools+=',"rust-demangler"'
|
@@ -478,6 +485,30 @@ src_configure() {
|
478 | 485 | _EOF_
|
479 | 486 | fi
|
480 | 487 | done
|
| 488 | + # Flatcar: workaround for cross-compile. Could soon be replaced |
| 489 | + # by the "experimental cross support" below |
| 490 | + if [ "${CBUILD}" != "aarch64-unknown-linux-gnu" ] && [ -f /usr/bin/aarch64-cros-linux-gnu-gcc ]; then |
| 491 | + cat <<- 'EOF' > "${S}/cc.sh" |
| 492 | + #!/bin/bash |
| 493 | + args=("$@") |
| 494 | + filtered=() |
| 495 | + for i in "${args[@]}"; do |
| 496 | + if [ "$i" != "-mindirect-branch-register" ] && [ "$i" != "-mindirect-branch=thunk" ]; then |
| 497 | + filtered+=("$i") |
| 498 | + fi |
| 499 | + done |
| 500 | + aarch64-cros-linux-gnu-gcc --sysroot=/usr/aarch64-cros-linux-gnu "${filtered[@]}" |
| 501 | + EOF |
| 502 | + sed 's/gcc/g++/g' "${S}/cc.sh" > "${S}/cxx.sh" |
| 503 | + chmod +x "${S}/cc.sh" "${S}/cxx.sh" |
| 504 | + cat <<- EOF >> "${S}"/config.toml |
| 505 | + [target.aarch64-unknown-linux-gnu] |
| 506 | + cc = "${S}/cc.sh" |
| 507 | + cxx = "${S}/cxx.sh" |
| 508 | + linker = "${S}/cc.sh" |
| 509 | + ar = "aarch64-cros-linux-gnu-ar" |
| 510 | + EOF |
| 511 | + fi |
481 | 512 | if use wasm; then
|
482 | 513 | cat <<- _EOF_ >> "${S}"/config.toml
|
483 | 514 | [target.wasm32-unknown-unknown]
|
|
0 commit comments