summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 33f4add1808a063c169d04136e4bd6668ac14fc3 (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
# Maintainer: Your name <bros at brocode dot sh>

pkgname=fbmirrors
pkgver=0.0.3
pkgrel=2
pkgdesc="Arch mirror list generator"
arch=('x86_64')
url="https://github.com/bomgar/fbmirrors"
license=('custom:GPL-3.0')
makedepends=('go')
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha256sums=('13fbc715d332ed87ae1f00dd768ab36a3e949bafee67c96c4367347db11cebaa')

prepare() {
  cd "$pkgname-$pkgver"
  go mod download
}


build() {
  cd "$pkgname-$pkgver"
  go build -o $pkgname -ldflags="-X main.version=$pkgver" main.go
  mkdir -p completions
  ./$pkgname completion bash > completions/$pkgname
  ./$pkgname completion zsh > completions/_$pkgname
  ./$pkgname completion fish > completions/$pkgname.fish
}

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

package() {
  cd "$pkgname-$pkgver"
  install -Dm 755 "$pkgname" -t "$pkgdir/usr/bin"
  install -Dm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"
  install -D -m644 completions/$pkgname "$pkgdir/usr/share/bash-completion/completions/$pkgname"
  install -D -m644 completions/_$pkgname "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
  install -D -m644 completions/$pkgname.fish "$pkgdir/usr/share/fish/completions/$pkgname.fish"
}