2023-05-10 02:04:08 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
|
|
|
|
trait pkgconfig
|
|
|
|
|
{
|
2023-08-20 19:51:45 +08:00
|
|
|
protected function build(): void
|
2023-05-10 02:04:08 +08:00
|
|
|
{
|
2023-10-23 00:37:28 +08:00
|
|
|
$macos_env = "CFLAGS='{$this->builder->arch_c_flags} -Wimplicit-function-declaration' ";
|
|
|
|
|
$linux_env = 'LDFLAGS=--static ';
|
2023-05-10 02:04:08 +08:00
|
|
|
|
|
|
|
|
shell()->cd($this->source_dir)
|
|
|
|
|
->exec(
|
|
|
|
|
match (PHP_OS_FAMILY) {
|
|
|
|
|
'Darwin' => $macos_env,
|
|
|
|
|
default => $linux_env,
|
|
|
|
|
} .
|
|
|
|
|
'./configure ' .
|
|
|
|
|
'--disable-shared ' .
|
|
|
|
|
'--enable-static ' .
|
2023-08-20 19:51:45 +08:00
|
|
|
'--with-internal-glib ' .
|
2023-05-10 02:04:08 +08:00
|
|
|
'--prefix=' . BUILD_ROOT_PATH . ' ' .
|
|
|
|
|
'--without-sysroot ' .
|
|
|
|
|
'--without-system-include-path ' .
|
|
|
|
|
'--without-system-library-path ' .
|
|
|
|
|
'--without-pc-path'
|
|
|
|
|
)
|
|
|
|
|
->exec('make clean')
|
|
|
|
|
->exec("make -j{$this->builder->concurrency}")
|
|
|
|
|
->exec('make install');
|
|
|
|
|
}
|
|
|
|
|
}
|