# powerdevil 6.7.2 — gestión de energía de Plasma (daemon org_kde_powerdevil + KCMs de batería/brillo).
# Campaña KDE (ADR 0011). Todas sus deps ya estaban selladas: Plasma(libplasma), PlasmaActivities,
# KF6Screen(libkscreen), LibKWorkspace(plasma-workspace), UDev(libudev-zero), XCB(RANDR/DPMS de libxcb),
# KF6Runner(krunner), KF6IdleTime(kidletime).
#
# qcoro-shared (NO el qcoro canónico): powerdevil linkea QCoro dentro de .so ⇒ necesita el PIC.
# KF6DocTools y DDCUtil (brillo de monitores externos por DDC/CI) son opcionales → se degradan.
name    = "powerdevil"
version = "6.7.2"

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

[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
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
'''
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",
  "wayland-protocols", "plasma-wayland-protocols", "qtwayland",
  "qcoro-shared", "libplasma", "plasma-activities", "libkscreen", "plasma-workspace", "libudev-zero",
  "ksvg", "kcmutils", "kdeclarative", "kirigami", "kirigami-addons", "kpackage", "krunner", "kidletime",
  "kauth", "kconfig", "kcrash", "kdbusaddons", "ki18n", "kitemmodels", "kglobalaccel", "kio",
  "knotifications", "solid", "kwindowsystem", "kxmlgui", "kwidgetsaddons",
  "kcolorscheme", "kcompletion", "kcoreaddons", "kjobwidgets", "kservice", "kconfigwidgets",
  "kguiaddons", "kitemviews", "kcodecs", "karchive", "kbookmarks", "sonnet", "attica",
  "icu4c", "kiconthemes", "kwallet", "plasma-activities-stats", "kglobalacceld", "kstatusnotifieritem",
  "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"]
