maintainer="fossdd <fossdd@pwned.life>"
pkgname=melange
pkgver=0.26.0
pkgrel=0
pkgdesc="Build apk packages using declarative pipelines"
url="https://github.com/chainguard-dev/melange"
# 32-bit: /home/buildozer/go/pkg/mod/go.step.sm/crypto@v0.58.1/internal/utils/convert.go:33:18: cannot convert math.MaxUint32 (untyped int constant 4294967295) to type T
arch="all !armhf !armv7 !x86"
license="Apache-2.0"
makedepends="go"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/chainguard-dev/melange/archive/v$pkgver/melange-$pkgver.tar.gz"

build() {
	mkdir build
	go build -o build/ .

	for i in bash fish zsh; do
		./build/melange completion $i > melange.$i
	done
}

check() {
	(unset SOURCE_DATE_EPOCH; go test ./...)
}

package() {
	install -Dm755 build/melange -t "$pkgdir"/usr/bin/

	install -Dm644 melange.bash "$pkgdir"/usr/share/bash-completion/completions/melange
	install -Dm644 melange.fish "$pkgdir"/usr/share/fish/vendor_completions.d/melange.fish
	install -Dm644 melange.zsh "$pkgdir"/usr/share/zsh/site-functions/_melange
}

sha512sums="
ef9f464a5c3542e6d451f4a00a4841ce091a02c18e143f0e1054923c3ffd7adccdf7885a564669bd292b0e554c21b348173591afee3c76b86b890b5e9e3d598f  melange-0.26.0.tar.gz
"
