File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ public static function isTarget(string $target): bool
4343 return false ;
4444 }
4545 $ env = strtolower ($ env );
46+ // ver
47+ $ env = explode ('@ ' , $ env )[0 ];
4648 return $ env === $ target ;
4749 }
4850
@@ -53,7 +55,9 @@ public static function isStaticTarget(): bool
5355 return false ;
5456 }
5557 $ env = strtolower ($ env );
56- return str_ends_with ($ env , '-static ' ) || $ env === self ::MUSL_STATIC ;
58+ // ver
59+ $ env = explode ('@ ' , $ env )[0 ];
60+ return str_ends_with ($ env , '-static ' );
5761 }
5862
5963 public static function initTargetForToolchain (string $ toolchain ): void
@@ -80,4 +84,12 @@ public static function afterInitTargetForToolchain()
8084 $ toolchainClass = self ::TOOLCHAIN_LIST [$ toolchain ];
8185 (new $ toolchainClass ())->afterInit (getenv ('SPC_TARGET ' ));
8286 }
87+
88+ public static function getTargetSuffix (): ?string
89+ {
90+ $ target = getenv ('SPC_TARGET ' );
91+ $ target = strtolower ($ target );
92+ // ver
93+ return explode ('@ ' , $ target )[1 ] ?? null ;
94+ }
8395}
Original file line number Diff line number Diff line change 99use SPC \builder \macos \SystemUtil as MacOSSystemUtil ;
1010use SPC \exception \WrongUsageException ;
1111use SPC \util \GlobalEnvManager ;
12+ use SPC \util \SPCTarget ;
1213
1314class ClangNativeToolchain implements ToolchainInterface
1415{
1516 public function initEnv (string $ target ): void
1617 {
18+ // native toolchain does not support versioning
19+ if (SPCTarget::getTargetSuffix () !== null ) {
20+ throw new WrongUsageException ('Clang native toolchain does not support versioning. ' );
21+ }
1722 GlobalEnvManager::putenv ('SPC_LINUX_DEFAULT_CC=clang ' );
1823 GlobalEnvManager::putenv ('SPC_LINUX_DEFAULT_CXX=clang++ ' );
1924 GlobalEnvManager::putenv ('SPC_LINUX_DEFAULT_AR=ar ' );
Original file line number Diff line number Diff line change 99use SPC \builder \macos \SystemUtil as MacOSSystemUtil ;
1010use SPC \exception \WrongUsageException ;
1111use SPC \util \GlobalEnvManager ;
12+ use SPC \util \SPCTarget ;
1213
1314class GccNativeToolchain implements ToolchainInterface
1415{
1516 public function initEnv (string $ target ): void
1617 {
18+ // native toolchain does not support versioning
19+ if (SPCTarget::getTargetSuffix () !== null ) {
20+ throw new WrongUsageException ('gcc native toolchain does not support versioning. ' );
21+ }
1722 GlobalEnvManager::putenv ('SPC_LINUX_DEFAULT_CC=gcc ' );
1823 GlobalEnvManager::putenv ('SPC_LINUX_DEFAULT_CXX=g++ ' );
1924 GlobalEnvManager::putenv ('SPC_LINUX_DEFAULT_AR=ar ' );
You can’t perform that action at this time.
0 commit comments