dev-lang/go: update EAPI 7 -> 8

also bootstrap with go-bootstrap instead of downloading the bootstrap
binaries in this ebuild.

Signed-off-by: William Hubbs <williamh@gentoo.org>
This commit is contained in:
William Hubbs
2024-03-06 14:26:07 -06:00
parent dd1117b25b
commit c58e3dba67
+22 -56
View File
@@ -1,56 +1,24 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
EAPI=8
export CBUILD=${CBUILD:-${CHOST}}
export CTARGET=${CTARGET:-${CHOST}}
# See "Bootstrap" in release notes
GO_BOOTSTRAP_MIN=1.20.14
MY_PV=${PV/_/}
inherit toolchain-funcs
# See "Bootstrap" in release notes
# GO_BV is set to the minimum version of go required to bootstrap the
# current version.
GO_BV=1.20.14
BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist"
SRC_URI="
!system-bootstrap? (
amd64? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-amd64-bootstrap.tbz )
arm? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-arm-bootstrap.tbz )
arm64? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-arm64-bootstrap.tbz )
loong? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-loong64-bootstrap.tbz )
mips? (
abi_mips_o32? (
big-endian? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-mips-bootstrap.tbz )
!big-endian? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-mipsle-bootstrap.tbz )
)
abi_mips_n64? (
big-endian? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-mips64-bootstrap.tbz )
!big-endian? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-mips64le-bootstrap.tbz )
)
)
ppc64? (
big-endian? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-ppc64-bootstrap.tbz )
!big-endian? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-ppc64le-bootstrap.tbz )
)
riscv? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-riscv64-bootstrap.tbz )
s390? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-s390x-bootstrap.tbz )
x86? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-linux-386-bootstrap.tbz )
x64-macos? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-darwin-amd64-bootstrap.tbz )
arm64-macos? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-darwin-arm64-bootstrap.tbz )
x64-solaris? ( ${BOOTSTRAP_DIST}/go-${GO_BV}-solaris-amd64-bootstrap.tbz )
)
"
case ${PV} in
*9999*)
EGIT_REPO_URI="https://github.com/golang/go.git"
inherit git-r3
;;
*)
SRC_URI+=" https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz "
SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz "
S="${WORKDIR}"/go
case ${PV} in
*_beta*|*_rc*) ;;
@@ -65,11 +33,14 @@ HOMEPAGE="https://go.dev"
LICENSE="BSD"
SLOT="0/${PV}"
IUSE="abi_mips_o32 abi_mips_n64 big-endian system-bootstrap"
IUSE="abi_mips_o32 abi_mips_n64 cpu_flags_x86_sse2"
RDEPEND="
arm? ( sys-devel/binutils[gold] )
arm64? ( sys-devel/binutils[gold] )"
BDEPEND="|| (
>=dev-lang/go-${GO_BOOTSTRAP_MIN}
>=dev-lang/go-bootstrap-${GO_BOOTSTRAP_MIN} )"
# the *.syso files have writable/executable stacks
QA_EXECSTACK='*.syso'
@@ -154,12 +125,20 @@ PATCHES=(
"${FILESDIR}"/go-never-download-newer-toolchains.patch
)
src_unpack() {
default
[[ ${PV} == *9999* ]] && git-r3_src_unpack
}
src_compile() {
if has_version -b ">=dev-lang/go-${GO_BOOTSTRAP_MIN}"; then
export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go"
elif has_version -b ">=dev-lang/go-bootstrap-${GO_BOOTSTRAP_MIN}"; then
export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go-bootstrap"
else
eerror "Go cannot be built without go or go-bootstrap installed"
die "Should not be here, please report a bug"
fi
export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
export GOROOT="${PWD}"
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})
@@ -172,19 +151,6 @@ src_compile() {
use arm && export GOARM=$(go_arm)
use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat')
export GOROOT="${PWD}"
if use system-bootstrap; then
if has_version <dev-lang/go-${GO_BV}; then
eerror "You need at least dev-lang/go-${GO_BV} installed to bootstrap this version of go"
die "version of go is too old"
fi
export GOROOT_BOOTSTRAP="${EPREFIX}/usr/lib/go"
else
export GOROOT_BOOTSTRAP="${WORKDIR}/go-${GOOS}-${GOARCH}-bootstrap"
fi
export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
export GOBIN="${GOROOT}/bin"
cd src
bash -x ./make.bash || die "build failed"
}
@@ -211,7 +177,7 @@ src_install() {
einstalldocs
insinto /usr/lib/go
doins go.env VERSION*
doins go.env VERSION
# testdata directories are not needed on the installed system
rm -fr $(find "${ED}"/usr/lib/go -iname testdata -type d -print)