mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Add spx extension support (#501)
This commit is contained in:
parent
29cd50206c
commit
522d8b4890
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@ -176,7 +176,7 @@ jobs:
|
|||||||
|
|
||||||
- name: "Run Build Tests (download)"
|
- name: "Run Build Tests (download)"
|
||||||
run: |
|
run: |
|
||||||
bin/spc download --for-extensions="$(php src/globals/test-extensions.php extensions)" --for-libs="$(php src/globals/test-extensions.php libs)" --with-php=${{ matrix.php }} --ignore-cache-sources=php-src --debug --retry=5
|
bin/spc download --for-extensions="$(php src/globals/test-extensions.php extensions)" --for-libs="$(php src/globals/test-extensions.php libs)" --with-php=${{ matrix.php }} --ignore-cache-sources=php-src --debug --retry=5 --shallow-clone
|
||||||
|
|
||||||
- name: "Run Build Tests (build, *nix)"
|
- name: "Run Build Tests (build, *nix)"
|
||||||
if: matrix.os != 'windows-latest'
|
if: matrix.os != 'windows-latest'
|
||||||
|
|||||||
1959
config/ext.json
1959
config/ext.json
File diff suppressed because it is too large
Load Diff
@ -640,6 +640,16 @@
|
|||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"spx": {
|
||||||
|
"type": "git",
|
||||||
|
"rev": "master",
|
||||||
|
"url": "https://github.com/static-php/php-spx.git",
|
||||||
|
"path": "php-src/ext/spx",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"sqlite": {
|
"sqlite": {
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"url": "https://www.sqlite.org/2023/sqlite-autoconf-3430200.tar.gz",
|
"url": "https://www.sqlite.org/2023/sqlite-autoconf-3430200.tar.gz",
|
||||||
|
|||||||
@ -144,3 +144,8 @@ If you enable event extension on macOS, the `openpty` will be disabled due to is
|
|||||||
## parallel
|
## parallel
|
||||||
|
|
||||||
Parallel is only supported on PHP 8.0 ZTS and above.
|
Parallel is only supported on PHP 8.0 ZTS and above.
|
||||||
|
|
||||||
|
## spx
|
||||||
|
|
||||||
|
1. The [SPX extension](https://github.com/NoiseByNorthwest/php-spx) only supports NTS mode.
|
||||||
|
2. SPX does not support Windows, and the official repository does not support static compilation. static-php-cli uses a [modified version](https://github.com/static-php/php-spx).
|
||||||
|
|||||||
@ -131,3 +131,8 @@ event 扩展在 macOS 系统下编译后暂无法使用 `openpty` 特性。相
|
|||||||
## parallel
|
## parallel
|
||||||
|
|
||||||
parallel 扩展只支持 PHP 8.0 及以上版本,并只支持 ZTS 构建(`--enable-zts`)。
|
parallel 扩展只支持 PHP 8.0 及以上版本,并只支持 ZTS 构建(`--enable-zts`)。
|
||||||
|
|
||||||
|
# spx
|
||||||
|
|
||||||
|
1. [SPX 扩展](https://github.com/NoiseByNorthwest/php-spx) 只支持非线程模式。
|
||||||
|
2. SPX 目前不支持 Windows,且官方仓库也不支持静态编译,static-php-cli 使用了 [修改版本](https://github.com/static-php/php-spx)。
|
||||||
|
|||||||
32
src/SPC/builder/extension/spx.php
Normal file
32
src/SPC/builder/extension/spx.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\exception\WrongUsageException;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('spx')]
|
||||||
|
class spx extends Extension
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws WrongUsageException
|
||||||
|
*/
|
||||||
|
public function validate(): void
|
||||||
|
{
|
||||||
|
if ($this->builder->getOption('enable-zts')) {
|
||||||
|
throw new WrongUsageException('ext-spx is not thread safe, do not build it with ZTS builds');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUnixConfigureArg(): string
|
||||||
|
{
|
||||||
|
$arg = '--enable-spx';
|
||||||
|
if ($this->builder->getExt('zlib') === null) {
|
||||||
|
$arg .= ' --with-zlib-dir=' . BUILD_ROOT_PATH;
|
||||||
|
}
|
||||||
|
return $arg;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -19,13 +19,13 @@ $upx = true;
|
|||||||
|
|
||||||
// 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' => 'sockets,yaml,swoole',
|
'Linux', 'Darwin' => 'spx',
|
||||||
'Windows' => 'mbstring,pdo_sqlite,mbregex,bz2,sqlsrv,pdo_sqlsrv,yaml',
|
'Windows' => 'mbstring,pdo_sqlite,mbregex,bz2,sqlsrv,pdo_sqlsrv,yaml',
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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`).
|
||||||
$with_libs = match (PHP_OS_FAMILY) {
|
$with_libs = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'xz',
|
'Linux', 'Darwin' => '',
|
||||||
'Windows' => '',
|
'Windows' => '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user