# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=easypki
pkgver=1.1.0
pkgrel=32
pkgdesc="Creating a certificate authority the easy way"
url="https://github.com/google/easypki"
arch="all"
license="Apache-2.0"
makedepends="go"
options="!check"
source="easypki-$pkgver.tar.gz::https://github.com/google/easypki/archive/v$pkgver.tar.gz
	go.mod
	go.sum
	overide-version.patch
	"

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

export GOFLAGS="$GOFLAGS -modcacherw"

prepare() {
	default_prepare

	cp "$srcdir"/go.mod "$srcdir"/go.sum .
}

build() {
	go build -v \
		-o "$builddir"/easypki ./cmd/easypki
}

package() {
	install -Dm755 easypki "$pkgdir"/usr/bin/easypki
}

sha512sums="
733a61645be46d1437b94e31d537c29b6648e2ff805abfba039154c4e765262c60652cdb42df44c17ae1553794cb667515cb03e4c9dfbfab42f9000f876012ca  easypki-1.1.0.tar.gz
a8c190cde1a850903d64c944923b7352bb13ca40e9cf27c944bd9b72449a859640a59e25a2fe0990aa209cd6f552ed61f880f14959f5f9cfcf92a1889b8d0f79  go.mod
15d4585e5a1fd280ae635d5536a9c2d4c42bf7ab8168edb4939195efa1db194e0224f920dbc0690fa6227f240d277a111c1ad99b269c655c7ba256b4f585fe77  go.sum
bfe4802694b7921a2a015900d56356dfda0e04a153c2b22c3bc03899c4e60fc2d79a425982f8dbdf08cee4fda0e793687f55c549e1ef657b4ef366705a2b9826  overide-version.patch
"
