commit: 167c53006749b6bbf952c80af0e0b5a7d31eca32 Author: William Hubbs <williamh <AT> gentoo <DOT> org> AuthorDate: Mon Apr 29 16:24:04 2019 +0000 Commit: William Hubbs <williamh <AT> gentoo <DOT> org> CommitDate: Mon Apr 29 16:30:30 2019 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=167c5300
dev-lang/go: add system-bootstrap use flag If a previous version of dev-lang/go is installed, you can use this use flag to skip downloading the bootstrap archives and bootstrap the new version using the already-installed version. For the initial installation of dev-lang/go, we have to download all of the bootstrap archives to make the go ebuild work under crossdev. For this reason, system-bootstrap cannot be turned on by default. Bug: https://bugs.gentoo.org/671394 closes: https://bugs.gentoo.org/684652 Copyright: Sony Interactive Entertainment Inc. Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: William Hubbs <williamh <AT> gentoo.org> dev-lang/go/go-1.11.9.ebuild | 19 ++++++++++++------- dev-lang/go/go-1.12.4.ebuild | 19 ++++++++++++------- dev-lang/go/metadata.xml | 7 ++++++- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/dev-lang/go/go-1.11.9.ebuild b/dev-lang/go/go-1.11.9.ebuild index 8fafeb455ba..a53df7c0956 100644 --- a/dev-lang/go/go-1.11.9.ebuild +++ b/dev-lang/go/go-1.11.9.ebuild @@ -48,20 +48,20 @@ case ${PV} in esac esac -# If gccgo is not being used to build Go, there is no way to know the -# architecture or operating system of the build machine, so we need to -# download all of our bootstrap archives to allow this ebuild to work -# under crossdev. +# If gccgo or a previously installed version of dev-lang/go is not being +# used to build Go, there is no way to know the architecture or operating system +# of the build machine, so we need to download all of our bootstrap +# archives to allow this ebuild to work under crossdev. # # https://bugs.gentoo.org/671394 -SRC_URI+="!gccgo? ( ${BOOTSTRAP_URI} )" +SRC_URI+="!gccgo? ( !system-bootstrap? ( ${BOOTSTRAP_URI} ) )" DESCRIPTION="A concurrent garbage collected and typesafe programming language" HOMEPAGE="https://golang.org" LICENSE="BSD" SLOT="0/${PV}" -IUSE="gccgo" +IUSE="gccgo system-bootstrap" BDEPEND="gccgo? ( >=sys-devel/gcc-5[go] )" RDEPEND="!<dev-go/go-tools-0_pre20150902" @@ -151,6 +151,9 @@ pkg_pretend() if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}" fi + [[ ${MERGE_TYPE} != binary ]] && + use system-bootstrap && ! has_version "dev-lang/go" && + die "dev-lang/go must be installed to use the system-bootstrap use flag" } src_unpack() @@ -160,7 +163,7 @@ src_unpack() else unpack "go${MY_PV}.src.tar.gz" fi - use gccgo || + use gccgo || use system-bootstrap || unpack "go-$(go_os ${CBUILD})-$(go_arch ${CBUILD})-${BOOTSTRAP_VERSION}.tbz" } @@ -176,6 +179,8 @@ src_compile() [[ -x ${go_binary} ]] || die "go-$(gcc-major-version): command not found" ln -s "${go_binary}" "${GOROOT_BOOTSTRAP}/bin/go" || die + elif use system-bootstrap; then + export GOROOT_BOOTSTRAP="${EPREFIX}"/usr/lib/go fi export GOROOT_FINAL="${EPREFIX}"/usr/lib/go export GOROOT="$(pwd)" diff --git a/dev-lang/go/go-1.12.4.ebuild b/dev-lang/go/go-1.12.4.ebuild index 8fafeb455ba..a53df7c0956 100644 --- a/dev-lang/go/go-1.12.4.ebuild +++ b/dev-lang/go/go-1.12.4.ebuild @@ -48,20 +48,20 @@ case ${PV} in esac esac -# If gccgo is not being used to build Go, there is no way to know the -# architecture or operating system of the build machine, so we need to -# download all of our bootstrap archives to allow this ebuild to work -# under crossdev. +# If gccgo or a previously installed version of dev-lang/go is not being +# used to build Go, there is no way to know the architecture or operating system +# of the build machine, so we need to download all of our bootstrap +# archives to allow this ebuild to work under crossdev. # # https://bugs.gentoo.org/671394 -SRC_URI+="!gccgo? ( ${BOOTSTRAP_URI} )" +SRC_URI+="!gccgo? ( !system-bootstrap? ( ${BOOTSTRAP_URI} ) )" DESCRIPTION="A concurrent garbage collected and typesafe programming language" HOMEPAGE="https://golang.org" LICENSE="BSD" SLOT="0/${PV}" -IUSE="gccgo" +IUSE="gccgo system-bootstrap" BDEPEND="gccgo? ( >=sys-devel/gcc-5[go] )" RDEPEND="!<dev-go/go-tools-0_pre20150902" @@ -151,6 +151,9 @@ pkg_pretend() if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}" fi + [[ ${MERGE_TYPE} != binary ]] && + use system-bootstrap && ! has_version "dev-lang/go" && + die "dev-lang/go must be installed to use the system-bootstrap use flag" } src_unpack() @@ -160,7 +163,7 @@ src_unpack() else unpack "go${MY_PV}.src.tar.gz" fi - use gccgo || + use gccgo || use system-bootstrap || unpack "go-$(go_os ${CBUILD})-$(go_arch ${CBUILD})-${BOOTSTRAP_VERSION}.tbz" } @@ -176,6 +179,8 @@ src_compile() [[ -x ${go_binary} ]] || die "go-$(gcc-major-version): command not found" ln -s "${go_binary}" "${GOROOT_BOOTSTRAP}/bin/go" || die + elif use system-bootstrap; then + export GOROOT_BOOTSTRAP="${EPREFIX}"/usr/lib/go fi export GOROOT_FINAL="${EPREFIX}"/usr/lib/go export GOROOT="$(pwd)" diff --git a/dev-lang/go/metadata.xml b/dev-lang/go/metadata.xml index f981de1f10b..8d9af604ec9 100644 --- a/dev-lang/go/metadata.xml +++ b/dev-lang/go/metadata.xml @@ -11,6 +11,11 @@ channels and a clean syntax. </longdescription> <use> - <flag name="gccgo">Enable bootstrapping using gccgo</flag> + <flag name="gccgo"> + Bootstrap using <pkg>sys-devel/gcc</pkg>[go] + </flag> + <flag name="system-bootstrap"> + Bootstrap using previously installed <pkg>dev-lang/go</pkg> + </flag> </use> </pkgmetadata>
