mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-05 15:55:39 +08:00
ensure liburing is only pulled in by suggested libs when glibc >= 2.30 (or musl)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user