# libksysguard 6.7.2 — Plasma (ADR 0011). Backend de monitor de sistema (procesos, sensores, red) que
# usan el widget de recursos y plasma-systemmonitor. CMakeLists: Qt6 DBus+Network+Widgets+Qml+Quick +
# KF6 CoreAddons Config I18n Auth Service Package NewStuff Solid (REQUIRED) + ZLIB REQUIRED + Libdrm
# REQUIRED (mesa/libdrm sellado). Opcionales AUTO-OFF (find_package sin REQUIRED): NL(libnl), libpcap,
# Libcap, Sensors(lm_sensors), UDev → sin ellos se apagan las features de red/sensores, NO bloquean.
# KNewStuff/Package/Kirigami arrastran el cierre KF6 completo. SET X11 (kwindowsystem transitivo). rm -rf po.
name    = "libksysguard"
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/libksysguard-6.7.2.tar.xz"
sha256  = "6f7dbf058e453c6d2d643cf5cf25051aa0398fa3c8f3cb754bf2e46434d94cd7"

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

[build.phases]
configure = '''
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"
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 -DCMAKE_AUTOMOC_MOC_OPTIONS=-D__linux__=1
'''
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", "qtdeclarative", "zlib", "kcoreaddons", "kconfig", "ki18n", "kauth", "kservice", "kpackage", "knewstuff", "solid", "kirigami", "kwidgetsaddons", "kwindowsystem", "kcompletion", "kconfigwidgets", "kcodecs", "kcolorscheme", "kguiaddons", "kiconthemes", "kitemviews", "karchive", "kio", "kxmlgui", "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes", "libXi", "libxcb", "attica", "libudev-zero", "libpcap", "libnl", "lm-sensors"]
