mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add suffix support for SPC_TARGET
This commit is contained in:
parent
a6364389ba
commit
0598eff9c5
@ -78,7 +78,7 @@ class GlobalEnvManager
|
||||
|
||||
// auto-select toolchain based on target and OS temporarily
|
||||
// TODO: use 'zig' instead of 'gcc-native' when ZigToolchain is implemented
|
||||
$toolchain = match (getenv('SPC_TARGET')) {
|
||||
$toolchain = match (SPCTarget::getTargetName()) {
|
||||
SPCTarget::MUSL_STATIC, SPCTarget::MUSL => SystemUtil::isMuslDist() ? 'gcc-native' : 'musl',
|
||||
SPCTarget::MACHO => 'clang-native',
|
||||
SPCTarget::MSVC_STATIC => 'msvc',
|
||||
|
||||
@ -85,6 +85,14 @@ class SPCTarget
|
||||
(new $toolchainClass())->afterInit(getenv('SPC_TARGET'));
|
||||
}
|
||||
|
||||
public static function getTargetName(): ?string
|
||||
{
|
||||
$target = getenv('SPC_TARGET');
|
||||
$target = strtolower($target);
|
||||
// ver
|
||||
return explode('@', $target)[0];
|
||||
}
|
||||
|
||||
public static function getTargetSuffix(): ?string
|
||||
{
|
||||
$target = getenv('SPC_TARGET');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user