From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-875588-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 1595059CAF
	for <garchives@archives.gentoo.org>; Sat,  9 Apr 2016 17:43:32 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 7133721C01D;
	Sat,  9 Apr 2016 17:43:29 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 0CDD021C018
	for <gentoo-commits@lists.gentoo.org>; Sat,  9 Apr 2016 17:43:28 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 744473406F2
	for <gentoo-commits@lists.gentoo.org>; Sat,  9 Apr 2016 17:43:27 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id E1D3F7E
	for <gentoo-commits@lists.gentoo.org>; Sat,  9 Apr 2016 17:43:24 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1460223790.266654a48bf9ccbc8f0556aa8660eaab78bb7bb9.williamh@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/go/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-lang/go/go-9999.ebuild dev-lang/go/metadata.xml
X-VCS-Directories: dev-lang/go/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 266654a48bf9ccbc8f0556aa8660eaab78bb7bb9
X-VCS-Branch: master
Date: Sat,  9 Apr 2016 17:43:24 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 67561d4e-0f53-4709-9388-1d73acd91dfe
X-Archives-Hash: 686cde28dce2e2cbe9f034006a7876a6

commit:     266654a48bf9ccbc8f0556aa8660eaab78bb7bb9
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  9 17:35:57 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Apr  9 17:43:10 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=266654a4

dev-lang/go:  add support for bootstrapping with gccgo

I would like to thank Zac Medico for the patch.
This allows a user to bootstrap go with gcc's go compiler if they have it
installed.

Bug: https://bugs.gentoo.org/show_bug.cgi?id=576290

Package-Manager: portage-2.2.26

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

diff --git a/dev-lang/go/go-9999.ebuild b/dev-lang/go/go-9999.ebuild
index ecfde4e..5a65136 100644
--- a/dev-lang/go/go-9999.ebuild
+++ b/dev-lang/go/go-9999.ebuild
@@ -12,7 +12,7 @@ MY_PV=${PV/_/}
 inherit toolchain-funcs
 
 BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist"
-SRC_URI="
+SRC_URI="!gccgo? (
 kernel_Darwin? (
 	x64-macos? ( ${BOOTSTRAP_DIST}/go-darwin-amd64-bootstrap.tbz )
 )
@@ -30,6 +30,7 @@ kernel_linux? (
 kernel_SunOS? (
 	x64-solaris? ( ${BOOTSTRAP_DIST}/go-solaris-amd64-bootstrap.tbz )
 )
+)
 "
 
 if [[ ${PV} = 9999 ]]; then
@@ -52,9 +53,9 @@ HOMEPAGE="http://www.golang.org"
 
 LICENSE="BSD"
 SLOT="0/${PV}"
-IUSE=""
+IUSE="gccgo"
 
-DEPEND=""
+DEPEND="gccgo? ( >=sys-devel/gcc-5[go] )"
 RDEPEND="!<dev-go/go-tools-0_pre20150902"
 
 # These test data objects have writable/executable stacks.
@@ -146,6 +147,14 @@ src_unpack()
 src_compile()
 {
 	export GOROOT_BOOTSTRAP="${WORKDIR}"/go-$(go_os)-$(go_arch)-bootstrap
+	if use gccgo; then
+		mkdir -p "${GOROOT_BOOTSTRAP}/bin" || die
+		local go_binary=$(type -P go-5 2>/dev/null)
+		[[ -x ${go_binary} ]] || go_binary=$(
+			find "${EPREFIX}"/usr/${CHOST}/gcc-bin/*/go-5 | sort -V | tail -n1)
+		[[ -x ${go_binary} ]] || die "go-5: command not found"
+		ln -s "${go_binary}" "${GOROOT_BOOTSTRAP}/bin/go" || die
+	fi
 	export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
 	export GOROOT="$(pwd)"
 	export GOBIN="${GOROOT}/bin"

diff --git a/dev-lang/go/metadata.xml b/dev-lang/go/metadata.xml
index 1050d93..f981de1 100644
--- a/dev-lang/go/metadata.xml
+++ b/dev-lang/go/metadata.xml
@@ -10,4 +10,7 @@
 		Rob Pike. It has garbage collection, coroutines, communication
 		channels and a clean syntax.  
 	</longdescription>
+	<use>
+		<flag name="gccgo">Enable bootstrapping using gccgo</flag>
+	</use>
 </pkgmetadata>