2025-06-05 09:44:03 +07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
|
|
|
|
use SPC\exception\FileSystemException;
|
|
|
|
|
use SPC\exception\RuntimeException;
|
|
|
|
|
use SPC\exception\WrongUsageException;
|
|
|
|
|
|
|
|
|
|
trait ngtcp2
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
* @throws RuntimeException
|
|
|
|
|
* @throws WrongUsageException
|
|
|
|
|
*/
|
|
|
|
|
protected function build(): void
|
|
|
|
|
{
|
|
|
|
|
$args = $this->builder->makeAutoconfArgs(static::NAME, [
|
|
|
|
|
'zlib' => null,
|
|
|
|
|
'openssl' => null,
|
|
|
|
|
'libxml2' => null,
|
|
|
|
|
'libev' => null,
|
|
|
|
|
'jemalloc' => null,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
shell()->cd($this->source_dir)
|
|
|
|
|
->setEnv([
|
|
|
|
|
'CFLAGS' => $this->getLibExtraCFlags(),
|
|
|
|
|
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
2025-06-05 09:50:14 +07:00
|
|
|
'LIBS' => $this->getLibExtraLibs(),
|
2025-06-05 09:44:03 +07:00
|
|
|
])
|
|
|
|
|
->execWithEnv(
|
|
|
|
|
'./configure ' .
|
|
|
|
|
'--enable-static ' .
|
|
|
|
|
'--disable-shared ' .
|
|
|
|
|
'--with-pic ' .
|
|
|
|
|
'--enable-lib-only ' .
|
|
|
|
|
$args . ' ' .
|
|
|
|
|
'--prefix='
|
|
|
|
|
)
|
|
|
|
|
->execWithEnv('make clean')
|
|
|
|
|
->execWithEnv("make -j{$this->builder->concurrency}")
|
|
|
|
|
->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH);
|
|
|
|
|
$this->patchPkgconfPrefix(['libngtcp2.pc']);
|
2025-06-05 10:06:20 +07:00
|
|
|
$this->patchPkgconfPrefix(['libngtcp2_crypto_ossl.pc']);
|
2025-06-05 09:44:03 +07:00
|
|
|
}
|
|
|
|
|
}
|