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 8C9F91581C1 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 3F1C3E2AA2; 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 22DD7E2AA2 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 5FA0933FEF1 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 7183E1E37 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: <1721121360.10ce0f5c2719a2395f51952d9ad2dad9e0a79f1a.chewi@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/go/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-lang/go/go-1.22.5.ebuild dev-lang/go/go-9999.ebuild X-VCS-Directories: dev-lang/go/ X-VCS-Committer: chewi X-VCS-Committer-Name: James Le Cuirot X-VCS-Revision: 10ce0f5c2719a2395f51952d9ad2dad9e0a79f1a 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: 47729c5a-f7ae-4eb2-a6ce-3e45f67177d3 X-Archives-Hash: 079a742e6f34f0000e5331c2e54931f0 commit: 10ce0f5c2719a2395f51952d9ad2dad9e0a79f1a Author: James Le Cuirot gentoo org> AuthorDate: Tue Jul 9 20:45:46 2024 +0000 Commit: James Le Cuirot gentoo org> CommitDate: Tue Jul 16 09:16:00 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10ce0f5c dev-lang/go: Use go-env.eclass in 1.22.5 and 9999 This deduplicates some helper functions. Signed-off-by: James Le Cuirot gentoo.org> dev-lang/go/go-1.22.5.ebuild | 65 ++++++-------------------------------------- dev-lang/go/go-9999.ebuild | 65 ++++++-------------------------------------- 2 files changed, 18 insertions(+), 112 deletions(-) diff --git a/dev-lang/go/go-1.22.5.ebuild b/dev-lang/go/go-1.22.5.ebuild index fc36a2d33ae9..b16e86ae904f 100644 --- a/dev-lang/go/go-1.22.5.ebuild +++ b/dev-lang/go/go-1.22.5.ebuild @@ -10,7 +10,7 @@ export CTARGET=${CTARGET:-${CHOST}} GO_BOOTSTRAP_MIN=1.20.14 MY_PV=${PV/_/} -inherit toolchain-funcs +inherit go-env toolchain-funcs case ${PV} in *9999*) @@ -33,7 +33,7 @@ HOMEPAGE="https://go.dev" LICENSE="BSD" SLOT="0/${PV}" -IUSE="abi_mips_o32 abi_mips_n64 cpu_flags_x86_sse2" +IUSE="cpu_flags_x86_sse2" RDEPEND=" arm? ( sys-devel/binutils[gold] ) @@ -66,55 +66,8 @@ DOCS=( SECURITY.md ) -go_arch() { - # 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}";; - esac -} - -go_arm() { - case "${1:-${CHOST}}" in - armv5*) echo 5;; - armv6*) echo 6;; - armv7*) echo 7;; - *) - die "unknown GOARM for ${1:-${CHOST}}" - ;; - esac -} - -go_os() { - case "${1:-${CHOST}}" in - *-linux*) echo linux;; - *-darwin*) echo darwin;; - *-freebsd*) echo freebsd;; - *-netbsd*) echo netbsd;; - *-openbsd*) echo openbsd;; - *-solaris*) echo solaris;; - *-cygwin*|*-interix*|*-winnt*) - echo windows - ;; - *) - die "unknown GOOS for ${1:-${CHOST}}" - ;; - esac -} - go_tuple() { - echo "$(go_os $@)_$(go_arch $@)" + echo "$(go-env_goos $@)_$(go-env_goarch $@)" } go_cross_compile() { @@ -140,16 +93,16 @@ src_compile() { export GOBIN="${GOROOT}/bin" # Go's build script does not use BUILD/HOST/TARGET consistently. :( - export GOHOSTARCH=$(go_arch ${CBUILD}) - export GOHOSTOS=$(go_os ${CBUILD}) + export GOHOSTARCH=$(go-env_goarch ${CBUILD}) + export GOHOSTOS=$(go-env_goos ${CBUILD}) export CC=$(tc-getBUILD_CC) - export GOARCH=$(go_arch) - export GOOS=$(go_os) + export GOARCH=$(go-env_goarch) + export GOOS=$(go-env_goos) export CC_FOR_TARGET=$(tc-getCC) export CXX_FOR_TARGET=$(tc-getCXX) - use arm && export GOARM=$(go_arm) - use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat') + use arm && export GOARM=$(go-env_goarm) + use x86 && export GO386=$(go-env_go386) cd src bash -x ./make.bash || die "build failed" diff --git a/dev-lang/go/go-9999.ebuild b/dev-lang/go/go-9999.ebuild index fc36a2d33ae9..b16e86ae904f 100644 --- a/dev-lang/go/go-9999.ebuild +++ b/dev-lang/go/go-9999.ebuild @@ -10,7 +10,7 @@ export CTARGET=${CTARGET:-${CHOST}} GO_BOOTSTRAP_MIN=1.20.14 MY_PV=${PV/_/} -inherit toolchain-funcs +inherit go-env toolchain-funcs case ${PV} in *9999*) @@ -33,7 +33,7 @@ HOMEPAGE="https://go.dev" LICENSE="BSD" SLOT="0/${PV}" -IUSE="abi_mips_o32 abi_mips_n64 cpu_flags_x86_sse2" +IUSE="cpu_flags_x86_sse2" RDEPEND=" arm? ( sys-devel/binutils[gold] ) @@ -66,55 +66,8 @@ DOCS=( SECURITY.md ) -go_arch() { - # 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}";; - esac -} - -go_arm() { - case "${1:-${CHOST}}" in - armv5*) echo 5;; - armv6*) echo 6;; - armv7*) echo 7;; - *) - die "unknown GOARM for ${1:-${CHOST}}" - ;; - esac -} - -go_os() { - case "${1:-${CHOST}}" in - *-linux*) echo linux;; - *-darwin*) echo darwin;; - *-freebsd*) echo freebsd;; - *-netbsd*) echo netbsd;; - *-openbsd*) echo openbsd;; - *-solaris*) echo solaris;; - *-cygwin*|*-interix*|*-winnt*) - echo windows - ;; - *) - die "unknown GOOS for ${1:-${CHOST}}" - ;; - esac -} - go_tuple() { - echo "$(go_os $@)_$(go_arch $@)" + echo "$(go-env_goos $@)_$(go-env_goarch $@)" } go_cross_compile() { @@ -140,16 +93,16 @@ src_compile() { export GOBIN="${GOROOT}/bin" # Go's build script does not use BUILD/HOST/TARGET consistently. :( - export GOHOSTARCH=$(go_arch ${CBUILD}) - export GOHOSTOS=$(go_os ${CBUILD}) + export GOHOSTARCH=$(go-env_goarch ${CBUILD}) + export GOHOSTOS=$(go-env_goos ${CBUILD}) export CC=$(tc-getBUILD_CC) - export GOARCH=$(go_arch) - export GOOS=$(go_os) + export GOARCH=$(go-env_goarch) + export GOOS=$(go-env_goos) export CC_FOR_TARGET=$(tc-getCC) export CXX_FOR_TARGET=$(tc-getCXX) - use arm && export GOARM=$(go_arm) - use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat') + use arm && export GOARM=$(go-env_goarm) + use x86 && export GO386=$(go-env_go386) cd src bash -x ./make.bash || die "build failed"