merge cmake changes from master into icurel

This commit is contained in:
DubbleClick
2025-06-09 14:38:45 +07:00
66 changed files with 628 additions and 798 deletions

View File

@@ -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']);