Skip to content

Commit 0598eff

Browse files
committed
Add suffix support for SPC_TARGET
1 parent a636438 commit 0598eff

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/SPC/util/GlobalEnvManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static function init(): void
7878

7979
// auto-select toolchain based on target and OS temporarily
8080
// TODO: use 'zig' instead of 'gcc-native' when ZigToolchain is implemented
81-
$toolchain = match (getenv('SPC_TARGET')) {
81+
$toolchain = match (SPCTarget::getTargetName()) {
8282
SPCTarget::MUSL_STATIC, SPCTarget::MUSL => SystemUtil::isMuslDist() ? 'gcc-native' : 'musl',
8383
SPCTarget::MACHO => 'clang-native',
8484
SPCTarget::MSVC_STATIC => 'msvc',

src/SPC/util/SPCTarget.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ public static function afterInitTargetForToolchain()
8585
(new $toolchainClass())->afterInit(getenv('SPC_TARGET'));
8686
}
8787

88+
public static function getTargetName(): ?string
89+
{
90+
$target = getenv('SPC_TARGET');
91+
$target = strtolower($target);
92+
// ver
93+
return explode('@', $target)[0];
94+
}
95+
8896
public static function getTargetSuffix(): ?string
8997
{
9098
$target = getenv('SPC_TARGET');

0 commit comments

Comments
 (0)