diff --git a/config/ext.json b/config/ext.json index e5aa0ce3..d1559900 100644 --- a/config/ext.json +++ b/config/ext.json @@ -756,6 +756,14 @@ "apcu" ] }, + "snmp": { + "type": "builtin", + "arg-type-unix": "with", + "arg-type-windows": "with", + "lib-depends": [ + "net-snmp" + ] + }, "soap": { "support": { "BSD": "wip" diff --git a/config/lib.json b/config/lib.json index c3d864f4..f40a8181 100644 --- a/config/lib.json +++ b/config/lib.json @@ -697,6 +697,17 @@ "libncurses.a" ] }, + "net-snmp": { + "source": "net-snmp", + "pkg-configs": [ + "netsnmp", + "netsnmp-agent" + ], + "lib-depends": [ + "openssl", + "zlib" + ] + }, "nghttp2": { "source": "nghttp2", "static-libs-unix": [ diff --git a/config/source.json b/config/source.json index 349ba68c..d014bc62 100644 --- a/config/source.json +++ b/config/source.json @@ -810,6 +810,14 @@ "path": "COPYING" } }, + "net-snmp": { + "type": "ghtagtar", + "repo": "net-snmp/net-snmp", + "license": { + "type": "file", + "path": "COPYING" + } + }, "nghttp2": { "type": "ghrel", "repo": "nghttp2/nghttp2", diff --git a/src/SPC/builder/extension/snmp.php b/src/SPC/builder/extension/snmp.php new file mode 100644 index 00000000..f797c5b4 --- /dev/null +++ b/src/SPC/builder/extension/snmp.php @@ -0,0 +1,25 @@ +source_dir}/config.m4", + 'PHP_EVAL_LIBLINE([$SNMP_LIBS], [SNMP_SHARED_LIBADD])', + "SNMP_LIBS=\"{$libs}\"\nPHP_EVAL_LIBLINE([\$SNMP_LIBS], [SNMP_SHARED_LIBADD])" + ); + return true; + } +} diff --git a/src/SPC/builder/linux/library/net_snmp.php b/src/SPC/builder/linux/library/net_snmp.php new file mode 100644 index 00000000..249b28aa --- /dev/null +++ b/src/SPC/builder/linux/library/net_snmp.php @@ -0,0 +1,12 @@ +setEnv(['PKG_CONFIG' => getenv('PKG_CONFIG') . ' --static']) + ->configure( + '--disable-mibs', + '--with-default-snmp-version="3"', + '--with-sys-contact="@@no.where"', + '--with-sys-location="Unknown"', + '--with-logfile="/var/log/snmpd.log"', + '--with-persistent-directory="/var/net-snmp"', + '--with-openssl=' . BUILD_ROOT_PATH, + '--with-zlib=' . BUILD_ROOT_PATH, + )->make(with_install: 'installheaders installlibs install_pkgconfig'); + $this->patchPkgconfPrefix(); + } +} diff --git a/src/SPC/util/executor/UnixAutoconfExecutor.php b/src/SPC/util/executor/UnixAutoconfExecutor.php index f196cb1c..e04fe4f9 100644 --- a/src/SPC/util/executor/UnixAutoconfExecutor.php +++ b/src/SPC/util/executor/UnixAutoconfExecutor.php @@ -115,6 +115,12 @@ class UnixAutoconfExecutor extends Executor return $this; } + public function setEnv(array $env): static + { + $this->shell->setEnv($env); + return $this; + } + public function appendEnv(array $env): static { $this->shell->appendEnv($env); diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 5aef4bd8..5c72cfe3 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -14,9 +14,9 @@ declare(strict_types=1); // test php version (8.1 ~ 8.4 available, multiple for matrix) $test_php_version = [ '8.1', - // '8.2', - // '8.3', - // '8.4', + '8.2', + '8.3', + '8.4', '8.5', // 'git', ]; @@ -49,8 +49,8 @@ $prefer_pre_built = false; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'gettext', - 'Windows' => 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pdo,pdo_mysql,pdo_sqlite,phar,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip', + 'Linux', 'Darwin' => 'snmp', + 'Windows' => 'snmp', }; // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).