summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3af9e217852f01cb9f94a08ac1909e161f0ca839 (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
pkgname=babelweb2-git
_pkgname=babelweb2
pkgver=r224.506f97f
pkgrel=1
pkgdesc='Yet Another Monitoring Tool for the Babel routing daemon.'
arch=('x86_64' 'i686')
url='https://github.com/Vivena/babelweb2'
license=('MIT')
makedepends=('git' 'go-pie')
source=("${_pkgname}::git+https://github.com/Vivena/babelweb2.git"
        "babelweb2.service")
sha256sums=('SKIP'
            '90592927110b955e2e533f90752c50b468dd8824379fdcfca2be41c42343ccfd')

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

prepare() {
  mkdir -p gopath/src/github.com/Vivena
  ln -rTsf $_pkgname gopath/src/github.com/Vivena/$_pkgname
  export GOPATH="$srcdir"/gopath

  cd gopath/src/github.com/Vivena/$_pkgname
  go get -v github.com/Vivena/babelweb2
}


build() {
  export GOPATH="$srcdir"/gopath
  cd gopath/src/github.com/Vivena/$_pkgname
  go build \
    -gcflags "all=-trimpath=$PWD" \
    -asmflags "all=-trimpath=$PWD" \
    -ldflags "-extldflags $LDFLAGS" \
    -o $_pkgname .
}

package() {
  cd "$_pkgname"
  install -Dm 755 $_pkgname "${pkgdir}/usr/bin/$_pkgname"
  mkdir -p $pkgdir/usr/share/$_pkgname
  cp -r static $pkgdir/usr/share/$_pkgname
  install -Dm644 "$srcdir/babelweb2.service" "$pkgdir/usr/lib/systemd/system/babelweb2.service"
}