commit:     8b57b79cbeb7c24133a423620b27b60fab34d0f0
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 21 18:52:34 2024 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Feb 21 18:53:45 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b57b79c

dev-lang/go: add system-bootstrap use flag

The system-bootstrap use flag allows you to bootstrap with the installed
version of go.

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

 dev-lang/go/go-9999.ebuild | 56 +++++++++++++++++++++++++++-------------------
 dev-lang/go/metadata.xml   |  3 +++
 2 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/dev-lang/go/go-9999.ebuild b/dev-lang/go/go-9999.ebuild
index 401b23dc4e83..6b21274bfbf5 100644
--- a/dev-lang/go/go-9999.ebuild
+++ b/dev-lang/go/go-9999.ebuild
@@ -16,30 +16,32 @@ inherit toolchain-funcs
 GO_BV=1.20.14
 BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist";
 SRC_URI="
-       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 )
+       !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 )
        )
-       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 )
        )
-       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
@@ -63,7 +65,7 @@ HOMEPAGE="https://go.dev";
 
 LICENSE="BSD"
 SLOT="0/${PV}"
-IUSE="abi_mips_o32 abi_mips_n64 cpu_flags_x86_sse2 big-endian"
+IUSE="abi_mips_o32 abi_mips_n64 big-endian system-bootstrap"
 
 RDEPEND="
 arm? ( sys-devel/binutils[gold] )
@@ -171,7 +173,15 @@ src_compile() {
        use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat')
 
        export GOROOT="${PWD}"
-       export GOROOT_BOOTSTRAP="${WORKDIR}/go-${GOOS}-${GOARCH}-bootstrap"
+       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"
 

diff --git a/dev-lang/go/metadata.xml b/dev-lang/go/metadata.xml
index 5e00214a73f6..51455ddf8e9f 100644
--- a/dev-lang/go/metadata.xml
+++ b/dev-lang/go/metadata.xml
@@ -14,4 +14,7 @@
                <remote-id type="cpe">cpe:/a:golang:go</remote-id>
                <remote-id type="github">golang/go</remote-id>
        </upstream>
+       <use>
+               <flag name="system-bootstrap">Bootstrap using installed go 
compiler</flag>
+       </use>
 </pkgmetadata>

Reply via email to