# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=yubikey-touch-detector
pkgver=1.12.2
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="
f8176e4c502c95713599c765db0fef80f94e9fbce59f874053afceca31a09420380f8c445311e6bdc56c784bd8e216d437e1cdab8bdd32cfdca3413b0c7e172d  yubikey-touch-detector-1.12.2.tar.gz
4b37793b5ab01391ddc808d8a4cd1650f0fb971e582883f7ef9954d9c72d4f9968f0a32fed311fafaa08c5fc0f1880e25dbf2be698cb312ca8be3f8aac27998b  yubikey-touch-detector.svg
"
