# pipewire - Audio and video server
#
# session-managers=[]: pipewire otherwise pulls wireplumber in as a meson
# subproject and builds it inside this package, which collides with the
# wireplumber package built separately ("Subproject wireplumber is buildable").
name=pipewire
version=1.6.2
release=1
desc="Audio and video server"
url="https://pipewire.org/"
license="MIT"
depend="glibc alsa-lib dbus libsndfile libusb"
makedepend="meson ninja"
source="https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/1.6.2/pipewire-1.6.2.tar.gz"
sha256="SKIP"

build() {
	cd "pipewire-1.6.2"
	# pipewire compiles its bundled PulseAudio compatibility layer with
	# -Werror=discarded-qualifiers, and its own compat.h drops const in
	# pa_path_get_filename(). Newer compilers make that fatal; the code is
	# upstream's and works, so downgrade that one check rather than patch it.
	CFLAGS="$CFLAGS -Wno-error=discarded-qualifiers"
	export CFLAGS
	meson setup build \
		--prefix=/usr \
		--libdir=/usr/lib \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--buildtype=release \
		--wrap-mode=nodownload \
		-Db_lto=true \
		-Dsession-managers=[] \
		-Ddocs=disabled \
		-Dman=disabled \
		-Dtests=disabled
	ninja -C build -j"$JOBS"
}

package() {
	cd "pipewire-1.6.2"
	DESTDIR="$pkgdir" ninja -C build install
}
