--- /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-06 15:32:26.228521819 +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} ) " @@ -32,7 +33,10 @@ verify-sig? ( sec-keys/openpgp-keys-rust ) " -REQUIRED_USE="x86? ( cpu_flags_x86_sse2 )" +REQUIRED_USE=" + x86? ( cpu_flags_x86_sse2 ) + abi_x86_x32? ( abi_x86_64 ) +" QA_PREBUILT=" opt/${P}/bin/.* @@ -68,7 +72,10 @@ default_src_unpack - mv "${WORKDIR}/${MY_P}-$(rust_abi)" "${S}" || die + # x32 is provided as a target for the amd64 install + if [[ "${ABI}" != x32 ]]; then + mv "${WORKDIR}/${MY_P}-$(rust_abi)" "${S}" || die + fi } patchelf_for_bin() { @@ -94,6 +101,12 @@ use clippy && components="${components},clippy-preview" use rls && components="${components},rls-preview,${analysis}" use rustfmt && components="${components},rustfmt-preview" + if use abi_x86_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" @@ -188,11 +201,13 @@ #end native abi install else - local rust_target - rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))" - 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 + if [[ "${ABI}" != x32 ]]; then + local rust_target + rust_target="$(rust_abi $(get_abi_CHOST ${v##*.}))" + 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 + fi fi # BUG: installs x86_64 binary on other arches