# NetworkManager 1.52.0 — libnm (libnm.so + libnm.pc + headers NetworkManager.h/nm-*.h). Campaña KDE
# (ADR 0011): destraba networkmanager-qt (KF6NetworkManagerQt) → plasma-nm, el applet de red. Era el
# "rabbit-hole libnm→glib" que plasma-workspace esquivó parcheando NetworkManagerQt a opcional.
#
# El tarball NO está en download.gnome.org (sólo llega a 1.9.x; NM migró) ⇒ git-archive de
# gitlab.freedesktop.org.
#
# **-Dcrypto=null es la clave**: NM ofrece crypto ∈ {nss, gnutls, null}; 'null' evita nss (→nspr/sqlite) y
# gnutls (→nettle/libtasn1/p11-kit), dos cadenas enormes. Sin cripto no valida certificados 802.1X, pero
# libnm compila y la API D-Bus que usa networkmanager-qt es completa.
#
# Deps DURAS de NM (dependency() sin required:false): libudev (→ libudev-zero YA sellado, da libudev.so.1
# + libudev.pc), libndp (receta nueva), gio-unix-2.0 (→ glib-shared, la deuda Capa 0 recién saldada).
# jansson/libpsl son required:false. Todo lo demás se apaga: sin daemon-extras (ovs/ppp/modem/wifi/nmtui/
# teamdctl/ofono/cloud-setup), sin systemd (session_tracking=no, journal off), sin polkit/selinux/audit,
# sin introspection/docs/tests/ebpf/firewalld.
name    = "networkmanager"
version = "1.52.0"

[source]
tarball = "https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/archive/1.52.0/NetworkManager-1.52.0.tar.gz"
sha256  = "2ebe60a1497a9650d58336b73413d838189b04543365b3dbc22e1eb8023d205f"

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

[build.phases]
configure = '''
# meson.build:92 hace `find_program('xsltproc')` INCONDICIONAL (required por defecto), pero xsltproc sólo
# se usa en man/meson.build (páginas de manual), que no se construye con -Ddocs=false. Se degrada a
# required:false y así se evita la receta libxslt entera. (sed DIRECTO: el sandbox usa busybox grep, que
# no soporta --include.)
sed -i "s/xsltproc = find_program('xsltproc')/xsltproc = find_program('xsltproc', required: false)/" meson.build
PYTHONPATH=/usr/lib/python3.12/site-packages meson setup output --prefix=/usr --buildtype=release \
  -Ddefault_library=shared \
  -Dld_gc=false -Dconcheck=false -Dnmcli=false -Dreadline=none \
  -Dcrypto=null \
  -Dsystemdsystemunitdir=no \
  -Dsession_tracking=no -Dsession_tracking_consolekit=false -Dsuspend_resume=consolekit \
  -Dpolkit=false -Dselinux=false -Dsystemd_journal=false -Dlibaudit=no \
  -Dwifi=false -Dppp=false -Dmodem_manager=false -Dovs=false -Dnmtui=false -Dnm_cloud_setup=false \
  -Dteamdctl=false -Dofono=false -Debpf=false -Dfirewalld_zone=false -Dlibpsl=false \
  -Dintrospection=false -Ddocs=false -Dtests=no -Dvapi=false \
  -Dconfig_dhcp_default=internal -Dqt=false
'''
compile = "PYTHONPATH=/usr/lib/python3.12/site-packages ninja -C output"
install = "PYTHONPATH=/usr/lib/python3.12/site-packages DESTDIR=/out meson install -C output --no-rebuild"

[deps]
build = ["meson", "samurai", "python3", "pkgconf", "glib-shared", "pcre2-shared", "libffi",
  "libudev-zero", "libndp", "libnl", "zlib-shared", "gettext-tiny", "libxml2", "util-linux", "perl", "dbus", "expat"]
