Skip to content

Commit aec03b2

Browse files
committed
move enable zts check
1 parent ba6ed13 commit aec03b2

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/SPC/builder/BuilderBase.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,10 @@ public function emitPatchPoint(string $point_name): void
513513
public function checkBeforeBuildPHP(int $rule): void
514514
{
515515
if (($rule & BUILD_TARGET_FRANKENPHP) === BUILD_TARGET_FRANKENPHP) {
516-
// frankenphp only support linux and macOS
516+
if (!$this->getOption('enable-zts')) {
517+
throw new WrongUsageException('FrankenPHP SAPI requires ZTS enabled PHP, build with `--enable-zts`!');
518+
}
519+
// frankenphp doesn't support windows, BSD is currently not supported by static-php-cli
517520
if (!in_array(PHP_OS_FAMILY, ['Linux', 'Darwin'])) {
518521
throw new WrongUsageException('FrankenPHP SAPI is only available on Linux and macOS!');
519522
}
@@ -523,9 +526,9 @@ public function checkBeforeBuildPHP(int $rule): void
523526
global $argv;
524527
throw new WrongUsageException("FrankenPHP SAPI requires go-mod-frankenphp package, please install it first: {$argv[0]} install-pkg go-mod-frankenphp");
525528
}
526-
// frankenphp needs libxml2 libs
529+
// frankenphp needs libxml2 lib on macos, see: https://github.com/php/frankenphp/blob/main/frankenphp.go#L17
527530
if (PHP_OS_FAMILY === 'Darwin' && !$this->getLib('libxml2')) {
528-
throw new WrongUsageException('FrankenPHP SAPI for macOS requires libxml2 library, please include `xml` extension in your build.');
531+
throw new WrongUsageException('FrankenPHP SAPI for macOS requires libxml2 library, please include the `xml` extension in your build.');
529532
}
530533
}
531534
}

src/SPC/command/BuildPHPCommand.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,6 @@ private function parseRules(array $shared_extensions = []): int
304304
$rule |= BUILD_TARGET_EMBED;
305305
f_putenv('SPC_CMD_VAR_PHP_EMBED_TYPE=' . ($embed === 'static' ? 'static' : 'shared'));
306306
}
307-
if ($this->getOption('build-frankenphp')) {
308-
$rule |= BUILD_TARGET_FRANKENPHP;
309-
if (!$this->getOption('enable-zts')) {
310-
logger()->warning('FrankenPHP requires ZTS to work with multiple threads, the --enable-zts option will be enabled automatically!');
311-
$this->input->setOption('enable-zts', true);
312-
}
313-
}
314307
$rule |= ($this->getOption('build-frankenphp') ? (BUILD_TARGET_FRANKENPHP | BUILD_TARGET_EMBED) : BUILD_TARGET_NONE);
315308
$rule |= ($this->getOption('build-all') ? BUILD_TARGET_ALL : BUILD_TARGET_NONE);
316309
return $rule;

0 commit comments

Comments
 (0)