PKGNAME=networkmanager
PKGSEC=admin
PKGDES="Linux network configuration tool suite"
PKGDEP="systemd nss dbus-glib util-linux iproute2 libnl polkit \
        wpa-supplicant modemmanager newt libndp iwd libteam"
PKGDEP__RETRO="systemd util-linux iproute2 libnl wpa-supplicant newt libndp"
PKGSUG__RETRO="modemmanager"
BUILDDEP__COMMON="pygobject-3 vala intltool gobject-introspection \
          ofono vim llvm kernel-tools"
BUILDDEP="${BUILDDEP__COMMON} llvm kernel-tools"
BUILDDEP__RETRO="intltool libxslt modemmanager"

# FIXME: FTBFS on loongson3 with BPF
# /usr/include/asm/byteorder.h:17:3: error: "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
#   17 | # error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
#      |   ^
BUILDDEP__LOONGSON3="${BUILDDEP__COMMON}"

ABTYPE=meson

# Note: We still use wpa_supplicant by default, we find it more reliable.
# Note: `wext` is deprecated and to be removed in the future
# Note: `modify_system=true` is deprecated and to be removed in the future
MESON_AFTER=(
    '-Dsession_tracking_consolekit=false'
    '-Dsession_tracking=systemd'
    '-Dsuspend_resume=systemd'
    '-Dpolkit=true'
    '-Dconfig_auth_polkit_default=default'
    '-Dmodify_system=false'
    '-Dselinux=false'
    '-Dsystemd_journal=true'
    '-Dconfig_logging_backend_default=journal'
    '-Dconfig_wifi_backend_default=wpa_supplicant'
    '-Dhostname_persist=default'
    '-Dlibaudit=no'
    '-Dwext=false'
    '-Dwifi=true'
    '-Diwd=true'
    '-Dppp=true'
    '-Dmodem_manager=true'
    '-Dofono=true'
    '-Dconcheck=true'
    '-Dteamdctl=true'
    '-Dovs=true'
    '-Dnmcli=true'
    '-Dnmtui=true'
    '-Dnm_cloud_setup=true'
    '-Dbluez5_dun=true'
    '-Debpf=true'
    '-Dnbft=true'
    '-Dclat=true'
    '-Dbpf-compiler=clang'
    '-Difcfg_rh=false'
    '-Difupdown=false'
    '-Dconfig_dhcp_default=internal'
    '-Dintrospection=true'
    '-Dvapi=true'
    '-Ddocs=false'
    '-Dman=true'
    '-Dfirewalld_zone=true'
    '-Dmore_asserts=no'
    '-Dmore_logging=false'
    '-Dvalgrind=no'
    '-Dld_gc=true'
    '-Dlibpsl=true'
    '-Dcrypto=nss'
    '-Dqt=false'
    '-Dreadline=auto'
    '-Dconfig_dns_rc_manager_default=auto'
    '-Dresolvconf=no'
    '-Db_lto=true'
)

# FIXME: FTBFS on loongson3 with BPF
# /usr/include/asm/byteorder.h:17:3: error: "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
#   17 | # error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
#      |   ^
MESON_AFTER__LOONGSON3=(
    "${MESON_AFTER[@]}"
    '-Dclat=false'
)

MESON_AFTER__RETRO=(
    "${MESON_AFTER[@]}"
    '-Dnbft=false'
    '-Dofono=false'
    '-Dconcheck=true'
    '-Dteamdctl=false'
    '-Dovs=false'
    '-Dnm_cloud_setup=false'
    '-Dbluez5_dun=false'
    '-Debpf=false'
    '-Dintrospection=false'
    '-Dvapi=false'
    '-Dfirewalld_zone=false'
    '-Dlibpsl=false'
    '-Dcrypto=gnutls'
    '-Dclat=false'
    # Note: Afterglow does not ship systemd-resolved.
    '-Dresolvconf=yes'
    '-Diwd=false'
    # Note: Afterglow does not ship systemd-logind.
    '-Dsession_tracking=no'
)

PKGESS=1

# Needed by Afterglow, whereas FAIL_ARCH defaults to mainline-only.
FAIL_ARCH="!(mainline|retro)"
