# zxing-cpp 2.3.0 — decodificador/codificador de códigos de barras y QR (libZXing.so). Campaña KDE
# (ADR 0011): lo exige el componente **Scanner** de prison, y spectacle exige KF6::PrisonScanner
# (`if (NOT TARGET KF6::PrisonScanner) message(SEND_ERROR ...)`).
#
# Wrapper zig PASS-THROUGH con "$@" (el clásico splitea args con espacios; ver opencv).
# READERS **y** WRITERS: prison no sólo escanea, también GENERA códigos — su zxingutil.cpp/pdf417barcode.cpp
# incluyen <ZXing/BitMatrix.h>, que es del lado writers; con ZXING_WRITERS=OFF ese header ni se instala.
# Sin examples/tests/python.
name    = "zxing-cpp"
version = "2.3.0"

[source]
tarball = "https://github.com/zxing-cpp/zxing-cpp/archive/refs/tags/v2.3.0.tar.gz"
sha256  = "64e4139103fdbc57752698ee15b5f0b0f7af9a0331ecbdc492047e0772c417ba"

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

[build.phases]
configure = '''
ZW="$PWD/.zwrap"; mkdir -p "$ZW"
cat > "$ZW/cc"  <<'W'
#!/bin/sh
exec /opt/zig/zig cc -mcpu=baseline "$@"
W
cat > "$ZW/cxx" <<'W'
#!/bin/sh
exec /opt/zig/zig c++ -mcpu=baseline "$@"
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_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr \
  -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF -DBUILD_SHARED_LIBS=ON \
  -DZXING_READERS=ON -DZXING_WRITERS=ON -DZXING_EXAMPLES=OFF -DZXING_BLACKBOX_TESTS=OFF \
  -DZXING_UNIT_TESTS=OFF -DZXING_PYTHON_MODULE=OFF -DZXING_C_API=OFF -DZXING_EXPERIMENTAL_API=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf"]
