test gnu (test musl again later, jxl fails with avx shit again)

This commit is contained in:
DubbleClick 2025-07-24 22:52:58 +07:00
parent 155e22a9f9
commit 8c5dc91895
2 changed files with 23 additions and 13 deletions

View File

@ -402,11 +402,12 @@ class Extension
public function buildUnixShared(): void
{
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()]);
[$staticLibs, $sharedLibs] = $this->getStaticAndSharedLibs($config['libs']);
$env = [
'CFLAGS' => $config['cflags'],
'CXXFLAGS' => $config['cflags'],
'LDFLAGS' => $config['ldflags'],
'LIBS' => $config['libs'],
'LIBS' => "-Wl,--start-group {$staticLibs} -Wl,--end-group {$sharedLibs}",
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
];
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
@ -436,20 +437,11 @@ class Extension
'--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
FileSystem::replaceFileRegex(
$this->source_dir . '/Makefile',
'/^(.*_SHARED_LIBADD\s*=.*)$/m',
'$1 ' . trim($staticLibString)
'$1 ' . trim($staticLibs)
);
if ($this->patchBeforeSharedMake()) {
@ -537,6 +529,22 @@ class Extension
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
{
$ret = array_filter($this->dependencies, fn ($x) => $x instanceof LibraryBase);

View File

@ -158,9 +158,11 @@ if ($shared_extensions) {
break;
case 'ubuntu-24.04':
case 'ubuntu-24.04-arm':
putenv('SPC_TARGET=native-native-musl -dynamic');
if (getenv('SPC_TARGET') && !str_contains(getenv('SPC_TARGET'), '-musl') || str_contains(getenv('SPC_TARGET'), '-dynamic')) {
putenv('SPC_TARGET=native-native-gnu');
if (getenv('SPC_TARGET') && !str_contains(getenv('SPC_TARGET'), '-musl')) {
exec('sudo apt install musl -y');
}
if (getenv('SPC_TARGET')) {
$shared_cmd = ' --build-shared=' . quote2($shared_extensions) . ' ';
}
break;