# pulseaudio-qt 1.8.1 — bindings Qt6 de PulseAudio (libKF6PulseAudioQt.so). Campaña KDE (ADR 0011):
# plasma-pa lo exige (find_package(KF6PulseAudioQt 1.6.0 REQUIRED)).
#
# pkg_check_modules(LIBPULSE libpulse REQUIRED) + libpulse-mainloop-glib ⇒ deps: pulseaudio (cliente) +
# glib-shared. Qt6 REQUIRED: Core Gui DBus; Qml/Quick opcionales (los damos: qtdeclarative).
name    = "pulseaudio-qt"
version = "1.8.1"

[source]
tarball = "https://download.kde.org/stable/pulseaudio-qt/pulseaudio-qt-1.8.1.tar.xz"
sha256  = "79619c55b94808aa7d307fb234ad39a1096d088f21f806be0e788be79a76b3c9"

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

[build.phases]
configure = '''
rm -rf po
ZW="$PWD/.zwrap"; mkdir -p "$ZW"
cat > "$ZW/cc"  <<'W'
#!/bin/sh
a=""; for x in "$@"; do [ "$x" = "-Wl,--fatal-warnings" ] && continue; a="$a $x"; done
exec /opt/zig/zig cc -mcpu=baseline $a
W
cat > "$ZW/cxx" <<'W'
#!/bin/sh
a=""; for x in "$@"; do [ "$x" = "-Wl,--fatal-warnings" ] && continue; a="$a $x"; done
exec /opt/zig/zig c++ -mcpu=baseline $a
W
chmod +x "$ZW/cc" "$ZW/cxx"
cmake -B build -G Ninja -Wno-dev \
  -DCMAKE_C_COMPILER="$ZW/cc" -DCMAKE_CXX_COMPILER="$ZW/cxx" -DCMAKE_ASM_COMPILER="$ZW/cc" \
  -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr \
  -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF -DBUILD_TESTING=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "extra-cmake-modules", "qttools",
  "gettext-tiny", "mesa", "libdrm", "libxkbcommon", "wayland", "qtdeclarative",
  "pulseaudio", "glib-shared", "pcre2-shared", "libffi", "libsndfile", "zlib-shared"]
