# Forked from Alpine for systemd support
maintainer=""
pkgname=wireplumber
_pkgver=0.5.13
pkgver=9999$_pkgver
pkgrel=0
pkgdesc="Session / policy manager implementation for PipeWire"
url="https://pipewire.org/"
# armhf: pmb#2618
arch="all !armhf"
license="LGPL-2.1-or-later"
options="!pmb:crossdirect"
depends_dev="
	systemd-dev
	glib-dev
	lua5.4-dev
	pipewire-dev>=0.3.39
	"
makedepends="$depends_dev
	doxygen
	gobject-introspection-dev
	graphviz
	meson
	py3-lxml
	"
checkdepends="
	dbus
	pipewire
	"
subpackages="
	$pkgname-dbg
	$pkgname-libs
	$pkgname-dev
	$pkgname-lang
	$pkgname-zsh-completion
	$pkgname-doc
	$pkgname-systemd
	"
source="https://gitlab.freedesktop.org/PipeWire/wireplumber/-/archive/$_pkgver/wireplumber-$_pkgver.tar.gz"

provides="pipewire-session-manager"
provider_priority=50
builddir="$srcdir/$pkgname-$_pkgver"

case "$CARCH" in
s390x)
	# probably broken here, but we want this just so pipewire is installable
	options="$options !check"
	;;
esac

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

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

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

sha512sums="
7eade5a372cb67adca205bc85e4da0ed689d6e0fef5b44d78dc73303a1bba1bc106c19338838c700ae2332c75d05e2eb187f9d89b489baefca3ccc1b92e5d62b  wireplumber-0.5.13.tar.gz
"
