# plasma-pa 6.7.2 — el APPLET DE VOLUMEN de Plasma (org.kde.plasma.volume + kcm_pulseaudio).
# Campaña KDE (ADR 0011). Cierra el frente de AUDIO, que el lab no tenía (libcanberra estaba sellado con
# backend NULL, sin reproducción). Cadena nueva completa:
#   alsa-lib/speexdsp/libsndfile → pulseaudio (cliente) → pulseaudio-qt → plasma-pa
#
# Canberra REQUIRED (libcanberra ya sellado). CanberraPulse/SoundThemeFreedesktop son opcionales.
# Kirigami/KirigamiAddons son RUNTIME. gio-2.0 REQUIRED → glib-shared.
name    = "plasma-pa"
version = "6.7.2"

[source]
tarball = "https://download.kde.org/stable/plasma/6.7.2/plasma-pa-6.7.2.tar.xz"
sha256  = "e58d83ed8f14919ac782336c335704e244f2128c63fd7508401e2cb99c8d6b43"

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

[build.phases]
configure = '''
rm -rf po doc
sed -i '/add_subdirectory(doc)/d' CMakeLists.txt
sed -i '/kdoctools_install/d' CMakeLists.txt
# DocTools marcado TYPE REQUIRED en set_package_properties → feature_summary aborta. A OPTIONAL.
sed -i '/set_package_properties(KF6DocTools/,/)/ s/TYPE REQUIRED/TYPE OPTIONAL/' CMakeLists.txt
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", "qtsvg", "dbus", "extra-cmake-modules",
  "qttools", "gettext-tiny", "mesa", "libdrm", "libxkbcommon", "wayland", "qtdeclarative",
  "pulseaudio", "pulseaudio-qt", "libcanberra", "libtool", "libogg", "libvorbis", "libsndfile",
  "glib-shared", "pcre2-shared", "libffi",
  "libplasma", "ksvg", "kcmutils", "kdeclarative", "kirigami", "kirigami-addons", "kpackage",
  "plasma-activities", "kstatusnotifieritem",
  "kconfig", "kcoreaddons", "kglobalaccel", "ki18n", "kdbusaddons",
  "kcolorscheme", "kcompletion", "kjobwidgets", "kservice", "kconfigwidgets", "kguiaddons",
  "kitemviews", "kcodecs", "kcrash", "karchive", "kbookmarks", "sonnet", "attica", "kauth",
  "icu4c", "kiconthemes", "kio", "kwindowsystem", "solid", "kwidgetsaddons", "kxmlgui",
  "zlib-shared", "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes",
  "libXi", "libxcb", "xcb-util", "xcb-util-keysyms", "xcb-util-wm", "xcb-util-image",
  "xcb-util-renderutil"]
