mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
we don't need a min glibc version, just don't use --use-libc!
This commit is contained in:
parent
00f262571c
commit
2d409db2f9
@ -939,7 +939,6 @@
|
|||||||
"headers-linux": [
|
"headers-linux": [
|
||||||
"liburing/",
|
"liburing/",
|
||||||
"liburing.h"
|
"liburing.h"
|
||||||
],
|
]
|
||||||
"glibc-min": "2.30"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC\builder\linux\library;
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
use SPC\exception\WrongUsageException;
|
|
||||||
use SPC\util\executor\UnixAutoconfExecutor;
|
use SPC\util\executor\UnixAutoconfExecutor;
|
||||||
use SPC\util\SPCTarget;
|
use SPC\util\SPCTarget;
|
||||||
|
|
||||||
@ -14,14 +13,23 @@ class liburing extends LinuxLibraryBase
|
|||||||
|
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
if (SPCTarget::getLibc() === 'glibc' && SPCTarget::getLibcVersion() < 2.30) {
|
$use_libc = SPCTarget::getLibc() !== 'glibc' || version_compare(SPCTarget::getLibcVersion(), '2.30', '>=');
|
||||||
throw new WrongUsageException('liburing requires glibc >= 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)
|
$make
|
||||||
->appendEnv([
|
|
||||||
'CFLAGS' => '-D_GNU_SOURCE',
|
|
||||||
])
|
|
||||||
->removeConfigureArgs(
|
->removeConfigureArgs(
|
||||||
'--disable-shared',
|
'--disable-shared',
|
||||||
'--enable-static',
|
'--enable-static',
|
||||||
@ -29,11 +37,11 @@ class liburing extends LinuxLibraryBase
|
|||||||
'--enable-pic',
|
'--enable-pic',
|
||||||
)
|
)
|
||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'--use-libc'
|
$use_libc ? '--use-libc' : '',
|
||||||
)
|
)
|
||||||
->configure()
|
->configure()
|
||||||
->make(with_clean: false)
|
->make(with_clean: false)
|
||||||
->exec("rm -rf {$this->getLibDir()}/*.so*");
|
->exec("rm -rf {$this->getLibDir()}/liburing*.so*");
|
||||||
|
|
||||||
$this->patchPkgconfPrefix(['liburing.pc', 'liburing-ffi.pc']);
|
$this->patchPkgconfPrefix(['liburing.pc', 'liburing-ffi.pc']);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,14 +76,6 @@ class DependencyUtil
|
|||||||
$del_list = [];
|
$del_list = [];
|
||||||
foreach ($obj['suggests'] as $id => $suggest) {
|
foreach ($obj['suggests'] as $id => $suggest) {
|
||||||
if (!str_starts_with($suggest, 'ext@')) {
|
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;
|
$dep_list[$name]['depends'][] = $suggest;
|
||||||
$del_list[] = $id;
|
$del_list[] = $id;
|
||||||
}
|
}
|
||||||
@ -142,14 +134,6 @@ class DependencyUtil
|
|||||||
$del_list = [];
|
$del_list = [];
|
||||||
foreach ($obj['suggests'] as $id => $suggest) {
|
foreach ($obj['suggests'] as $id => $suggest) {
|
||||||
if (!str_starts_with($suggest, 'ext@')) {
|
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;
|
$dep_list[$name]['depends'][] = $suggest;
|
||||||
$del_list[] = $id;
|
$del_list[] = $id;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user