mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-13 20:05:35 +08:00
Add net-snmp
This commit is contained in:
15
config/pkg/lib/net-snmp.yml
Normal file
15
config/pkg/lib/net-snmp.yml
Normal file
@@ -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
|
||||||
57
src/Package/Library/net_snmp.php
Normal file
57
src/Package/Library/net_snmp.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Package\Library;
|
||||||
|
|
||||||
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
|
use StaticPHP\Attribute\Package\Library;
|
||||||
|
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||||
|
use StaticPHP\Attribute\PatchDescription;
|
||||||
|
use StaticPHP\Package\LibraryPackage;
|
||||||
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
|
#[Library('net-snmp')]
|
||||||
|
class net_snmp
|
||||||
|
{
|
||||||
|
#[PatchBeforeBuild]
|
||||||
|
#[PatchDescription('Link with pthread and dl on Linux')]
|
||||||
|
public function patchBeforeBuild(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
spc_skip_if(SystemTarget::getTargetOS() !== 'Linux', 'This patch is only for Linux systems.');
|
||||||
|
FileSystem::replaceFileStr("{$lib->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();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user