ensure liburing is only pulled in by suggested libs when glibc >= 2.30 (or musl)

This commit is contained in:
DubbleClick
2025-08-26 14:07:49 +07:00
parent 43352ab986
commit 4eac953c71
5 changed files with 35 additions and 4 deletions

View File

@@ -76,6 +76,14 @@ class DependencyUtil
$del_list = [];
foreach ($obj['suggests'] as $id => $suggest) {
if (!str_starts_with($suggest, 'ext@')) {
$glibcMin = Config::getLib($suggest, 'glibc-min');
if ($glibcMin !== null) {
$libc = SPCTarget::getLibc();
$ver = SPCTarget::getLibcVersion();
if ($libc === 'glibc' && version_compare($ver, (string) $glibcMin, '<')) {
continue;
}
}
$dep_list[$name]['depends'][] = $suggest;
$del_list[] = $id;
}
@@ -134,6 +142,14 @@ class DependencyUtil
$del_list = [];
foreach ($obj['suggests'] as $id => $suggest) {
if (!str_starts_with($suggest, 'ext@')) {
$glibcMin = Config::getLib($suggest, 'glibc-min');
if ($glibcMin !== null) {
$libc = SPCTarget::getLibc();
$ver = SPCTarget::getLibcVersion();
if ($libc === 'glibc' && version_compare($ver, (string) $glibcMin, '<')) {
continue;
}
}
$dep_list[$name]['depends'][] = $suggest;
$del_list[] = $id;
}

View File

@@ -100,6 +100,10 @@ class SPCTarget
public static function getLibcVersion(): ?string
{
if (PHP_OS_FAMILY === 'Linux') {
$target = getenv('SPC_TARGET');
if (str_contains($target, '-gnu.2.')) {
return preg_match('/-gnu\.(2\.\d+)/', $target, $matches) ? $matches[1] : null;
}
$libc = self::getLibc();
return SystemUtil::getLibcVersionIfExists($libc);
}