summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2535d9e5afef4b56609e35053143769278a54bc5 (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
56
57
58
59
60
61
62
63
64
65
66
# Maintainer: Chocobo1 <chocobo1 AT archlinux DOT net>

pkgname=gum-git
pkgver=0.2.0.r8.g378a000
pkgrel=2
pkgdesc="A tool for glamorous shell scripts"
arch=('i686' 'x86_64')
url="https://github.com/charmbracelet/gum"
license=('MIT')
depends=('glibc')
makedepends=('git' 'go')
provides=("gum=$pkgver")
conflicts=('gum')
source=("git+https://github.com/charmbracelet/gum.git")
sha256sums=('SKIP')


export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -ldflags=-linkmode=external -trimpath -mod=readonly -modcacherw"

pkgver() {
  cd "gum"

  _tag=$(git tag -l --sort -v:refname | sed '/rc[0-9]*/d' | head -n1)
  _rev=$(git rev-list --count $_tag..HEAD)
  _hash=$(git rev-parse --short HEAD)
  printf "%s.r%s.g%s" "$_tag" "$_rev" "$_hash" | sed 's/^v//'
}

build() {
  cd "gum"

  go build \
    ./

  ./gum man > "gum.1"

  for shell in bash fish zsh; do
    ./gum completion "$shell" > "$shell-completion"
  done
}

check() {
  cd "gum"

  #go test \
  #  ./...
}

package() {
  cd "gum"

  install -Dm755 "gum" -t "$pkgdir/usr/bin"

  install -Dm644 "README.md" -t "$pkgdir/usr/share/doc/gum"
  install -Dm644 "gum.1" -t "$pkgdir/usr/share/man/man1"

  install -Dm644 "bash-completion" "$pkgdir/usr/share/bash-completion/completions/gum"
  install -Dm644 "fish-completion" "$pkgdir/usr/share/fish/vendor_completions.d/gum.fish"
  install -Dm644 "zsh-completion" "$pkgdir/usr/share/zsh/site-functions/_gum"

  install -Dm644 "LICENSE" -t "$pkgdir/usr/share/licenses/gum"
}