summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 416442534f4ef031187361f5967f6d047a9e5da4 (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
# Maintainer: Javier Domingo Cansino <javierdo1@gmail.com>

_pkgname=sawyer
pkgname=${_pkgname}-git
pkgver=v0.0.1.r0.g7d842d5
pkgrel=1
pkgdesc="Sawyer is a background changer"
url='https://github.com/txomon/sawyer/'
arch=('i686' 'x86_64')
license=('MPL')
makedepends=('go' 'git')
conflicts=('sawyer-bin')
_gourl=github.com/txomon
source=(${pkgname}::"git+https://${_gourl}/${_pkgname}.git#branch=master")
sha256sums=('SKIP')

pkgver() {
  cd "${srcdir}/../$pkgname"
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  mkdir -p "${srcdir}/src/${_gourl}"
  rm -rf "${srcdir}/src/${_gourl}/${_pkgname}"
  mv -f "${pkgname}" "${srcdir}/src/${_gourl}/${_pkgname}"
  msg2 "Fetching dependencies"
  cd "${srcdir}/src/${_gourl}/${_pkgname}"
  GOPATH="${srcdir}" ./go-get-deps.sh
}

build() {
  msg2 "Build program"
  cd "${srcdir}/src/${_gourl}/${_pkgname}"
  GOPATH="${srcdir}" PATH="${srcdir}/bin:${PATH}" go build -o sawyer.bin
}

package() {
  cd "${srcdir}/src/${_gourl}/${_pkgname}"
  install -Dm755 sawyer.bin "${pkgdir}/usr/bin/sawyer"

  cd "${srcdir}/.."
  # Zsh completion
  install -Dm755 config.json $pkgdir/etc/sawyer/config.json
}