# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=opentofu
pkgver=1.9.1
pkgrel=1
pkgdesc="OpenTofu lets you declaratively manage your cloud infrastructure"
url="https://opentofu.org/"
arch="all"
license="MPL-2.0"
makedepends="go"
source="$pkgname-$pkgver.tar.gz::https://github.com/opentofu/opentofu/archive/refs/tags/v${pkgver/_/-}.tar.gz"
builddir="$srcdir/$pkgname-${pkgver/_/-}"

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

build() {
	local ldflags="-X 'github.com/opentofu/opentofu/version.dev=no'"
	go build -ldflags "$ldflags" ./cmd/tofu
}

check() {
	go test -v ./...
}

package() {
	install -Dm0755 tofu -t "$pkgdir"/usr/bin/
}

sha512sums="
02780ea2851bf830177f6fb56a57cdbabfb31085c5d7540b43c20d93bc113f36d181dfec4518fd2c50ce0c557e7f77f551c8e7c40e09c9462c5c4a972eedd681  opentofu-1.9.1.tar.gz
"
