we don't need a min glibc version, just don't use --use-libc!

This commit is contained in:
DubbleClick 2025-08-26 14:42:34 +07:00
parent 00f262571c
commit 2d409db2f9
3 changed files with 18 additions and 27 deletions

View File

@ -939,7 +939,6 @@
"headers-linux": [
"liburing/",
"liburing.h"
],
"glibc-min": "2.30"
]
}
}

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\linux\library;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor;
use SPC\util\SPCTarget;
@ -14,14 +13,23 @@ class liburing extends LinuxLibraryBase
protected function build(): void
{
if (SPCTarget::getLibc() === 'glibc' && SPCTarget::getLibcVersion() < 2.30) {
throw new WrongUsageException('liburing requires glibc >= 2.30');
$use_libc = SPCTarget::getLibc() !== 'glibc' || version_compare(SPCTarget::getLibcVersion(), '2.30', '>=');
$make = UnixAutoconfExecutor::create($this);
if (!$use_libc) {
$make->appendEnv([
'CC' => 'gcc', // libc-less version fails to compile with clang or zig
'CXX' => 'g++',
'AR' => 'ar',
'LD' => 'ld',
]);
} else {
$make->appendEnv([
'CFLAGS' => '-D_GNU_SOURCE',
]);
}
UnixAutoconfExecutor::create($this)
->appendEnv([
'CFLAGS' => '-D_GNU_SOURCE',
])
$make
->removeConfigureArgs(
'--disable-shared',
'--enable-static',
@ -29,11 +37,11 @@ class liburing extends LinuxLibraryBase
'--enable-pic',
)
->addConfigureArgs(
'--use-libc'
$use_libc ? '--use-libc' : '',
)
->configure()
->make(with_clean: false)
->exec("rm -rf {$this->getLibDir()}/*.so*");
->exec("rm -rf {$this->getLibDir()}/liburing*.so*");
$this->patchPkgconfPrefix(['liburing.pc', 'liburing-ffi.pc']);
}

View File

@ -76,14 +76,6 @@ 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;
}
@ -142,14 +134,6 @@ 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;
}