# kquickimageeditor 0.6.2.1 — editor de imágenes para QtQuick (org.kde.kquickimageeditor) + la API de
# ANOTACIONES. Campaña KDE (ADR 0011): spectacle lo marca TYPE REQUIRED (recorte/anotación de la captura).
#
# **La versión importa**: spectacle 6.7 incluye <KQuickImageEditor/AnnotationDocument>, que NO existe en
# 0.5.0 (esa serie no tiene src/annotations) ⇒ "fatal error: KQuickImageEditor/AnnotationDocument file not
# found". Hay que usar la serie 0.6.x. Esa serie además suma deps: KF6Config REQUIRED y OpenCV 4.7
# (core+imgproc, para el "stack blur" — WITH_OPENCV es TRUE por defecto en UNIX); ambas ya selladas.
name    = "kquickimageeditor"
version = "0.6.2.1"
license = "LGPL-2.1-or-later OR LGPL-3.0-or-later"

[source]
tarball = "https://download.kde.org/stable/kquickimageeditor/kquickimageeditor-0.6.2.1.tar.xz"
sha256  = "6d37a479463dcd16e4746d8b43d4adb05640e8b49056baabc82c865e2e1a4c85"

[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 -DBUILD_TESTING=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "extra-cmake-modules", "qttools",
  "gettext-tiny", "mesa", "libdrm", "libxkbcommon", "wayland", "qtdeclarative", "kirigami",
  "kconfig", "kcoreaddons", "opencv", "zlib-shared"]
