mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Add ext-snmp
This commit is contained in:
parent
3f812fe5fc
commit
21e2a0194c
@ -241,6 +241,12 @@ ext-simplexml:
|
|||||||
arg-type@unix: '--enable-simplexml@shared_suffix@ --with-libxml=@build_root_path@'
|
arg-type@unix: '--enable-simplexml@shared_suffix@ --with-libxml=@build_root_path@'
|
||||||
arg-type@windows: with
|
arg-type@windows: with
|
||||||
build-with-php: true
|
build-with-php: true
|
||||||
|
ext-snmp:
|
||||||
|
type: php-extension
|
||||||
|
depends:
|
||||||
|
- net-snmp
|
||||||
|
php-extension:
|
||||||
|
arg-type: with
|
||||||
ext-sockets:
|
ext-sockets:
|
||||||
type: php-extension
|
type: php-extension
|
||||||
ext-sqlite3:
|
ext-sqlite3:
|
||||||
|
|||||||
34
src/Package/Extension/snmp.php
Normal file
34
src/Package/Extension/snmp.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Package\Extension;
|
||||||
|
|
||||||
|
use Package\Target\php;
|
||||||
|
use StaticPHP\Attribute\Package\BeforeStage;
|
||||||
|
use StaticPHP\Attribute\Package\Extension;
|
||||||
|
use StaticPHP\Attribute\PatchDescription;
|
||||||
|
use StaticPHP\Package\PhpExtensionPackage;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
use StaticPHP\Util\PkgConfigUtil;
|
||||||
|
|
||||||
|
#[Extension('snmp')]
|
||||||
|
class snmp extends PhpExtensionPackage
|
||||||
|
{
|
||||||
|
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-snmp')]
|
||||||
|
#[PatchDescription('Fix snmp extension compile error when building with older PHP version and newer net-snmp library')]
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
// Overwrite m4 config using newer PHP version
|
||||||
|
if (php::getPHPVersionID() < 80400) {
|
||||||
|
FileSystem::copy(ROOT_DIR . '/src/globals/extra/snmp-ext-config-old.m4', "{$this->getSourceDir()}/config.m4");
|
||||||
|
}
|
||||||
|
$libs = implode(' ', PkgConfigUtil::getLibsArray('netsnmp'));
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
"{$this->getSourceDir()}/config.m4",
|
||||||
|
'PHP_EVAL_LIBLINE([$SNMP_LIBS], [SNMP_SHARED_LIBADD])',
|
||||||
|
"SNMP_LIBS=\"{$libs}\"\nPHP_EVAL_LIBLINE([\$SNMP_LIBS], [SNMP_SHARED_LIBADD])"
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user