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();
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-26 23:50:24 +08:00
|
|
|
shell()->cd($this->source_dir)
|
|
|
|
|
->exec(
|
2023-10-17 00:52:49 +02:00
|
|
|
'CFLAGS="-I' . BUILD_INCLUDE_PATH . '" ' .
|
|
|
|
|
"{$this->builder->getOption('library_path')} " .
|
|
|
|
|
"{$this->builder->getOption('ld_library_path')} " .
|
|
|
|
|
'LDFLAGS="-L' . BUILD_LIB_PATH . '" ' .
|
|
|
|
|
"LIBS='{$required_libs} -lstdc++' " .
|
|
|
|
|
'./configure ' .
|
2023-08-26 23:50:24 +08:00
|
|
|
'--enable-static --disable-shared ' .
|
|
|
|
|
'--without-python ' .
|
|
|
|
|
'--without-mem-debug ' .
|
|
|
|
|
'--without-crypto ' .
|
|
|
|
|
'--without-debug ' .
|
|
|
|
|
'--without-debugger ' .
|
|
|
|
|
'--with-libxml-prefix=' . escapeshellarg(BUILD_ROOT_PATH) . ' ' .
|
|
|
|
|
'--prefix='
|
|
|
|
|
)
|
|
|
|
|
->exec('make clean')
|
|
|
|
|
->exec("make -j{$this->builder->concurrency}")
|
|
|
|
|
->exec('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH));
|
|
|
|
|
$this->patchPkgconfPrefix(['libexslt.pc']);
|
|
|
|
|
}
|
|
|
|
|
}
|