# kinfocenter 6.7.2 — info del sistema (KCMs de hardware). Campaña KDE (ADR 0011).
# Patrón app/KCM-Plasma (dynamic, wrapper zig, ECM). Todas sus deps ya estaban selladas.
name    = "kinfocenter"
version = "6.7.2"

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

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

[build.phases]
configure = '''
rm -rf po doc
sed -i '/add_subdirectory(doc)/d' CMakeLists.txt
sed -i '/kdoctools_install/d' CMakeLists.txt
sed -i '/set_package_properties(KF6DocTools/,/)/ s/TYPE REQUIRED/TYPE OPTIONAL/' CMakeLists.txt
# El KCM about-distro ("Acerca de este sistema") incluye <QVulkanInstance>/<QVulkanFunctions> en sus
# helpers Y en GPUEntry.h: esos headers SÓLO existen si Qt6Gui se configuró con Vulkan, y nuestro qtbase
# sellado NO lo tiene. Se poda el KCM entero (deuda: página "Acerca de" ausente) en vez de re-configurar
# qtbase con vulkan, que cascadearía un rebuild de TODO el stack Qt/KF6/Plasma (horas).
sed -i '/add_subdirectory( *about-distro *)/d' kcms/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"
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_DOC=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "qtsvg", "dbus", "extra-cmake-modules",
  "qttools", "gettext-tiny", "mesa", "libdrm", "libxkbcommon", "wayland", "qtdeclarative",
  "kcmutils", "kdeclarative", "kirigami", "kpackage", "systemsettings", "libudev-zero", "kglobalaccel", "kiconthemes", "kdbusaddons", "knotifications", "kitemmodels", "libplasma", "ksvg", "plasma-activities", "krunner",
  "kcolorscheme", "kcompletion", "kcoreaddons", "kconfigwidgets", "kcodecs", "karchive", "kbookmarks",
  "sonnet", "attica", "icu4c", "kguiaddons", "kitemviews", "kwidgetsaddons", "kjobwidgets",
  "kconfig", "kcrash", "ki18n", "kio", "kservice", "solid", "kauth", "kwindowsystem", "kxmlgui",
  "zlib-shared", "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes",
  "libXi", "libxcb", "xcb-util", "xcb-util-keysyms", "xcb-util-wm", "xcb-util-image",
  "xcb-util-renderutil"]
