# plasma5support 6.7.2 — biblioteca de compatibilidad/runtime (dataengines estilo Plasma 5, Plasma5Support::*).
# La consumen applets/plasmoids portados desde Plasma 5. Campaña KDE (ADR 0011), Capa Plasma.
# Patrón KF6 (dynamic, wrapper zig que filtra -Wl,--fatal-warnings, CMAKE_PREFIX_PATH=/usr) + Ninja.
#
# ===================== ESTADO: BLOQUEADOR DURO =====================
# find_package REQUIRED del CMakeLists (KF6 REQUIRED COMPONENTS ...):
#   - KF6UnitConversion (COMPONENT UnitConversion, dataengine Weather) → falta receta **kunitconversion**
#     (KDE Frameworks 6.27.0). BLOQUEADOR DURO: es COMPONENT de un find_package(KF6 REQUIRED), sin flag
#     para desactivar. Tarball: https://download.kde.org/stable/frameworks/6.27/kunitconversion-6.27.0.tar.xz
#     sha256 404e064114c95eca0ef759b96ca4e0ba5f9b8bc563138574358270963f3f5554
# Resto de KF6 REQUIRED COMPONENTS ya sellados: Config CoreAddons GuiAddons I18n Notifications Solid Service
#   IdleTime KIO Holidays. Qt6 REQUIRED: Core Gui Quick Sql Qml Widgets (todos qtbase/qtdeclarative).
# WITH_X11=ON (default) → find_package(X11 REQUIRED) para el dataengine mouse → SET X11.
# Opcionales auto-OFF: KSysGuard (devicenotifications), KF6NetworkManagerQt (geolocation), PlasmaActivities,
#   libgps (geolocation gps). PlasmaActivities lo incluyo igual (ya sellado).
# ===================================================================
name    = "plasma5support"
version = "6.7.2"
license = "LGPL-2.1-or-later OR LGPL-3.0-or-later"

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

[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"
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=ON
'''
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",
  # KF6 REQUIRED COMPONENTS (falta kunitconversion → bloqueador):
  "kconfig", "kcoreaddons", "kguiaddons", "ki18n", "knotifications", "solid", "kservice",
  "kidletime", "kio", "kholidays", "kunitconversion",
  "libplasma", "plasma-activities",
  # cierre transitivo KF6 (find_dependency de kio/libplasma/kservice/kholidays Config.cmake):
  "kcodecs", "kcolorscheme", "kconfigwidgets", "kcompletion", "kwidgetsaddons", "kitemviews",
  "kitemmodels", "karchive", "sonnet", "kjobwidgets", "kbookmarks", "kwindowsystem", "kcrash",
  "kdbusaddons", "kwallet", "kglobalaccel", "kiconthemes", "kdnssd", "kpackage", "kdeclarative",
  "attica", "libgcrypt", "libgpg-error", "openssl", "util-linux", "zlib", "zstd",
  # SET X11 completo (WITH_X11 → find_package(X11 REQUIRED); activado transitivamente por kwindowsystem/kio):
  "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"]
