mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
fix ldap for postgresql
This commit is contained in:
parent
08d3849c43
commit
2f53915064
@ -234,8 +234,8 @@
|
|||||||
"ldap": {
|
"ldap": {
|
||||||
"source": "ldap",
|
"source": "ldap",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"liblber.a",
|
"libldap.a",
|
||||||
"libldap.a"
|
"liblber.a"
|
||||||
],
|
],
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"openssl",
|
"openssl",
|
||||||
|
|||||||
@ -356,16 +356,18 @@ class Extension
|
|||||||
{
|
{
|
||||||
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true);
|
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()], with_dependencies: true);
|
||||||
$sharedLibs = '';
|
$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) {
|
foreach (explode('-l', $config['libs']) as $lib) {
|
||||||
$lib = trim($lib);
|
$lib = trim($lib);
|
||||||
if ($lib === '') {
|
if ($lib === '') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$static_lib = 'lib' . $lib . '.a';
|
$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;
|
$staticLibs .= ' -l' . $lib;
|
||||||
} else {
|
} elseif (!str_contains($sharedLibs, '-l' . $lib)) {
|
||||||
$sharedLibs .= ' -l' . $lib;
|
$sharedLibs .= ' -l' . $lib;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -373,7 +375,7 @@ class Extension
|
|||||||
'CFLAGS' => $config['cflags'],
|
'CFLAGS' => $config['cflags'],
|
||||||
'CXXFLAGS' => $config['cflags'],
|
'CXXFLAGS' => $config['cflags'],
|
||||||
'LDFLAGS' => $config['ldflags'],
|
'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,
|
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
||||||
];
|
];
|
||||||
// prepare configure args
|
// prepare configure args
|
||||||
|
|||||||
@ -49,5 +49,8 @@ trait libxslt
|
|||||||
->execWithEnv('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH));
|
->execWithEnv('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH));
|
||||||
$this->patchPkgconfPrefix(['libexslt.pc']);
|
$this->patchPkgconfPrefix(['libexslt.pc']);
|
||||||
$this->patchLaDependencyPrefix(['libxslt.la', 'libexslt.la']);
|
$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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,7 +120,7 @@ trait postgresql
|
|||||||
->exec("rm -rf {$builddir}/lib/*.so")
|
->exec("rm -rf {$builddir}/lib/*.so")
|
||||||
->exec("rm -rf {$builddir}/lib/*.dylib");
|
->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
|
private function getVersion(): string
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class SPCConfigUtil
|
|||||||
* @param array $libraries Additional library name list
|
* @param array $libraries Additional library name list
|
||||||
* @param bool $include_suggest_ext Include suggested extensions
|
* @param bool $include_suggest_ext Include suggested extensions
|
||||||
* @param bool $include_suggest_lib Include suggested libraries
|
* @param bool $include_suggest_lib Include suggested libraries
|
||||||
* @param mixed $with_dependencies
|
* @param bool $with_dependencies
|
||||||
* @return array{
|
* @return array{
|
||||||
* cflags: string,
|
* cflags: string,
|
||||||
* ldflags: string,
|
* ldflags: string,
|
||||||
@ -43,7 +43,7 @@ class SPCConfigUtil
|
|||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
* @throws \Throwable
|
* @throws \Throwable
|
||||||
*/
|
*/
|
||||||
public function config(array $extensions = [], array $libraries = [], bool $include_suggest_ext = false, bool $include_suggest_lib = false, $with_dependencies = false): array
|
public function config(array $extensions = [], array $libraries = [], bool $include_suggest_ext = false, bool $include_suggest_lib = false, bool $with_dependencies = false): array
|
||||||
{
|
{
|
||||||
[$extensions, $libraries] = DependencyUtil::getExtsAndLibs($extensions, $libraries, $include_suggest_ext, $include_suggest_lib);
|
[$extensions, $libraries] = DependencyUtil::getExtsAndLibs($extensions, $libraries, $include_suggest_ext, $include_suggest_lib);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user