# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=age
pkgver=1.2.1
pkgrel=5
pkgdesc="Simple, modern and secure encryption tool"
url="https://github.com/FiloSottile/age"
license="BSD-3-Clause"
arch="all"
makedepends="go"
subpackages="$pkgname-doc"
source="https://github.com/FiloSottile/age/archive/v$pkgver/age-$pkgver.tar.gz"
options="net" # Go modules

case "$CARCH" in
s390x)
	# tests fail on s390x
	# fix in https://github.com/rogpeppe/go-internal/pull/246 (unreleased)
	options="$options !check"
	;;
esac

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

build() {
	mkdir bin
	go build -ldflags "-X main.Version=$pkgver" -o bin ./cmd/...
}

check() {
	TMPDIR="$GOTMPDIR" go test ./...
}

package() {
	install -Dm755 bin/* -t "$pkgdir"/usr/bin
	install -Dm644 doc/*.1 -t "$pkgdir"/usr/share/man/man1
}

sha512sums="
685914db0bf398e20ee599627d131004f85ab5f37dcbc6752b1379c07702a1896d48163a8e9c71a25a44858ec648f3cb404f7c92360657f935342cd766a13a3a  age-1.2.1.tar.gz
"
