# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=nfpm
pkgver=2.42.1
pkgrel=0
pkgdesc="a simple apk, Deb and RPM packager without external dependencies"
url="https://nfpm.goreleaser.com/"
arch="all"
license="MIT"
options="net" # net for go
makedepends="go"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/goreleaser/nfpm/archive/v$pkgver.tar.gz"

# secfixes:
#   2.35.2-r0:
#     - CVE-2023-49568

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

build() {
	go build -ldflags "-X main.version=$pkgver" -v -o nfpm ./cmd/nfpm/main.go
}

check() {
	go test
}

package() {
	install -Dm0755 nfpm "$pkgdir"/usr/bin/nfpm
	install -Dm0644 LICENSE.md "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
342ab7788757d280900f595398107af0f143efd102ff08c43e57432fc12d49c66742dcb99412157764161711352bbb44dcc8bdc2e00355e4737e697e3dfe4455  nfpm-2.42.1.tar.gz
"
