commit:     7d13afbc883539b4f9fffc7d6f115b4aea591b4e
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 17 18:05:36 2024 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Feb 17 18:11:18 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d13afbc

dev-lang/go: simplify bootstrapping

This changes the live ebuild to download the appropriate bootstrap
tarball directly instead of using the dev-lang/go-bootstrap package.

Signed-off-by: William Hubbs <williamh <AT> gentoo.org>

 dev-lang/go/Manifest       | 16 +++++++++++
 dev-lang/go/go-9999.ebuild | 72 ++++++++++++++++++++++++++++++----------------
 2 files changed, 64 insertions(+), 24 deletions(-)

diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
index a32d5d91aeb1..942c066488b4 100644
--- a/dev-lang/go/Manifest
+++ b/dev-lang/go/Manifest
@@ -1,3 +1,19 @@
+DIST go-1.20.14-darwin-amd64-bootstrap.tbz 94549781 BLAKE2B 
604d6b183b6be19f98f330a73fd07db1824442b14c3870447340e628b3fd13c87972d9a192f888e329b1d0337a48d66651f35c0237e4a5a609091e73385925d7
 SHA512 
ef2b179a096319dca8cd3907ad7c9d80bc61d409ce198a323073fbceb3b6ab3f5752eaeeb8f37f9287ba1c009f5e37da341e359228d0509ab766340f61a10c68
+DIST go-1.20.14-darwin-arm64-bootstrap.tbz 92159553 BLAKE2B 
28a95dafd3126e95fd997744ca20385bf634c3bc08be5698bc314c8e902e261d66ebae754492997562ba3bd2635f68ad8173cbd84aa6e59bcf38fe0c2cd35a65
 SHA512 
1f39a132037f9b1141cac752c20c34da0f87583dba9094965ffb7f65015d3d5273a1b63201e1f68e00d436aa1b1d79972f6f50a195a3d5799f012fb3fbaa20b6
+DIST go-1.20.14-linux-386-bootstrap.tbz 96003553 BLAKE2B 
c3a07e7dd840387281b065aebd216fa0cdd1c2e7bc71cce63f4a0fd7fa2ce1848f2b3b91c2506bea1a5b747ca7eece9aff08fe67dcf6b63f8afcc4a92e382f6b
 SHA512 
236423e5b65078afd7a44f83f91f0b2bf11c78871d01adce942651ec24d02ae96021dfdb00640034dff9b43c636b1975402b68955bf6572c680dfbbb9bdb266e
+DIST go-1.20.14-linux-amd64-bootstrap.tbz 95467194 BLAKE2B 
d0d016a1f6334db056342432f401edf17c9ea0032ed13f3a1ab127b4697fcc18e471cd133ed306ccd98d62779bc2d0304a97a7100f91c566ca064237dab109d0
 SHA512 
638103faca6d913a8b774a00b1846e746c1f6272f1d3d0343942e81886aee84b6a8b10befab5d1e9e9ad7c3f1a3cbf72a2ff223fd236c21a6ef05ed63ae4c495
+DIST go-1.20.14-linux-arm-bootstrap.tbz 92749037 BLAKE2B 
4a58c00132c84510cff0cbca9ed910b565220dfd2f7ef2080b40b3bb35f94b1d3d05e36e964ebf715261c13b38763be0c4df1ac8675f7bd27e9f087a710236b5
 SHA512 
94aa1264ac11243959d2768e67d29e405ec1a63daef3efdea695950fcbacb0e5bfad68eae71e5bca31e74415fc8fce90de2de9ac440e67921221a1b166cf9b23
+DIST go-1.20.14-linux-arm64-bootstrap.tbz 90313482 BLAKE2B 
839f7e2a30944c622cdd3ebbcda8cbbaff6070b0c6bff3c2cdb5429f65df5cd830ed211d05df81d5f25c798e8d113d6bfe605e12b25f271ab35f9a7e98e6a95e
 SHA512 
b7336febe2f687c8b91a885885a5f85e9a25333120fec38c08b96e115cbd1f66bd054d8c8a69891c210f60609828dc8cd9d188ac06d98d97fcec75730c97b5c9
+DIST go-1.20.14-linux-loong64-bootstrap.tbz 91910305 BLAKE2B 
e470bed6fdcae3e5baf9e8079bfaa211814cee00a9bebf2bfef24a27e249b2b2251b1400389b5844ed1f7631a4d8306b358bdf43f92bc96c2d071e79949b4e26
 SHA512 
2c878541d02cadd7cbe66647ef1cbec2ef1c9b43c4798adfd8cdf3ad800c6cc2bd2c702af221e133fa03099029e740362c9f490b1ace6c530462b27d73fb9d50
+DIST go-1.20.14-linux-mips-bootstrap.tbz 89723945 BLAKE2B 
c3ac0d9de529f4d033cf3942726124013f9772aa62174d185e1883e359bc195aca531170a4ba25c40de8d5b8c74d7553b461aabeeca31f76737d38fe86d7ca9a
 SHA512 
461b043acece310ac3c4750086092d4ba6e56c5dcfa2eef1e2d626e8f4d18796dc8d13e9d4e36a2bea500422c7b6aeba863a0da74305ad7952cf2d05fd371c8b
+DIST go-1.20.14-linux-mips64-bootstrap.tbz 90162590 BLAKE2B 
f3fc550a6f2b05dd99fcb1a2437a3c2a4db7d13d434bad9478c400449286a78ea8f824fc40ba2e7e88646d9220ae0508ca57f2cad277b0fcc444d20e0ec8f594
 SHA512 
046baa51362abfa0865fea437d4b80e90b113387d2603661d1ca96c819237b459d3fc50d69acfc0b41b906baed56da031801ec913e55baf0db389ddf10d93d3b
+DIST go-1.20.14-linux-mips64le-bootstrap.tbz 89241603 BLAKE2B 
1708a4d82376ea34dc3c569b2b44e34cb0a6698a4bfb1c04da89da6c2b660e93372926c4d88ca9cc8185c2b5949265779038882b84ff9ea99ddbb709cf7dac91
 SHA512 
ce95ca20b66bea1f4faa2edede7082858689cb50d5579225c635ba7987db7d0627453ae06eb141678cc46720d0bc050ae87d4fc3fbbbaaa16f4db7fd0234b6d2
+DIST go-1.20.14-linux-mipsle-bootstrap.tbz 89478289 BLAKE2B 
e09bf90783a11dda0ed81a2a1f8998bd7ea6ef4c7dc06e0e1abfc885a4cf0622bf40ae9d74d2bb3683ecb96b9a93a3064a8783a609cd88ef3f319af6332bf52d
 SHA512 
5246e8da2fe58053bbdfa861d527b119227eacd055a7e69ffbb1e5c3dd2f477a286951c0577632c492f34ffc3ef4c015b1b7affdf5cca03b22bb0ef1ddea52de
+DIST go-1.20.14-linux-ppc64-bootstrap.tbz 91456774 BLAKE2B 
b4a7ca37f7bfe4c13dbfcb94cbd0521e924ba322eb49a49c6934dbb3b00c7f4929828dde3f18e1c26421c684f4a63bcf7f0834a30d58918b53fd13fc908860ee
 SHA512 
28d9c6b33ab7f72f840fd06b0219845638c3df50b7741152f303288a3b4ab55e7bdb083dbd668e95563e459950e4e89ae9edf7ad604687afe5247781330e2fb1
+DIST go-1.20.14-linux-ppc64le-bootstrap.tbz 90575770 BLAKE2B 
0c76ba27d41d329a7c58ae5c2c168e021a4fbb01800cdc7e61baf50de57b146578aef123755b09df5a4aa405452e2b3cc9ff1960cdc34c3a38442691e7cd0422
 SHA512 
d3ecb191f73f157a09252c50ffb8249040bfb4ba39dc0a462c992830eba3eeadb18b7851410a1f9f2d6d362ee37fcb210c815d7b01cc632e10d962cb2c2769e9
+DIST go-1.20.14-linux-riscv64-bootstrap.tbz 93091456 BLAKE2B 
197811a57c728ef546b9660328ab6624b87ae085e98264e5b3317fc66581fc0ee8ef95af3040c07a6cebfe30da88d209bf5bdb8ee11a647b716fa3122031724a
 SHA512 
a3faaeaac90354a9be130d01108c8fdb178a0427d7dab0362c570428216ddd362f55044021082cbbb466f3a69458869d4978bd28652f7a4e55295d357c9c7c54
+DIST go-1.20.14-linux-s390x-bootstrap.tbz 94671247 BLAKE2B 
7ff60a7c1245b66cbe852662589fe3a87c4fc29a1134dd46ad76272b9bc619b7ffba823374658a0f8d54a440d808d3eb8d97788483bbe69628bda167f4377109
 SHA512 
bc6c7efddfcc90fe2f1bbb2dee7f4396eb5b478eee7236216ca00c5bd4ce1dc0e3315edb58bf6ef3f7a7e5c45950e6f5be9163cfffd1cf5c36004aaa4916a1b7
+DIST go-1.20.14-solaris-amd64-bootstrap.tbz 95085901 BLAKE2B 
aed378201db555121bae1ab049d44b297dc922d7cd977c3d6f2dbff1b3cc46f59a697a211c244ed2f012d5c8ea6211501527512325188e34a3ccd2946ef6dbe8
 SHA512 
22a8b79ab2eb08319d1d9fb517458cdafd1a4fcbba2da70935d65ccdcc3808978ca0dbb045a7cfde2ca43eb6effd3ce687d2f99ee24dedcae9967b414fd6fe57
 DIST go1.20.12.src.tar.gz 26200362 BLAKE2B 
f33dc8c1ce565443c2cd975db493998bf921eb9734b5e58f7200d6ddfd9c076cabcab105cb3d335c2dabff6a3d01a6fa52e597357e8bd616c8a7462aa5fb89d7
 SHA512 
3f4d1a22a0f1dd7e8feb008517e43b32c3600ce77168e5edfb75b4060577362ae62f28c9891de0f7bf553407bd8e09efc1563d34ee8af5285b3c80b3946f4b65
 DIST go1.20.13.src.tar.gz 26287815 BLAKE2B 
fbcb52039785d4d030d626768dee914e4c27e0be942740230618589708721246e8708f198e04812cfc41165cec49bbb0e92d380b4bff39924fe8f99fea736a40
 SHA512 
87cf8c5e201526c3f44a6b1845a7de3f8a02d054f8689d10c84d5da0d286390b54dc23fc22f82e050d792e1d10c69049691a0d46b198b3fdd2e80087b38f5f06
 DIST go1.21.5.src.tar.gz 26986890 BLAKE2B 
a57550a3f586060d8efa93b6c8d9bf3f87d791ebf66767c9a3344983111aa14ed88c71fe44aabe79b64dcdad85426de647eaf5845d9a5cac082b42969f9a27cb
 SHA512 
c064b7cb3c47d8fb99fc181a3cddf327a4b7a8c6af39a8ac568e9d74cd44903141680903ca48673bb02a7a159cce4f32a94f3b37fc65a9549d3518ad7c731fa3

diff --git a/dev-lang/go/go-9999.ebuild b/dev-lang/go/go-9999.ebuild
index 688f241e0106..8228ba2c0140 100644
--- a/dev-lang/go/go-9999.ebuild
+++ b/dev-lang/go/go-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -6,19 +6,49 @@ EAPI=7
 export CBUILD=${CBUILD:-${CHOST}}
 export CTARGET=${CTARGET:-${CHOST}}
 
-# See "Bootstrap" in release notes
-GO_BOOTSTRAP_MIN=1.17.13
 MY_PV=${PV/_/}
 
 inherit toolchain-funcs
 
+# See "Bootstrap" in release notes
+# BV is set to the minimum version of go required to bootstrap the
+# current version.
+BV=1.20.14
+BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist";
+SRC_URI="
+       amd64? ( ${BOOTSTRAP_DIST}/go-${BV}-linux-amd64-bootstrap.tbz )
+       arm? ( ${BOOTSTRAP_DIST}/go-${BV}-linux-arm-bootstrap.tbz )
+       arm64? ( ${BOOTSTRAP_DIST}/go-${BV}-linux-arm64-bootstrap.tbz )
+       loong? ( ${BOOTSTRAP_DIST}/go-${BV}-linux-loong64-bootstrap.tbz )
+       mips? (
+               abi_mips_o32? (
+                       big-endian? ( 
${BOOTSTRAP_DIST}/go-${BV}-linux-mips-bootstrap.tbz )
+                       !big-endian? ( 
${BOOTSTRAP_DIST}/go-${BV}-linux-mipsle-bootstrap.tbz )
+               )
+               abi_mips_n64? (
+                       big-endian? ( 
${BOOTSTRAP_DIST}/go-${BV}-linux-mips64-bootstrap.tbz )
+                       !big-endian? ( 
${BOOTSTRAP_DIST}/go-${BV}-linux-mips64le-bootstrap.tbz )
+               )
+       )
+       ppc64? (
+               big-endian? ( 
${BOOTSTRAP_DIST}/go-${BV}-linux-ppc64-bootstrap.tbz )
+               !big-endian? ( 
${BOOTSTRAP_DIST}/go-${BV}-linux-ppc64le-bootstrap.tbz )
+       )
+       riscv? ( ${BOOTSTRAP_DIST}/go-${BV}-linux-riscv64-bootstrap.tbz )
+       s390? ( ${BOOTSTRAP_DIST}/go-${BV}-linux-s390x-bootstrap.tbz )
+       x86? ( ${BOOTSTRAP_DIST}/go-${BV}-linux-386-bootstrap.tbz )
+       x64-macos? ( ${BOOTSTRAP_DIST}/go-${BV}-darwin-amd64-bootstrap.tbz )
+       arm64-macos? ( ${BOOTSTRAP_DIST}/go-${BV}-darwin-arm64-bootstrap.tbz )
+       x64-solaris? ( ${BOOTSTRAP_DIST}/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*) ;;
@@ -33,14 +63,11 @@ HOMEPAGE="https://go.dev";
 
 LICENSE="BSD"
 SLOT="0/${PV}"
-IUSE="abi_mips_o32 abi_mips_n64 cpu_flags_x86_sse2"
+IUSE="abi_mips_o32 abi_mips_n64 cpu_flags_x86_sse2 big-endian"
 
 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'
@@ -57,7 +84,7 @@ QA_PREBUILT='.*'
 
 # Do not strip this package. Stripping is unsupported upstream and may
 # fail.
-RESTRICT+=" strip"
+RESTRICT=" strip"
 
 DOCS=(
        CONTRIBUTING.md
@@ -125,20 +152,12 @@ PATCHES=(
        "${FILESDIR}"/go-never-download-newer-toolchains.patch
 )
 
-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"
+src_unpack() {
+       default
+       [[ ${PV} == *9999* ]] && git-r3_src_unpack
+}
 
+src_compile() {
        # Go's build script does not use BUILD/HOST/TARGET consistently. :(
        export GOHOSTARCH=$(go_arch ${CBUILD})
        export GOHOSTOS=$(go_os ${CBUILD})
@@ -151,6 +170,11 @@ src_compile() {
        use arm && export GOARM=$(go_arm)
        use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat')
 
+       export GOROOT="${PWD}"
+       export GOROOT_BOOTSTRAP="${WORKDIR}/go-${GOOS}-${GOARCH}-bootstrap"
+       export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
+       export GOBIN="${GOROOT}/bin"
+
        cd src
        bash -x ./make.bash || die "build failed"
 }
@@ -161,7 +185,7 @@ src_test() {
        cd src
 
        # https://github.com/golang/go/issues/42005
-       rm cmd/link/internal/ld/fallocate_test.go || true
+       rm cmd/link/internal/ld/fallocate_test.go || die
 
        PATH="${GOBIN}:${PATH}" \
        ./run.bash -no-rebuild -k || die "tests failed"
@@ -177,7 +201,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)

Reply via email to