# Forked from Alpine for systemd support

pkgname=wireplumber
pkgver=9990.5.8
_pkgver=0.5.8
pkgrel=0
pkgdesc="Session / policy manager implementation for PipeWire"
url="https://pipewire.org/"
arch="all"
license="LGPL-2.1-or-later"
depends_dev="
	systemd-dev
	glib-dev
	lua5.4-dev
	pipewire-dev>=0.3.39
	"
makedepends="$depends_dev
	doxygen
	graphviz
	meson
	"
checkdepends="
	dbus
	pipewire
	"
subpackages="
	$pkgname-dbg
	$pkgname-libs
	$pkgname-dev
	$pkgname-lang
	$pkgname-zsh-completion
	$pkgname-doc
	"
source="https://gitlab.freedesktop.org/PipeWire/wireplumber/-/archive/$_pkgver/wireplumber-$_pkgver.tar.gz"

provides="pipewire-session-manager"
provider_priority=50
install="$pkgname.post-install $pkgname.pre-deinstall"
builddir="$srcdir/$pkgname-$_pkgver"

case "$CARCH" in
s390x)
	# probably broken here, but we want this just so pipewire is installable
	options="$options !check"
	;;
armv7|armhf)
	# Tests fail in BPO, probably related to QEMU since they seem to pass
	# for the pipewire package in Alpine for these arches.
	options="$options !check"
	;;
esac

build() {
	abuild-meson \
		-Db_lto=true \
		-Dsystem-lua=true \
		-Dsystemd=enabled \
		-Dsystemd-user-service=true\
		-Dtests="$(want_check && echo true || echo false)" \
		. output
	meson compile -C output
}

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

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

sha512sums="
8fa1b3acd6abf6e18c473f7abcb148946e53632feb7d1c1f3b5c32a84b85019092d38c8b500266ab8f5aef82331256d45561dbc72fa963577a2791ed99a344c4  wireplumber-0.5.8.tar.gz
"
