# Maintainer: Integral <integral@member.fsf.org>

pkgname=tenere
pkgver=0.11.3
pkgrel=2
pkgdesc="TUI interface for LLMs written in Rust"
arch=('x86_64' 'aarch64' 'riscv64')
url="https://github.com/pythops/${pkgname}"
license=('GPL-3.0-or-later')
depends=('libgcc' 'zlib' 'oniguruma')
makedepends=('cargo')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('3605fcdff3dbd5d153ed6126e98274994bd00ed83a2a1f5587058d75797257a8')
options=('!lto')

prepare() {
	cd "${pkgname}-${pkgver}/"
	cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}

build() {
	cd "${pkgname}-${pkgver}/"
	RUSTONIG_DYNAMIC_LIBONIG=1 cargo build --frozen --release --all-features
}

check() {
	cd "${pkgname}-${pkgver}/"
	RUSTONIG_DYNAMIC_LIBONIG=1 cargo test --frozen --all-features
}

package() {
	cd "${pkgname}-${pkgver}/"
	install -Dm755 "target/release/${pkgname}" -t "${pkgdir}/usr/bin/"
	install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}
