SUMMARY="The Go Programming Language"
DESCRIPTION="The Go Programming Language is an open source project to make \
programmers more productive.

Go is expressive, concise, clean, and efficient. Its concurrency \
mechanisms make it easy to write programs that get the most out of multicore \
and networked machines, while its novel type system enables flexible and \
modular program construction. Go compiles quickly to machine code yet has the \
convenience of garbage collection and the power of run-time reflection. It's a \
fast, statically typed, compiled language that feels like a dynamically typed, \
interpreted language."
HOMEPAGE="https://golang.org/"
COPYRIGHT="2009-2018 The Go Authors"
LICENSE="BSD (3-clause)"
REVISION="6"
SOURCE_URI="https://dl.google.com/go/go$portVersion.src.tar.gz"
CHECKSUM_SHA256="9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959"
SOURCE_DIR="go"
PATCHES="golang-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2 !x86"
SECONDARY_ARCHITECTURES="!x86"

GLOBAL_WRITABLE_FILES="
	non-packaged/lib/go directory keep-old
	"

PROVIDES="
	golang$secondaryArchSuffix = $portVersion
	cmd:go$secondaryArchSuffix = $portVersion
	cmd:gofmt$secondaryArchSuffix = $portVersion
	cmd:godoc$secondaryArchSuffix = $portVersion
	"
if [ -n "$secondaryArchSuffix" ]; then
PROVIDES="$PROVIDES
	cmd:go = $portVersion
	cmd:gofmt = $portVersion
	cmd:godoc = $portVersion
	"
fi

REQUIRES="
	haiku$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"

BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:git
	"

BUILD()
{
	echo "$portVersion" > VERSION
	export GOROOT_FINAL=$prefix/non-packaged/lib/go
	cd src
	DISABLE_ASLR=1 ./make.bash
	cd ..
	export GOPATH=/tmp
	export GOROOT="$sourceDir"
}

INSTALL()
{
	mkdir -p $prefix/non-packaged/lib/go/
	cp -r src pkg doc bin include $prefix/non-packaged/lib/go/
	mkdir -p $binDir
	cp bin/* $binDir
}

TEST()
{
	cd src
	DISABLE_ASLR=1 ./all.bash
}
