45 lines
1.5 KiB
PHP
Raw Normal View History

2023-08-26 23:50:24 +08:00
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase;
2023-08-26 23:50:24 +08:00
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
2025-06-09 19:32:31 +08:00
use SPC\util\executor\UnixAutoconfExecutor;
2023-08-26 23:50:24 +08:00
trait libxslt
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
2023-08-26 23:50:24 +08:00
*/
protected function build(): void
{
2025-06-10 15:33:41 +08:00
$static_libs = $this instanceof LinuxLibraryBase ? $this->getStaticLibFiles(include_self: false) : '';
2025-06-09 19:32:31 +08:00
$ac = UnixAutoconfExecutor::create($this)
->appendEnv([
'CFLAGS' => "-I{$this->getIncludeDir()}",
'LDFLAGS' => "-L{$this->getLibDir()}",
2025-06-09 19:32:31 +08:00
'LIBS' => "{$static_libs} -lstdc++",
])
2025-06-09 19:32:31 +08:00
->addConfigureArgs(
'--without-python',
'--without-crypto',
'--without-debug',
'--without-debugger',
"--with-libxml-prefix={$this->getBuildRootPath()}",
);
$ac->exec("{$this->builder->getOption('library_path')} {$this->builder->getOption('ld_library_path')} ./configure {$ac->getConfigureArgsString()}")->make();
2023-08-26 23:50:24 +08:00
$this->patchPkgconfPrefix(['libexslt.pc']);
$this->patchLaDependencyPrefix();
2025-06-07 23:00:26 +07:00
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");
2023-08-26 23:50:24 +08:00
}
}