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;
|
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
|
|
|
|
|
{
|
2023-10-17 00:52:49 +02:00
|
|
|
$required_libs = '';
|
|
|
|
|
foreach ($this->getDependencies() as $dep) {
|
|
|
|
|
if ($dep instanceof LinuxLibraryBase) {
|
|
|
|
|
$required_libs .= ' ' . $dep->getStaticLibFiles();
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-06-09 11:12:34 +08:00
|
|
|
shell()->cd($this->source_dir)->initializeEnv($this)
|
2025-06-09 10:24:06 +08:00
|
|
|
->appendEnv([
|
|
|
|
|
'CFLAGS' => "-I{$this->getIncludeDir()}",
|
|
|
|
|
'LDFLAGS' => "-L{$this->getLibDir()}",
|
|
|
|
|
'LIBS' => "{$required_libs} -lstdc++",
|
2025-05-06 16:24:57 +07:00
|
|
|
])
|
2025-06-09 10:24:06 +08:00
|
|
|
->exec(
|
2023-10-17 00:52:49 +02:00
|
|
|
"{$this->builder->getOption('library_path')} " .
|
|
|
|
|
"{$this->builder->getOption('ld_library_path')} " .
|
|
|
|
|
'./configure ' .
|
2023-08-26 23:50:24 +08:00
|
|
|
'--enable-static --disable-shared ' .
|
2025-05-31 14:35:59 +07:00
|
|
|
'--with-pic ' .
|
2023-08-26 23:50:24 +08:00
|
|
|
'--without-python ' .
|
|
|
|
|
'--without-mem-debug ' .
|
|
|
|
|
'--without-crypto ' .
|
|
|
|
|
'--without-debug ' .
|
|
|
|
|
'--without-debugger ' .
|
|
|
|
|
'--with-libxml-prefix=' . escapeshellarg(BUILD_ROOT_PATH) . ' ' .
|
|
|
|
|
'--prefix='
|
|
|
|
|
)
|
2025-06-09 10:24:06 +08:00
|
|
|
->exec('make clean')
|
|
|
|
|
->exec("make -j{$this->builder->concurrency}")
|
|
|
|
|
->exec('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH));
|
2023-08-26 23:50:24 +08:00
|
|
|
$this->patchPkgconfPrefix(['libexslt.pc']);
|
2025-05-21 13:19:51 +07:00
|
|
|
$this->patchLaDependencyPrefix(['libxslt.la', 'libexslt.la']);
|
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
|
|
|
}
|
|
|
|
|
}
|