# prison 6.27.0 — KDE Frameworks 6 (ADR 0011). Generación de códigos de barras (KF6Prison), la usa el
# applet de compartir de Plasma / KDE Connect. CMakeLists: Qt6 Core+Gui + Quick (WITH_QUICK, sellado).
#
# ⛔ BLOCKER (dep no sellada): find_package(QRencode) es TYPE REQUIRED SIN guarda (siempre) →
#   necesita libqrencode. NO hay receta qrencode en el catálogo. Se necesita:
#     qrencode 4.1.1 → https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
#     (autotools/cmake, dep libpng sellado; fukuchi.org/works dio 404, usar el mirror de GitHub).
#   Apagamos los otros generadores para no arrastrar más deps no selladas:
#     WITH_DMTX=OFF (libdmtx), WITH_ZXING=OFF (ZXing C++), WITH_MULTIMEDIA=OFF (Qt Multimedia, no sellado).
#   Con qrencode sellado y estos OFF, prison construye limpio (Quick vía qtdeclarative). rm -rf po.
name    = "prison"
version = "6.27.0"

[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=OFF -DWITH_MULTIMEDIA=OFF -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"]
