mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14:52 +08:00
51 lines
1.7 KiB
PHP
51 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
use SPC\builder\linux\library\LinuxLibraryBase;
|
|
use SPC\exception\FileSystemException;
|
|
use SPC\exception\RuntimeException;
|
|
use SPC\exception\WrongUsageException;
|
|
use SPC\util\executor\UnixAutoconfExecutor;
|
|
|
|
trait libxslt
|
|
{
|
|
/**
|
|
* @throws FileSystemException
|
|
* @throws RuntimeException
|
|
* @throws WrongUsageException
|
|
*/
|
|
protected function build(): void
|
|
{
|
|
$static_libs = $this instanceof LinuxLibraryBase ? $this->getStaticLibFiles(include_self: false) : '';
|
|
$ac = UnixAutoconfExecutor::create($this)
|
|
->appendEnv([
|
|
'CFLAGS' => "-I{$this->getIncludeDir()}",
|
|
'LDFLAGS' => "-L{$this->getLibDir()}",
|
|
'LIBS' => "{$static_libs} -lstdc++",
|
|
])
|
|
->addConfigureArgs(
|
|
'--without-python',
|
|
'--without-crypto',
|
|
'--without-debug',
|
|
'--without-debugger',
|
|
"--with-libxml-prefix={$this->getBuildRootPath()}",
|
|
);
|
|
if (getenv('SPC_LINUX_DEFAULT_LD_LIBRARY_PATH') && getenv('SPC_LINUX_DEFAULT_LIBRARY_PATH')) {
|
|
$ac->appendEnv([
|
|
'LD_LIBRARY_PATH' => getenv('SPC_LINUX_DEFAULT_LD_LIBRARY_PATH'),
|
|
'LIBRARY_PATH' => getenv('SPC_LINUX_DEFAULT_LIBRARY_PATH'),
|
|
]);
|
|
}
|
|
$ac->configure()->make();
|
|
|
|
$this->patchPkgconfPrefix(['libexslt.pc']);
|
|
$this->patchLaDependencyPrefix();
|
|
shell()->cd(BUILD_LIB_PATH)
|
|
->exec("ar -t libxslt.a | grep '\\.a$' | xargs -n1 ar d libxslt.a")
|
|
->exec("ar -t libexslt.a | grep '\\.a$' | xargs -n1 ar d libexslt.a");
|
|
}
|
|
}
|