# Contributor: omni <omni@gitlab.alpinelinux.org>
# Maintainer: omni <omni@gitlab.alpinelinux.org>
pkgname=didder
pkgver=1.3.0
_commit=409cfa6
pkgrel=10
pkgdesc="An extensive, fast, and accurate command-line image dithering tool"
url="https://github.com/makeworld-the-better-one/didder"
license="GPL-3.0-or-later"
arch="all"
makedepends="go"
subpackages="$pkgname-doc"
options="!check" # no test files
source="$pkgname-$pkgver.tar.gz::https://github.com/makeworld-the-better-one/didder/archive/v$pkgver.tar.gz"

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

build() {
	go build \
		-ldflags="-linkmode=external -extldflags \"$LDFLAGS\" \
		-X main.version=$pkgver -X main.commit=$_commit \
		-X main.builtBy=Alpine_Linux" \
		-v .
}

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

package() {
	install -Dm0755 "$pkgname" -t "$pkgdir"/usr/bin
	install -Dm0644 "$pkgname".1 -t "$pkgdir"/usr/share/man/man1
}

sha512sums="
660691d5ce06e370dd688077e05e55165c127032f45e3c51e525c2ae5e219447cfc02435bb96233e51b685eac050eabedeafb0077c35b699a6ba2605baad4dba  didder-1.3.0.tar.gz
"
