diff --git a/config/lib.json b/config/lib.json index 43b2a3da5..1565a1a65 100644 --- a/config/lib.json +++ b/config/lib.json @@ -34,7 +34,7 @@ "libcurl.a" ], "static-libs-windows": [ - "libcurl_a.lib" + "libcurl.lib" ], "headers": [ "curl" diff --git a/src/SPC/ConsoleApplication.php b/src/SPC/ConsoleApplication.php index 2609d3179..8fafbbda8 100644 --- a/src/SPC/ConsoleApplication.php +++ b/src/SPC/ConsoleApplication.php @@ -31,7 +31,7 @@ */ final class ConsoleApplication extends Application { - public const VERSION = '2.4.4'; + public const VERSION = '2.4.5'; public function __construct() { diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 231e33935..912135b7f 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -203,7 +203,7 @@ public function runCliCheckWindows(): void // Run compile check if build target is cli // If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php // If check failed, throw RuntimeException - [$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe --ri "' . $this->getDistName() . '"', false); + [$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe -n --ri "' . $this->getDistName() . '"', false); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret); } @@ -216,7 +216,7 @@ public function runCliCheckWindows(): void file_get_contents(FileSystem::convertPath(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php')) ); - [$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe -r "' . trim($test) . '"'); + [$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe -n -r "' . trim($test) . '"'); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed sanity check'); } diff --git a/src/SPC/builder/extension/mbregex.php b/src/SPC/builder/extension/mbregex.php index be1290d1b..2f2c28666 100644 --- a/src/SPC/builder/extension/mbregex.php +++ b/src/SPC/builder/extension/mbregex.php @@ -34,7 +34,7 @@ public function runCliCheckUnix(): void public function runCliCheckWindows(): void { - [$ret, $out] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "mbstring"', false); + [$ret, $out] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n --ri "mbstring"', false); if ($ret !== 0) { throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli does not contain mbstring !'); } diff --git a/src/SPC/builder/windows/WindowsBuilder.php b/src/SPC/builder/windows/WindowsBuilder.php index 46b8ac482..76fac3b73 100644 --- a/src/SPC/builder/windows/WindowsBuilder.php +++ b/src/SPC/builder/windows/WindowsBuilder.php @@ -277,7 +277,7 @@ public function sanityCheck(mixed $build_target): void // sanity check for php-cli if (($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI) { logger()->info('running cli sanity check'); - [$ret, $output] = cmd()->execWithResult(BUILD_ROOT_PATH . '\bin\php.exe -r "echo \"hello\";"'); + [$ret, $output] = cmd()->execWithResult(BUILD_ROOT_PATH . '\bin\php.exe -n -r "echo \"hello\";"'); if ($ret !== 0 || trim(implode('', $output)) !== 'hello') { throw new RuntimeException('cli failed sanity check'); } diff --git a/src/SPC/builder/windows/library/curl.php b/src/SPC/builder/windows/library/curl.php index 766a1f4b1..1ba0eb064 100644 --- a/src/SPC/builder/windows/library/curl.php +++ b/src/SPC/builder/windows/library/curl.php @@ -12,14 +12,41 @@ class curl extends WindowsLibraryBase protected function build(): void { - FileSystem::createDir(BUILD_BIN_PATH); - cmd()->cd($this->source_dir . '\winbuild') + // reset cmake + FileSystem::resetDir($this->source_dir . '\cmakebuild'); + + // lib:zstd + $alt = $this->builder->getLib('zstd') ? '' : '-DCURL_ZSTD=OFF'; + // lib:brotli + $alt .= $this->builder->getLib('brotli') ? '' : ' -DCURL_BROTLI=OFF'; + + // start build + cmd()->cd($this->source_dir) + ->execWithWrapper( + $this->builder->makeSimpleWrapper('cmake'), + '-B cmakebuild ' . + '-A x64 ' . + "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . + '-DCMAKE_BUILD_TYPE=Release ' . + '-DBUILD_SHARED_LIBS=OFF ' . + '-DBUILD_STATIC_LIBS=ON ' . + '-DCURL_STATICLIB=ON ' . + '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . + '-DBUILD_CURL_EXE=OFF ' . // disable curl.exe + '-DBUILD_TESTING=OFF ' . // disable tests + '-DBUILD_EXAMPLES=OFF ' . // disable examples + '-DUSE_LIBIDN2=OFF ' . // disable libidn2 + '-DCURL_USE_LIBPSL=OFF ' . // disable libpsl + '-DCURL_ENABLE_SSL=ON ' . + '-DUSE_NGHTTP2=ON ' . // enable nghttp2 + '-DCURL_USE_LIBSSH2=ON ' . // enable libssh2 + '-DENABLE_IPV6=ON ' . // enable ipv6 + '-DNGHTTP2_CFLAGS="/DNGHTTP2_STATICLIB" ' . + $alt + ) ->execWithWrapper( - $this->builder->makeSimpleWrapper('nmake'), - '/f Makefile.vc WITH_DEVEL=' . BUILD_ROOT_PATH . ' ' . - 'WITH_PREFIX=' . BUILD_ROOT_PATH . ' ' . - 'mode=static RTLIBCFG=static WITH_SSL=static WITH_NGHTTP2=static WITH_SSH2=static ENABLE_IPV6=yes WITH_ZLIB=static MACHINE=x64 DEBUG=no' + $this->builder->makeSimpleWrapper('cmake'), + "--build cmakebuild --config Release --target install -j{$this->builder->concurrency}" ); - FileSystem::copyDir($this->source_dir . '\include\curl', BUILD_INCLUDE_PATH . '\curl'); } } diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index dde3d7e93..64cda46d7 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -21,14 +21,14 @@ // test os (macos-13, macos-14, ubuntu-latest, windows-latest are available) $test_os = [ - 'macos-13', - 'macos-14', - 'ubuntu-latest', + // 'macos-13', + // 'macos-14', + // 'ubuntu-latest', 'windows-latest', ]; // whether enable thread safe -$zts = false; +$zts = true; $no_strip = false; @@ -36,12 +36,12 @@ $upx = false; // prefer downloading pre-built packages to speed up the build process -$prefer_pre_built = true; +$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' => 'opentelemetry', - 'Windows' => 'opentelemetry', + 'Linux', 'Darwin' => 'curl', + 'Windows' => 'curl', }; // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).