2023-04-15 18:45:11 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\extension;
|
|
|
|
|
|
|
|
|
|
use SPC\builder\Extension;
|
2026-03-06 13:46:55 +08:00
|
|
|
use SPC\builder\linux\SystemUtil;
|
|
|
|
|
use SPC\store\SourcePatcher;
|
2023-04-15 18:45:11 +08:00
|
|
|
use SPC\util\CustomExt;
|
|
|
|
|
|
|
|
|
|
#[CustomExt('ffi')]
|
|
|
|
|
class ffi extends Extension
|
|
|
|
|
{
|
2026-03-06 13:46:55 +08:00
|
|
|
public function patchBeforeBuildconf(): bool
|
|
|
|
|
{
|
|
|
|
|
if (PHP_OS_FAMILY === 'Linux' && SystemUtil::getOSRelease()['dist'] === 'centos') {
|
|
|
|
|
return SourcePatcher::patchFfiCentos7FixO3strncmp();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-27 11:12:19 +07:00
|
|
|
public function getUnixConfigureArg(bool $shared = false): string
|
2023-04-15 18:45:11 +08:00
|
|
|
{
|
2025-05-21 13:19:51 +07:00
|
|
|
return '--with-ffi' . ($shared ? '=shared' : '') . ' --enable-zend-signals';
|
2023-04-15 18:45:11 +08:00
|
|
|
}
|
2024-02-29 15:34:06 +08:00
|
|
|
|
2025-05-21 12:01:00 +07:00
|
|
|
public function getWindowsConfigureArg(bool $shared = false): string
|
2024-02-29 15:34:06 +08:00
|
|
|
{
|
|
|
|
|
return '--with-ffi';
|
|
|
|
|
}
|
2023-04-15 18:45:11 +08:00
|
|
|
}
|