37 lines
956 B
PHP
Raw Normal View History

2023-03-18 17:32:21 +08:00
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
2023-03-18 17:32:21 +08:00
class libffi extends MacOSLibraryBase
{
public const NAME = 'libffi';
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
2023-03-18 17:32:21 +08:00
{
[, , $destdir] = SEPARATED_PATH;
$arch = getenv('SPC_ARCH');
2023-04-03 20:47:24 +08:00
shell()->cd($this->source_dir)
->exec(
'./configure ' .
2023-04-03 20:47:24 +08:00
'--enable-static ' .
'--disable-shared ' .
"--host={$arch}-apple-darwin " .
"--target={$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
}
}