summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8ed5b1f32d5d05822fdf21d5e996528a0335d6a0 (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
51
52
53
54
55
# Maintainer: Blallo <blallo@autistici.org>

pkgname="savvy-git"
pkgver="0.16.0.r1.g0e3533d"
pkgrel="1"
pkgdesc="Command line tool for savvy services services (built from master)"
arch=("x86_64")
url="https://getsavvy.so"
license=("MIT")
depends=("go")
provides=("savvy")
conflicts=("savvy")
source=("savvy-cli::git+https://github.com/getsavvyinc/savvy-cli")
sha256sums=('SKIP')

pkgver() {
  cd savvy-cli
  git describe --long --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  mkdir -p "$pkgname-$pkgver/build/"
}

build() {
  cd savvy-cli
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  go build \
    -buildmode=pie \
    -trimpath \
    -mod=readonly \
    -modcacherw \
    -ldflags="-linkmode=external -s -w -X github.com/getsavvyinc/savvy-cli/config.version=${pkgver}" \
    -o ../$pkgname-$pkgver/build \
    ./
}

package() {
  mkdir -p completions
  cp "$pkgname-$pkgver/build/savvy-cli" ./savvy
  chmod +x ./savvy
  ./savvy completion bash > completions/savvy
  ./savvy completion zsh > completions/_savvy
  mkdir -p "$pkgdir/usr/bin"
  mkdir -p "$pkgdir/usr/share/bash-completion/completions"
  mkdir -p "$pkgdir/usr/share/zsh/site-functions"
  install -m755 savvy "$pkgdir/usr/bin"
  install -m644 completions/savvy "$pkgdir/usr/share/bash-completion/completions"
  install -m644 completions/_savvy "$pkgdir/usr/share/zsh/site-functions"
}

# vim:et ts=2 sts=0 sw=0: