summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e9bf2effa0f7cc6ec85ecb64df02cb17dd72f460 (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
pkgname=go-outline-git
pkgver=20161011.9_e785568
pkgrel=2
pkgdesc="Utility to extract JSON representation of declarations from a Go source file"
arch=('i686' 'x86_64')
license=('GPL')
url="https://github.com/lukehoban/go-outline"
makedepends=(
  'go'
  'git'
)

source=(
  "git+https://github.com/lukehoban/go-outline.git"
)

md5sums=(
  'SKIP'
)

pkgver() {
  cd "$srcdir/go-outline"
  local date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
  local count=$(git rev-list --count HEAD)
  local commit=$(git rev-parse --short HEAD)
  echo "$date.${count}_$commit"
}

prepare() {
  cd "${pkgname%-git}"
  go mod init "${url#https://}"
  go mod tidy
}

build() {
  GOPATH=$srcdir
  GOBIN=$srcdir/bin/
  mkdir -p $srcdir/src
  ln -sf $srcdir/go-outline $srcdir/src
  cd $srcdir/src/go-outline
  go get -v
}

package() {
  find "$srcdir/bin/" -type f -executable | while read filename; do
    install -DT "$filename" "$pkgdir/usr/bin/$(basename $filename)"
  done
}