Skip to content

Commit 1b0b551

Browse files
committed
handle case where libphp.so is built instead of libphp-release.so
1 parent 74849a8 commit 1b0b551

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/SPC/builder/linux/LinuxBuilder.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
105105
$disable_jit = $this->getOption('disable-opcache-jit', false) ? '--disable-opcache-jit ' : '';
106106
$cc = trim(getenv('CC'));
107107
if (!$disable_jit && $this->getExt('opcache') && str_contains($cc, 'zig')) {
108-
f_putenv("CC=$cc -fno-sanitize=undefined");
108+
f_putenv("CC={$cc} -fno-sanitize=undefined");
109109
}
110110

111111
$config_file_path = $this->getOption('with-config-file-path', false) ?
@@ -180,7 +180,7 @@ public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
180180
$this->buildEmbed();
181181
}
182182
if (!$disable_jit && $this->getExt('opcache') && str_contains($cc, 'zig')) {
183-
f_putenv("CC=$cc");
183+
f_putenv("CC={$cc}");
184184
}
185185
if ($enableFrankenphp) {
186186
logger()->info('building frankenphp');
@@ -300,9 +300,13 @@ protected function buildEmbed(): void
300300
$release = $matches[1];
301301
$realLibName = 'libphp-' . $release . '.so';
302302
$cwd = getcwd();
303-
if (file_exists($realLibName)) {
304-
$realLib = BUILD_LIB_PATH . '/' . $realLibName;
305-
rename(BUILD_LIB_PATH . '/libphp.so', $realLib);
303+
$libphpPath = BUILD_LIB_PATH . '/libphp.so';
304+
$libphpRelease = BUILD_LIB_PATH . '/' . $realLibName;
305+
if (!file_exists($libphpRelease) && file_exists($libphpPath)) {
306+
rename($libphpPath, $libphpRelease);
307+
}
308+
if (file_exists($libphpRelease)) {
309+
rename(BUILD_LIB_PATH . '/libphp.so', $libphpRelease);
306310
chdir(BUILD_LIB_PATH);
307311
symlink($realLibName, 'libphp.so');
308312
}

0 commit comments

Comments
 (0)