From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 416BD1581C1 for ; Tue, 16 Jul 2024 09:16:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 29C9DE2A9E; Tue, 16 Jul 2024 09:16:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1202EE2A9E for ; Tue, 16 Jul 2024 09:16:55 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5A038335DCD for ; Tue, 16 Jul 2024 09:16:54 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 45D711E35 for ; Tue, 16 Jul 2024 09:16:51 +0000 (UTC) From: "James Le Cuirot" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "James Le Cuirot" Message-ID: <1721121336.1cf828923e730d232df90a3a057777230bc7092c.chewi@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/go-env.eclass X-VCS-Directories: eclass/ X-VCS-Committer: chewi X-VCS-Committer-Name: James Le Cuirot X-VCS-Revision: 1cf828923e730d232df90a3a057777230bc7092c X-VCS-Branch: master Date: Tue, 16 Jul 2024 09:16:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 5ad56282-878f-47f7-b7e4-42c78eeb7bb7 X-Archives-Hash: fb042175d344d51a4c37ade623163f5a commit: 1cf828923e730d232df90a3a057777230bc7092c Author: James Le Cuirot gentoo org> AuthorDate: Tue Jul 9 20:28:52 2024 +0000 Commit: James Le Cuirot gentoo org> CommitDate: Tue Jul 16 09:15:36 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1cf82892 go-env.eclass: Rewrite the go-env_goarch() logic The previous logic was flawed, incomplete, and needlessly made use of USE flags. We can rely on the tuple instead. Tested against all the tuples we have in our profiles. Closes: https://bugs.gentoo.org/935414 Signed-off-by: James Le Cuirot gentoo.org> eclass/go-env.eclass | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass index c34c634bb600..c839c41be0d7 100644 --- a/eclass/go-env.eclass +++ b/eclass/go-env.eclass @@ -53,21 +53,23 @@ go-env_set_compile_environment() { # @DESCRIPTION: # Returns the appropriate GOARCH setting for the target architecture. go-env_goarch() { - # By chance most portage arch names match Go - local tc_arch=$(tc-arch $@) - case "${tc_arch}" in - x86) echo 386;; - x64-*) echo amd64;; - loong) echo loong64;; - mips) if use abi_mips_o32; then - [[ $(tc-endian $@) = big ]] && echo mips || echo mipsle - elif use abi_mips_n64; then - [[ $(tc-endian $@) = big ]] && echo mips64 || echo mips64le - fi ;; - ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;; - riscv) echo riscv64 ;; - s390) echo s390x ;; - *) echo "${tc_arch}";; + local target=${1:-${CHOST}} + # Some Portage arch names match Go. + local arch=$(tc-arch "${target}") cpu=${target%%-*} + case "${arch}" in + x86) echo 386 ;; + loong) echo loong64 ;; + *) case "${cpu}" in + aarch64*be) echo arm64be ;; + arm64) echo arm64 ;; + arm*b*) echo armbe ;; + mips64*l*) echo mips64le ;; + mips*l*) echo mipsle ;; + powerpc64le*) echo ppc64le ;; + arm64|s390x) echo "${cpu}" ;; + mips64*|riscv64*|sparc64*) echo "${arch}64" ;; + *) echo "${arch}" ;; + esac ;; esac }