patch before make for uv

This commit is contained in:
DubbleClick
2025-06-20 15:25:07 +07:00
parent 625ee2703d
commit 7d45415990
2 changed files with 22 additions and 4 deletions

View File

@@ -5,6 +5,8 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\builder\linux\SystemUtil;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('uv')]
@@ -17,10 +19,12 @@ class uv extends Extension
}
}
public function getStaticAndSharedLibs(): array
public function patchBeforeSharedMake(): bool
{
[$static, $shared] = parent::getStaticAndSharedLibs();
$shared .= ' -lpthread';
return [$static, $shared];
if (SystemUtil::getLibcVersionIfExists() >= '2.17') {
return false;
}
FileSystem::replaceFileRegex($this->source_dir . '/Makefile', '/^(LDFLAGS =.*)$/', '$1 -luv -ldl -lrt -pthread');
return true;
}
}