commit:     32a7e626490101308c19b10a2a3f70ca4276c493
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Sat Jun  3 06:32:53 2023 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Thu Jul 20 09:48:26 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32a7e626

rust-toolchain.eclass: add preparatory loong support

Rust 1.71.0 was already beta at time of the commit, meaning the target
tuple of loong can be considered stable.

See: https://github.com/gentoo/gentoo/pull/31241
Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 eclass/rust-toolchain.eclass | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/eclass/rust-toolchain.eclass b/eclass/rust-toolchain.eclass
index 0dcafdf9b335..f4451f743596 100644
--- a/eclass/rust-toolchain.eclass
+++ b/eclass/rust-toolchain.eclass
@@ -40,6 +40,7 @@ rust_abi() {
                armv6j*s*)    echo arm-unknown-linux-gnueabi;;
                armv7a*h*)    echo armv7-unknown-linux-gnueabihf;;
                i?86*)        echo i686-unknown-linux-gnu;;
+               loongarch64*) echo loongarch64-unknown-linux-gnu;;
                mips64el*)    echo mips64el-unknown-linux-gnuabi64;;
                mips64*)      echo mips64-unknown-linux-gnuabi64;;
                mipsel*)      echo mipsel-unknown-linux-gnu;;
@@ -139,4 +140,12 @@ rust_all_arch_uris()
        riscv? ( $(rust_arch_uri riscv64gc-unknown-linux-gnu "$@") )
        s390?  ( $(rust_arch_uri s390x-unknown-linux-gnu     "$@") )
        "
+
+       # Upstream did not gain support for loong until v1.71.0.
+       # NOTE: Merge this into the block above after every <1.71.0 version is
+       # gone from tree.
+       local arg_version="${1##*-}"
+       if ver_test "${arg_version:-$PV}" -ge 1.71.0; then
+               echo "loong? ( $(rust_arch_uri loongarch64-unknown-linux-gnu 
"$@") )"
+       fi
 }

Reply via email to