summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: afa8bc5e5165fbaa90ea4e6ef7577b8bacaef234 (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
# Maintainer: Jakub "Kubuxu" Sztandera  <kubuxu@protonmail.ch>
# vim: set expandtab ts=2 sw=2:

_pkgname=gx-go
pkgname=$_pkgname-git
pkgver=latest
pkgrel=1
epoch=
pkgdesc="A tool to use with the gx package manager for packages written in go."
arch=('i686' 'x86_64' 'armv7h')
url="https://github.com/whyrusleeping/$_pkgname"
license=('MIT')
depends=('gx')
conflicts=('gx-go')
makedepends=('git' 'go')
source=("git+${url}.git")
md5sums=('SKIP')

pkgver() {
  # Renable after tags are placed in the repo.
  cd "$srcdir/$_pkgname"
  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  mkdir -p "$srcdir"/src/github.com/whyrusleeping/
  ln -fs "$srcdir/$_pkgname" "$srcdir"/src/github.com/whyrusleeping/"$_pkgname"
}

build() {
  # Required for go get
  export GOPATH="$srcdir"
  export GOBIN="$GOPATH/bin"
  cd "$srcdir"/src/github.com/whyrusleeping/"$_pkgname"

  msg2 'Installing dependencies...'
  go get -v

  msg2 'Building binary...'
  go install -v
}

package() {
  msg2 'Packaging binary...'
  install -Dm 755 bin/gx-go "${pkgdir}/usr/bin/gx-go"

  msg2 'Packaging auxiliary files...'
  cd "$_pkgname"
  install -Dm 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}