2023-04-29 18:59:47 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
2023-08-20 19:51:45 +08:00
|
|
|
use SPC\exception\FileSystemException;
|
|
|
|
|
use SPC\exception\RuntimeException;
|
2023-04-29 18:59:47 +08:00
|
|
|
use SPC\store\FileSystem;
|
|
|
|
|
|
|
|
|
|
trait zstd
|
|
|
|
|
{
|
2023-08-20 19:51:45 +08:00
|
|
|
/**
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
*/
|
|
|
|
|
protected function build(): void
|
2023-04-29 18:59:47 +08:00
|
|
|
{
|
|
|
|
|
FileSystem::resetDir($this->source_dir . '/build/cmake/build');
|
|
|
|
|
shell()->cd($this->source_dir . '/build/cmake/build')
|
2025-05-18 17:59:02 +07:00
|
|
|
->setEnv([
|
|
|
|
|
'CFLAGS' => $this->getLibExtraCFlags(),
|
|
|
|
|
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
|
|
|
|
'LIBS' => $this->getLibExtraLibs(),
|
|
|
|
|
])
|
2025-06-07 23:19:32 +07:00
|
|
|
->execWithEnv(
|
|
|
|
|
"cmake {$this->builder->makeCmakeArgs()} " .
|
|
|
|
|
'-DZSTD_BUILD_STATIC=ON ' .
|
|
|
|
|
'-DZSTD_BUILD_SHARED=OFF ' .
|
|
|
|
|
'..'
|
|
|
|
|
)
|
2025-06-07 20:09:50 +07:00
|
|
|
->execWithEnv("cmake --build . -j {$this->builder->concurrency}")
|
|
|
|
|
->execWithEnv('make install');
|
2023-04-29 18:59:47 +08:00
|
|
|
$this->patchPkgconfPrefix(['libzstd.pc']);
|
|
|
|
|
}
|
|
|
|
|
}
|