summaryrefslogtreecommitdiffstats
path: root/main/go/APKBUILD
blob: ad33db231e2edfac9f582b4c530c26d08020d3b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Maintainer: Eivind Uggedal <eivind@uggedal.com>
pkgname=go
pkgver=1.3.1
pkgrel=0
pkgdesc="Go programming language compiler"
url="http://www.golang.org/"
arch="x86 x86_64"
license="BSD"
depends=""
depends_dev=""
makedepends="bash perl mercurial"
options="!strip"
install=""
subpackages="
	$pkgname-tools:tools
	$pkgname-bash-completion:completion
	$pkgname-vim:vim
	"
source="
	http://golang.org/dl/go${pkgver}.src.tar.gz
	no-werror.patch
	no-pic.patch
	no-longjmp-redefine.patch
	default-sc-getpw-r-size-max.patch
	"

_builddir="$srcdir"/$pkgname
_toolrepo=code.google.com/p/go.tools
_tooltag=release-branch.go1.3

prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	export GOPATH="$srcdir"
	export GOROOT="$_builddir"
	export GOBIN="$GOROOT"/bin
	export GOROOT_FINAL=/usr/lib/go
	# ccache breaks build for some reason
	unset CC

	case "$CARCH" in
		x86) GOARCH=386;;
		x86_64) GOARCH=amd64;;
		*) return 1;;
	esac
	export GOARCH

	cd "$_builddir/src"

	./make.bash || return 1

	# FIXME: race and bench tests fail:
	#PATH="$GOROOT/bin:$PATH" ./run.bash --no-rebuild --banner || return 1

	# Build tools provided with the upstream binary distribution:
	"$GOROOT"/bin/go get -d $_toolrepo/...
	(
		cd "$srcdir"/src/$_toolrepo
		hg update $_tooltag
	)
	local tool
	for tool in cover vet godoc; do
		"$GOROOT"/bin/go install $_toolrepo/cmd/$tool
	done
}

package() {
	local f d
	cd "$_builddir"

	install -dm755 "$pkgdir"/usr/bin
	for f in go gofmt; do
		install -m755 bin/$f "$pkgdir"/usr/bin
	done

	install -dm755 "$pkgdir"/usr/lib/go
	cp -a pkg "$pkgdir"/usr/lib/go

	# The source needs to be installed due to an upstream
	# bug (http://code.google.com/p/go/issues/detail?id=2775).
	# When this is resolved we can split out the source to a
	# go-doc sub package.
	install -dm755 "$pkgdir"/usr/lib/go/src
	for d in pkg cmd; do
		cp -a src/$d "$pkgdir"/usr/lib/go/src
	done
}

tools() {
	local tool

	pkgdesc="Go programming language tools"
	depends="$pkgname"

	install -Dm755 "$_builddir"/bin/godoc "$subpkgdir"/usr/bin/godoc

	install -dm755 "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH

	for tool in cover vet; do
		mv "$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool \
			"$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool
	done

	# Make documentation for tools available through godoc:
	for tool in cover vet godoc; do
		install -dm755 "$subpkgdir"/usr/lib/go/src/pkg/$tool
		sed -e 's/^package main$/package documentation/' \
			"$srcdir"/src/$_toolrepo/cmd/$tool/doc.go > \
			"$subpkgdir"/usr/lib/go/src/pkg/$tool/doc.go
	done
}

completion() {
	pkgdesc="Bash completion script for Go"
	arch="noarch"

	install -Dm644 "$_builddir"/misc/bash/$pkgname \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}

vim() {
	local f

	pkgdesc="Vim syntax for Go"
	arch="noarch"

	for f in ftdetect/gofiletype.vim syntax/go.vim indent/go.vim; do
		install -Dm644 "$_builddir"/misc/vim/$f \
			"$subpkgdir"/usr/share/vim/vimfiles/$f
	done
}

md5sums="13e32d14e974e3d903fa2de03581c681  go1.3.1.src.tar.gz
65330c61f6d6c881033b0a95ca228edb  no-werror.patch
4391be88ce8bacdd7fee433b39635583  no-pic.patch
93ad940db4a6d51e086f80755eaa8f53  no-longjmp-redefine.patch
2576180fb906455bb786ca2937bbe180  default-sc-getpw-r-size-max.patch"
sha256sums="fdfa148cc12f1e4ea45a5565261bf43d8a2e7d1fad4a16aed592d606223b93a8  go1.3.1.src.tar.gz
65d38b9485da2ff9417a2c44a81b6e52cc9bd2727b27e7add10d48a63805d4a3  no-werror.patch
86fc68a50bc4a9336a003239adf1dcc6d7cabfb9c1bcf09b0d53d09100ceff12  no-pic.patch
084020e0eb6cb0aceee047bd5962872ed51dbb45465174018d108eb195c26605  no-longjmp-redefine.patch
be711a828ddda89dd28ffc19d88958471c832005f0666a8a28c8838c0082a208  default-sc-getpw-r-size-max.patch"
sha512sums="3d35c823e6f5264044c299a38ff425519dcf07bdc1b37a2362108be23ff1442f747ef8fe659df33b2588327a5ec8d9e85f4fd24929d8e23a8ede96a63d6f90ff  go1.3.1.src.tar.gz
3cf139723e6ff0cbf7aaf76295fe4208f2062f2d4086e36d05cad83919217b5355e0e79b0b515a06a578389301bd07b062cb58b98fc0f9e4badf190cd1c34826  no-werror.patch
a8e95c3c536a30e15b9bad5e623a085c521739639a58ac638679d99413a1bee8823729783123cbe4495ac42822df31f4776f0380a63786b9f4fc73190e012ae5  no-pic.patch
3a9b665f8fda89729c4c269ea82f82ee515f0026d26f1d51e2cf84054456e394afc14875e7ed29280a12488907d50c70af313e2e4a5b62c328bbade098db9d4d  no-longjmp-redefine.patch
9e9a288ff912b57eff250db53891be166376ec3ee11fcde94b49f1ff1c9433ef531d6c12706258a65a8666e11142506ecc3778e4bbf43dbe23afd2492a3a17a4  default-sc-getpw-r-size-max.patch"