# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=songrec
pkgver=0.4.2
pkgrel=0
pkgdesc="Open-source Shazam client for Linux"
url="https://github.com/marin-m/SongRec"
# s390x fails to build
# riscv64: rust broken
# loongarch64: blocked by nix crate
arch="all !s390x !riscv64 !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="
46b45ec9585f4ac87d9fc514bdb59eeaa679a8980be83a2b833f2bec0859f2983711659b2d8c1962a695556af83dfb717a90fce44f2ee135bb44b49d094ae207  songrec-0.4.2.tar.gz
c5b082ced0b66d6451435901e2bffc82afa38c25b44eac7ad45032caece86d7297af02257904594f850900775a3a17946a21cce606cc4df3cae23f8a43695321  getrandom-0.2.10.patch
"
