From 9912b213f0e093c937adab8aa207db2fa9c494f6 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 6 Feb 2026 13:29:25 +0800 Subject: [PATCH] Add net-snmp --- config/pkg/lib/net-snmp.yml | 15 +++++++++ src/Package/Library/net_snmp.php | 57 ++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 config/pkg/lib/net-snmp.yml create mode 100644 src/Package/Library/net_snmp.php diff --git a/config/pkg/lib/net-snmp.yml b/config/pkg/lib/net-snmp.yml new file mode 100644 index 00000000..b1e9912e --- /dev/null +++ b/config/pkg/lib/net-snmp.yml @@ -0,0 +1,15 @@ +net-snmp: + type: library + artifact: + source: + type: ghtagtar + repo: net-snmp/net-snmp + metadata: + license-files: [COPYING] + license: 'BSD-3-Clause AND MIT' + depends: + - openssl + - zlib + pkg-configs: + - netsnmp + - netsnmp-agent diff --git a/src/Package/Library/net_snmp.php b/src/Package/Library/net_snmp.php new file mode 100644 index 00000000..cb7b2aae --- /dev/null +++ b/src/Package/Library/net_snmp.php @@ -0,0 +1,57 @@ +getSourceDir()}/configure", 'LIBS="-lssl ${OPENSSL_LIBS}"', 'LIBS="-lssl ${OPENSSL_LIBS} -lpthread -ldl"'); + } + + #[BuildFor('Darwin')] + #[BuildFor('Linux')] + public function buildUnix(LibraryPackage $lib): void + { + // use --static for PKG_CONFIG + UnixAutoconfExecutor::create($lib) + ->setEnv(['PKG_CONFIG' => getenv('PKG_CONFIG') . ' --static']) + ->configure( + '--disable-mibs', + '--without-nl', + '--disable-agent', + '--disable-applications', + '--disable-manuals', + '--disable-scripts', + '--disable-embedded-perl', + '--without-perl-modules', + '--with-out-mib-modules="if-mib host disman/event-mib ucd-snmp/diskio mibII"', + '--with-out-transports="Unix"', + '--with-mib-modules=""', + '--enable-mini-agent', + '--with-default-snmp-version="3"', + '--with-sys-contact="@@no.where"', + '--with-sys-location="Unknown"', + '--with-logfile="/var/log/snmpd.log"', + '--with-persistent-directory="/var/lib/net-snmp"', + "--with-openssl={$lib->getBuildRootPath()}", + "--with-zlib={$lib->getBuildRootPath()}", + )->make(with_install: 'installheaders installlibs install_pkgconfig'); + $lib->patchPkgconfPrefix(); + } +}