mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
ensure liburing is only pulled in by suggested libs when glibc >= 2.30 (or musl)
This commit is contained in:
parent
43352ab986
commit
4eac953c71
@ -939,6 +939,7 @@
|
|||||||
"headers-linux": [
|
"headers-linux": [
|
||||||
"liburing/",
|
"liburing/",
|
||||||
"liburing.h"
|
"liburing.h"
|
||||||
]
|
],
|
||||||
|
"glibc-min": "2.30"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,8 +69,10 @@ class swoole extends Extension
|
|||||||
$arg .= $this->builder->getExt('swoole-hook-mysql') ? ' --enable-mysqlnd' : ' --disable-mysqlnd';
|
$arg .= $this->builder->getExt('swoole-hook-mysql') ? ' --enable-mysqlnd' : ' --disable-mysqlnd';
|
||||||
$arg .= $this->builder->getExt('swoole-hook-sqlite') ? ' --enable-swoole-sqlite' : ' --disable-swoole-sqlite';
|
$arg .= $this->builder->getExt('swoole-hook-sqlite') ? ' --enable-swoole-sqlite' : ' --disable-swoole-sqlite';
|
||||||
|
|
||||||
$config = (new SPCConfigUtil($this->builder, ['libs_only_deps' => true]))->config([], ['unixodbc']);
|
if ($this->builder->getExt('swoole-hook-odbc')) {
|
||||||
$arg .= $this->builder->getExt('swoole-hook-odbc') ? ' --with-swoole-odbc=unixODBC,' . BUILD_ROOT_PATH . ' SWOOLE_ODBC_LIBS="' . $config['libs'] . '"' : '';
|
$config = (new SPCConfigUtil($this->builder, ['libs_only_deps' => true]))->config([], ['unixodbc']);
|
||||||
|
$arg .= ' --with-swoole-odbc=unixODBC,' . BUILD_ROOT_PATH . ' SWOOLE_ODBC_LIBS="' . $config['libs'] . '"';
|
||||||
|
}
|
||||||
return $arg;
|
return $arg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,9 @@ 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;
|
||||||
|
|
||||||
class liburing extends LinuxLibraryBase
|
class liburing extends LinuxLibraryBase
|
||||||
{
|
{
|
||||||
@ -12,8 +14,14 @@ class liburing extends LinuxLibraryBase
|
|||||||
|
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
// Build liburing with static linking via autoconf
|
if (SPCTarget::getLibc() === 'glibc' && SPCTarget::getLibcVersion() < 2.30) {
|
||||||
|
throw new WrongUsageException('liburing requires glibc >= 2.30');
|
||||||
|
}
|
||||||
|
|
||||||
UnixAutoconfExecutor::create($this)
|
UnixAutoconfExecutor::create($this)
|
||||||
|
->appendEnv([
|
||||||
|
'CFLAGS' => '-D_GNU_SOURCE'
|
||||||
|
])
|
||||||
->removeConfigureArgs(
|
->removeConfigureArgs(
|
||||||
'--disable-shared',
|
'--disable-shared',
|
||||||
'--enable-static',
|
'--enable-static',
|
||||||
|
|||||||
@ -76,6 +76,14 @@ 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;
|
||||||
}
|
}
|
||||||
@ -134,6 +142,14 @@ 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,6 +100,10 @@ class SPCTarget
|
|||||||
public static function getLibcVersion(): ?string
|
public static function getLibcVersion(): ?string
|
||||||
{
|
{
|
||||||
if (PHP_OS_FAMILY === 'Linux') {
|
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();
|
$libc = self::getLibc();
|
||||||
return SystemUtil::getLibcVersionIfExists($libc);
|
return SystemUtil::getLibcVersionIfExists($libc);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user