# prison-scanner 6.27.0 — variante de prison CON el componente **Scanner** (KF6PrisonScanner).
# El prison canónico de esta cola se selló con WITH_ZXING=OFF/WITH_MULTIMEDIA=OFF (no había ZXing ni se
# quería Qt Multimedia) ⇒ NO provee KF6::PrisonScanner. spectacle lo exige duro:
#     if (NOT TARGET KF6::PrisonScanner) message(SEND_ERROR "Prison built without required PrisonScanner")
# Esta variante activa WITH_ZXING=ON (receta zxing-cpp nueva) + WITH_MULTIMEDIA=ON (qtmultimedia ya
# sellado). Nombre distinto para NO re-hashear el prison que ya consumen plasma-workspace/plasma-nm
# (mismo patrón que kcoreaddons-QML / kwindowsystem-QML / qcoro-shared).
name    = "prison-scanner"
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/prison-6.27.0.tar.xz"
sha256  = "760903e9ae401f8bcdb9efc9ad6548982642e7411a223c8ceb41e5491a6b1135"

[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 \
  -DWITH_DMTX=OFF -DWITH_ZXING=ON -DWITH_MULTIMEDIA=ON -DWITH_QUICK=ON \
  -DBUILD_TESTING=OFF -DBUILD_PYTHON_BINDINGS=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

# NOTA: falta "qrencode" en [deps].build (sellar primero, ver cabecera). Con él añadido, construye.
[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "extra-cmake-modules", "qttools", "mesa", "libdrm", "libxkbcommon", "wayland", "gettext-tiny", "qtdeclarative", "qrencode", "zxing-cpp", "qtmultimedia"]
