mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 09:25:35 +08:00
Use cmake executor instead of raw command
This commit is contained in:
@@ -4,9 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\builder\unix\executor\UnixCMakeExecutor;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
trait libzip
|
||||
{
|
||||
@@ -16,35 +16,21 @@ trait libzip
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
$extra = '';
|
||||
// lib:bzip2
|
||||
$extra .= $this->builder->getLib('bzip2') ? '-DENABLE_BZIP2=ON ' : '-DENABLE_BZIP2=OFF ';
|
||||
// lib:xz
|
||||
$extra .= $this->builder->getLib('xz') ? '-DENABLE_LZMA=ON ' : '-DENABLE_LZMA=OFF ';
|
||||
// lib:zstd (disabled due to imagemagick link issue
|
||||
$extra .= /* $this->builder->getLib('zstd') ? '-DENABLE_ZSTD=ON ' : */ '-DENABLE_ZSTD=OFF ';
|
||||
// lib:openssl
|
||||
$extra .= $this->builder->getLib('openssl') ? '-DENABLE_OPENSSL=ON ' : '-DENABLE_OPENSSL=OFF ';
|
||||
|
||||
FileSystem::resetDir($this->source_dir . '/build');
|
||||
shell()->cd($this->source_dir . '/build')
|
||||
->exec(
|
||||
'cmake ' .
|
||||
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||
'-DENABLE_GNUTLS=OFF ' .
|
||||
'-DENABLE_MBEDTLS=OFF ' .
|
||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||
'-DBUILD_DOC=OFF ' .
|
||||
'-DBUILD_EXAMPLES=OFF ' .
|
||||
'-DBUILD_REGRESS=OFF ' .
|
||||
'-DBUILD_TOOLS=OFF ' .
|
||||
$extra .
|
||||
'..'
|
||||
UnixCMakeExecutor::create($this)
|
||||
->optionalLib('bzip2', ...cmake_boolean_args('ENABLE_BZIP2'))
|
||||
->optionalLib('xz', ...cmake_boolean_args('ENABLE_LZMA'))
|
||||
->optionalLib('openssl', ...cmake_boolean_args('ENABLE_OPENSSL'))
|
||||
->addConfigureArgs(
|
||||
'-DENABLE_GNUTLS=OFF',
|
||||
'-DENABLE_MBEDTLS=OFF',
|
||||
'-DBUILD_SHARED_LIBS=OFF',
|
||||
'-DBUILD_DOC=OFF',
|
||||
'-DBUILD_EXAMPLES=OFF',
|
||||
'-DBUILD_REGRESS=OFF',
|
||||
'-DBUILD_TOOLS=OFF',
|
||||
'-DENABLE_ZSTD=OFF',
|
||||
)
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install');
|
||||
->build();
|
||||
$this->patchPkgconfPrefix(['libzip.pc'], PKGCONF_PATCH_PREFIX);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user