# knotifications 6.27.0 — KDE Frameworks 6 (Capa 2 tier-2, ADR 0011). Patrón KF6: dynamic, wrapper zig que
# filtra -Wl,--fatal-warnings (ECM lo agrega, zig lo rechaza), CMAKE_PREFIX_PATH=/usr, ECM + qttools + dbus.
# Qt6Gui/Qml ⇒ qtdeclarative. Deps KF6: kconfig, kcoreaddons, kguiaddons.
# Canberra (backend de sonido) DESBLOQUEADO con patch: knotifications hace find_package(Canberra REQUIRED)
# incondicional en Linux (sin flag WITHOUT_SOUND), pero el código ya guarda -DHAVE_CANBERRA ⇒ el patch
# quita el REQUIRED y compila sin audio (libcanberra = stack alsa/pulse/vorbis, deuda audio diferida).
name    = "knotifications"
version = "6.27.0"

[source]
tarball = "https://download.kde.org/stable/frameworks/6.27/knotifications-6.27.0.tar.xz"
sha256  = "eeb067fab001dd24735ad56e8ec4808fca76e5ecdf003cf614246c9abe1c3e19"
patches = ["knotifications-canberra-optional.patch"]

[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 -DBUILD_PYTHON_BINDINGS=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "extra-cmake-modules", "qttools", "mesa", "libdrm", "libxkbcommon", "wayland", "qtdeclarative", "kconfig", "kcoreaddons", "kguiaddons"]
