SUMMARY="Reference compiler for 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://bitbucket.org/zhuowei/go-1-3-haiku"

# archived tar for this version
SOURCE_URI="https://bitbucket.org/zhuowei/go-1-3-haiku/downloads/golang-1.3-porthaiku2.tar.gz"
SOURCE_DIR="golang-1.3-porthaiku2"
CHECKSUM_SHA256="7ec832d47bf5080f579aa80f8f196bf0b8f60aa99718510e8028586255f716c7"

REVISION="3"
LICENSE="BSD (3-clause)"
COPYRIGHT="2009-2014 The Go Authors"

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

PROVIDES="
	golang$secondaryArchSuffix = $portVersion
	cmd:go$secondaryArchSuffix = $portVersion
	cmd:gofmt$secondaryArchSuffix = $portVersion
	cmd:godoc$secondaryArchSuffix = $portVersion
	"
if [ "$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:hg
	cmd:git
	"

BUILD()
{
	echo "1.3-porthaiku2" > VERSION
	export GOROOT_FINAL=/system/develop/lib$secondaryArchSubDir/go
	cd src
	./make.bash
	cd ..
	export GOPATH=/tmp
	export GOROOT=`pwd`
	bin/go get code.google.com/p/go.tools/cmd/godoc
	bin/go get code.google.com/p/go.tools/cmd/vet
}

INSTALL()
{
	mkdir -p $developLibDir/go/
	cp -r src pkg doc $developLibDir/go/
	mkdir -p $binDir
	cp bin/* $binDir/
	if [ "$secondaryArchSuffix" != "" ]; then
		cd $binDir/..
		for a in `ls $binDir`
		do
			ln -s .$secondaryArchSubDir/$a $a
		done
	fi
}
