# spectacle 6.7.2 — la herramienta de CAPTURA DE PANTALLA de Plasma. Campaña KDE (ADR 0011).
# Captura en Wayland es notoriamente difícil: no hay X11 grab; va por los protocolos de KWin
# (plasma-wayland-protocols + layer-shell-qt) y/o portales. **NO está en release-service** (migró): vive
# en download.kde.org/stable/plasma/.
#
# Es la app más cara de la campaña en deps nuevas. Todo REQUIRED, casi nada degradable:
#   - **kpipewire** (→ pipewire → ffmpeg + libva): src/CMakeLists.txt:101 linkea `K::KPipeWireRecord`
#     INCONDICIONALMENTE. Degradar KPipeWire a TYPE OPTIONAL con sed NO alcanza (el link es duro).
#   - **opencv** (core+imgproc): find_package(OpenCV 4.7 REQUIRED), lo usa src/QtCV.h.
#   - **prison-scanner** (+zxing-cpp): corta con SEND_ERROR si falta KF6::PrisonScanner, y el prison
#     canónico va con WITH_ZXING=OFF/WITH_MULTIMEDIA=OFF.
#   - **tesseract** (+leptonica): pkg_check_modules(TESSERACT REQUIRED) en CMakeLists:111, sin option().
#   - **kquickimageeditor**: TYPE REQUIRED (recorte/anotación).
#   - **xcb-util-cursor**: sin él, "No suitable backend platform was found ... XCB-CURSOR".
name    = "spectacle"
version = "6.7.2"
license = "GPL-2.0-or-later"

[source]
tarball = "https://download.kde.org/stable/plasma/6.7.2/spectacle-6.7.2.tar.xz"
sha256  = "24d2cd02296401538f0ac7736804b071b9e9f516a8ad58a4b821411bc15642a3"

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

[build.phases]
configure = '''
rm -rf po doc
sed -i '/add_subdirectory(doc)/d' CMakeLists.txt
sed -i '/kdoctools_install/d' CMakeLists.txt
sed -i '/set_package_properties(KF6DocTools/,/)/ s/TYPE REQUIRED/TYPE OPTIONAL/' CMakeLists.txt
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", "qtsvg", "dbus", "extra-cmake-modules",
  "qttools", "gettext-tiny", "mesa", "libdrm", "libxkbcommon", "wayland", "qtdeclarative",
  "wayland-protocols", "plasma-wayland-protocols", "qtwayland", "layer-shell-qt", "qtmultimedia",
  "opencv", "prison-scanner", "zxing-cpp", "qt5compat",
  "tesseract", "leptonica", "kquickimageeditor", "libpng-shared", "libjpeg-turbo-shared",
  "kpipewire", "pipewire", "ffmpeg", "libva", "libepoxy", "kwayland",
  "kcoreaddons", "kwidgetsaddons", "kdbusaddons", "knotifications", "kconfig", "ki18n", "kio",
  "kwindowsystem", "kglobalaccel", "kxmlgui", "kguiaddons", "kirigami", "kirigami-addons",
  "kstatusnotifieritem", "kcrash", "kpackage",
  "kcolorscheme", "kcompletion", "kjobwidgets", "kservice", "kconfigwidgets", "kitemviews",
  "kcodecs", "karchive", "kbookmarks", "sonnet", "attica", "icu4c", "kiconthemes", "solid",
  "kauth", "kitemmodels",
  "zlib-shared", "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes",
  "libXi", "libxcb", "xcb-util", "xcb-util-keysyms", "xcb-util-wm", "xcb-util-image",
  "xcb-util-cursor",
  "xcb-util-renderutil"]
