mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 16:55:38 +08:00
refactor: replace SPC_LIBC with SPC_TARGET and update related logic
This commit is contained in:
@@ -4,12 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\builder\linux\library\LinuxLibraryBase;
|
||||
use SPC\builder\macos\library\MacOSLibraryBase;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\executor\UnixAutoconfExecutor;
|
||||
use SPC\util\SPCTarget;
|
||||
|
||||
trait imagemagick
|
||||
{
|
||||
@@ -33,16 +32,16 @@ trait imagemagick
|
||||
->optionalLib('bzip2', ...ac_with_args('bzlib'))
|
||||
->addConfigureArgs(
|
||||
// TODO: glibc rh 10 toolset's libgomp.a was built without -fPIC so we can't use openmp without depending on libgomp.so
|
||||
getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10') ? '--disable-openmp' : '--enable-openmp',
|
||||
SPCTarget::isTarget(SPCTarget::GLIBC) ? '--disable-openmp' : '--enable-openmp',
|
||||
'--without-jxl',
|
||||
'--without-x',
|
||||
);
|
||||
|
||||
// special: linux musl needs `-static`
|
||||
$ldflags = ($this instanceof LinuxLibraryBase) && getenv('SPC_LIBC') !== 'glibc' ? ('-static -ldl') : '-ldl';
|
||||
// special: linux musl-static needs `-static`
|
||||
$ldflags = !SPCTarget::isTarget(SPCTarget::MUSL_STATIC) ? ('-static -ldl') : '-ldl';
|
||||
|
||||
// special: macOS needs -iconv
|
||||
$libs = $this instanceof MacOSLibraryBase ? '-liconv' : '';
|
||||
$libs = SPCTarget::isTarget(SPCTarget::MACHO) ? '-liconv' : '';
|
||||
|
||||
$ac->appendEnv([
|
||||
'LDFLAGS' => $ldflags,
|
||||
|
||||
Reference in New Issue
Block a user