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;
|
|
|
|
|
use SPC\exception\WrongUsageException;
|
2023-04-29 18:59:47 +08:00
|
|
|
use SPC\store\FileSystem;
|
|
|
|
|
|
|
|
|
|
trait libavif
|
|
|
|
|
{
|
2023-08-20 19:51:45 +08:00
|
|
|
/**
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
* @throws WrongUsageException
|
|
|
|
|
*/
|
|
|
|
|
protected function build(): void
|
2023-04-29 18:59:47 +08:00
|
|
|
{
|
|
|
|
|
// CMake needs a clean build directory
|
|
|
|
|
FileSystem::resetDir($this->source_dir . '/build');
|
|
|
|
|
// Start build
|
|
|
|
|
shell()->cd($this->source_dir . '/build')
|
2025-05-15 14:45:51 +07:00
|
|
|
->setEnv([
|
|
|
|
|
'CFLAGS' => $this->getLibExtraCFlags(),
|
|
|
|
|
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
|
|
|
|
'LIBS' => $this->getLibExtraLibs(),
|
|
|
|
|
])
|
2025-05-31 14:41:35 +07:00
|
|
|
->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DPOSITION_INDEPENDENT_CODE=ON -DAVIF_LIBYUV=OFF ..")
|
2024-04-07 15:52:24 +08:00
|
|
|
->execWithEnv("cmake --build . -j {$this->builder->concurrency}")
|
2025-03-10 00:39:20 +08:00
|
|
|
->execWithEnv('make install');
|
2023-04-29 18:59:47 +08:00
|
|
|
// patch pkgconfig
|
|
|
|
|
$this->patchPkgconfPrefix(['libavif.pc']);
|
2023-05-10 02:04:08 +08:00
|
|
|
$this->cleanLaFiles();
|
2023-04-29 18:59:47 +08:00
|
|
|
}
|
|
|
|
|
}
|