mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-04 23:35:40 +08:00
allow compilation with empty target
This commit is contained in:
@@ -86,16 +86,13 @@ class SPCTarget
|
||||
*/
|
||||
public static function getTargetOS(): string
|
||||
{
|
||||
$target = getenv('SPC_TARGET');
|
||||
if ($target === false) {
|
||||
return PHP_OS_FAMILY;
|
||||
}
|
||||
$target = (string) getenv('SPC_TARGET');
|
||||
return match (true) {
|
||||
str_contains($target, '-linux') => 'Linux',
|
||||
str_contains($target, '-macos') => 'Darwin',
|
||||
str_contains($target, '-windows') => 'Windows',
|
||||
str_contains($target, '-native') => PHP_OS_FAMILY,
|
||||
default => throw new WrongUsageException('Cannot parse target.'),
|
||||
default => PHP_OS_FAMILY,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user