summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6ee30a190d361374a61bf9ca5d84bcf0b6f5db7d (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
pkgname=go-jira
_pkgname=jira
pkgver=1.0.27
pkgrel=1
pkgdesc='simple jira command line client in Go'
arch=('x86_64')
url="https://github.com/go-jira/jira"
license=('Apache')
makedepends=('go')
optdepends=('bash-completion: support auto completion for bash')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz"
        "jira"
        "_jira")
sha256sums=('c5bcf7b61300b67a8f4e42ab60e462204130c352050e8551b1c23ab2ecafefc7'
            '737b5bcf05a0121bf5db7baec080446a3c85c9bcdeaf53867d2cba3b86049e48'
            '0ddd0422eb74510bd71b8d370ef8e6b698126fd66abebbb18a00ede45cc9facf')

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

build() {
  cd "${_pkgname}-${pkgver}"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
  go build -o build ./cmd/...
}

package() {
  cd "$_pkgname-$pkgver"
  install -Dm755 build/$_pkgname "$pkgdir"/usr/bin/$_pkgname
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  install -dm 755 "${pkgdir}/etc/bash_completion.d/" \
                  "${pkgdir}/usr/share/zsh/site-functions/"

  # Autocomplete generated by the binary are quite outdated due to old version of kingpin
  # For some reason go-jira returns non-zero exit code for completions
  # https://github.com/go-jira/jira/issues/326
  #
  # "${pkgdir}/usr/bin/${_pkgname}" --completion-script-bash > "${pkgdir}/etc/bash_completion.d/${_pkgname}" || true
  # "${pkgdir}/usr/bin/${_pkgname}" --completion-script-zsh > "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}" || true

  # Our modified autocomplete
  cd ..
  install -Dm644 ${_pkgname} "${pkgdir}/etc/bash_completion.d/${_pkgname}"
  install -Dm644 _${_pkgname} "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}"
}