# Contributor: John Gebbie <me@johngebbie.com>
# Maintainer: John Gebbie <me@johngebbie.com>
pkgname=sprec
pkgver=0.1
pkgrel=5
pkgdesc="Speech recognition command"
url="https://sr.ht/~geb/sprec"
# limited by vosk-api
arch="x86_64 aarch64 armv7"
license="GPL-3.0-only"
makedepends="go scdoc vosk-api-dev"
checkdepends="vosk-model-small-en-us"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~geb/sprec/archive/$pkgver.tar.gz"
options="net" # golang

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

build() {
	export SPREC_VERSION="$pkgver"
	./build.sh
}

check() {
	[ "$(./sprec < test.wav)" = 'final 1: hello world' ]
}

package() {
	export SPREC_DESTDIR="$pkgdir"
	export SPREC_BINDIR=usr/bin
	./build.sh install
}

sha512sums="
28f3b93aa386110f25e9fea7ddbce617550308adcb6d027e1c46bb5b134ea02ea54679438847a904abbcdc26461651cb6bc4824b121971caa7f7933756cfa839  sprec-0.1.tar.gz
"
