2023-08-26 23:50:24 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
2023-10-17 00:52:49 +02:00
|
|
|
use SPC\builder\linux\library\LinuxLibraryBase;
|
2023-08-26 23:50:24 +08:00
|
|
|
use SPC\exception\FileSystemException;
|
|
|
|
|
use SPC\exception\RuntimeException;
|
2023-10-17 00:52:49 +02:00
|
|
|
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
|
2023-10-17 00:52:49 +02:00
|
|
|
* @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)
|
2025-06-09 10:24:06 +08:00
|
|
|
->appendEnv([
|
|
|
|
|
'CFLAGS' => "-I{$this->getIncludeDir()}",
|
|
|
|
|
'LDFLAGS' => "-L{$this->getLibDir()}",
|
2025-06-09 19:32:31 +08:00
|
|
|
'LIBS' => "{$static_libs} -lstdc++",
|
2025-05-06 16:24:57 +07:00
|
|
|
])
|
2025-06-09 19:32:31 +08:00
|
|
|
->addConfigureArgs(
|
|
|
|
|
'--without-python',
|
|
|
|
|
'--without-crypto',
|
|
|
|
|
'--without-debug',
|
|
|
|
|
'--without-debugger',
|
|
|
|
|
"--with-libxml-prefix={$this->getBuildRootPath()}",
|
|
|
|
|
);
|
2025-06-28 16:36:05 +08:00
|
|
|
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();
|
2025-06-09 19:32:31 +08:00
|
|
|
|
2023-08-26 23:50:24 +08:00
|
|
|
$this->patchPkgconfPrefix(['libexslt.pc']);
|
2025-06-10 19:46:55 +07:00
|
|
|
$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
|
|
|
}
|
|
|
|
|
}
|