# ktexteditor 6.27.0 — KDE Frameworks 6 (ADR 0011). Motor de edición de texto (KF6TextEditor / Kate
# part). Lo consumen apps de Plasma y editores.
#
# ⛔ DOBLE BLOCKER (deps no selladas, ambas REQUIRED en CMakeLists):
#   1) find_package(KF6SyntaxHighlighting REQUIRED) — framework KF6 no sellado. Se necesita:
#        syntax-highlighting 6.27.0 →
#        https://download.kde.org/stable/frameworks/6.27/syntax-highlighting-6.27.0.tar.xz
#        sha256 = cbff001b9f00d032feb254313ecfee9a6e0a0b3c5a8c82a7e0806c5f1915a545
#        (CMake+ECM, molde kxmlgui; deps: qtbase + Qt Xml/Gui, sin blockers conocidos → sellable ya).
#   2) find_package(Qt6 ... TextToSpeech) REQUIRED (línea 57) — módulo Qt Speech (qtspeech) no sellado.
#        qtspeech 6.11.1 → https://download.qt.io/official_releases/qt/6.11/6.11.1/submodules/qtspeech-everywhere-src-6.11.1.tar.xz
#        (backend flite/speechd; puede necesortar más deps de audio — evaluar).
#   Opcionales: EditorConfig (find_package sin REQUIRED → off), KAuth (ENABLE_KAUTH, kauth sellado).
#   Deps KF6 REQUIRED selladas: KIO Parts Archive Config GuiAddons I18n Sonnet ColorScheme (+ cierre kio).
#   Qt: Core Widgets Qml PrintSupport. WITH: rm -rf po. NO construye hasta sellar (1) y (2).
name    = "ktexteditor"
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/ktexteditor-6.27.0.tar.xz"
sha256  = "2b737a61737e73650cd0b40d9e246a182dcccc6c8ae8121cfcb9415433ee41ae"

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

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

# NOTA: faltan "ksyntaxhighlighting" y "qtspeech" en [deps].build (sellar primero, ver cabecera).
[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "extra-cmake-modules", "qttools", "mesa", "libdrm", "libxkbcommon", "wayland", "gettext-tiny", "qtdeclarative", "qtsvg", "kio", "kparts", "karchive", "kconfig", "kguiaddons", "ki18n", "sonnet", "kcolorscheme", "kauth", "kcoreaddons", "kwidgetsaddons", "kcodecs", "kservice", "kcompletion", "kconfigwidgets", "kwindowsystem", "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes", "libXi", "libxcb", "syntax-highlighting", "qtspeech", "qtmultimedia", "kbookmarks", "kitemviews", "ktextwidgets", "kjobwidgets", "kiconthemes", "solid", "kglobalaccel", "kcrash", "kdbusaddons", "kxmlgui", "knotifications", "kwallet", "libgcrypt", "libgpg-error", "openssl", "util-linux", "zlib"]
