2023-03-18 17:32:21 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\macos\library;
|
|
|
|
|
|
2023-08-20 19:51:45 +08:00
|
|
|
use SPC\exception\FileSystemException;
|
|
|
|
|
use SPC\exception\RuntimeException;
|
|
|
|
|
|
2023-03-18 17:32:21 +08:00
|
|
|
class libffi extends MacOSLibraryBase
|
|
|
|
|
{
|
|
|
|
|
public const NAME = 'libffi';
|
|
|
|
|
|
2023-08-20 19:51:45 +08:00
|
|
|
/**
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
*/
|
|
|
|
|
protected function build(): void
|
2023-03-18 17:32:21 +08:00
|
|
|
{
|
2023-08-20 19:51:45 +08:00
|
|
|
[, , $destdir] = SEPARATED_PATH;
|
2023-04-03 20:47:24 +08:00
|
|
|
shell()->cd($this->source_dir)
|
|
|
|
|
->exec(
|
2023-10-23 00:37:28 +08:00
|
|
|
'./configure ' .
|
2023-04-03 20:47:24 +08:00
|
|
|
'--enable-static ' .
|
|
|
|
|
'--disable-shared ' .
|
2023-08-20 19:51:45 +08:00
|
|
|
"--host={$this->builder->getOption('arch')}-apple-darwin " .
|
|
|
|
|
"--target={$this->builder->getOption('arch')}-apple-darwin " .
|
2023-05-10 21:59:33 +08:00
|
|
|
'--prefix= ' // use prefix=/
|
2023-04-03 20:47:24 +08:00
|
|
|
)
|
|
|
|
|
->exec('make clean')
|
|
|
|
|
->exec("make -j{$this->builder->concurrency}")
|
|
|
|
|
->exec("make install DESTDIR={$destdir}");
|
2023-05-10 21:59:33 +08:00
|
|
|
$this->patchPkgconfPrefix(['libffi.pc']);
|
2023-03-18 17:32:21 +08:00
|
|
|
}
|
|
|
|
|
}
|