Add spx extension support (#501)

This commit is contained in:
Jerry Ma 2024-07-06 21:56:42 +08:00 committed by GitHub
parent 29cd50206c
commit 522d8b4890
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 1041 additions and 976 deletions

View File

@ -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'

View File

@ -619,6 +619,19 @@
"libsodium" "libsodium"
] ]
}, },
"spx": {
"support": {
"BSD": "wip",
"Windows": "no"
},
"notes": true,
"type": "external",
"source": "spx",
"arg-type": "custom",
"lib-depends": [
"zlib"
]
},
"sqlite3": { "sqlite3": {
"support": { "support": {
"BSD": "wip" "BSD": "wip"

View File

@ -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",

View File

@ -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).

View File

@ -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)。

View 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;
}
}

View File

@ -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' => '',
}; };