summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9ec6671026cd1942726c837ac9127233d2c88627 (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
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=vgo-git
pkgver=r34.88f0e96
pkgrel=1
pkgdesc='Versioned Go (git version)'
arch=('x86_64')
url='https://github.com/golang/vgo'
license=('BSD')
makedepends=('go')
source=("git+https://github.com/golang/vgo")
sha256sums=('SKIP')

# create a fake go path directory and pushd into it
# $1 real directory
# $2 gopath directory
_fake_gopath_pushd() {
  mkdir -p "$GOPATH/src/${2%/*}"
  rm -f "$GOPATH/src/$2"
  ln -rsT "$1" "$GOPATH/src/$2"
  pushd  "$GOPATH/src/$2" >/dev/null
}

_fake_gopath_popd() {
  popd >/dev/null
}

pkgver() {
	cd vgo
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
	cd "$srcdir"
	export GOPATH="$srcdir"
	export PATH="$GOPATH/bin:$PATH"
	_fake_gopath_pushd vgo github.com/golang/vgo
	go get
	go build
	_fake_gopath_popd
}

package() {
	cd "$srcdir"
    mkdir -p "$pkgdir"/usr/bin
	install -Dm755 bin/vgo "$pkgdir"/usr/bin/
}