mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
fix imagemagick and postgresql builds with different libs
This commit is contained in:
parent
da1cbeb79c
commit
0007043f4a
@ -12,11 +12,10 @@ class imagick extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
// linux need to link library manually, we add it to extra-libs
|
||||
// imagick may call omp_pause_all which requires -lgomp
|
||||
$extra_libs = $this->builder->getOption('extra-libs', '');
|
||||
if (!str_contains($extra_libs, 'libMagickCore')) {
|
||||
$extra_libs .= ' /usr/lib/libMagick++-7.Q16HDRI.a /usr/lib/libMagickCore-7.Q16HDRI.a /usr/lib/libMagickWand-7.Q16HDRI.a';
|
||||
}
|
||||
$libf = BUILD_LIB_PATH;
|
||||
$extra_libs .= " {$libf}/libMagick++-7.Q16HDRI.a {$libf}/libMagickWand-7.Q16HDRI.a {$libf}/libMagickCore-7.Q16HDRI.a -lgomp ";
|
||||
$this->builder->setOption('extra-libs', $extra_libs);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -16,23 +16,31 @@ trait imagemagick
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
$extra = '--without-jxl --without-xml --without-zstd --without-x --disable-openmp ';
|
||||
// libzip support
|
||||
$extra .= $this->builder->getLib('libzip') ? '--with-zip ' : '--without-zip ';
|
||||
// jpeg support
|
||||
$extra .= $this->builder->getLib('libjpeg') ? '--with-jpeg ' : '';
|
||||
// png support
|
||||
$extra .= $this->builder->getLib('libpng') ? '--with-png ' : '';
|
||||
// webp support
|
||||
$extra .= $this->builder->getLib('libwebp') ? '--with-webp ' : '';
|
||||
// zstd support
|
||||
// $extra .= $this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ';
|
||||
// freetype support
|
||||
$extra .= $this->builder->getLib('freetype') ? '--with-freetype ' : '--without-freetype ';
|
||||
$extra = '--without-jxl --without-x --disable-openmp ';
|
||||
$required_libs = '';
|
||||
$optional_libs = [
|
||||
'libzip' => 'zip',
|
||||
'libjpeg' => 'jpeg',
|
||||
'libpng' => 'png',
|
||||
'libwebp' => 'webp',
|
||||
'libxml2' => 'xml',
|
||||
'zlib' => 'zlib',
|
||||
'zstd' => 'zstd',
|
||||
'freetype' => 'freetype',
|
||||
];
|
||||
foreach ($optional_libs as $lib => $option) {
|
||||
$extra .= $this->builder->getLib($lib) ? "--with-{$option} " : "--without-{$option} ";
|
||||
if ($this->builder->getLib($lib)) {
|
||||
$required_libs .= ' ' . $this->builder->getLib($lib)->getStaticLibFiles();
|
||||
}
|
||||
}
|
||||
|
||||
shell()->cd($this->source_dir)
|
||||
->exec(
|
||||
"{$this->builder->configure_env} ./configure " .
|
||||
"{$this->builder->configure_env} " .
|
||||
'LDFLAGS="-static" ' .
|
||||
"LIBS='{$required_libs}' " .
|
||||
'./configure ' .
|
||||
'--enable-static --disable-shared ' .
|
||||
$extra .
|
||||
'--prefix='
|
||||
|
||||
@ -21,9 +21,16 @@ trait postgresql
|
||||
$env = $this->builder->configure_env;
|
||||
$envs = $env;
|
||||
$packages = 'openssl zlib readline libxml-2.0 zlib';
|
||||
foreach (['zstd', 'ldap', 'pam', 'libxslt'] as $lib) {
|
||||
$optional_packages = [
|
||||
'zstd' => 'libzstd',
|
||||
'ldap' => 'ldap',
|
||||
'libpam' => 'libpam',
|
||||
'libxslt' => 'libxslt',
|
||||
'icu' => 'icu-i18n',
|
||||
];
|
||||
foreach ($optional_packages as $lib => $pkg) {
|
||||
if ($this->getBuilder()->getLib($lib)) {
|
||||
$packages .= ' ' . $lib;
|
||||
$packages .= ' ' . $pkg;
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,11 +69,11 @@ trait postgresql
|
||||
'--with-ssl=openssl ' .
|
||||
'--with-readline ' .
|
||||
'--with-libxml ' .
|
||||
($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') .
|
||||
($this->builder->getLib('icu') ? '--with-icu ' : '--without-icu ') .
|
||||
($this->builder->getLib('pam') ? '--with-pam ' : '--without-pam ') .
|
||||
($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') .
|
||||
($this->builder->getLib('ldap') ? '--with-ldap ' : '--without-ldap ') .
|
||||
($this->builder->getLib('libpam') ? '--with-pam ' : '--without-pam ') .
|
||||
($this->builder->getLib('libxslt') ? '--with-libxslt ' : '--without-libxslt ') .
|
||||
($this->builder->getLib('zstd') ? '--with-zstd ' : '--without-zstd ') .
|
||||
'--without-lz4 ' .
|
||||
'--without-perl ' .
|
||||
'--without-python ' .
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user