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}" }