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
|
|
|
trait gmp
|
|
|
|
|
{
|
2023-08-20 19:51:45 +08:00
|
|
|
/**
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
*/
|
|
|
|
|
protected function build(): void
|
2023-04-29 18:59:47 +08:00
|
|
|
{
|
|
|
|
|
shell()->cd($this->source_dir)
|
2025-01-28 19:37:50 +08:00
|
|
|
->setEnv(['CFLAGS' => $this->getLibExtraCFlags() ?: $this->builder->arch_c_flags, 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
|
2024-04-07 15:52:24 +08:00
|
|
|
->execWithEnv(
|
2023-10-23 00:37:28 +08:00
|
|
|
'./configure ' .
|
2023-04-29 18:59:47 +08:00
|
|
|
'--enable-static --disable-shared ' .
|
|
|
|
|
'--prefix='
|
|
|
|
|
)
|
2024-04-07 15:52:24 +08:00
|
|
|
->execWithEnv('make clean')
|
|
|
|
|
->execWithEnv("make -j{$this->builder->concurrency}")
|
2023-04-29 18:59:47 +08:00
|
|
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
|
|
|
|
$this->patchPkgconfPrefix(['gmp.pc']);
|
|
|
|
|
}
|
|
|
|
|
}
|