Skip to content

Commit f3f581f

Browse files
authored
Merge pull request #784 from crazywhalecc/revert/embed-option
Revert build-embed option as boolean
2 parents 5cd987b + f683707 commit f3f581f

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/SPC/command/BuildPHPCommand.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function configure(): void
3131
$this->addOption('build-micro', null, null, 'Build micro SAPI');
3232
$this->addOption('build-cli', null, null, 'Build cli SAPI');
3333
$this->addOption('build-fpm', null, null, 'Build fpm SAPI (not available on Windows)');
34-
$this->addOption('build-embed', null, InputOption::VALUE_OPTIONAL, 'Build embed SAPI (not available on Windows)');
34+
$this->addOption('build-embed', null, null, 'Build embed SAPI (not available on Windows)');
3535
$this->addOption('build-frankenphp', null, null, 'Build FrankenPHP SAPI (not available on Windows)');
3636
$this->addOption('build-all', null, null, 'Build all SAPI');
3737
$this->addOption('no-strip', null, null, 'build without strip, keep symbols to debug');
@@ -289,18 +289,7 @@ private function parseRules(array $shared_extensions = []): int
289289
$rule |= ($this->getOption('build-cli') ? BUILD_TARGET_CLI : BUILD_TARGET_NONE);
290290
$rule |= ($this->getOption('build-micro') ? BUILD_TARGET_MICRO : BUILD_TARGET_NONE);
291291
$rule |= ($this->getOption('build-fpm') ? BUILD_TARGET_FPM : BUILD_TARGET_NONE);
292-
$embed = $this->getOption('build-embed');
293-
$embed = match ($embed) {
294-
null => getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') ?: 'static',
295-
'static' => 'static',
296-
'shared' => 'shared',
297-
false => false,
298-
default => throw new WrongUsageException('Invalid --build-embed option, please use --build-embed[=static|shared]'),
299-
};
300-
if ($embed) {
301-
$rule |= BUILD_TARGET_EMBED;
302-
f_putenv('SPC_CMD_VAR_PHP_EMBED_TYPE=' . ($embed === 'static' ? 'static' : 'shared'));
303-
}
292+
$rule |= $this->getOption('build-embed') || !empty($shared_extensions) ? BUILD_TARGET_EMBED : BUILD_TARGET_NONE;
304293
$rule |= ($this->getOption('build-frankenphp') ? (BUILD_TARGET_FRANKENPHP | BUILD_TARGET_EMBED) : BUILD_TARGET_NONE);
305294
$rule |= ($this->getOption('build-all') ? BUILD_TARGET_ALL : BUILD_TARGET_NONE);
306295
return $rule;

0 commit comments

Comments
 (0)