summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a9400dbf63f95f63a3b24342a1335483457d2bfd (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: tarball <bootctl@gmail.com>

pkgname=newreleases
pkgver=0.1.16
pkgrel=1
pkgdesc='NewReleases.io CLI'
url='https://newreleases.io'
arch=(i686 x86_64 aarch64 riscv64)
license=(BSD)
makedepends=(go)
depends=(glibc)
source=("$pkgname-$pkgver.tar.gz::https://github.com/newreleasesio/cli-go/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('c3729e788cd6f742833917ccbc3cb00c2ddd9a0d226b717da3cdafaee19a473a')

prepare() {
  cd "cli-go-$pkgver"
  mkdir -p build
  go mod download
}

build() {
  export CGO_CPPFLAGS="$CPPFLAGS"
  export CGO_CFLAGS="$CFLAGS"
  export CGO_CXXFLAGS="$CXXFLAGS"
  export CGO_LDFLAGS="$LDFLAGS"
  export GOFLAGS='-buildmode=pie -trimpath -mod=readonly -modcacherw'

  cd "cli-go-$pkgver"
  go build -o build/$pkgname ./$pkgname

  for shell in bash fish zsh; do
    ./build/$pkgname completion $shell >build/completion.$shell
  done
}

check() {
  cd "cli-go-$pkgver"
  go test ./...
}

package() {
  cd "cli-go-$pkgver"

  install -Dm755 build/$pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  install -Dm644 build/completion.bash "$pkgdir/usr/share/bash-completion/completions/$pkgname"
  install -Dm644 build/completion.fish "$pkgdir/usr/share/fish/completions/$pkgname.fish"
  install -Dm644 build/completion.zsh "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
}