@@ -31,7 +31,7 @@ public function configure(): void
31
31
$ this ->addOption ('build-micro ' , null , null , 'Build micro SAPI ' );
32
32
$ this ->addOption ('build-cli ' , null , null , 'Build cli SAPI ' );
33
33
$ 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) ' );
35
35
$ this ->addOption ('build-frankenphp ' , null , null , 'Build FrankenPHP SAPI (not available on Windows) ' );
36
36
$ this ->addOption ('build-all ' , null , null , 'Build all SAPI ' );
37
37
$ this ->addOption ('no-strip ' , null , null , 'build without strip, keep symbols to debug ' );
@@ -289,18 +289,7 @@ private function parseRules(array $shared_extensions = []): int
289
289
$ rule |= ($ this ->getOption ('build-cli ' ) ? BUILD_TARGET_CLI : BUILD_TARGET_NONE );
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
- $ 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 ;
304
293
$ rule |= ($ this ->getOption ('build-frankenphp ' ) ? (BUILD_TARGET_FRANKENPHP | BUILD_TARGET_EMBED ) : BUILD_TARGET_NONE );
305
294
$ rule |= ($ this ->getOption ('build-all ' ) ? BUILD_TARGET_ALL : BUILD_TARGET_NONE );
306
295
return $ rule ;
0 commit comments