Add suffix support for SPC_TARGET

This commit is contained in:
crazywhalecc 2025-06-28 23:13:40 +08:00
parent a6364389ba
commit 0598eff9c5
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 9 additions and 1 deletions

View File

@ -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',

View File

@ -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');