This commit is contained in:
DubbleClick 2025-06-04 21:42:44 +07:00
parent 42f356d322
commit ba0796c9ea
6 changed files with 164 additions and 0 deletions

View File

@ -618,6 +618,25 @@
"libxml2"
]
},
"nghttp3": {
"source": "nghttp3",
"static-libs-unix": [
"libnghttp3.a"
],
"static-libs-windows": [
"nghttp3.lib"
],
"headers": [
"nghttp3"
],
"lib-depends": [
"zlib",
"openssl"
],
"lib-suggests": [
"libxml2"
]
},
"onig": {
"source": "onig",
"static-libs-unix": [

View File

@ -703,6 +703,16 @@
"path": "COPYING"
}
},
"nghttp3": {
"type": "ghrel",
"repo": "ngtcp2/nghttp3",
"match": "nghttp3.+\\.tar\\.xz",
"prefer-stable": true,
"license": {
"type": "file",
"path": "COPYING"
}
},
"onig": {
"type": "ghrel",
"repo": "kkos/oniguruma",

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class nghttp3 extends LinuxLibraryBase
{
use \SPC\builder\unix\library\nghttp3;
public const NAME = 'nghttp3';
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*
* lwmbs is licensed under Mulan PSL v2. You can use this
* software according to the terms and conditions of the
* Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
* WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*
* See the Mulan PSL v2 for more details.
*/
declare(strict_types=1);
namespace SPC\builder\macos\library;
class nghttp3 extends MacOSLibraryBase
{
use \SPC\builder\unix\library\nghttp3;
public const NAME = 'nghttp3';
}

View File

@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
trait nghttp3
{
/**
* @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,
'libbpf' => null,
'libevent-openssl' => null,
'jansson' => null,
'jemalloc' => null,
'systemd' => null,
'cunit' => null,
]);
shell()->cd($this->source_dir)
->setEnv([
'CFLAGS' => $this->getLibExtraCFlags(),
'LDFLAGS' => $this->getLibExtraLdFlags(),
'LIBS' => $this->getLibExtraLibs()
])
->execWithEnv(
'./configure ' .
'--enable-static ' .
'--disable-shared ' .
'--enable-lib-only ' .
'--with-boost=no ' .
$args . ' ' .
'--prefix='
)
->execWithEnv('make clean')
->execWithEnv("make -j{$this->builder->concurrency}")
->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['libnghttp3.pc']);
}
}

View File

@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace SPC\builder\windows\library;
use SPC\store\FileSystem;
class nghttp3 extends WindowsLibraryBase
{
public const NAME = 'nghttp3';
protected function build(): void
{
// reset cmake
FileSystem::resetDir($this->source_dir . '\build');
// start build
cmd()->cd($this->source_dir)
->execWithWrapper(
$this->builder->makeSimpleWrapper('cmake'),
'-B build ' .
'-A x64 ' .
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
'-DCMAKE_BUILD_TYPE=Release ' .
'-DENABLE_SHARED_LIB=OFF ' .
'-DENABLE_STATIC_LIB=ON ' .
'-DBUILD_STATIC_LIBS=ON ' .
'-DBUILD_SHARED_LIBS=OFF ' .
'-DENABLE_STATIC_CRT=ON ' .
'-DENABLE_LIB_ONLY=ON ' .
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
)
->execWithWrapper(
$this->builder->makeSimpleWrapper('cmake'),
"--build build --config Release --target install -j{$this->builder->concurrency}"
);
}
}