mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 13:24:51 +08:00
disable opcache jit automatically on alpine target (only required for php < 8.5)
This commit is contained in:
parent
20fbbb1dbe
commit
f18725083a
@ -12,9 +12,9 @@ class mongodb extends Extension
|
|||||||
{
|
{
|
||||||
public function getUnixConfigureArg(bool $shared = false): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
$arg = ' --enable-mongodb ';
|
$arg = ' --enable-mongodb' . ($shared ? '=shared' : '') . ' ';
|
||||||
$arg .= ' --with-mongodb-system-libs=no --with-mongodb-client-side-encryption=no ';
|
$arg .= ' --with-mongodb-system-libs=no --with-mongodb-client-side-encryption=no ';
|
||||||
$arg .= ' --with-mongodb-sasl=no ';
|
$arg .= ' --with-mongodb-sasl=no ';
|
||||||
if ($this->builder->getLib('openssl')) {
|
if ($this->builder->getLib('openssl')) {
|
||||||
$arg .= '--with-mongodb-ssl=openssl';
|
$arg .= '--with-mongodb-ssl=openssl';
|
||||||
}
|
}
|
||||||
@ -22,6 +22,6 @@ class mongodb extends Extension
|
|||||||
$arg .= $this->builder->getLib('zstd') ? ' --with-mongodb-zstd=yes ' : ' --with-mongodb-zstd=no ';
|
$arg .= $this->builder->getLib('zstd') ? ' --with-mongodb-zstd=yes ' : ' --with-mongodb-zstd=no ';
|
||||||
// $arg .= $this->builder->getLib('snappy') ? ' --with-mongodb-snappy=yes ' : ' --with-mongodb-snappy=no ';
|
// $arg .= $this->builder->getLib('snappy') ? ' --with-mongodb-snappy=yes ' : ' --with-mongodb-snappy=no ';
|
||||||
$arg .= $this->builder->getLib('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled ';
|
$arg .= $this->builder->getLib('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled ';
|
||||||
return $arg;
|
return clean_spaces($arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ use SPC\builder\Extension;
|
|||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\store\SourcePatcher;
|
use SPC\store\SourcePatcher;
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
|
use SPC\util\SPCTarget;
|
||||||
|
|
||||||
#[CustomExt('opcache')]
|
#[CustomExt('opcache')]
|
||||||
class opcache extends Extension
|
class opcache extends Extension
|
||||||
@ -46,7 +47,17 @@ class opcache extends Extension
|
|||||||
|
|
||||||
public function getUnixConfigureArg(bool $shared = false): string
|
public function getUnixConfigureArg(bool $shared = false): string
|
||||||
{
|
{
|
||||||
return '--enable-opcache';
|
$phpVersionID = $this->builder->getPHPVersionID();
|
||||||
|
$opcache_jit = ' --enable-opcache-jit';
|
||||||
|
if ((SPCTarget::getTargetOS() === 'Linux' &&
|
||||||
|
SPCTarget::getLibc() === 'musl' &&
|
||||||
|
$this->builder->getOption('enable-zts') &&
|
||||||
|
$phpVersionID < 80500) ||
|
||||||
|
$this->builder->getOption('disable-opcache-jit')
|
||||||
|
) {
|
||||||
|
$opcache_jit = ' --disable-opcache-jit';
|
||||||
|
}
|
||||||
|
return '--enable-opcache' . ($shared ? '=shared' : '') . $opcache_jit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDistName(): string
|
public function getDistName(): string
|
||||||
|
|||||||
@ -64,10 +64,7 @@ class LinuxBuilder extends UnixBuilderBase
|
|||||||
// if opcache_jit is enabled for 8.5 or opcache enabled,
|
// if opcache_jit is enabled for 8.5 or opcache enabled,
|
||||||
// we need to disable undefined behavior sanitizer.
|
// we need to disable undefined behavior sanitizer.
|
||||||
f_putenv('SPC_COMPILER_EXTRA=-fno-sanitize=undefined');
|
f_putenv('SPC_COMPILER_EXTRA=-fno-sanitize=undefined');
|
||||||
} elseif ($opcache_jit) {
|
|
||||||
$opcache_jit = false;
|
|
||||||
}
|
}
|
||||||
$opcache_jit_arg = $opcache_jit ? '--enable-opcache-jit ' : '--disable-opcache-jit ';
|
|
||||||
|
|
||||||
if ($this->getOption('enable-zts', false)) {
|
if ($this->getOption('enable-zts', false)) {
|
||||||
$maxExecutionTimers = $phpVersionID >= 80100 ? '--enable-zend-max-execution-timers ' : '';
|
$maxExecutionTimers = $phpVersionID >= 80100 ? '--enable-zend-max-execution-timers ' : '';
|
||||||
@ -115,7 +112,6 @@ class LinuxBuilder extends UnixBuilderBase
|
|||||||
($enableMicro ? '--enable-micro=all-static ' : '--disable-micro ') .
|
($enableMicro ? '--enable-micro=all-static ' : '--disable-micro ') .
|
||||||
$config_file_path .
|
$config_file_path .
|
||||||
$config_file_scan_dir .
|
$config_file_scan_dir .
|
||||||
$opcache_jit_arg .
|
|
||||||
$json_74 .
|
$json_74 .
|
||||||
$zts .
|
$zts .
|
||||||
$maxExecutionTimers .
|
$maxExecutionTimers .
|
||||||
|
|||||||
@ -90,13 +90,6 @@ class MacOSBuilder extends UnixBuilderBase
|
|||||||
$json_74 = $phpVersionID < 80000 ? '--enable-json ' : '';
|
$json_74 = $phpVersionID < 80000 ? '--enable-json ' : '';
|
||||||
$zts = $this->getOption('enable-zts', false) ? '--enable-zts --disable-zend-signals ' : '';
|
$zts = $this->getOption('enable-zts', false) ? '--enable-zts --disable-zend-signals ' : '';
|
||||||
|
|
||||||
$opcache_jit = !$this->getOption('disable-opcache-jit', false);
|
|
||||||
// disable opcache jit for PHP < 8.5.0 when opcache is not enabled
|
|
||||||
if ($opcache_jit && $phpVersionID < 80500 && !$this->getExt('opcache')) {
|
|
||||||
$opcache_jit = false;
|
|
||||||
}
|
|
||||||
$opcache_jit_arg = $opcache_jit ? '--enable-opcache-jit ' : '--disable-opcache-jit ';
|
|
||||||
|
|
||||||
$config_file_path = $this->getOption('with-config-file-path', false) ?
|
$config_file_path = $this->getOption('with-config-file-path', false) ?
|
||||||
('--with-config-file-path=' . $this->getOption('with-config-file-path') . ' ') : '';
|
('--with-config-file-path=' . $this->getOption('with-config-file-path') . ' ') : '';
|
||||||
$config_file_scan_dir = $this->getOption('with-config-file-scan-dir', false) ?
|
$config_file_scan_dir = $this->getOption('with-config-file-scan-dir', false) ?
|
||||||
@ -131,7 +124,6 @@ class MacOSBuilder extends UnixBuilderBase
|
|||||||
($enableFpm ? '--enable-fpm ' : '--disable-fpm ') .
|
($enableFpm ? '--enable-fpm ' : '--disable-fpm ') .
|
||||||
($enableEmbed ? "--enable-embed={$embed_type} " : '--disable-embed ') .
|
($enableEmbed ? "--enable-embed={$embed_type} " : '--disable-embed ') .
|
||||||
($enableMicro ? '--enable-micro ' : '--disable-micro ') .
|
($enableMicro ? '--enable-micro ' : '--disable-micro ') .
|
||||||
$opcache_jit_arg .
|
|
||||||
$config_file_path .
|
$config_file_path .
|
||||||
$config_file_scan_dir .
|
$config_file_scan_dir .
|
||||||
$json_74 .
|
$json_74 .
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user