# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=songrec
pkgver=0.4.3
pkgrel=0
pkgdesc="Open-source Shazam client for Linux"
url="https://github.com/marin-m/SongRec"
# s390x fails to build
# loongarch64: blocked by nix crate
arch="all !s390x !loongarch64"
license="GPL-3.0-only"
makedepends="
	alsa-lib-dev
	cargo
	cargo-auditable
	gdk-pixbuf-dev
	glib-dev
	gtk+3.0-dev
	openssl-dev>3
	pango-dev
	pulseaudio-dev
	"
source="https://github.com/marin-m/songrec/archive/$pkgver/songrec-$pkgver.tar.gz
	getrandom-0.2.10.patch
	"
# net required to download Rust dependencies
# no tests
options="net !check"
builddir="$srcdir/SongRec-$pkgver"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/songrec -t "$pkgdir"/usr/bin/
	mv packaging/rootfs/usr/share "$pkgdir"/usr
}

sha512sums="
f5598c22cc41693f4ddb15f495122fb1cec5033f363ae4858407cc673861e613153a0db2dafcd7684281a90ea4f5ac4849107158cbc2b3d297ef4ff24fb629a8  songrec-0.4.3.tar.gz
c5b082ced0b66d6451435901e2bffc82afa38c25b44eac7ad45032caece86d7297af02257904594f850900775a3a17946a21cce606cc4df3cae23f8a43695321  getrandom-0.2.10.patch
"
