# Copyright 2019-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit go-module git-r3 desktop

EGO_PN="https://github.com/noisetorch/NoiseTorch"

go-module_set_globals
DESCRIPTION="Real-time microphone noise suppression on Linux."
HOMEPAGE="https://github.com/noisetorch/NoiseTorch"
EGIT_REPO_URI="https://github.com/noisetorch/${PN}"
EGIT_COMMIT="v${PV}"
#SRC_URI="https://github.com/noisetorch/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
#			${EGO_SUM_SRC_URI}"

BDEPEND=">=dev-lang/go-1.16"

# generated by dev-go/golicense
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"

src_compile() {
	emake
}

src_install() {
	setcap 'CAP_SYS_RESOURCE=+ep' bin/noisetorch
	dobin "bin/noisetorch"
	dodoc README.md
	newicon "${S}/assets/icon/noisetorch.png" NoiseTorch.png
	make_desktop_entry "noisetorch" "${PN^}" "${PN}" "Media" "Terminal=false"
}