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;
|
2025-07-23 00:48:37 +08:00
|
|
|
use SPC\builder\macos\library\MacOSLibraryBase;
|
2025-06-09 19:32:31 +08:00
|
|
|
use SPC\util\executor\UnixAutoconfExecutor;
|
2023-08-26 23:50:24 +08:00
|
|
|
|
|
|
|
|
trait libxslt
|
|
|
|
|
{
|
|
|
|
|
protected function build(): void
|
|
|
|
|
{
|
2025-06-10 15:33:41 +08:00
|
|
|
$static_libs = $this instanceof LinuxLibraryBase ? $this->getStaticLibFiles(include_self: false) : '';
|
2025-07-23 00:48:37 +08:00
|
|
|
$cpp = $this instanceof MacOSLibraryBase ? '-lc++' : '-lstdc++';
|
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-07-23 00:38:25 +08:00
|
|
|
'LIBS' => "{$static_libs} {$cpp}",
|
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-07-01 14:01:48 +07:00
|
|
|
if (getenv('SPC_LD_LIBRARY_PATH') && getenv('SPC_LIBRARY_PATH')) {
|
2025-06-28 16:36:05 +08:00
|
|
|
$ac->appendEnv([
|
2025-07-01 14:01:48 +07:00
|
|
|
'LD_LIBRARY_PATH' => getenv('SPC_LD_LIBRARY_PATH'),
|
|
|
|
|
'LIBRARY_PATH' => getenv('SPC_LIBRARY_PATH'),
|
2025-06-28 16:36:05 +08:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
$ac->configure()->make();
|
2025-06-09 19:32:31 +08:00
|
|
|
|
2025-07-23 14:35:34 +08:00
|
|
|
$this->patchPkgconfPrefix(['libexslt.pc', 'libxslt.pc']);
|
2025-06-10 19:46:55 +07:00
|
|
|
$this->patchLaDependencyPrefix();
|
2025-07-27 00:59:32 +07:00
|
|
|
$AR = getenv('AR') ?: 'ar';
|
2025-06-07 23:00:26 +07:00
|
|
|
shell()->cd(BUILD_LIB_PATH)
|
2025-07-27 01:10:21 +07:00
|
|
|
->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
|
|
|
}
|
|
|
|
|
}
|