# phonon 4.12.0 — framework multimedia de KDE (libphonon4qt6.so). Abstracción sobre backends de audio/
# video (vlc/gstreamer, RUNTIME). Campaña KDE (ADR 0011): gwenview lo exige REQUIRED (sonido de slideshow).
#
# CMake + wrapper zig. Se recorta a la lib Qt6 mínima: sin designer-plugin (Qt6Designer), sin experimental
# (Qt6Core5Compat), sin Qt5, sin settings-GUI. Sólo Core/Gui/Widgets. Sin backend: silencioso pero enlaza.
name    = "phonon"
version = "4.12.0"

[source]
tarball = "https://download.kde.org/stable/phonon/4.12.0/phonon-4.12.0.tar.xz"
sha256  = "3287ffe0fbcc2d4aa1363f9e15747302d0b080090fe76e5f211d809ecb43f39a"

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

[build.phases]
configure = '''
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 \
  -DPHONON_BUILD_QT5=OFF -DPHONON_BUILD_QT6=ON \
  -DPHONON_BUILD_EXPERIMENTAL=OFF -DPHONON_BUILD_DESIGNER_PLUGIN=OFF \
  -DPHONON_BUILD_DEMOS=OFF -DPHONON_BUILD_SETTINGS=OFF -DPHONON_BUILD_DOC=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "extra-cmake-modules", "qttools",
  "qt5compat", "gettext-tiny", "mesa", "libdrm", "libxkbcommon", "wayland",
  "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes", "libXi",
  "libxcb", "xcb-util", "xcb-util-keysyms", "xcb-util-wm", "xcb-util-image", "xcb-util-renderutil"]
