mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 08:45:40 +08:00
merge cmake changes from master into icurel
This commit is contained in:
@@ -7,6 +7,7 @@ namespace SPC\builder\unix\library;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\executor\UnixCMakeExecutor;
|
||||
|
||||
trait libevent
|
||||
{
|
||||
@@ -39,31 +40,19 @@ trait libevent
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
// CMake needs a clean build directory
|
||||
$extra = '';
|
||||
$cmake = UnixCMakeExecutor::create($this)
|
||||
->addConfigureArgs(
|
||||
'-DEVENT__LIBRARY_TYPE=STATIC',
|
||||
'-DEVENT__DISABLE_BENCHMARK=ON',
|
||||
'-DEVENT__DISABLE_THREAD_SUPPORT=ON',
|
||||
'-DEVENT__DISABLE_TESTS=ON',
|
||||
'-DEVENT__DISABLE_SAMPLES=ON',
|
||||
'-DEVENT__DISABLE_MBEDTLS=ON ',
|
||||
);
|
||||
if (version_compare(get_cmake_version(), '4.0.0', '>=')) {
|
||||
$extra .= '-DCMAKE_POLICY_VERSION_MINIMUM=3.10 ';
|
||||
$cmake->addConfigureArgs('-DCMAKE_POLICY_VERSION_MINIMUM=3.10');
|
||||
}
|
||||
FileSystem::resetDir($this->source_dir . '/build');
|
||||
// Start build
|
||||
shell()->cd($this->source_dir . '/build')
|
||||
->setEnv([
|
||||
'CFLAGS' => $this->getLibExtraCFlags(),
|
||||
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
||||
'LIBS' => $this->getLibExtraLibs(),
|
||||
])
|
||||
->execWithEnv(
|
||||
"cmake {$this->builder->makeCmakeArgs()} {$extra}" .
|
||||
'-DEVENT__LIBRARY_TYPE=STATIC ' .
|
||||
'-DEVENT__DISABLE_BENCHMARK=ON ' .
|
||||
'-DEVENT__DISABLE_THREAD_SUPPORT=ON ' .
|
||||
'-DEVENT__DISABLE_MBEDTLS=ON ' .
|
||||
'-DEVENT__DISABLE_TESTS=ON ' .
|
||||
'-DEVENT__DISABLE_SAMPLES=ON ' .
|
||||
'..'
|
||||
)
|
||||
->execWithEnv("cmake --build . -j {$this->builder->concurrency}")
|
||||
->exec('make install');
|
||||
$cmake->build();
|
||||
|
||||
$this->patchPkgconfPrefix(['libevent.pc', 'libevent_core.pc', 'libevent_extra.pc', 'libevent_openssl.pc']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user