@@ -74,12 +74,12 @@ public function handle(): int
74
74
75
75
if ($ rule === BUILD_TARGET_NONE ) {
76
76
$ this ->output ->writeln ('<error>Please add at least one build SAPI!</error> ' );
77
- $ this ->output ->writeln ("<comment> \t--build-cli \tBuild php-cli SAPI</comment> " );
78
- $ this ->output ->writeln ("<comment> \t--build-micro \tBuild phpmicro SAPI</comment> " );
79
- $ this ->output ->writeln ("<comment> \t--build-fpm \tBuild php-fpm SAPI</comment> " );
80
- $ this ->output ->writeln ("<comment> \t--build-embed \tBuild embed SAPI/libphp</comment> " );
77
+ $ this ->output ->writeln ("<comment> \t--build-cli \t\ tBuild php-cli SAPI</comment> " );
78
+ $ this ->output ->writeln ("<comment> \t--build-micro \t\ tBuild phpmicro SAPI</comment> " );
79
+ $ this ->output ->writeln ("<comment> \t--build-fpm \t\ tBuild php-fpm SAPI</comment> " );
80
+ $ this ->output ->writeln ("<comment> \t--build-embed \t\ tBuild embed SAPI/libphp</comment> " );
81
81
$ this ->output ->writeln ("<comment> \t--build-frankenphp \tBuild FrankenPHP SAPI/libphp</comment> " );
82
- $ this ->output ->writeln ("<comment> \t--build-all \tBuild all SAPI: cli, micro, fpm, embed, frankenphp</comment> " );
82
+ $ this ->output ->writeln ("<comment> \t--build-all \t\ tBuild all SAPI: cli, micro, fpm, embed, frankenphp</comment> " );
83
83
return static ::FAILURE ;
84
84
}
85
85
if ($ rule === BUILD_TARGET_ALL ) {
@@ -290,13 +290,14 @@ private function parseRules(array $shared_extensions = []): int
290
290
$ rule |= ($ this ->getOption ('build-micro ' ) ? BUILD_TARGET_MICRO : BUILD_TARGET_NONE );
291
291
$ rule |= ($ this ->getOption ('build-fpm ' ) ? BUILD_TARGET_FPM : BUILD_TARGET_NONE );
292
292
$ embed = $ this ->getOption ('build-embed ' );
293
- if (!$ embed && !empty ($ shared_extensions )) {
294
- $ embed = true ;
295
- }
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
+ };
296
300
if ($ embed ) {
297
- if ($ embed === true ) {
298
- $ embed = getenv ('SPC_CMD_VAR_PHP_EMBED_TYPE ' ) ?: 'static ' ;
299
- }
300
301
$ rule |= BUILD_TARGET_EMBED ;
301
302
f_putenv ('SPC_CMD_VAR_PHP_EMBED_TYPE= ' . ($ embed === 'static ' ? 'static ' : 'shared ' ));
302
303
}
0 commit comments