# kdeclarative 6.27.0 — KDE Frameworks 6 (Capa 3, ADR 0011). Integración QML ↔ KF6 (KQuickControls, config bindings).
# Patrón KF6: dynamic, wrapper zig que filtra -Wl,--fatal-warnings, CMAKE_PREFIX_PATH=/usr, ECM + qttools + dbus.
# Deps del CMakeLists:
#   Qt6 REQUIRED: Qml Quick Gui (qtdeclarative + qtbase) y Qt6 ShaderTools en src/qmlcontrols/graphicaleffects
#     (qtshadertools, sellado). ecm_find_qmlmodule(org.kde.ki18n REQUIRED) → módulo QML que instala ki18n.
#   KF6 REQUIRED: I18n, Config, GuiAddons; en Linux además GlobalAccel; salvo Android además WidgetsAddons.
#   Cierre transitivo (find_dependency): kcoreaddons, kcodecs, kcolorscheme, kwindowsystem, kcrash, kdbusaddons.
# NO depende de kio (verificado en el CMakeLists, pese a lo que sugería el brief).
# ki18n → gettext-tiny. kconfig se construyó con QML ⇒ qtdeclarative ya está.
# Sin option(WITH_X11); sin código X11 → sin -DWITH_X11=OFF.
name    = "kdeclarative"
version = "6.27.0"

[source]
tarball = "https://download.kde.org/stable/frameworks/6.27/kdeclarative-6.27.0.tar.xz"
sha256  = "b14e81143aed25ee62413f9c2b3742c558f5b6a1da6c5b92ca9a95bb6341e964"

[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"
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 -DBUILD_DESIGNERPLUGIN=OFF
'''
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", "qtshadertools", "ki18n", "kconfig", "kguiaddons", "kglobalaccel", "kwidgetsaddons", "kcoreaddons", "kcodecs", "kcolorscheme", "kwindowsystem", "kcrash", "kdbusaddons"]
