# kscreenlocker 6.7.2 — bloqueo/desbloqueo de pantalla de Plasma (greeter + kcheckpass, autenticación PAM).
# Lo requiere plasma-workspace (find_package(KScreenLocker REQUIRED) dentro de WITH_X11) y provee el
# ScreenSaverDBusInterfaceConfig.cmake que plasma-workspace también exige. Campaña KDE (ADR 0011), Capa Plasma.
# Patrón KF6 (dynamic, wrapper zig que filtra -Wl,--fatal-warnings, CMAKE_PREFIX_PATH=/usr) + Ninja.
#
# ===================== ESTADO: BLOQUEADORES DUROS =====================
# find_package REQUIRED del CMakeLists (raíz) NO cubiertos por el catálogo:
#   1. KF6Screen (find_package(KF6Screen REQUIRED)) → falta receta **libkscreen** (KDE Plasma 6.7.2).
#      BLOQUEADOR DURO, sin flag. Tarball: https://download.kde.org/stable/plasma/6.7.2/libkscreen-6.7.2.tar.xz
#      sha256 408dc2753001a689cadfc77bdcc4a968baa385cae8dd8abce6c3ce422284d078
#   2. PAM (find_package(PAM REQUIRED), desbloqueo/kcheckpass) → hay receta `recipes/linux-pam.toml`
#      (Linux-PAM 1.6.1, gcc) pero NO está sellada. ACCIÓN: sellarla y promoverla; luego provee libpam.
#      No hay flag para desactivar PAM (es el mecanismo de auth del locker).
# Cubiertos por el catálogo: PlasmaQuick (lo provee libplasma, ya sellado) · LayerShellQt (receta nueva
#   de esta tanda) · Qt6 DBus/Widgets/Quick · KF6 Crash/KCMUtils/KIO/GlobalAccel/I18n/IdleTime/Notifications/
#   Solid/WindowSystem/XmlGui/Svg (todos sellados) · X11 + XCB (XCB/KEYSYMS/UTIL/XTEST; XTEST=xcb-xtest de
#   libxcb) → SET X11 · Wayland + WaylandScanner (wayland).
# loginctl/ConsoleKit → RUNTIME (auto-OFF, no bloquea el build).
# ======================================================================
name    = "kscreenlocker"
version = "6.7.2"
license = "GPL-2.0-or-later"

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

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

[build.phases]
configure = '''
# rm -rf po preventivo (gettext-tiny msgfmt crashea con .po grandes; ver kwin). Locker sin traducciones (inglés).
rm -rf po
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"
PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig \
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", "qtdeclarative", "qtsvg",
  "dbus", "extra-cmake-modules", "qttools", "gettext-tiny",
  "mesa", "libdrm", "libxkbcommon", "wayland", "wayland-protocols",
  # nuevos de esta tanda / no sellados (bloqueadores):
  "layer-shell-qt", "libkscreen", "linux-pam",
  # KF6 REQUIRED COMPONENTS + PlasmaQuick (libplasma):
  "kcrash", "kcmutils", "kio", "kglobalaccel", "ki18n", "kidletime", "knotifications", "solid",
  "kwindowsystem", "kxmlgui", "ksvg", "libplasma", "kdeclarative", "kpackage",
  # cierre transitivo KF6 (find_dependency de kcmutils/kio/kxmlgui/libplasma Config.cmake):
  "kcoreaddons", "kconfig", "kconfigwidgets", "kcodecs", "kcolorscheme", "kcompletion",
  "kwidgetsaddons", "kitemviews", "kitemmodels", "karchive", "sonnet", "kjobwidgets",
  "kbookmarks", "kparts", "kguiaddons", "kiconthemes", "kservice", "kdbusaddons", "kdnssd",
  "kwallet", "attica", "kglobalacceld", "knewstuff", "plasma-activities", "kirigami",
  "libgcrypt", "libgpg-error", "openssl", "util-linux", "zlib", "zstd",
  # SET X11 completo (find_package(X11 REQUIRED) + XCB XCB/KEYSYMS/UTIL/XTEST):
  "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes", "libXi",
  "libxcb", "xcb-util", "xcb-util-cursor", "xcb-util-keysyms", "xcb-util-wm",
  "xcb-util-image", "xcb-util-renderutil"]
