# plasma-workspace 6.7.2 — EL PAQUETE GRANDE del escritorio: contiene plasmashell, ksmserver, plasma-session,
# krunner (frontend), startplasma, krunner dbus, applets base, systray, kcms del shell, etc. Es el objetivo
# final de la campaña KDE (ADR 0011). Patrón KF6 (dynamic, wrapper zig filtra -Wl,--fatal-warnings) + Ninja.
#
# ===================== ESTADO: MUCHOS BLOQUEADORES DUROS (receta especulativa) =====================
# Se leyó el CMakeLists raíz completo + los 204 CMakeLists de subdirectorios. TODO find_package REQUIRED /
# pkg_check REQUIRED vive en la raíz (los subdirs no agregan REQUIRED nuevos; JOURNALD/libsystemd está tras
# if(SYSTEMD_FOUND), falso en musl → no bloquea). BLOQUEADORES que faltan por sellar (crear receta):
#
#  Qt6 (módulos no sellados):
#   - qtlocation      COMPONENT Location  → https://download.qt.io/official_releases/qt/6.11/6.11.1/submodules/qtlocation-everywhere-src-6.11.1.tar.xz
#                                            sha256 3791ce77299e6f600a593d0fbfa5bd32fbcfc2d16104782b84acc489e382e41b
#  Terceros (libs C/C++):
#   - qcoro (QCoro6 REQUIRED Core)       → https://github.com/qcoro/qcoro/archive/refs/tags/v0.12.0.tar.gz
#                                            sha256 809afafab61593f994c005ca6e242300e1e3e7f4db8b5d41f8c642aab9450fbc
#   - icu4c (ICU i18n uc, TYPE REQUIRED) → https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-src.tgz
#                                            sha256 588e431f77327c39031ffbb8843c0e3bc122c211374485fa87dc5f3faff24061
#   - libqalculate (QALCULATE>2.0 REQ)  → https://github.com/Qalculate/libqalculate/releases/download/v5.6.0/libqalculate-5.6.0.tar.gz
#                                            sha256 2d44130954f327e595af74d0d035f450b560e7997eceb9af16503456d5196f39
#   - libcanberra (Canberra REQUIRED)   → https://0pointer.de/lennart/projects/libcanberra/libcanberra-0.30.tar.xz
#                                            sha256 c2b671e67e0c288a69fc33dc1b6f1b534d07882c2aceed37004bf48c601afa72
#                                            (PARCHEABLE a opcional como kwin/knotifications, o sellar libcanberra)
#  Frameworks KF6 6.27.0 (COMPONENTS de find_package(KF6 REQUIRED)):
#   - kded             (KDED)             → https://download.kde.org/stable/frameworks/6.27/kded-6.27.0.tar.xz               sha256 4f24067915b05a1d0cc87e2c37f37eb0e8c441e8fccdf06ca27ee7b923058243
#   - prison           (Prison)           → https://download.kde.org/stable/frameworks/6.27/prison-6.27.0.tar.xz             sha256 760903e9ae401f8bcdb9efc9ad6548982642e7411a223c8ceb41e5491a6b1135
#   - krunner          (Runner)           → https://download.kde.org/stable/frameworks/6.27/krunner-6.27.0.tar.xz            sha256 46d06321bbccadb8f3fbb948ffaac5eff18dad9552fde677761ddddb9470202f
#   - kstatusnotifieritem (StatusNotifierItem) → https://download.kde.org/stable/frameworks/6.27/kstatusnotifieritem-6.27.0.tar.xz  sha256 a2eec2a981ed9da6cffc955cc21a50dcbc77141cbb840d915f92d1897442d239
#   - ktexteditor      (TextEditor)       → https://download.kde.org/stable/frameworks/6.27/ktexteditor-6.27.0.tar.xz        sha256 2b737a61737e73650cd0b40d9e246a182dcccc6c8ae8121cfcb9415433ee41ae
#  KDE Plasma 6.7.2 (libs no selladas, TYPE REQUIRED):
#   - plasma-activities-stats (PlasmaActivitiesStats) → https://download.kde.org/stable/plasma/6.7.2/plasma-activities-stats-6.7.2.tar.xz  sha256 1928355838356bcd59790701cb8d470849b0dc4bec183e3eae26d12f789459b4
#   - libksysguard    (KSysGuard REQUIRED) → https://download.kde.org/stable/plasma/6.7.2/libksysguard-6.7.2.tar.xz          sha256 6f7dbf058e453c6d2d643cf5cf25051aa0398fa3c8f3cb754bf2e46434d94cd7
#   - libkscreen      (KF6Screen REQUIRED) → https://download.kde.org/stable/plasma/6.7.2/libkscreen-6.7.2.tar.xz            sha256 408dc2753001a689cadfc77bdcc4a968baa385cae8dd8abce6c3ce422284d078
#   - networkmanager-qt (KF6NetworkManagerQt REQUIRED en LINUX) → https://download.kde.org/stable/frameworks/6.27/networkmanager-qt-6.27.0.tar.xz  sha256 a8193895b420d576fac228388ba8fd1b24d6f229c43b7963e2ed581ef82cad9a
#                                            (además exige NetworkManager runtime/headers)
#  Cadena X11-session (WITH_X11=ON, default; check_X11_lib hace SEND_ERROR si falta):
#   - libICE     → https://www.x.org/releases/individual/lib/libICE-1.1.2.tar.xz      sha256 974e4ed414225eb3c716985df9709f4da8d22a67a2890066bc6dfc89ad298625
#   - libSM      → https://www.x.org/releases/individual/lib/libSM-1.2.6.tar.xz       sha256 be7c0abdb15cbfd29ac62573c1c82e877f9d4047ad15321e7ea97d1e43d835be
#   - libXcursor → https://www.x.org/releases/individual/lib/libXcursor-1.2.3.tar.xz  sha256 fde9402dd4cfe79da71e2d96bb980afc5e6ff4f8a7d74c159e1966afb2b2c2c0
#   - libXft     → https://www.x.org/releases/individual/lib/libXft-2.3.9.tar.xz      sha256 60a25b78945ed6932635b3bb1899a517d31df7456e69867ffba27f89ff3976f5  (freetype+fontconfig, ambos con receta)
#   - libXtst    → https://www.x.org/releases/individual/lib/libXtst-1.2.5.tar.xz     sha256 b50d4c25b97009a744706c1039c598f4d8e64910c9fde381994e1cae235d9242
#  Región&Idioma KCM (mitigado abajo con -DGLIBC_LOCALE_GEN=OFF -DGLIBC_LOCALE_PREGENERATED=ON, que apaga
#   REGION_LANG_GENERATE_LOCALE_HELPER y evita el PolkitQt6-1 REQUIRED). Si se reactiva:
#   - polkit-qt-1 (PolkitQt6-1 REQUIRED) → https://download.kde.org/stable/polkit-qt-1/polkit-qt-1-0.200.0.tar.xz  sha256 5d3b611c062d2b76a93750bb10c907bfd21d1ff08d0a15dc2cf63e278e1677fb  (+ polkit)
#
#  De esta tanda (recetas nuevas, a su vez con blockers propios): kscreenlocker (KScreenLocker REQUIRED bajo
#   WITH_X11; blocker libkscreen+PAM) · layer-shell-qt (LayerShellQt REQUIRED, sin blockers).
#  Provistos por el catálogo: KWinDBusInterface ← kwin (sellado) · ScreenSaverDBusInterface ← kscreenlocker
#   (esta tanda) · Plasma/PlasmaQuick ← libplasma · KWayland ← kwayland · PlasmaActivities ← plasma-activities
#   · KNightTime ← knighttime · PlasmaWaylandProtocols · Wayland · UDev(libudev-zero) · ZLIB · DBus · XCB · X11(base).
#  RUNTIME/OPTIONAL (auto-OFF, NO bloquean el build; sellar para funcionalidad completa del escritorio):
#   - kirigami-addons (KF6KirigamiAddons) → https://download.kde.org/stable/kirigami-addons/kirigami-addons-1.9.0.tar.xz   sha256 21314a91f26b1c962def3fd7ff2e762d3358b075f63f4d7e0144fb2c63b7ebc7
#   - kquickcharts (KF6QuickCharts)       → https://download.kde.org/stable/frameworks/6.27/kquickcharts-6.27.0.tar.xz      sha256 d2a533bbf3d7f257e9306009bc32bdea41346cbd8e82d06c188879d5f0460380
#   - qqc2-desktop-style                  → https://download.kde.org/stable/frameworks/6.27/qqc2-desktop-style-6.27.0.tar.xz sha256 6c005f06c5f8c4ac349238abf14999bb917215a8f7b8c51364e2fdd12e9e6355
#   - breeze (Breeze OPTIONAL, deco/tema) → https://download.kde.org/stable/plasma/6.7.2/breeze-6.7.2.tar.xz                sha256 80818bf6382a96e1a45c755f983d98357c4f7163f80cb8217897df15f8a02785
#   - plasma-integration                  → https://download.kde.org/stable/plasma/6.7.2/plasma-integration-6.7.2.tar.xz    sha256 f1ce2c3fb0e07a4e0cd5e3d5566fb67e6063aaf435e8efb3402f7d65e1da95a4
#   - kpipewire (PipeWire QUIET, applets)→ https://download.kde.org/stable/plasma/6.7.2/kpipewire-6.7.2.tar.xz             sha256 68bd246f4d403d3d7f49bd2ffcd4e0d12bc55fa81554533f750ac2e4bb5aa61e
#   - KF6Baloo/KF6UserFeedback/AppStreamQt/PackageKitQt6/KExiv2Qt6/KIOExtras/KIOFuse/Flatpak/kirigami(RUNTIME).
#  NOTA: con -DWITH_X11=OFF -DWITH_X11_SESSION=OFF (experimental) se caen los 5 libX* de sesión, KScreenLocker
#   y XCB-AUX/CURSOR/RANDR/IMAGE; camino Wayland-puro, no probado aquí.
# ==================================================================================================
name    = "plasma-workspace"
version = "6.7.2"

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

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

[build.phases]
configure = '''
# rm -rf po: paquete ENORME con muchísimas traducciones; gettext-tiny msgfmt crashea (ver kwin). Inglés.
rm -rf po
# CAMINO WAYLAND-PURO (WITH_X11=OFF): cae la sesión X11 (libICE/libSM/libXcursor/libXft/libXtst) +
# kscreenlocker (bajo WITH_X11) + XCB AUX/CURSOR/RANDR/IMAGE. WITH_X11_SESSION=ON FUERZA WITH_X11=1
# (línea 172-174) ⇒ hay que apagar AMBOS.
# NetworkManagerQt: `if(LINUX) find_package(KF6NetworkManagerQt ... REQUIRED)` (esquiva libnm→glib).
# El código consumidor ya está tras `if(TARGET KF6::NetworkManagerQt)` (L443) ⇒ degrada limpio. Quitamos REQUIRED.
sed -i '/find_package(KF6NetworkManagerQt/ s/ REQUIRED)/)/' CMakeLists.txt
# Canberra: `find_package(Canberra)` (L133) no lleva REQUIRED pero `set_package_properties(Canberra ...
# TYPE REQUIRED)` (L134-136) lo hace obligatorio en feature_summary. Es cosmético ("preview notification
# sounds") ⇒ lo bajamos a OPTIONAL (acotado al bloque Canberra para no tocar el de Breeze que sigue).
sed -i '/set_package_properties(Canberra/,/)/ s/TYPE REQUIRED/TYPE OPTIONAL/' CMakeLists.txt
# xembed-sni-proxy: `ecm_optional_add_subdirectory(xembed-sni-proxy)` (L458) NO está gated por WITH_X11
# (oversight upstream) y linkea X11::Xtst, inexistente en Wayland-puro (WITH_X11=OFF) ⇒ falla el Generate.
# Es un shim SNI para apps XEmbed legacy (bandeja X11), irrelevante sin X11. Lo removemos.
sed -i '/ecm_optional_add_subdirectory(xembed-sni-proxy)/d' 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"
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 \
  -DWITH_X11=OFF -DWITH_X11_SESSION=OFF \
  -DGLIBC_LOCALE_GEN=OFF -DGLIBC_LOCALE_PREGENERATED=ON
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "qtdeclarative", "qtsvg", "qtshadertools",
  "qtwayland", "qtpositioning", "qttools", "dbus", "extra-cmake-modules", "gettext-tiny",
  "mesa", "libdrm", "libxkbcommon", "wayland", "wayland-protocols", "plasma-wayland-protocols",
  # Qt6 módulos (SELLADO):
  "qtlocation",
  # Terceros (SELLADOS; libcanberra=opcional en CMakeLists, fuera):
  "qcoro", "icu4c", "libqalculate", "libcanberra",
  # Frameworks KF6 COMPONENTS (SELLADOS):
  "kded", "prison", "krunner", "kstatusnotifieritem", "ktexteditor",
  # KDE Plasma libs (SELLADAS; networkmanager-qt patcheado a opcional, fuera):
  "plasma-activities-stats", "libksysguard", "libkscreen",
  # WAYLAND-PURO (WITH_X11=OFF): libICE/libSM/libXcursor/libXft/libXtst + kscreenlocker CAEN.
  "freetype", "fontconfig",
  # LayerShellQt REQUIRED (SELLADO):
  "layer-shell-qt", "kscreenlocker",
  # KF6 REQUIRED COMPONENTS ya sellados:
  "karchive", "kauth", "kcoreaddons", "kcrash", "kdbusaddons", "kdeclarative", "kglobalaccel",
  "kguiaddons", "kholidays", "ki18n", "kiconthemes", "kidletime", "kitemmodels", "kcmutils",
  "kio", "knewstuff", "knotifications", "kpackage", "kparts", "ksvg", "ktextwidgets", "kwallet",
  "kcolorscheme",
  # KDE Plasma / KF6 provistos por el catálogo (REQUIRED satisfechos):
  "libplasma", "kwayland", "plasma-activities", "knighttime", "kwin", "kirigami",
  # cierre transitivo KF6 tier1-4 (find_dependency de los Config.cmake anteriores):
  "kconfig", "kconfigwidgets", "kcodecs", "kcompletion", "kwidgetsaddons", "kitemviews",
  "kxmlgui", "syntax-highlighting", "qtspeech", "qtmultimedia",
  "sonnet", "kjobwidgets", "kbookmarks", "kservice", "attica", "solid", "kdnssd",
  "kfilemetadata", "kwindowsystem", "kglobalacceld", "kdecoration", "kplotting",
  "qtpositioning", "kholidays",
  "libgcrypt", "libgpg-error", "openssl", "util-linux", "zlib", "zstd",
  # SET X11 completo + XCB extras (WITH_X11 → X11 + XCB AUX/XCB/CURSOR/RANDR/IMAGE):
  "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",
  # sustrato de sistema:
  "libudev-zero", "pixman", "lcms2"]
