diff --git a/config/lib.json b/config/lib.json index 78443d0d..0d4941f0 100644 --- a/config/lib.json +++ b/config/lib.json @@ -635,9 +635,6 @@ ], "lib-depends": [ "openssl" - ], - "lib-suggests": [ - "ngtcp2" ] }, "ngtcp2": { @@ -655,6 +652,10 @@ ], "lib-depends": [ "openssl" + ], + "lib-suggests": [ + "nghttp3", + "brotli" ] }, "onig": { diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 66604ecb..9c404dd9 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -81,7 +81,7 @@ class LinuxBuilder extends UnixBuilderBase foreach ($libSpecs as $libName => $arr) { $lib = $this->getLib($libName); if ($lib === null && str_starts_with($libName, 'lib')) { - $lib = $this->getExt(substr($libName, 3)); + $lib = $this->getLib(substr($libName, 3)); } $arr = $arr ?? []; diff --git a/src/SPC/builder/linux/library/openssl.php b/src/SPC/builder/linux/library/openssl.php index 5c07ec7e..d57265dd 100644 --- a/src/SPC/builder/linux/library/openssl.php +++ b/src/SPC/builder/linux/library/openssl.php @@ -92,4 +92,13 @@ class openssl extends LinuxLibraryBase FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', '/Libs.private:.*/m', 'Libs.private: ${libdir}/libz.a'); FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/cmake/OpenSSL/OpenSSLConfig.cmake', '/set\(OPENSSL_LIBCRYPTO_DEPENDENCIES .*\)/m', 'set(OPENSSL_LIBCRYPTO_DEPENDENCIES "${OPENSSL_LIBRARY_DIR}/libz.a")'); } + + public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true): string + { + $libFiles = parent::getStaticLibFiles($style, $recursive); + if (!str_contains('-ldl -lpthread', $libFiles)) { + $libFiles .= ' -ldl -lpthread'; + } + return $libFiles; + } } diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 36b8583f..d9a0c505 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -56,7 +56,7 @@ class MacOSBuilder extends UnixBuilderBase foreach ($lib_specs as $libName => $arr) { $lib = $this->getLib($libName); if ($lib === null && str_starts_with($libName, 'lib')) { - $lib = $this->getExt(substr($libName, 3)); + $lib = $this->getLib(substr($libName, 3)); } $arr = $arr ?? []; diff --git a/src/SPC/builder/unix/library/nghttp2.php b/src/SPC/builder/unix/library/nghttp2.php index dbbb6415..202b2959 100644 --- a/src/SPC/builder/unix/library/nghttp2.php +++ b/src/SPC/builder/unix/library/nghttp2.php @@ -31,6 +31,12 @@ trait nghttp2 'jemalloc' => null, 'systemd' => null, ]); + 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() . '"'; + } [,,$destdir] = SEPARATED_PATH; diff --git a/src/SPC/builder/unix/library/nghttp3.php b/src/SPC/builder/unix/library/nghttp3.php index 6f677869..03d4d481 100644 --- a/src/SPC/builder/unix/library/nghttp3.php +++ b/src/SPC/builder/unix/library/nghttp3.php @@ -6,22 +6,15 @@ 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, - ]); - shell()->cd($this->source_dir) ->setEnv([ 'CFLAGS' => $this->getLibExtraCFlags(), @@ -34,7 +27,6 @@ trait nghttp3 '--disable-shared ' . '--with-pic ' . '--enable-lib-only ' . - $args . ' ' . '--prefix=' ) ->execWithEnv('make clean') diff --git a/src/SPC/builder/unix/library/ngtcp2.php b/src/SPC/builder/unix/library/ngtcp2.php index 20620499..654bb8e5 100644 --- a/src/SPC/builder/unix/library/ngtcp2.php +++ b/src/SPC/builder/unix/library/ngtcp2.php @@ -18,12 +18,17 @@ trait ngtcp2 protected function build(): void { $args = $this->builder->makeAutoconfArgs(static::NAME, [ - 'zlib' => null, 'openssl' => null, - 'libxml2' => null, 'libev' => null, 'jemalloc' => null, + 'libnghttp3' => null, ]); + 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() . '"'; + } shell()->cd($this->source_dir) ->setEnv([ @@ -43,7 +48,6 @@ trait ngtcp2 ->execWithEnv('make clean') ->execWithEnv("make -j{$this->builder->concurrency}") ->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH); - $this->patchPkgconfPrefix(['libngtcp2.pc']); - $this->patchPkgconfPrefix(['libngtcp2_crypto_ossl.pc']); + $this->patchPkgconfPrefix(['libngtcp2.pc', 'libngtcp2_crypto_ossl.pc']); } } diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 95362357..af59c409 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -22,13 +22,13 @@ $test_php_version = [ // test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available) $test_os = [ 'macos-13', - 'macos-14', + // 'macos-14', 'macos-15', 'ubuntu-latest', 'ubuntu-22.04', - 'ubuntu-24.04', + // 'ubuntu-24.04', 'ubuntu-22.04-arm', - 'ubuntu-24.04-arm', + // 'ubuntu-24.04-arm', // 'windows-latest', ]; @@ -45,7 +45,7 @@ $prefer_pre_built = false; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'lz4', + 'Linux', 'Darwin' => 'openssl,curl', 'Windows' => 'xlswriter,openssl', }; @@ -57,7 +57,7 @@ $shared_extensions = match (PHP_OS_FAMILY) { // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`). $with_libs = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => '', + 'Linux', 'Darwin' => 'nghttp2,nghttp3,ngtcp2', 'Windows' => '', };