mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-20 15:25:36 +08:00
test gnu (test musl again later, jxl fails with avx shit again)
This commit is contained in:
@@ -402,11 +402,12 @@ class Extension
|
|||||||
public function buildUnixShared(): void
|
public function buildUnixShared(): void
|
||||||
{
|
{
|
||||||
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()]);
|
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()]);
|
||||||
|
[$staticLibs, $sharedLibs] = $this->getStaticAndSharedLibs($config['libs']);
|
||||||
$env = [
|
$env = [
|
||||||
'CFLAGS' => $config['cflags'],
|
'CFLAGS' => $config['cflags'],
|
||||||
'CXXFLAGS' => $config['cflags'],
|
'CXXFLAGS' => $config['cflags'],
|
||||||
'LDFLAGS' => $config['ldflags'],
|
'LDFLAGS' => $config['ldflags'],
|
||||||
'LIBS' => $config['libs'],
|
'LIBS' => "-Wl,--start-group {$staticLibs} -Wl,--end-group {$sharedLibs}",
|
||||||
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
||||||
];
|
];
|
||||||
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||||
@@ -436,20 +437,11 @@ class Extension
|
|||||||
'--enable-shared --disable-static'
|
'--enable-shared --disable-static'
|
||||||
);
|
);
|
||||||
|
|
||||||
$staticLibString = '';
|
|
||||||
$libs = explode(' ', $config['libs']);
|
|
||||||
foreach ($libs as $lib) {
|
|
||||||
$staticLib = BUILD_LIB_PATH . '/' . str_replace('-l', '', $lib) . '.a';
|
|
||||||
if (file_exists($staticLib)) {
|
|
||||||
$staticLibString .= " {$lib}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// some extensions don't define their dependencies well, this patch is only needed for a few
|
// some extensions don't define their dependencies well, this patch is only needed for a few
|
||||||
FileSystem::replaceFileRegex(
|
FileSystem::replaceFileRegex(
|
||||||
$this->source_dir . '/Makefile',
|
$this->source_dir . '/Makefile',
|
||||||
'/^(.*_SHARED_LIBADD\s*=.*)$/m',
|
'/^(.*_SHARED_LIBADD\s*=.*)$/m',
|
||||||
'$1 ' . trim($staticLibString)
|
'$1 ' . trim($staticLibs)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($this->patchBeforeSharedMake()) {
|
if ($this->patchBeforeSharedMake()) {
|
||||||
@@ -537,6 +529,22 @@ class Extension
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getStaticAndSharedLibs(string $allLibs): array
|
||||||
|
{
|
||||||
|
$staticLibString = '';
|
||||||
|
$sharedLibString = '';
|
||||||
|
$libs = explode(' ', $allLibs);
|
||||||
|
foreach ($libs as $lib) {
|
||||||
|
$staticLib = BUILD_LIB_PATH . '/lib' . str_replace('-l', '', $lib) . '.a';
|
||||||
|
if (file_exists($staticLib)) {
|
||||||
|
$staticLibString .= " {$lib}";
|
||||||
|
} else {
|
||||||
|
$sharedLibString .= " {$lib}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [$staticLibString, $sharedLibString];
|
||||||
|
}
|
||||||
|
|
||||||
private function getLibraryDependencies(bool $recursive = false): array
|
private function getLibraryDependencies(bool $recursive = false): array
|
||||||
{
|
{
|
||||||
$ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase);
|
$ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase);
|
||||||
|
|||||||
@@ -158,9 +158,11 @@ if ($shared_extensions) {
|
|||||||
break;
|
break;
|
||||||
case 'ubuntu-24.04':
|
case 'ubuntu-24.04':
|
||||||
case 'ubuntu-24.04-arm':
|
case 'ubuntu-24.04-arm':
|
||||||
putenv('SPC_TARGET=native-native-musl -dynamic');
|
putenv('SPC_TARGET=native-native-gnu');
|
||||||
if (getenv('SPC_TARGET') && !str_contains(getenv('SPC_TARGET'), '-musl') || str_contains(getenv('SPC_TARGET'), '-dynamic')) {
|
if (getenv('SPC_TARGET') && !str_contains(getenv('SPC_TARGET'), '-musl')) {
|
||||||
exec('sudo apt install musl -y');
|
exec('sudo apt install musl -y');
|
||||||
|
}
|
||||||
|
if (getenv('SPC_TARGET')) {
|
||||||
$shared_cmd = ' --build-shared=' . quote2($shared_extensions) . ' ';
|
$shared_cmd = ' --build-shared=' . quote2($shared_extensions) . ' ';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user