# kidletime 6.27.0 — KDE Frameworks 6 (Capa 2, ADR 0011). Detección de inactividad del usuario (KIdleTime).
# Campaña KDE: componente KF6::IdleTime que kwin exige (KF6 REQUIRED COMPONENTS IdleTime). Patrón KF6:
# dynamic, wrapper zig que filtra -Wl,--fatal-warnings, CMAKE_PREFIX_PATH=/usr.
# CMakeLists: WITH_X11=ON → X11 + XCB(SYNC) + X11_XCB; WITH_WAYLAND=ON → Qt6WaylandClient (qtwayland),
# Wayland, PlasmaWaylandProtocols>=1.6, WaylandProtocols>=1.27, Qt6GuiPrivate, Qt6DBus. SET X11 + qtwayland.
name    = "kidletime"
version = "6.27.0"

[source]
tarball = "https://download.kde.org/stable/frameworks/6.27/kidletime-6.27.0.tar.xz"
sha256  = "2cb0196ee3bb1b60be9bad14b4d04dfaf53b3d0017cd459083035c715910551b"

[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 \
  -DWITH_X11=ON -DWITH_WAYLAND=ON
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "extra-cmake-modules", "qttools",
  "qtwayland", "wayland", "wayland-protocols", "plasma-wayland-protocols", "mesa", "libdrm", "libxkbcommon",
  "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes", "libXi", "libxcb"]
