fix undefined references to brotlicommon functions in gd.so

This commit is contained in:
DubbleClick 2025-05-21 17:58:11 +07:00
parent 11c116480f
commit 3ff31d20cf
3 changed files with 7 additions and 3 deletions

View File

@ -268,8 +268,7 @@ abstract class BuilderBase
logger()->info('Building extension [' . $ext->getName() . '] as shared extension (' . $ext->getName() . '.so)');
$ext->buildShared();
}
}
catch (RuntimeException $e) {
} catch (RuntimeException $e) {
FileSystem::replaceFileLineContainsString(BUILD_BIN_PATH . '/php-config', 'extension_dir=', $extension_dir_line);
throw $e;
}

View File

@ -96,7 +96,10 @@ trait UnixLibraryTrait
// replace prefix
$file = FileSystem::readFile($realpath);
$file = str_replace(
' /lib/', ' ' . BUILD_LIB_PATH . '/', $file);
' /lib/',
' ' . BUILD_LIB_PATH . '/',
$file
);
$file = preg_replace('/^libdir=.*$/m', "libdir='" . BUILD_LIB_PATH . "'", $file);
FileSystem::writeFile($realpath, $file);
}

View File

@ -36,6 +36,8 @@ trait brotli
->execWithEnv("cmake --build . -j {$this->builder->concurrency}")
->execWithEnv('make install');
$this->patchPkgconfPrefix(['libbrotlicommon.pc', 'libbrotlidec.pc', 'libbrotlienc.pc']);
FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/libbrotlidec.pc', 'Libs: -L${libdir} -lbrotlidec', 'Libs: -L${libdir} -lbrotlidec -lbrotlicommon');
FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/libbrotlienc.pc', 'Libs: -L${libdir} -lbrotlienc', 'Libs: -L${libdir} -lbrotlidec -lbrotlicommon');
shell()->cd(BUILD_ROOT_PATH . '/lib')->exec('ln -sf libbrotlicommon.a libbrotli.a');
foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) {
if (str_starts_with($filename, 'libbrotli') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) {