# pipewire 1.2.7 — servidor de multimedia (libpipewire-0.3.so + libspa). Campaña KDE (ADR 0011). Dos
# frentes lo necesitan:
#   1. **spectacle**: linkea K::KPipeWireRecord incondicionalmente → kpipewire → pipewire.
#   2. **audio real**: hoy sólo tenemos el CLIENTE libpulse; el servidor previsto por Plasma 6 es PipeWire.
#      (Además Plasma usa pipewire para compartir pantalla/portales.)
#
# Fuente del gitlab.freedesktop.org (como networkmanager/modemmanager).
# Recortado al core + SPA: sin bluez5 (cadena de códecs aptx/ldac/aac/opus enorme), sin jack/v4l2/
# libcamera/gstreamer/ffmpeg/vulkan/roc/lv2/avahi/x11/echo-cancel-webrtc/libusb/flatpak/snap.
# systemd/logind/selinux/rtkit off (no hay systemd acá). alsa=enabled + sndfile=enabled + libpulse=enabled
# (el emulador pulse: deja que los clientes libpulse hablen con pipewire) — las 3 ya selladas.
#
# SIN ncurses a propósito: la única consumidora es la tool `pw-top` (monitor de terminal), guardada por
# `if ncurses_dep.found()`. El ncurses del catálogo es static-only y su .pc arrastra `-static` al link ⇒
# "error: using shared libraries requires dynamic linking" al enlazar pw-top contra libpipewire-0.3.so.
# Quitando la dep, meson saltea pw-top y el resto construye.
name    = "pipewire"
version = "1.2.7"
license = "MIT"

[source]
tarball = "https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/1.2.7/pipewire-1.2.7.tar.gz"
sha256  = "e75568ed18bcbe75e9779af57cb9cc256fd7ebfaadc12bb347a0717055d1d3a9"

[build]
compiler = "zig-cc"
target   = "x86_64-linux-musl"
link     = "dynamic"
flags    = []

[build.phases]
configure = '''
PYTHONPATH=/usr/lib/python3.12/site-packages meson setup output --prefix=/usr --buildtype=release \
  -Ddefault_library=shared \
  -Ddocs=disabled -Dman=disabled -Dexamples=disabled -Dtests=disabled \
  -Dgstreamer=disabled -Dgstreamer-device-provider=disabled \
  -Dsystemd=disabled -Dlogind=disabled -Dsystemd-system-service=disabled \
  -Dsystemd-user-service=disabled -Dselinux=disabled -Dlegacy-rtkit=false \
  -Dpipewire-jack=disabled -Dpipewire-v4l2=disabled -Djack=disabled -Dv4l2=disabled \
  -Dlibcamera=disabled -Dbluez5=disabled -Dffmpeg=disabled -Dvulkan=disabled \
  -Droc=disabled -Dlv2=disabled -Davahi=disabled -Dx11=disabled -Dx11-xfixes=disabled \
  -Decho-cancel-webrtc=disabled -Dlibusb=disabled -Dflatpak=disabled -Dsnap=disabled \
  -Dlibmysofa=disabled -Dsdl2=disabled -Dopus=disabled -Dlibffado=disabled -Dcompress-offload=disabled \
  -Dlibcanberra=disabled -Dgsettings=disabled -Dreadline=disabled -Draop=disabled -Davb=disabled \
  -Dsession-managers=[] \
  -Dalsa=enabled -Dsndfile=enabled -Dlibpulse=enabled -Ddbus=enabled -Dudev=enabled \
  -Dpipewire-alsa=disabled \
  -Dspa-plugins=enabled -Daudioconvert=enabled -Daudiomixer=enabled -Dcontrol=enabled \
  -Dvideoconvert=enabled -Dsupport=enabled
'''
compile = "PYTHONPATH=/usr/lib/python3.12/site-packages ninja -C output"
install = "PYTHONPATH=/usr/lib/python3.12/site-packages DESTDIR=/out meson install -C output --no-rebuild"

[deps]
build = ["meson", "samurai", "python3", "pkgconf", "dbus", "expat", "alsa-lib", "libsndfile",
  "pulseaudio", "glib-shared", "pcre2-shared", "libffi", "libudev-zero", "zlib-shared",
  "gettext-tiny"]
