# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Claas Störtenbecker <claas.stoertenbecker@gmail.com>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=gopass
pkgver=1.15.16
pkgrel=1
pkgdesc="The slightly more awesome Standard Unix Password Manager for Teams. Written in Go."
url="https://www.gopass.pw"
arch="all"
license="MIT"
makedepends="gnupg go ncurses"
source="$pkgname-$pkgver.tar.gz::https://github.com/gopasspw/gopass/archive/v$pkgver.tar.gz
	enable-cgo.patch"
options="chmod-clean net"
subpackages="
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	$pkgname-doc
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	make build BUILDFLAGS="\$(BUILDFLAGS_NOPIE) $GOFLAGS"
}

check() {
	# This fails if user already has a ~/.password-store
	make test-integration
}

package() {
	make install DESTDIR="$pkgdir" PREFIX="/usr" BUILDFLAGS="\$(BUILDFLAGS_NOPIE) $GOFLAGS"
	install -Dm0644 "$builddir"/fish.completion \
		"$pkgdir"/usr/share/fish/vendor_completions.d/gopass.fish
}

sha512sums="
e14cd08187c4b4754ff696df11b9a4ee8fb949ea0690c040eb9451630f93949085785b1b757095ace4e7b2f19bc976f90aa7a7285d48a3aa5eee573a673e6329  gopass-1.15.16.tar.gz
0866b5378abc1c621d188c5dd6afe25841dd1459f176543f93d319c0e041e701a80e0d51c1977d2e6ed892b38730248217b2c9c7c53f3dddaa155f5c2a311456  enable-cgo.patch
"
