# kdecoration 6.7.2 — KDE Plasma (Capa Plasma-foundation, ADR 0011). API de decoración de ventanas (la usa kwin).
# Patrón KF6/ECM: dynamic, wrapper zig que filtra -Wl,--fatal-warnings, CMAKE_PREFIX_PATH=/usr, ECM + qttools + dbus.
# Del CMakeLists (verificado en el árbol 6.7.2): Qt6 Core+Gui+Test (Test lo trae qtbase), KF6I18n REQUIRED.
# NO expone option(WITH_X11) ni toca X11 → NO lleva -DWITH_X11=OFF.
name    = "kdecoration"
version = "6.7.2"

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

[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", "gettext-tiny", "ki18n", "kcoreaddons", "kcodecs"]
