mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add mbregex support for windows (#351)
* add mbregex support for windows * cs fix * fix curl http2 support
This commit is contained in:
parent
4ab7b6bfdc
commit
df0e37cd0f
@ -440,10 +440,8 @@
|
|||||||
"libonig.a"
|
"libonig.a"
|
||||||
],
|
],
|
||||||
"static-libs-windows": [
|
"static-libs-windows": [
|
||||||
[
|
|
||||||
"onig.lib",
|
"onig.lib",
|
||||||
"onig_a.lib"
|
"onig_a.lib"
|
||||||
]
|
|
||||||
],
|
],
|
||||||
"headers": [
|
"headers": [
|
||||||
"oniggnu.h",
|
"oniggnu.h",
|
||||||
|
|||||||
@ -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 !');
|
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 !');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,8 @@ class mbstring extends Extension
|
|||||||
$arg = '--enable-mbstring';
|
$arg = '--enable-mbstring';
|
||||||
if ($this->builder->getExt('mbregex') === null) {
|
if ($this->builder->getExt('mbregex') === null) {
|
||||||
$arg .= ' --disable-mbregex';
|
$arg .= ' --disable-mbregex';
|
||||||
|
} else {
|
||||||
|
$arg .= ' --enable-mbregex';
|
||||||
}
|
}
|
||||||
return $arg;
|
return $arg;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,7 @@ class curl extends WindowsLibraryBase
|
|||||||
'-DUSE_ZLIB=ON ' .
|
'-DUSE_ZLIB=ON ' .
|
||||||
'-DCURL_USE_OPENSSL=ON ' .
|
'-DCURL_USE_OPENSSL=ON ' .
|
||||||
'-DCURL_USE_LIBLSSH2=ON ' .
|
'-DCURL_USE_LIBLSSH2=ON ' .
|
||||||
|
'-DUSE_NGHTTP2=ON ' . // php-src with curl needs nghttp2
|
||||||
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
|
||||||
)
|
)
|
||||||
->execWithWrapper(
|
->execWithWrapper(
|
||||||
|
|||||||
37
src/SPC/builder/windows/library/onig.php
Normal file
37
src/SPC/builder/windows/library/onig.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\windows\library;
|
||||||
|
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
class onig extends WindowsLibraryBase
|
||||||
|
{
|
||||||
|
public const NAME = 'onig';
|
||||||
|
|
||||||
|
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 ' .
|
||||||
|
'-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');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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`).
|
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
||||||
$extensions = match (PHP_OS_FAMILY) {
|
$extensions = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'event,gettext',
|
'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`).
|
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user