Skip to content

Commit

Permalink
fix pgsql build on non-alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
DubbleClick committed Oct 17, 2023
1 parent e076e63 commit 8973fca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/SPC/builder/linux/library/libxml2.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ public function build(): void
)
->exec("cmake --build . -j {$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);

FileSystem::replaceFileStr(
BUILD_LIB_PATH . '/pkgconfig/libxml-2.0.pc',
'-licudata -licui18n -licuuc',
'-licui18n -licuuc -licudata'
);
}
}
17 changes: 11 additions & 6 deletions src/SPC/builder/unix/library/postgresql.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ protected function build(): void
$builddir = BUILD_ROOT_PATH;
$env = $this->builder->configure_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';
$output = shell()->execWithResult($env . " {$pkgconfig_executable} --cflags-only-I --static " . $packages);
Expand All @@ -36,15 +41,15 @@ protected function build(): void
$output = shell()->execWithResult($env . " {$pkgconfig_executable} --libs-only-l --static " . $packages);
if (!empty($output[1][0])) {
$libs = $output[1][0];
$envs .= " LIBS=\"{$libs}\" ";
$envs .= " LIBS=\"{$libs} -lstdc++\" ";
}

FileSystem::resetDir($this->source_dir . '/build');

# 有静态链接配置 参考文件: src/interfaces/libpq/Makefile
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 "293 s/^/#$/" ../src/Makefile.shlib')
->exec('sed -i.backup "293 s/^/#$/" ../src/Makefile.shlib')
->exec('sed -i.backup "441 s/^/#$/" ../src/Makefile.shlib');

// configure
Expand All @@ -59,12 +64,12 @@ protected function build(): void
'--with-libxml ' .
($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') .
($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-zstd ' .
'--without-perl ' .
'--without-python ' .
'--without-pam ' .
'--without-bonjour ' .
'--without-tcl '
);
Expand Down

0 comments on commit 8973fca

Please sign in to comment.