66
77use SPC \builder \linux \SystemUtil ;
88use SPC \store \FileSystem ;
9+ use SPC \toolchain \GccNativeToolchain ;
10+ use SPC \toolchain \ToolchainManager ;
911use SPC \util \executor \UnixAutoconfExecutor ;
1012use SPC \util \SPCTarget ;
1113
@@ -15,26 +17,19 @@ class liburing extends LinuxLibraryBase
1517
1618 public function patchBeforeBuild (): bool
1719 {
18- if (!SystemUtil::isMuslDist ()) {
19- return false ;
20+ if (SystemUtil::isMuslDist ()) {
21+ FileSystem::replaceFileStr ($ this ->source_dir . '/configure ' , 'realpath -s ' , 'realpath ' );
22+ return true ;
2023 }
21- FileSystem::replaceFileStr ($ this ->source_dir . '/configure ' , 'realpath -s ' , 'realpath ' );
22- return true ;
24+ return false ;
2325 }
2426
2527 protected function build (): void
2628 {
27- $ use_libc = SPCTarget:: getLibc () !== ' glibc ' || version_compare (SPCTarget::getLibcVersion (), '2.30 ' , '>= ' );
29+ $ use_libc = ToolchainManager:: getToolchainClass () !== GccNativeToolchain::class || version_compare (SPCTarget::getLibcVersion (), '2.30 ' , '>= ' );
2830 $ make = UnixAutoconfExecutor::create ($ this );
2931
30- if (!$ use_libc ) {
31- $ make ->appendEnv ([
32- 'CC ' => 'gcc ' , // libc-less version fails to compile with clang or zig
33- 'CXX ' => 'g++ ' ,
34- 'AR ' => 'ar ' ,
35- 'LD ' => 'ld ' ,
36- ]);
37- } else {
32+ if ($ use_libc ) {
3833 $ make ->appendEnv ([
3934 'CFLAGS ' => '-D_GNU_SOURCE ' ,
4035 ]);
@@ -51,7 +46,7 @@ protected function build(): void
5146 $ use_libc ? '--use-libc ' : '' ,
5247 )
5348 ->configure ()
54- ->make ('library ' , 'install ENABLE_SHARED=0 ' , with_clean: false );
49+ ->make ('library ENABLE_SHARED=0 ' , 'install ENABLE_SHARED=0 ' , with_clean: false );
5550
5651 $ this ->patchPkgconfPrefix ();
5752 }
0 commit comments