Return default version for musl and musl-wrapper

This commit is contained in:
crazywhalecc 2025-03-30 20:34:57 +08:00
parent 4e5c0f0a48
commit a940200164
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 7 additions and 4 deletions

View File

@ -189,7 +189,7 @@ class SystemUtil
public static function getLibcVersionIfExists(): ?string public static function getLibcVersionIfExists(): ?string
{ {
if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'glibc') { if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'glibc') {
$result = shell()->execWithResult('ldd --version'); $result = shell()->execWithResult('ldd --version', false);
if ($result[0] !== 0) { if ($result[0] !== 0) {
return null; return null;
} }
@ -202,11 +202,13 @@ class SystemUtil
} }
return null; return null;
} }
/*
// for musl, disabled temporarily as musl has better compatibility between different patch version?
if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'musl') { if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'musl') {
if (self::isMuslDist()) { if (self::isMuslDist()) {
$result = shell()->execWithResult('ldd 2>&1'); $result = shell()->execWithResult('ldd 2>&1', false);
} else { } else {
$result = shell()->execWithResult('/usr/local/musl/lib/libc.so 2>&1'); $result = shell()->execWithResult('/usr/local/musl/lib/libc.so 2>&1', false);
} }
// Match Version * line // Match Version * line
// match ldd version: "Version 1.2.3" match 1.2.3 // match ldd version: "Version 1.2.3" match 1.2.3
@ -215,6 +217,7 @@ class SystemUtil
return $matches[1]; return $matches[1];
} }
} }
*/
return null; return null;
} }
} }

View File

@ -31,7 +31,7 @@ class Config
if (self::$pre_built === null) { if (self::$pre_built === null) {
self::$pre_built = FileSystem::loadConfigArray('pre-built'); self::$pre_built = FileSystem::loadConfigArray('pre-built');
} }
$supported_sys_based = ['match-pattern']; $supported_sys_based = ['match-pattern', 'prefer-stable', 'repo'];
if (in_array($name, $supported_sys_based)) { if (in_array($name, $supported_sys_based)) {
$m_key = match (PHP_OS_FAMILY) { $m_key = match (PHP_OS_FAMILY) {
'Windows' => ['-windows', '-win', ''], 'Windows' => ['-windows', '-win', ''],