diff --git a/config/lib.json b/config/lib.json index 576f1087..8a9337e2 100644 --- a/config/lib.json +++ b/config/lib.json @@ -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": [ diff --git a/config/source.json b/config/source.json index a4b25cb8..fdcebbe8 100644 --- a/config/source.json +++ b/config/source.json @@ -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", diff --git a/src/SPC/builder/linux/library/nghttp3.php b/src/SPC/builder/linux/library/nghttp3.php new file mode 100644 index 00000000..7e3fc11d --- /dev/null +++ b/src/SPC/builder/linux/library/nghttp3.php @@ -0,0 +1,12 @@ + + * + * 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'; +} diff --git a/src/SPC/builder/unix/library/nghttp3.php b/src/SPC/builder/unix/library/nghttp3.php new file mode 100644 index 00000000..c12cdaf5 --- /dev/null +++ b/src/SPC/builder/unix/library/nghttp3.php @@ -0,0 +1,55 @@ +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']); + } +} diff --git a/src/SPC/builder/windows/library/nghttp3.php b/src/SPC/builder/windows/library/nghttp3.php new file mode 100644 index 00000000..5fa21107 --- /dev/null +++ b/src/SPC/builder/windows/library/nghttp3.php @@ -0,0 +1,39 @@ +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}" + ); + } +}