# qtkeychain 0.16.0 — almacenamiento de credenciales para Qt (libqt6keychain.so). Campaña KDE (ADR 0011):
# el ADR ya lo listaba como "extra KDE" de Capa 1; plasma-nm lo exige
# (find_package(Qt6Keychain 0.16.0 CONFIG REQUIRED)) para guardar las claves WiFi.
#
# BUILD_WITH_QT6=ON (por defecto es OFF → buscaría Qt5). BUILD_TRANSLATIONS=OFF evita Qt6LinguistTools.
# **LIBSECRET_SUPPORT=OFF**: por defecto ON ⇒ pkg_check_modules(LIBSECRET REQUIRED libsecret-1) y aborta.
# libsecret es el llavero de GNOME; apagándolo queda el backend `KEYCHAIN_DBUS` = **kwallet vía Qt6DBus**,
# que es justamente el que usa KDE (kwallet ya está sellado) ⇒ cero deps nuevas.
# OJO: el tag de git es `0.16.0`, SIN prefijo `v` (v0.16.0 da 404).
name    = "qtkeychain"
version = "0.16.0"

[source]
tarball = "https://github.com/frankosterfeld/qtkeychain/archive/refs/tags/0.16.0.tar.gz"
sha256  = "3be26ec4ae30eecf0c2ff7572ba83799791b157c76e15a05ef35f23dc25e4054"

[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
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_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr \
  -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF -DBUILD_SHARED_LIBS=ON \
  -DBUILD_WITH_QT6=ON -DBUILD_TRANSLATIONS=OFF -DLIBSECRET_SUPPORT=OFF \
  -DBUILD_TEST_APPLICATION=OFF -DBUILD_QTQUICK_DEMO=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "qttools",
  "mesa", "libdrm", "libxkbcommon", "wayland"]
