fix ldap for postgresql

This commit is contained in:
DubbleClick
2025-06-07 23:00:26 +07:00
parent 08d3849c43
commit 2f53915064
5 changed files with 14 additions and 9 deletions

View File

@@ -356,16 +356,18 @@ class Extension
{
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true);
$sharedLibs = '';
$staticLibs = '';
$staticLibs = $this->getLibFilesString();
$staticLibs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $staticLibs);
$staticLibs = str_replace('.a', '', $staticLibs);
foreach (explode('-l', $config['libs']) as $lib) {
$lib = trim($lib);
if ($lib === '') {
continue;
}
$static_lib = 'lib' . $lib . '.a';
if (file_exists(BUILD_LIB_PATH . '/' . $static_lib)) {
if (file_exists(BUILD_LIB_PATH . '/' . $static_lib) && !str_contains($staticLibs, '-llib')) {
$staticLibs .= ' -l' . $lib;
} else {
} elseif (!str_contains($sharedLibs, '-l' . $lib)) {
$sharedLibs .= ' -l' . $lib;
}
}
@@ -373,7 +375,7 @@ class Extension
'CFLAGS' => $config['cflags'],
'CXXFLAGS' => $config['cflags'],
'LDFLAGS' => $config['ldflags'],
'LIBS' => '-Wl,-Bstatic ' . $staticLibs . ' -Wl,-Bdynamic ' . $sharedLibs,
'LIBS' => '-Wl,-Bstatic -Wl,--start-group ' . $staticLibs . ' -Wl,--end-group -Wl,-Bdynamic ' . $sharedLibs,
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
];
// prepare configure args

View File

@@ -49,5 +49,8 @@ trait libxslt
->execWithEnv('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH));
$this->patchPkgconfPrefix(['libexslt.pc']);
$this->patchLaDependencyPrefix(['libxslt.la', 'libexslt.la']);
shell()->cd(BUILD_LIB_PATH)
->exec("ar -t libxslt.a | grep '\\.a$' | xargs -n1 ar d libxslt.a")
->exec("ar -t libexslt.a | grep '\\.a$' | xargs -n1 ar d libexslt.a");
}
}

View File

@@ -120,7 +120,7 @@ trait postgresql
->exec("rm -rf {$builddir}/lib/*.so")
->exec("rm -rf {$builddir}/lib/*.dylib");
FileSystem::replaceFileStr(BUILD_LIB_PATH . '/libpq.pc', '-lldap', '-lldap -llber');
FileSystem::replaceFileStr(BUILD_LIB_PATH . '/pkgconfig/libpq.pc', '-lldap', '-lldap -llber');
}
private function getVersion(): string