diff --git a/src/SPC/builder/extension/opcache.php b/src/SPC/builder/extension/opcache.php index 5d9dda0a..d982978f 100644 --- a/src/SPC/builder/extension/opcache.php +++ b/src/SPC/builder/extension/opcache.php @@ -26,25 +26,36 @@ class opcache extends Extension public function patchBeforeBuildconf(): bool { + $version = $this->builder->getPHPVersion(); if (file_exists(SOURCE_PATH . '/php-src/.opcache_patched')) { return false; } // if 8.2.0 <= PHP_VERSION < 8.2.23, we need to patch from legacy patch file - if (version_compare($this->builder->getPHPVersion(), '8.2.0', '>=') && version_compare($this->builder->getPHPVersion(), '8.2.23', '<')) { + if (version_compare($version, '8.2.0', '>=') && version_compare($version, '8.2.23', '<')) { SourcePatcher::patchFile('spc_fix_static_opcache_before_80222.patch', SOURCE_PATH . '/php-src'); } // if 8.3.0 <= PHP_VERSION < 8.3.11, we need to patch from legacy patch file - elseif (version_compare($this->builder->getPHPVersion(), '8.3.0', '>=') && version_compare($this->builder->getPHPVersion(), '8.3.11', '<')) { + elseif (version_compare($version, '8.3.0', '>=') && version_compare($version, '8.3.11', '<')) { SourcePatcher::patchFile('spc_fix_static_opcache_before_80310.patch', SOURCE_PATH . '/php-src'); - } else { + } + // if 8.3.12 <= PHP_VERSION < 8.5.0-dev, we need to patch from legacy patch file + elseif (version_compare($version, '8.5.0-dev', '<')) { SourcePatcher::patchMicro(items: ['static_opcache']); } + // PHP 8.5.0-dev and later supports static opcache without patching + else { + return false; + } return file_put_contents(SOURCE_PATH . '/php-src/.opcache_patched', '1') !== false; } public function getUnixConfigureArg(bool $shared = false): string { - return '--enable-opcache'; + $version = $this->builder->getPHPVersion(); + if (version_compare($version, '8.5.0-dev', '<')) { + return '--enable-opcache'; + } + return ''; } public function getDistName(): string diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 85cda2a1..6a0766ab 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -79,7 +79,13 @@ class LinuxBuilder extends UnixBuilderBase $maxExecutionTimers = ''; $zts = ''; } - $disable_jit = $this->getOption('disable-opcache-jit', false) ? '--disable-opcache-jit ' : ''; + + $opcache_jit = !$this->getOption('disable-opcache-jit', false); + if ($opcache_jit) { + $opcache_jit = $phpVersionID >= 80500 ? '--enable-opcache-jit ' : ''; + } else { + $opcache_jit = '--disable-opcache-jit '; + } $config_file_path = $this->getOption('with-config-file-path', false) ? ('--with-config-file-path=' . $this->getOption('with-config-file-path') . ' ') : ''; @@ -120,7 +126,7 @@ class LinuxBuilder extends UnixBuilderBase ($enableMicro ? '--enable-micro=all-static ' : '--disable-micro ') . $config_file_path . $config_file_scan_dir . - $disable_jit . + $opcache_jit . $json_74 . $zts . $maxExecutionTimers . diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 9b131b9d..50353e32 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -97,9 +97,17 @@ class MacOSBuilder extends UnixBuilderBase $this->emitPatchPoint('before-php-configure'); SourcePatcher::patchBeforeConfigure($this); - $json_74 = $this->getPHPVersionID() < 80000 ? '--enable-json ' : ''; + $phpVersionID = $this->getPHPVersionID(); + $json_74 = $phpVersionID < 80000 ? '--enable-json ' : ''; $zts = $this->getOption('enable-zts', false) ? '--enable-zts --disable-zend-signals ' : ''; + $opcache_jit = !$this->getOption('disable-opcache-jit', false); + if ($opcache_jit) { + $opcache_jit = $phpVersionID >= 80500 ? '--enable-opcache-jit ' : ''; + } else { + $opcache_jit = '--disable-opcache-jit '; + } + $config_file_path = $this->getOption('with-config-file-path', false) ? ('--with-config-file-path=' . $this->getOption('with-config-file-path') . ' ') : ''; $config_file_scan_dir = $this->getOption('with-config-file-scan-dir', false) ? @@ -138,6 +146,7 @@ class MacOSBuilder extends UnixBuilderBase ($enableMicro ? '--enable-micro ' : '--disable-micro ') . $config_file_path . $config_file_scan_dir . + $opcache_jit . $json_74 . $zts . $this->makeStaticExtensionArgs() . ' ' .