# libqrencode 4.1.1 — generador de códigos QR (libqrencode.so). Campaña KDE (ADR 0011): sustrato de
# prison (KF6 barcode), que a su vez alimenta KRunner/Plasma. C puro, CMake (4.1.1 trae CMakeLists.txt).
#
# WITH_TOOLS=NO: el ejecutable `qrencode` sólo lo usa la CLI de ejemplo y es lo único que necesita
# PNG::PNG (líneas 139-147 del CMakeLists); prison sólo enlaza la lib, así que sin tools no hace falta
# libpng (no sellado aún). WITHOUT_PNG=YES lo confirma. BUILD_SHARED_LIBS=ON (default del proyecto es
# NO → estático). find_package(PNG)/find_package(Iconv) NO son REQUIRED; iconv lo aporta musl.
name    = "qrencode"
version = "4.1.1"
license = "LGPL-2.1-or-later"

[source]
tarball = "https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz"
sha256  = "5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c"

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

[build.phases]
configure = '''
ZW="$PWD/.zwrap"; mkdir -p "$ZW"
printf '#!/bin/sh\nexec /opt/zig/zig cc -mcpu=baseline "$@"\n'  > "$ZW/cc"
printf '#!/bin/sh\nexec /opt/zig/zig c++ -mcpu=baseline "$@"\n' > "$ZW/cxx"
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_SHARED_LIBS=ON -DWITH_TOOLS=NO -DWITHOUT_PNG=YES -DWITH_TESTS=NO
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

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