mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 13:24:51 +08:00
Add ext-ffi
This commit is contained in:
parent
b226887bd2
commit
cf2e1d9819
@ -36,6 +36,13 @@ ext-dom:
|
||||
arg-type@windows: with
|
||||
ext-exif:
|
||||
type: php-extension
|
||||
ext-ffi:
|
||||
type: php-extension
|
||||
depends@unix:
|
||||
- libffi
|
||||
php-extension:
|
||||
arg-type@unix: '--with-ffi=@shared_suffix@ --enable-zend-signals'
|
||||
arg-type@windows: with
|
||||
ext-mbregex:
|
||||
type: php-extension
|
||||
depends:
|
||||
|
||||
@ -7,7 +7,6 @@ namespace Package\Artifact;
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Artifact\AfterSourceExtract;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
use StaticPHP\Util\SourcePatcher;
|
||||
|
||||
@ -52,16 +51,6 @@ class php_src
|
||||
}
|
||||
}
|
||||
|
||||
#[AfterSourceExtract('php-src')]
|
||||
#[PatchDescription('Patch FFI extension on CentOS 7 with -O3 optimization (strncmp issue)')]
|
||||
public function patchFfiCentos7FixO3strncmp(): void
|
||||
{
|
||||
spc_skip_if(!($ver = SystemTarget::getLibcVersion()) || version_compare($ver, '2.17', '>'));
|
||||
$ver_id = php::getPHPVersionID(return_null_if_failed: true);
|
||||
spc_skip_if($ver_id === null || $ver_id < 80316);
|
||||
SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src');
|
||||
}
|
||||
|
||||
#[AfterSourceExtract('php-src')]
|
||||
#[PatchDescription('Add LICENSE file to IMAP extension if missing')]
|
||||
public function patchImapLicense(): void
|
||||
|
||||
29
src/Package/Extension/ffi.php
Normal file
29
src/Package/Extension/ffi.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?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\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\SourcePatcher;
|
||||
use StaticPHP\Util\System\LinuxUtil;
|
||||
|
||||
#[Extension('ffi')]
|
||||
class ffi extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-ffi')]
|
||||
#[PatchDescription('Patch FFI extension on CentOS 7 with -O3 optimization (strncmp issue)')]
|
||||
public function patchBeforeBuildconf(): void
|
||||
{
|
||||
spc_skip_if(!($ver = SystemTarget::getLibcVersion()) || version_compare($ver, '2.17', '>'));
|
||||
$ver_id = php::getPHPVersionID(return_null_if_failed: true);
|
||||
spc_skip_if($ver_id === null || $ver_id < 80316);
|
||||
spc_skip_if(LinuxUtil::getOSRelease()['dist'] !== 'centos');
|
||||
SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src');
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user