2024-01-03 10:31:21 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
|
|
|
|
use SPC\exception\FileSystemException;
|
|
|
|
|
use SPC\exception\RuntimeException;
|
|
|
|
|
use SPC\exception\WrongUsageException;
|
|
|
|
|
|
|
|
|
|
trait nghttp2
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
* @throws WrongUsageException
|
|
|
|
|
*/
|
|
|
|
|
protected function build(): void
|
|
|
|
|
{
|
|
|
|
|
$args = $this->builder->makeAutoconfArgs(static::NAME, [
|
|
|
|
|
'zlib' => null,
|
|
|
|
|
'openssl' => null,
|
|
|
|
|
'libxml2' => null,
|
|
|
|
|
'libev' => null,
|
|
|
|
|
'libcares' => null,
|
|
|
|
|
'libngtcp2' => null,
|
|
|
|
|
'libnghttp3' => null,
|
|
|
|
|
'libbpf' => null,
|
|
|
|
|
'libevent-openssl' => null,
|
|
|
|
|
'jansson' => null,
|
|
|
|
|
'jemalloc' => null,
|
|
|
|
|
'systemd' => null,
|
|
|
|
|
]);
|
2025-06-06 17:02:35 +07:00
|
|
|
if ($brotli = $this->builder->getLib('brotli')) {
|
|
|
|
|
/* @phpstan-ignore-next-line */
|
|
|
|
|
$args .= ' --with-libbrotlidec=yes LIBBROTLIDEC_CFLAGS="-I' . BUILD_ROOT_PATH . '/include" LIBBROTLIDEC_LIBS="' . $brotli->getStaticLibFiles() . '"';
|
|
|
|
|
/* @phpstan-ignore-next-line */
|
|
|
|
|
$args .= ' --with-libbrotlienc=yes LIBBROTLIENC_CFLAGS="-I' . BUILD_ROOT_PATH . '/include" LIBBROTLIENC_LIBS="' . $brotli->getStaticLibFiles() . '"';
|
|
|
|
|
}
|
2024-01-03 10:31:21 +08:00
|
|
|
|
|
|
|
|
[,,$destdir] = SEPARATED_PATH;
|
|
|
|
|
|
2025-06-09 11:12:34 +08:00
|
|
|
shell()->cd($this->source_dir)->initializeEnv($this)
|
2025-06-09 10:24:06 +08:00
|
|
|
->exec(
|
2024-01-03 10:31:21 +08:00
|
|
|
'./configure ' .
|
|
|
|
|
'--enable-static ' .
|
|
|
|
|
'--disable-shared ' .
|
2025-05-31 14:35:59 +07:00
|
|
|
'--with-pic ' .
|
2024-01-03 10:31:21 +08:00
|
|
|
'--enable-lib-only ' .
|
|
|
|
|
$args . ' ' .
|
|
|
|
|
'--prefix='
|
|
|
|
|
)
|
2025-06-09 10:24:06 +08:00
|
|
|
->exec('make clean')
|
|
|
|
|
->exec("make -j{$this->builder->concurrency}")
|
|
|
|
|
->exec("make install DESTDIR={$destdir}");
|
2024-01-03 10:31:21 +08:00
|
|
|
$this->patchPkgconfPrefix(['libnghttp2.pc']);
|
2025-06-06 14:26:06 +07:00
|
|
|
$this->patchLaDependencyPrefix(['libnghttp2.la']);
|
2024-01-03 10:31:21 +08:00
|
|
|
}
|
|
|
|
|
}
|