2024-03-01 20:10:48 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
|
|
|
|
use SPC\exception\FileSystemException;
|
|
|
|
|
use SPC\exception\RuntimeException;
|
2024-03-01 21:27:51 +08:00
|
|
|
use SPC\store\FileSystem;
|
2024-03-01 20:10:48 +08:00
|
|
|
|
|
|
|
|
trait libuuid
|
|
|
|
|
{
|
2024-03-01 21:27:51 +08:00
|
|
|
public function patchBeforeBuild(): bool
|
|
|
|
|
{
|
|
|
|
|
FileSystem::replaceFileStr($this->source_dir . '/configure', '-${am__api_version}', '');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-01 20:10:48 +08:00
|
|
|
/**
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
*/
|
|
|
|
|
protected function build(): void
|
|
|
|
|
{
|
|
|
|
|
shell()->cd($this->source_dir)
|
|
|
|
|
->exec('chmod +x configure')
|
|
|
|
|
->exec('chmod +x install-sh')
|
|
|
|
|
->exec(
|
|
|
|
|
'./configure ' .
|
|
|
|
|
'--enable-static --disable-shared ' .
|
|
|
|
|
'--prefix='
|
|
|
|
|
)
|
|
|
|
|
->exec('make clean')
|
|
|
|
|
->exec("make -j{$this->builder->concurrency}")
|
|
|
|
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
|
|
|
|
$this->patchPkgconfPrefix(['uuid.pc']);
|
|
|
|
|
}
|
|
|
|
|
}
|