# Contributor: Newbyte <newbie13xd@gmail.com>
# Maintainer: Newbyte <newbie13xd@gmail.com>
pkgname=amberol
pkgver=2024.2
pkgrel=0
pkgdesc="Plays music, and nothing else"
url="https://gitlab.gnome.org/World/amberol"
# s390x, loongarch64: fails to build
arch="all !s390x !loongarch64"
license="GPL-3.0-or-later"
depends="
	gst-libav
	gst-plugins-bad
	gst-plugins-good
	"
makedepends="
	cargo
	dbus-dev
	desktop-file-utils
	gmp-dev
	gst-plugins-bad-dev
	gst-plugins-base-dev
	gstreamer-dev
	libadwaita-dev
	m4
	meson
	mpfr-dev
	"
checkdepends="
	bash
	grep
	"
subpackages="$pkgname-lang"
source="
	https://gitlab.gnome.org/World/amberol/-/archive/$pkgver/amberol-$pkgver.tar.gz
	no-cargo-home.patch
	"
options="net" # needed for downloading dependencies

export CARGO_FEATURE_USE_SYSTEM_LIBS=1 # gmp-mpfr-sys links to gmp-dev and mpfr-dev

prepare() {
	default_prepare

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

build() {
	# without buildtype=release it builds debug
	abuild-meson \
		--buildtype=release \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
c34fbceb16b07bb8e20e750a38f5ffacb4143c4cf1c2ad3985ea15fb8661c834c88aaf567fe02bcc776afd6d6166d1ee3439ec69aed3eb10211e3e97d5831b8a  amberol-2024.2.tar.gz
2c4b7433f27b18bbb428bdc2053cda53f10e958a2045499ab7af6102df9610822cf36a82636cd5b9501ba4e204aeddc18fcdb79aff773657a9a5a3c1aeba8e95  no-cargo-home.patch
"
