# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit go-module

DESCRIPTION="A tool to detect when your YubiKey is waiting for a touch"
HOMEPAGE="https://github.com/max-baz/yubikey-touch-detector"
SRC_URI="https://github.com/max-baz/yubikey-touch-detector/releases/download/${PV}/${P}-vendored.tar.gz"

LICENSE="ISC"
SLOT="0"
KEYWORDS="~amd64"
IUSE="man"

RDEPEND="
	app-crypt/gpgme
	sys-apps/dbus
"
DEPEND="${RDEPEND}"
BDEPEND="man? ( app-text/scdoc )"

src_compile() {
	ego build -o ${PN} main.go
	if use man; then
		scdoc < ${PN}.1.scd > ${PN}.1 || die
	fi
}

src_install() {
	dobin ${PN}
	use man && doman ${PN}.1
}