summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e6c1b5ce648cb97fe013e5e162399803f971fb5e (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
# Maintainer: Chocobo1 <chocobo1 AT archlinux DOT net>

pkgname=github-cli-git
pkgver=2.18.1.r33.g9ea76237
pkgrel=2
pkgdesc="The GitHub CLI tool"
arch=('i686' 'x86_64')
url="https://github.com/cli/cli"
license=('MIT')
depends=('glibc')
makedepends=('git' 'go')
checkdepends=("openssh")
optdepends=("git: To interact with repositories")
provides=("github-cli=$pkgver")
conflicts=('github-cli')
source=("git+https://github.com/cli/cli.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 "cli"

  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "cli"

  make manpages
}

check() {
  cd "cli"

  go test \
    ./...
}

package() {
  cd "cli"

  GOBIN="$pkgdir/usr/bin" \
    go install ./cmd/gh

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

  "$pkgdir/usr/bin/gh" completion -s bash > "$pkgdir/usr/share/bash-completion/completions/gh"
  "$pkgdir/usr/bin/gh" completion -s fish > "$pkgdir/usr/share/fish/vendor_completions.d/gh.fish"
  "$pkgdir/usr/bin/gh" completion -s zsh > "$pkgdir/usr/share/zsh/site-functions/_gh"

  cp -r "share" "$pkgdir/usr"
  install -Dm644 "README.md" -t "$pkgdir/usr/share/doc/github-cli"
  install -Dm644 "LICENSE" -t "$pkgdir/usr/share/licenses/github-cli"
}