Files
static-php-cli/src/SPC/builder/unix/library/libxslt.php

46 lines
1.6 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;
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)
->appendEnv([
'CFLAGS' => "-I{$this->getIncludeDir()}",
'LDFLAGS' => "-L{$this->getLibDir()}",
2025-07-23 00:38:25 +08:00
'LIBS' => "{$static_libs} {$cpp}",
])
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')) {
$ac->appendEnv([
2025-07-01 14:01:48 +07:00
'LD_LIBRARY_PATH' => getenv('SPC_LD_LIBRARY_PATH'),
'LIBRARY_PATH' => getenv('SPC_LIBRARY_PATH'),
]);
}
$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']);
$this->patchLaDependencyPrefix();
$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
}
}