# kcoreaddons 6.27.0 — framework KF6 tier-1 más fundamental (KAboutData, KFormat, KJob, KProcess…).
# Solo Qt6Core + ECM; base de casi todo KF6. Campaña KDE (ADR 0011), Capa 2. Patrón KF6 = patrón módulo
# Qt (dynamic, wrappers zig, CMAKE_PREFIX_PATH=/usr) + dep extra-cmake-modules. QML bindings / python /
# docs apagados. Core-only ⇒ sin el set Gui (mesa/xkb/wayland).
name    = "kcoreaddons"
version = "6.27.0"

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

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

[build.phases]
configure = '''
# Wrapper zig que FILTRA -Wl,--fatal-warnings: ECM (KDECompilerSettings) lo agrega y el linker de zig
# lo rechaza ("unsupported linker arg"). Patrón KF6 (todos los frameworks usan ECM).
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 \
  -DKCOREADDONS_USE_QML=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "extra-cmake-modules", "util-linux", "qttools", "qtdeclarative", "mesa", "libdrm", "libxkbcommon", "wayland"]
