public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/8] golang-vcs.eclass: Drop support for EAPI 6
@ 2024-07-09 21:07 James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 2/8] golang-vcs-snapshot.eclass: " James Le Cuirot
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: James Le Cuirot @ 2024-07-09 21:07 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs, James Le Cuirot

All such usage has gone.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
 eclass/golang-vcs.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/golang-vcs.eclass b/eclass/golang-vcs.eclass
index 6f7a837bc15fd..dee040505d237 100644
--- a/eclass/golang-vcs.eclass
+++ b/eclass/golang-vcs.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: golang-vcs.eclass
 # @MAINTAINER:
 # William Hubbs <williamh@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 7
 # @PROVIDES: golang-base
 # @BLURB: Eclass for fetching and unpacking go repositories.
 # @DEPRECATED: go-module.eclass
@@ -13,7 +13,7 @@
 # of software written in the Go programming language.
 
 case ${EAPI} in
-	6|7) ;;
+	7) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 2/8] golang-vcs-snapshot.eclass: Drop support for EAPI 6
  2024-07-09 21:07 [gentoo-dev] [PATCH 1/8] golang-vcs.eclass: Drop support for EAPI 6 James Le Cuirot
@ 2024-07-09 21:07 ` James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 3/8] golang-build.eclass: " James Le Cuirot
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: James Le Cuirot @ 2024-07-09 21:07 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs, James Le Cuirot

All such usage has gone.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
 eclass/golang-vcs-snapshot.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/golang-vcs-snapshot.eclass b/eclass/golang-vcs-snapshot.eclass
index d34b8a6e913da..a91ddbbe36150 100644
--- a/eclass/golang-vcs-snapshot.eclass
+++ b/eclass/golang-vcs-snapshot.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: golang-vcs-snapshot.eclass
 # @MAINTAINER:
 # William Hubbs <williamh@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 7
 # @PROVIDES: golang-base
 # @BLURB: eclass to unpack VCS snapshot tarballs for Go software
 # @DEPRECATED: go-module.eclass
@@ -45,7 +45,7 @@
 # and add the vendored tarballs to ${WORKDIR}/src/${EGO_PN}/vendor
 
 case ${EAPI} in
-	6|7) ;;
+	7) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 3/8] golang-build.eclass: Drop support for EAPI 6
  2024-07-09 21:07 [gentoo-dev] [PATCH 1/8] golang-vcs.eclass: Drop support for EAPI 6 James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 2/8] golang-vcs-snapshot.eclass: " James Le Cuirot
@ 2024-07-09 21:07 ` James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 4/8] golang-base.eclass: Drop support for EAPI 5 and 6 James Le Cuirot
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: James Le Cuirot @ 2024-07-09 21:07 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs, James Le Cuirot

All such usage has gone.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
 eclass/golang-build.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/golang-build.eclass b/eclass/golang-build.eclass
index 235313bd70f5d..b5218ce36572f 100644
--- a/eclass/golang-build.eclass
+++ b/eclass/golang-build.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: golang-build.eclass
 # @MAINTAINER:
 # William Hubbs <williamh@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 7
 # @PROVIDES: golang-base
 # @BLURB: Eclass for compiling go packages.
 # @DEPRECATED: go-module.eclass
@@ -13,7 +13,7 @@
 # functions for software written in the Go programming language.
 
 case ${EAPI} in
-	6|7) ;;
+	7) ;;
 	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 4/8] golang-base.eclass: Drop support for EAPI 5 and 6
  2024-07-09 21:07 [gentoo-dev] [PATCH 1/8] golang-vcs.eclass: Drop support for EAPI 6 James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 2/8] golang-vcs-snapshot.eclass: " James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 3/8] golang-build.eclass: " James Le Cuirot
@ 2024-07-09 21:07 ` James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 5/8] go-env.eclass: Establish EAPI 7 and 8 as supported James Le Cuirot
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: James Le Cuirot @ 2024-07-09 21:07 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs, James Le Cuirot

All such usage has gone.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
 eclass/golang-base.eclass | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/eclass/golang-base.eclass b/eclass/golang-base.eclass
index 4bba00200cfc9..a2996e3b06836 100644
--- a/eclass/golang-base.eclass
+++ b/eclass/golang-base.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: golang-base.eclass
 # @MAINTAINER:
 # William Hubbs <williamh@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 7
 # @BLURB: Eclass that provides base functions for Go packages.
 # @DEPRECATED: go-module.eclass
 # @DESCRIPTION:
@@ -12,12 +12,9 @@
 # programming language; it also provides the build-time dependency on
 # dev-lang/go.
 
-case "${EAPI:-0}" in
-	5|6|7)
-		;;
-	*)
-		die "${ECLASS}: Unsupported EAPI (EAPI=${EAPI})"
-		;;
+case ${EAPI} in
+	7) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ -z ${_GOLANG_BASE} ]]; then
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 5/8] go-env.eclass: Establish EAPI 7 and 8 as supported
  2024-07-09 21:07 [gentoo-dev] [PATCH 1/8] golang-vcs.eclass: Drop support for EAPI 6 James Le Cuirot
                   ` (2 preceding siblings ...)
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 4/8] golang-base.eclass: Drop support for EAPI 5 and 6 James Le Cuirot
@ 2024-07-09 21:07 ` James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 6/8] go-env.eclass: Rewrite the go-env_goarch() logic James Le Cuirot
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: James Le Cuirot @ 2024-07-09 21:07 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs, James Le Cuirot

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
 eclass/go-env.eclass | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass
index 1a2c9787a146b..c34c634bb6003 100644
--- a/eclass/go-env.eclass
+++ b/eclass/go-env.eclass
@@ -6,11 +6,17 @@
 # Flatcar Linux Maintainers <infra@flatcar-linux.org>
 # @AUTHOR:
 # Flatcar Linux Maintainers <infra@flatcar-linux.org>
+# @SUPPORTED_EAPIS: 7 8
 # @BLURB: Helper eclass for setting the Go compile environment. Required for cross-compiling.
 # @DESCRIPTION:
 # This eclass includes helper functions for setting the compile environment for Go ebuilds.
 # Intended to be called by other Go eclasses in an early build stage, e.g. src_unpack.
 
+case ${EAPI} in
+	7|8) ;;
+	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
 if [[ -z ${_GO_ENV_ECLASS} ]]; then
 _GO_ENV_ECLASS=1
 
@@ -34,14 +40,7 @@ go-env_set_compile_environment() {
 	use x86 && export GO386=$(go-env_go386)
 
 	# XXX: Hack for checking ICE (bug #912152, gcc PR113204)
-	case ${EAPI} in
-		6)
-			has_version "sys-devel/gcc[debug]" && filter-lto
-			;;
-		*)
-			has_version -b "sys-devel/gcc[debug]" && filter-lto
-			;;
-	esac
+	has_version -b "sys-devel/gcc[debug]" && filter-lto
 
 	export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}"
 	export CGO_CPPFLAGS="${CGO_CPPFLAGS:-$CPPFLAGS}"
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 6/8] go-env.eclass: Rewrite the go-env_goarch() logic
  2024-07-09 21:07 [gentoo-dev] [PATCH 1/8] golang-vcs.eclass: Drop support for EAPI 6 James Le Cuirot
                   ` (3 preceding siblings ...)
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 5/8] go-env.eclass: Establish EAPI 7 and 8 as supported James Le Cuirot
@ 2024-07-09 21:07 ` James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 7/8] go-env.eclass: Add the go-env_goos() helper function James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 8/8] dev-lang/go: Use go-env.eclass in 1.22.5 and 9999 James Le Cuirot
  6 siblings, 0 replies; 8+ messages in thread
From: James Le Cuirot @ 2024-07-09 21:07 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs, James Le Cuirot

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.

Signed-off-by: James Le Cuirot <chewi@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 c34c634bb6003..c839c41be0d7e 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
 }
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 7/8] go-env.eclass: Add the go-env_goos() helper function
  2024-07-09 21:07 [gentoo-dev] [PATCH 1/8] golang-vcs.eclass: Drop support for EAPI 6 James Le Cuirot
                   ` (4 preceding siblings ...)
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 6/8] go-env.eclass: Rewrite the go-env_goarch() logic James Le Cuirot
@ 2024-07-09 21:07 ` James Le Cuirot
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 8/8] dev-lang/go: Use go-env.eclass in 1.22.5 and 9999 James Le Cuirot
  6 siblings, 0 replies; 8+ messages in thread
From: James Le Cuirot @ 2024-07-09 21:07 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs, James Le Cuirot

This code is taken from dev-lang/go. No other packages have code like
this, but some erroneously call `go env GOOS`, which is bad for
cross-compiling. They should use this function instead.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
---
 eclass/go-env.eclass | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass
index c839c41be0d7e..be131133113be 100644
--- a/eclass/go-env.eclass
+++ b/eclass/go-env.eclass
@@ -48,6 +48,24 @@ go-env_set_compile_environment() {
 	export CGO_LDFLAGS="${CGO_LDFLAGS:-$LDFLAGS}"
 }
 
+# @FUNCTION: go-env_goos
+# @USAGE: [toolchain prefix]
+# @DESCRIPTION:
+# Returns the appropriate GOOS setting for the target operating system.
+go-env_goos() {
+	local target=${1:-${CHOST}}
+	case "${target}" 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 ${target}" ;;
+	esac
+}
+
 # @FUNCTION: go-env_goarch
 # @USAGE: [toolchain prefix]
 # @DESCRIPTION:
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-dev] [PATCH 8/8] dev-lang/go: Use go-env.eclass in 1.22.5 and 9999
  2024-07-09 21:07 [gentoo-dev] [PATCH 1/8] golang-vcs.eclass: Drop support for EAPI 6 James Le Cuirot
                   ` (5 preceding siblings ...)
  2024-07-09 21:07 ` [gentoo-dev] [PATCH 7/8] go-env.eclass: Add the go-env_goos() helper function James Le Cuirot
@ 2024-07-09 21:07 ` James Le Cuirot
  6 siblings, 0 replies; 8+ messages in thread
From: James Le Cuirot @ 2024-07-09 21:07 UTC (permalink / raw
  To: gentoo-dev; +Cc: William Hubbs, James Le Cuirot

This deduplicates some helper functions.

Signed-off-by: James Le Cuirot <chewi@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 fc36a2d33ae98..b16e86ae904f0 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 fc36a2d33ae98..b16e86ae904f0 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"
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-07-09 21:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-09 21:07 [gentoo-dev] [PATCH 1/8] golang-vcs.eclass: Drop support for EAPI 6 James Le Cuirot
2024-07-09 21:07 ` [gentoo-dev] [PATCH 2/8] golang-vcs-snapshot.eclass: " James Le Cuirot
2024-07-09 21:07 ` [gentoo-dev] [PATCH 3/8] golang-build.eclass: " James Le Cuirot
2024-07-09 21:07 ` [gentoo-dev] [PATCH 4/8] golang-base.eclass: Drop support for EAPI 5 and 6 James Le Cuirot
2024-07-09 21:07 ` [gentoo-dev] [PATCH 5/8] go-env.eclass: Establish EAPI 7 and 8 as supported James Le Cuirot
2024-07-09 21:07 ` [gentoo-dev] [PATCH 6/8] go-env.eclass: Rewrite the go-env_goarch() logic James Le Cuirot
2024-07-09 21:07 ` [gentoo-dev] [PATCH 7/8] go-env.eclass: Add the go-env_goos() helper function James Le Cuirot
2024-07-09 21:07 ` [gentoo-dev] [PATCH 8/8] dev-lang/go: Use go-env.eclass in 1.22.5 and 9999 James Le Cuirot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox