diff --git a/config/lib.json b/config/lib.json index df55c82d..f4d48e88 100644 --- a/config/lib.json +++ b/config/lib.json @@ -440,10 +440,8 @@ "libonig.a" ], "static-libs-windows": [ - [ - "onig.lib", - "onig_a.lib" - ] + "onig.lib", + "onig_a.lib" ], "headers": [ "oniggnu.h", diff --git a/src/SPC/builder/extension/mbregex.php b/src/SPC/builder/extension/mbregex.php index eca3d5ee..be1290d1 100644 --- a/src/SPC/builder/extension/mbregex.php +++ b/src/SPC/builder/extension/mbregex.php @@ -31,4 +31,16 @@ class mbregex extends Extension throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !'); } } + + public function runCliCheckWindows(): void + { + [$ret, $out] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "mbstring"', false); + if ($ret !== 0) { + throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli does not contain mbstring !'); + } + $out = implode("\n", $out); + if (!str_contains($out, 'regex')) { + throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: compiled php-cli mbstring extension does not contain regex !'); + } + } } diff --git a/src/SPC/builder/extension/mbstring.php b/src/SPC/builder/extension/mbstring.php index 2318208e..5fcb88bd 100644 --- a/src/SPC/builder/extension/mbstring.php +++ b/src/SPC/builder/extension/mbstring.php @@ -15,6 +15,8 @@ class mbstring extends Extension $arg = '--enable-mbstring'; if ($this->builder->getExt('mbregex') === null) { $arg .= ' --disable-mbregex'; + } else { + $arg .= ' --enable-mbregex'; } return $arg; } diff --git a/src/SPC/builder/windows/library/curl.php b/src/SPC/builder/windows/library/curl.php index 5f8443a0..4423a16c 100644 --- a/src/SPC/builder/windows/library/curl.php +++ b/src/SPC/builder/windows/library/curl.php @@ -29,6 +29,7 @@ class curl extends WindowsLibraryBase '-DUSE_ZLIB=ON ' . '-DCURL_USE_OPENSSL=ON ' . '-DCURL_USE_LIBLSSH2=ON ' . + '-DUSE_NGHTTP2=ON ' . // php-src with curl needs nghttp2 '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' ) ->execWithWrapper( diff --git a/src/SPC/builder/windows/library/onig.php b/src/SPC/builder/windows/library/onig.php new file mode 100644 index 00000000..11ce815e --- /dev/null +++ b/src/SPC/builder/windows/library/onig.php @@ -0,0 +1,37 @@ +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 ' . + '-DBUILD_SHARED_LIBS=OFF ' . + '-DBUILD_STATIC_LIBS=ON ' . + '-DMSVC_STATIC_RUNTIME=ON ' . + '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' + ) + ->execWithWrapper( + $this->builder->makeSimpleWrapper('cmake'), + "--build build --config Release --target install -j{$this->builder->concurrency}" + ); + copy(BUILD_LIB_PATH . '/onig.lib', BUILD_LIB_PATH . '/onig_a.lib'); + } +} diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 3e00b921..29c0e0a1 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -14,7 +14,8 @@ declare(strict_types=1); // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { 'Linux', 'Darwin' => 'event,gettext', - 'Windows' => 'mbstring,pdo_sqlite', + 'Linux', 'Darwin' => 'event,gettext', + 'Windows' => 'mbstring,pdo_sqlite,mbregex', }; // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).