# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=yubikey-touch-detector
pkgver=1.11.0
pkgrel=5
pkgdesc="Tool to detect when your YubiKey is waiting for a touch"
url="https://github.com/maximbaz/yubikey-touch-detector"
arch="all"
license="ISC"
depends="gpgme"
makedepends="go gpgme-dev"
# Note: SVG image is based on https://github.com/Yubico/yubioath-desktop/blob/main/images/touch.svg.
source="https://github.com/maximbaz/yubikey-touch-detector/archive/$pkgver/yubikey-touch-detector-$pkgver.tar.gz
	yubikey-touch-detector.svg
	"
# !check: no tests provided
# net: needed for fetching go dependencies
options="!check net"

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

prepare() {
	default_prepare
	sed -i 's/GOFLAGS :=/GOFLAGS +=/' Makefile
}

build() {
	make GOFLAGS="$GOFLAGS -tags=netcgo -v"
}

package() {
	make DESTDIR="$pkgdir" install

	# Nothing useful
	rm -rf "$pkgdir"/usr/lib
	rm -rf "$pkgdir"/usr/share

	install -D -m644 "$srcdir"/yubikey-touch-detector.svg -t "$pkgdir"/usr/share/pixmaps/
}

sha512sums="
09c93b304a1c9cf5b761ba9d7af7d1c1dc456151b2371bcd0cdcc57aa2f4071851af6b30b11036c555bbfa4ffefcfc6d2d061afcc42b136756715360f60c9111  yubikey-touch-detector-1.11.0.tar.gz
4b37793b5ab01391ddc808d8a4cd1650f0fb971e582883f7ef9954d9c72d4f9968f0a32fed311fafaa08c5fc0f1880e25dbf2be698cb312ca8be3f8aac27998b  yubikey-touch-detector.svg
"
