# syntax-highlighting 6.27.0 — KDE Frameworks 6 (KSyntaxHighlighting, KF6::SyntaxHighlighting).
# Campaña KDE (ADR 0011): sustrato de ktexteditor (el motor de Kate/KWrite) y de KTextEditor-consumers.
# Molde KF6 (kxmlgui): dynamic, wrapper zig que filtra -Wl,--fatal-warnings, CMAKE_PREFIX_PATH=/usr, ECM.
#
# find_package del CMakeLists: Qt6 Core+Network+Test REQUIRED, Qt6::Gui REQUIRED (KSYNTAXHIGHLIGHTING_USE_GUI
# ON por defecto), Qt6::Quick OPCIONAL (→ qtdeclarative, para los bindings QML). PrintSupport/Widgets sólo
# para el ejemplo (BUILD_TESTING=OFF los evita). XercesC/Python OPCIONALES (omitidos).
#
# ⚠️ find_package(Perl REQUIRED): perl regenera las definiciones de sintaxis (data/generators/*.pl,
# PHP auto-gen). Es dep de build DURA. 'perl' NO está sellado todavía → esta receta NO construye hasta
# tener recipes/…/perl. Es el único blocker nuevo de esta pieza.
#
# rm -rf po poqm: no hay carpeta po en 6.27.0, pero se limpia poqm defensivamente (gettext-tiny/msgfmt
# crashea con catálogos grandes; ecm_install_po_files_as_qm(poqm) quedaría inerte).
name    = "syntax-highlighting"
version = "6.27.0"
license = "LGPL-2.1-or-later OR LGPL-3.0-or-later"

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

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

[build.phases]
configure = '''
rm -rf po poqm
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
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

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