fix pgsql build on non-alpine

This commit is contained in:
DubbleClick 2023-10-16 21:03:26 +02:00
parent a4dc177621
commit a83a457905
2 changed files with 17 additions and 6 deletions

View File

@ -40,5 +40,11 @@ class libxml2 extends LinuxLibraryBase
) )
->exec("cmake --build . -j {$this->builder->concurrency}") ->exec("cmake --build . -j {$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH); ->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
FileSystem::replaceFileStr(
BUILD_LIB_PATH . '/pkgconfig/libxml-2.0.pc',
'-licudata -licui18n -licuuc',
'-licui18n -licuuc -licudata'
);
} }
} }

View File

@ -20,7 +20,12 @@ trait postgresql
$builddir = BUILD_ROOT_PATH; $builddir = BUILD_ROOT_PATH;
$env = $this->builder->configure_env; $env = $this->builder->configure_env;
$envs = $env; $envs = $env;
$packages = 'openssl zlib readline libxml-2.0'; // icu-uc icu-io icu-i18n libzstd $packages = 'openssl zlib readline libxml-2.0 zlib';
foreach (['zstd', 'ldap', 'pam', 'libxslt'] as $lib) {
if ($this->getBuilder()->getLib($lib)) {
$packages .= ' ' . $lib;
}
}
$pkgconfig_executable = $builddir . '/bin/pkg-config'; $pkgconfig_executable = $builddir . '/bin/pkg-config';
$output = shell()->execWithResult($env . " {$pkgconfig_executable} --cflags-only-I --static " . $packages); $output = shell()->execWithResult($env . " {$pkgconfig_executable} --cflags-only-I --static " . $packages);
@ -36,7 +41,7 @@ trait postgresql
$output = shell()->execWithResult($env . " {$pkgconfig_executable} --libs-only-l --static " . $packages); $output = shell()->execWithResult($env . " {$pkgconfig_executable} --libs-only-l --static " . $packages);
if (!empty($output[1][0])) { if (!empty($output[1][0])) {
$libs = $output[1][0]; $libs = $output[1][0];
$envs .= " LIBS=\"{$libs}\" "; $envs .= " LIBS=\"{$libs} -lstdc++\" ";
} }
FileSystem::resetDir($this->source_dir . '/build'); FileSystem::resetDir($this->source_dir . '/build');
@ -44,7 +49,7 @@ trait postgresql
# 有静态链接配置 参考文件: src/interfaces/libpq/Makefile # 有静态链接配置 参考文件: src/interfaces/libpq/Makefile
shell()->cd($this->source_dir . '/build') shell()->cd($this->source_dir . '/build')
->exec('sed -i.backup "s/invokes exit\'; exit 1;/invokes exit\';/" ../src/interfaces/libpq/Makefile') ->exec('sed -i.backup "s/invokes exit\'; exit 1;/invokes exit\';/" ../src/interfaces/libpq/Makefile')
->exec(' sed -i.backup "293 s/^/#$/" ../src/Makefile.shlib') ->exec('sed -i.backup "293 s/^/#$/" ../src/Makefile.shlib')
->exec('sed -i.backup "441 s/^/#$/" ../src/Makefile.shlib'); ->exec('sed -i.backup "441 s/^/#$/" ../src/Makefile.shlib');
// configure // configure
@ -59,12 +64,12 @@ trait postgresql
'--with-libxml ' . '--with-libxml ' .
($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') . ($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') .
($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') . ($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') .
'--without-libxslt ' . ($this->builder->getLib('pam') ? '--with-pam ' : '--without-pam ') .
($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') .
($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') .
'--without-lz4 ' . '--without-lz4 ' .
'--without-zstd ' .
'--without-perl ' . '--without-perl ' .
'--without-python ' . '--without-python ' .
'--without-pam ' .
'--without-bonjour ' . '--without-bonjour ' .
'--without-tcl ' '--without-tcl '
); );