mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Add extension simdjson support (#402)
* add extension simdjson support * add extension simdjson tests * fix windows build for simdjson
This commit is contained in:
parent
9fd56987ef
commit
c77dc1af6c
@ -382,6 +382,11 @@
|
||||
"shmop": {
|
||||
"type": "builtin"
|
||||
},
|
||||
"simdjson": {
|
||||
"type": "external",
|
||||
"source": "ext-simdjson",
|
||||
"cpp-extension": true
|
||||
},
|
||||
"simplexml": {
|
||||
"type": "builtin",
|
||||
"arg-type": "custom",
|
||||
|
||||
@ -100,6 +100,16 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-simdjson": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/simdjson",
|
||||
"path": "php-src/ext/simdjson",
|
||||
"filename": "simdjson.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-snappy": {
|
||||
"type": "git",
|
||||
"path": "php-src/ext/snappy",
|
||||
|
||||
34
src/SPC/builder/extension/simdjson.php
Normal file
34
src/SPC/builder/extension/simdjson.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('simdjson')]
|
||||
class simdjson extends Extension
|
||||
{
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
$php_ver = $this->builder->getPHPVersionID();
|
||||
FileSystem::replaceFileRegex(
|
||||
SOURCE_PATH . '/php-src/ext/simdjson/config.m4',
|
||||
'/php_version=(`.*`)$/m',
|
||||
'php_version=' . strval($php_ver)
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/simdjson/config.m4',
|
||||
'if test -z "$PHP_CONFIG"; then',
|
||||
'if false; then'
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
SOURCE_PATH . '/php-src/ext/simdjson/config.w32',
|
||||
"'yes',",
|
||||
'PHP_SIMDJSON_SHARED,'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -13,8 +13,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' => 'ds',
|
||||
'Windows' => 'mbstring,pdo_sqlite,mbregex,ffi,ds',
|
||||
'Linux', 'Darwin' => 'ds,simdjson',
|
||||
'Windows' => 'mbstring,pdo_sqlite,mbregex,ffi,ds,simdjson',
|
||||
};
|
||||
|
||||
// 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