# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ncspot
pkgver=1.1.2
pkgrel=0
pkgdesc="Cross-platform ncurses Spotify client inspired by ncmpc and the likes"
url="https://github.com/hrkfdn/ncspot"
# s390x: fails to build nix crate
# ppc64le: fails to build notify-rust crate
arch="all !s390x !ppc64le"
license="BSD-2-Clause"
makedepends="
	cargo
	cargo-auditable
	libxcb-dev
	ncurses-dev
	openssl-dev>3
	pulseaudio-dev
	python3
	"
source="https://github.com/hrkfdn/ncspot/archive/v$pkgver/ncspot-$pkgver.tar.gz
	cargo.lock.patch
	"
options="!check"  # there's only one unit test (in v0.8.1)

# Build with ncurses_backend instead of termion_backend, enable cover and share_selection.
_cargo_opts="
	--frozen
	--no-default-features
	--features share_clipboard,pulseaudio_backend,mpris,notify,cover,share_selection,ncurses_backend
	"

prepare() {
	default_prepare

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

build() {
	cargo auditable build $_cargo_opts --release
}

check() {
	cargo test $_cargo_opts
}

package() {
	install -D -m755 target/release/$pkgname -t "$pkgdir"/usr/bin/
}

sha512sums="
81f79f7fb92998faccf12482a029057ee80758fb522ec9d34427a193d5dd5c1ffe6390e3f327f8883e0d27925f715025e8eab16e80888326931c6bf4deced3ba  ncspot-1.1.2.tar.gz
cbaf3dc7fb4c0f789445c0abc46c9bf49fc82d71a8934f16f7aeef7423bbcd2e61717a8aeb949767c35db6c664ff8a574d747a03df27101fb758f544ac507b8f  cargo.lock.patch
"
