--- /usr/portage/dev-lang/rust-bin/rust-bin-1.60.0.ebuild 2022-04-25 19:40:01.000000000 +0100 +++ rust-bin-1.60.0.ebuild 2022-05-03 18:43:48.844411265 +0100 @@ -12,6 +12,7 @@ DESCRIPTION="Systems programming language from Mozilla" HOMEPAGE="https://www.rust-lang.org/" SRC_URI="$(rust_all_arch_uris ${MY_P}) + abi_x86_x32? ( "${RUST_TOOLCHAIN_BASEURL%/}/2022-04-07/rust-std-${PV}-x86_64-unknown-linux-gnux32.tar.xz" ) rust-src? ( ${MY_SRC_URI} ) " @@ -68,7 +69,11 @@ default_src_unpack - mv "${WORKDIR}/${MY_P}-$(rust_abi)" "${S}" || die + if [[ "${ABI}" == x32 ]]; then + cp -p -R --reflink=auto "${WORKDIR}/${MY_P}-x86_64-unknown-linux-gnu" "${S}" || die + else + cp -p -R --reflink=auto "${WORKDIR}/${MY_P}-$(rust_abi)" "${S}" || die + fi } patchelf_for_bin() { @@ -94,6 +99,12 @@ use clippy && components="${components},clippy-preview" use rls && components="${components},rls-preview,${analysis}" use rustfmt && components="${components},rustfmt-preview" + if [[ ${ABI} == x32 ]]; then + einfo "Adding x32 target to x86-64 rust" + mv -v "${WORKDIR}/rust-std-${PV}-x86_64-unknown-linux-gnux32/rust-std-x86_64-unknown-linux-gnux32" "${S}" || die + echo rust-std-x86_64-unknown-linux-gnux32 >> ./components || die + components="${components},rust-std-x86_64-unknown-linux-gnux32" + fi # Rust component 'rust-src' is extracted from separate archive if use rust-src; then einfo "Combining rust and rust-src installers" @@ -189,7 +200,11 @@ else local rust_target - rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))" + if [[ "${ABI}" == x32 ]]; then + rust_target="$(x86_64-unknown-linux-gnu $(get_abi_CHOST ${v##*.}))" + else + rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))" + fi dodir "/opt/${P}/lib/rustlib" cp -vr "${WORKDIR}/rust-${PV}-${rust_target}/rust-std-${rust_target}/lib/rustlib/${rust_target}"\ "${ED}/opt/${P}/lib/rustlib" || die