Skip to content

Commit 88f9172

Browse files
committed
bring back opcache jit fix
1 parent 27f57cc commit 88f9172

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

.php-cs-fixer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@
6969
])
7070
->setFinder(
7171
PhpCsFixer\Finder::create()->in([__DIR__ . '/src', __DIR__ . '/tests/SPC'])
72-
);
72+
)
73+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect());

src/SPC/builder/linux/LinuxBuilder.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use SPC\toolchain\ToolchainManager;
1414
use SPC\toolchain\ZigToolchain;
1515
use SPC\util\GlobalEnvManager;
16+
use SPC\util\SPCTarget;
1617

1718
class LinuxBuilder extends UnixBuilderBase
1819
{
@@ -92,7 +93,9 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
9293
$zts = '';
9394
}
9495
$disable_jit = $this->getOption('disable-opcache-jit', false) ? '--disable-opcache-jit ' : '';
95-
96+
if (!$disable_jit && $this->getExt('opcache')) {
97+
f_putenv('COMPILER_EXTRA=-fno-sanitize=undefined');
98+
}
9699
$config_file_path = $this->getOption('with-config-file-path', false) ?
97100
('--with-config-file-path=' . $this->getOption('with-config-file-path') . ' ') : '';
98101
$config_file_scan_dir = $this->getOption('with-config-file-scan-dir', false) ?
@@ -123,6 +126,12 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
123126
}
124127

125128
$embed_type = getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') ?: 'static';
129+
if ($embed_type !== 'static' && SPCTarget::isStatic()) {
130+
throw new WrongUsageException(
131+
'Linux does not support loading shared libraries when linking libc statically. ' .
132+
'Change SPC_CMD_VAR_PHP_EMBED_TYPE to static.'
133+
);
134+
}
126135
shell()->cd(SOURCE_PATH . '/php-src')
127136
->exec(
128137
getenv('SPC_CMD_PREFIX_PHP_CONFIGURE') . ' ' .

src/SPC/builder/unix/library/libaom.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,24 @@
44

55
namespace SPC\builder\unix\library;
66

7-
use SPC\exception\FileSystemException;
8-
use SPC\exception\RuntimeException;
97
use SPC\toolchain\ToolchainManager;
108
use SPC\toolchain\ZigToolchain;
119
use SPC\util\executor\UnixCMakeExecutor;
1210

1311
trait libaom
1412
{
15-
/**
16-
* @throws RuntimeException
17-
* @throws FileSystemException
18-
*/
1913
protected function build(): void
2014
{
15+
$extra = getenv('COMPILER_EXTRA');
2116
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
22-
f_putenv('COMPILER_EXTRA=-D_GNU_SOURCE');
17+
$new = trim($extra . ' -D_GNU_SOURCE');
18+
f_putenv("COMPILER_EXTRA={$new}");
2319
}
2420
UnixCMakeExecutor::create($this)
2521
->setBuildDir("{$this->source_dir}/builddir")
2622
->addConfigureArgs('-DAOM_TARGET_CPU=generic')
2723
->build();
28-
f_putenv('COMPILER_EXTRA');
24+
f_putenv("COMPILER_EXTRA={$extra}");
2925
$this->patchPkgconfPrefix(['aom.pc']);
3026
}
3127
}

0 commit comments

Comments
 (0)