fix imagemagick linking issue

This commit is contained in:
crazywhalecc 2023-11-29 00:51:05 +08:00 committed by Jerry Ma
parent 9dcda873f3
commit cee1346bec
2 changed files with 9 additions and 1 deletions

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace SPC\builder\extension; namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\builder\linux\LinuxBuilder;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('imagick')] #[CustomExt('imagick')]
@ -14,7 +15,9 @@ class imagick extends Extension
{ {
// imagick may call omp_pause_all which requires -lgomp // imagick may call omp_pause_all which requires -lgomp
$extra_libs = $this->builder->getOption('extra-libs', ''); $extra_libs = $this->builder->getOption('extra-libs', '');
if ($this->builder instanceof LinuxBuilder) {
$extra_libs .= ' -lgomp '; $extra_libs .= ' -lgomp ';
}
$this->builder->setOption('extra-libs', $extra_libs); $this->builder->setOption('extra-libs', $extra_libs);
return true; return true;
} }

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase; use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\exception\FileSystemException; use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException; use SPC\exception\RuntimeException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
@ -39,8 +40,12 @@ trait imagemagick
} }
$ldflags = $this instanceof LinuxLibraryBase ? ('LDFLAGS="-static" ') : ''; $ldflags = $this instanceof LinuxLibraryBase ? ('LDFLAGS="-static" ') : '';
// libxml iconv patch
$required_libs .= $this instanceof MacOSLibraryBase ? (' -liconv') : '';
shell()->cd($this->source_dir) shell()->cd($this->source_dir)
->exec( ->exec(
'PKG_CONFIG="$PKG_CONFIG --static" ' .
$ldflags . $ldflags .
"LIBS='{$required_libs}' " . "LIBS='{$required_libs}' " .
'./configure ' . './configure ' .