mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-13 11:55:36 +08:00
Compare commits
37 Commits
2.3.4
...
01c78aa92a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01c78aa92a | ||
|
|
54573dfbbe | ||
|
|
1d7ded0390 | ||
|
|
65ace41884 | ||
|
|
942786f2d6 | ||
|
|
57dd174aff | ||
|
|
80effd029f | ||
|
|
1c79cc9f61 | ||
|
|
491eb5c2f2 | ||
|
|
8632a4e005 | ||
|
|
4b44c3adf7 | ||
|
|
a950498fd4 | ||
|
|
48294c9c5f | ||
|
|
ce155987ad | ||
|
|
32a98bb8a1 | ||
|
|
8cec136656 | ||
|
|
8ec50c88ca | ||
|
|
5ec194efb2 | ||
|
|
b8f63ec3b9 | ||
|
|
125d6ca772 | ||
|
|
cedd58443d | ||
|
|
467c7ae667 | ||
|
|
0c30fc2039 | ||
|
|
28b336c666 | ||
|
|
884d7bf56a | ||
|
|
9c8b525f89 | ||
|
|
6cb2b3f28c | ||
|
|
9a954bd75f | ||
|
|
730d304ca2 | ||
|
|
768fd0d4a0 | ||
|
|
ac5f1919b4 | ||
|
|
cc7f9fb44f | ||
|
|
91e089d74a | ||
|
|
14ce15c85e | ||
|
|
fc617134ca | ||
|
|
ff8863d5a1 | ||
|
|
fc053253e7 |
4
.github/FUNDING.yml
vendored
4
.github/FUNDING.yml
vendored
@@ -3,7 +3,7 @@
|
|||||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
patreon: # Replace with a single Patreon username
|
patreon: # Replace with a single Patreon username
|
||||||
open_collective: # Replace with a single Open Collective username
|
open_collective: # Replace with a single Open Collective username
|
||||||
ko_fi: crazywhalecc # Replace with a single Ko-fi username
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||||
liberapay: # Replace with a single Liberapay username
|
liberapay: # Replace with a single Liberapay username
|
||||||
@@ -11,5 +11,5 @@ issuehunt: # Replace with a single IssueHunt username
|
|||||||
otechie: # Replace with a single Otechie username
|
otechie: # Replace with a single Otechie username
|
||||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||||
# noinspection YAMLSchemaValidation
|
# noinspection YAMLSchemaValidation
|
||||||
buy_me_a_coffee: # crazywhalecc
|
buy_me_a_coffee: crazywhalecc
|
||||||
custom: 'https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md' # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
custom: 'https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md' # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||||
|
|||||||
23
.github/workflows/release-build.yml
vendored
23
.github/workflows/release-build.yml
vendored
@@ -71,10 +71,10 @@ jobs:
|
|||||||
- name: "Download Minimal Combination"
|
- name: "Download Minimal Combination"
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ matrix.operating-system.name }}" = "windows-x64" ]; then
|
if [ "${{ matrix.operating-system.name }}" = "windows-x64" ]; then
|
||||||
curl -fsSL https://dl.static-php.dev/static-php-cli/windows/spc-min/php-${{ env.MICRO_VERSION }}-micro-win.zip -o tmp.zip
|
curl https://dl.static-php.dev/static-php-cli/windows/spc-min/php-${{ env.MICRO_VERSION }}-micro-win.zip -o tmp.zip
|
||||||
unzip tmp.zip
|
unzip tmp.zip
|
||||||
else
|
else
|
||||||
curl -fsSL https://dl.static-php.dev/static-php-cli/minimal/php-${{ env.MICRO_VERSION }}-micro-${{ matrix.operating-system.name }}.tar.gz -o tmp.tgz
|
curl https://dl.static-php.dev/static-php-cli/minimal/php-${{ env.MICRO_VERSION }}-micro-${{ matrix.operating-system.name }}.tar.gz -o tmp.tgz
|
||||||
tar -zxvf tmp.tgz
|
tar -zxvf tmp.tgz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -115,16 +115,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
files: dist/${{ matrix.operating-system.filename }}
|
files: dist/${{ matrix.operating-system.filename }}
|
||||||
|
|
||||||
- name: "Deploy to self-hosted OSS"
|
- name: "Deploy to Self-Hosted Server"
|
||||||
if: github.repository == 'crazywhalecc/static-php-cli'
|
if: github.repository == 'crazywhalecc/static-php-cli'
|
||||||
uses: static-php/upload-s3-action@v1.0.0
|
uses: easingthemes/ssh-deploy@main
|
||||||
with:
|
env:
|
||||||
aws_key_id: ${{ secrets.AWS_KEY_ID }}
|
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SERVER_SECRET_KEY }}
|
||||||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
ARGS: "-rltgoDzvO"
|
||||||
aws_bucket: ${{ secrets.AWS_BUCKET }}
|
SOURCE: "dist/"
|
||||||
source_dir: "dist/"
|
REMOTE_HOST: ${{ secrets.DEPLOY_SERVER_HOST }}
|
||||||
destination_dir: static-php-cli/spc-bin/nightly/
|
REMOTE_PORT: ${{ secrets.DEPLOY_SERVER_PORT }}
|
||||||
endpoint: ${{ secrets.AWS_ENDPOINT }}
|
REMOTE_USER: ${{ secrets.DEPLOY_SERVER_USER }}
|
||||||
|
TARGET: ${{ secrets.DEPLOY_SERVER_TARGET_SPC_NIGHTLY }}
|
||||||
|
|
||||||
- name: "Upload Artifact"
|
- name: "Upload Artifact"
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|||||||
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -190,4 +190,4 @@ jobs:
|
|||||||
|
|
||||||
- name: "Run Build Tests (build, windows)"
|
- name: "Run Build Tests (build, windows)"
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
run: bin/spc build "$(php src/globals/test-extensions.php extensions)" $(php src/globals/test-extensions.php zts) $(php src/globals/test-extensions.php no_strip) $env:UPX_CMD --with-libs="$(php src/globals/test-extensions.php libs)" --build-cli --build-micro --debug
|
run: bin/spc build "$(php src/globals/test-extensions.php extensions)" $(php src/globals/test-extensions.php zts) $(php src/globals/test-extensions.php no_strip) $env:UPX_CMD --with-libs="$(php src/globals/test-extensions.php libs)" --build-cli --build-micro --debug --enable-micro-win32
|
||||||
2
.github/workflows/vitepress-deploy.yml
vendored
2
.github/workflows/vitepress-deploy.yml
vendored
@@ -58,8 +58,6 @@ jobs:
|
|||||||
- name: "Generate Extension Support List"
|
- name: "Generate Extension Support List"
|
||||||
run: |
|
run: |
|
||||||
bin/spc dev:gen-ext-docs > docs/extensions.md
|
bin/spc dev:gen-ext-docs > docs/extensions.md
|
||||||
bin/spc dev:gen-ext-dep-docs > docs/deps-map-ext.md
|
|
||||||
bin/spc dev:gen-lib-dep-docs > docs/deps-map-lib.md
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: yarn docs:build
|
run: yarn docs:build
|
||||||
|
|||||||
33
README-zh.md
33
README-zh.md
@@ -43,17 +43,15 @@ static-php-cli(简称 `spc`)有许多特性:
|
|||||||
|
|
||||||
如果你不想自行编译 PHP,可以从本项目现有的示例 Action 下载 Artifact,也可以从自托管的服务器下载。
|
如果你不想自行编译 PHP,可以从本项目现有的示例 Action 下载 Artifact,也可以从自托管的服务器下载。
|
||||||
|
|
||||||
| 组合名称 | 组合扩展数 | 系统 | 备注 |
|
- [扩展组合 - common](https://dl.static-php.dev/static-php-cli/common/):common 组合包含了约 [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) 个常用扩展,体积为 7.5MB 左右。
|
||||||
|---------------------------------------------------------------------|----------------------------------------------------------------------------|-------------|--------------|
|
- [扩展组合 - bulk](https://dl.static-php.dev/static-php-cli/bulk/):bulk 组合包含了 [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) 个扩展,体积为 25MB 左右。
|
||||||
| [common](https://dl.static-php.dev/static-php-cli/common/) | [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) | Linux/macOS | 体积为 7.5MB 左右 |
|
- [扩展组合 - minimal](https://dl.static-php.dev/static-php-cli/minimal/):minimal 组合包含了 [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) 个扩展,体积为 3MB 左右。
|
||||||
| [bulk](https://dl.static-php.dev/static-php-cli/bulk/) | [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) | Linux/macOS | 体积为 25MB 左右 |
|
|
||||||
| [minimal](https://dl.static-php.dev/static-php-cli/minimal/) | [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) | Linux/macOS | 体积为 3MB 左右 |
|
|
||||||
| [spc-min](https://dl.static-php.dev/static-php-cli/windows/spc-min) | [5](https://dl.static-php.dev/static-php-cli/windows/spc-min/README.txt) | Windows | 体积为 3MB 左右 |
|
|
||||||
| [spc-max](https://dl.static-php.dev/static-php-cli/windows/spc-max) | [40+](https://dl.static-php.dev/static-php-cli/windows/spc-max/README.txt) | Windows | 体积为 8.5MB 左右 |
|
|
||||||
|
|
||||||
> Linux 和 Windows 默认启用了 UPX 压缩,可减小 30~50% 的 PHP 二进制体积。
|
> Linux 和 Windows 默认启用了 UPX 压缩,可减小 30~50% 的 PHP 二进制体积。
|
||||||
> macOS 当前不支持 UPX,所以上述预编译的 macOS 版本体积可能较大。
|
> macOS 当前不支持 UPX,所以上述预编译的 macOS 版本体积可能较大。
|
||||||
|
|
||||||
|
对于 Windows 系统,目前支持的扩展较少,故仅提供 SPC 自身运行的最小扩展组合的 `cli` 和 `micro`:[扩展组合 - spc-min](https://dl.static-php.dev/static-php-cli/windows/spc-min/)。
|
||||||
|
|
||||||
## 使用 static-php-cli 构建 PHP
|
## 使用 static-php-cli 构建 PHP
|
||||||
|
|
||||||
### 编译环境需求
|
### 编译环境需求
|
||||||
@@ -91,7 +89,6 @@ static-php-cli(简称 `spc`)有许多特性:
|
|||||||
| 8.1 | :heavy_check_mark: | PHP 官方仅对 8.1 提供安全更新 |
|
| 8.1 | :heavy_check_mark: | PHP 官方仅对 8.1 提供安全更新 |
|
||||||
| 8.2 | :heavy_check_mark: | |
|
| 8.2 | :heavy_check_mark: | |
|
||||||
| 8.3 | :heavy_check_mark: | |
|
| 8.3 | :heavy_check_mark: | |
|
||||||
| 8.4 | :x: | WIP |
|
|
||||||
|
|
||||||
### 支持的扩展
|
### 支持的扩展
|
||||||
|
|
||||||
@@ -113,7 +110,7 @@ static-php-cli(简称 `spc`)有许多特性:
|
|||||||
|
|
||||||
如果你选择了 `debug`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。
|
如果你选择了 `debug`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。
|
||||||
|
|
||||||
### 本地构建(使用 spc 二进制,推荐)
|
### 本地构建(使用 spc 二进制)
|
||||||
|
|
||||||
该项目提供了 static-php-cli 的二进制文件:`spc`。
|
该项目提供了 static-php-cli 的二进制文件:`spc`。
|
||||||
您可以使用 `spc` 二进制文件,无需安装任何运行时(用起来就像 golang 程序)。
|
您可以使用 `spc` 二进制文件,无需安装任何运行时(用起来就像 golang 程序)。
|
||||||
@@ -124,15 +121,15 @@ static-php-cli(简称 `spc`)有许多特性:
|
|||||||
```bash
|
```bash
|
||||||
# Download from self-hosted nightly builds (sync with main branch)
|
# Download from self-hosted nightly builds (sync with main branch)
|
||||||
# For Linux x86_64
|
# For Linux x86_64
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||||
# For Linux aarch64
|
# For Linux aarch64
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
||||||
# macOS x86_64 (Intel)
|
# macOS x86_64 (Intel)
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||||
# macOS aarch64 (Apple)
|
# macOS aarch64 (Apple)
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
||||||
# Windows (x86_64, win10 build 17063 or later)
|
# Windows (x86_64, win10 build 17063 or later)
|
||||||
curl.exe -fsSL -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
curl.exe -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
||||||
|
|
||||||
# Add execute perm (Linux and macOS only)
|
# Add execute perm (Linux and macOS only)
|
||||||
chmod +x ./spc
|
chmod +x ./spc
|
||||||
@@ -147,8 +144,6 @@ chmod +x ./spc
|
|||||||
|
|
||||||
### 本地构建(使用 git 源码)
|
### 本地构建(使用 git 源码)
|
||||||
|
|
||||||
如果你需要修改 static-php-cli 源码,或者使用 spc 二进制构建有问题,你可以使用 git 源码下载 static-php-cli。
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# clone 仓库即可
|
# clone 仓库即可
|
||||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||||
@@ -182,16 +177,14 @@ bin/spc --version
|
|||||||
./bin/spc download --all
|
./bin/spc download --all
|
||||||
# 只拉取编译指定扩展需要的所有依赖(推荐)
|
# 只拉取编译指定扩展需要的所有依赖(推荐)
|
||||||
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
||||||
# 下载依赖时,优先下载有预编译的库(节省编译依赖的时间)
|
# 下载编译不同版本的 PHP (--with-php=x.y,推荐 7.3 ~ 8.3)
|
||||||
./bin/spc download --for-extensions="openssl,curl,mbstring,mbregex" --prefer-pre-built
|
|
||||||
# 下载编译不同版本的 PHP (--with-php=x.y 或 --with-php=x.y.z,推荐 8.1 ~ 8.3)
|
|
||||||
./bin/spc download --for-extensions="openssl,curl,mbstring" --with-php=8.1
|
./bin/spc download --for-extensions="openssl,curl,mbstring" --with-php=8.1
|
||||||
|
|
||||||
# 构建包含 bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl 扩展的 php-cli 和 micro.sfx
|
# 构建包含 bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl 扩展的 php-cli 和 micro.sfx
|
||||||
./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro
|
./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro
|
||||||
# 编译线程安全版本 (--enable-zts)
|
# 编译线程安全版本 (--enable-zts)
|
||||||
./bin/spc build "curl,phar" --enable-zts --build-cli
|
./bin/spc build "curl,phar" --enable-zts --build-cli
|
||||||
# 编译后使用 UPX 减小可执行文件体积 (仅 Linux、Windows 可用) (至少压缩至原来的 30~50%)
|
# 编译后使用 UPX 减小可执行文件体积 (--with-upx-pack) (至少压缩至原来的 30~50%)
|
||||||
./bin/spc build "curl,phar" --enable-zts --build-cli --with-upx-pack
|
./bin/spc build "curl,phar" --enable-zts --build-cli --with-upx-pack
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
35
README.md
35
README.md
@@ -49,17 +49,16 @@ If you don't want to build or want to test first, you can download example pre-c
|
|||||||
Below are several precompiled static-php binaries with different extension combinations,
|
Below are several precompiled static-php binaries with different extension combinations,
|
||||||
which can be downloaded directly according to your needs.
|
which can be downloaded directly according to your needs.
|
||||||
|
|
||||||
| Combination | Extension Count | OS | Comment |
|
- [Extension-Combination - common](https://dl.static-php.dev/static-php-cli/common/): `common` contains about [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) commonly used extensions, and the size is about 7.5MB.
|
||||||
|----------------------------------------------------------------------|----------------------------------------------------------------------------|--------------|--------------------------------|
|
- [Extension-Combination - bulk](https://dl.static-php.dev/static-php-cli/bulk/): `bulk` contains [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) extensions and is about 25MB in size.
|
||||||
| [common](https://dl.static-php.dev/static-php-cli/common/) | [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) | Linux, macOS | The binary size is about 7.5MB |
|
- [Extension-Combination - minimal](https://dl.static-php.dev/static-php-cli/minimal/): `minimal` contains [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) extensions and is about 3MB in size.
|
||||||
| [bulk](https://dl.static-php.dev/static-php-cli/bulk/) | [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) | Linux, macOS | The binary size is about 25MB |
|
|
||||||
| [minimal](https://dl.static-php.dev/static-php-cli/minimal/) | [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) | Linux, macOS | The binary size is about 3MB |
|
|
||||||
| [spc-min](https://dl.static-php.dev/static-php-cli/windows/spc-min/) | [5](https://dl.static-php.dev/static-php-cli/windows/spc-min/README.txt) | Windows | The binary size is about 3MB |
|
|
||||||
| [spc-max](https://dl.static-php.dev/static-php-cli/windows/spc-max/) | [40+](https://dl.static-php.dev/static-php-cli/windows/spc-max/README.txt) | Windows | The binary size is about 8.5MB |
|
|
||||||
|
|
||||||
> Linux and Windows supports UPX compression for binaries, which can reduce the size of the binary by 30% to 50%.
|
> Linux and Windows supports UPX compression for binaries, which can reduce the size of the binary by 30% to 50%.
|
||||||
> macOS does not support UPX compression, so the size of the pre-built binaries for mac is larger.
|
> macOS does not support UPX compression, so the size of the pre-built binaries for mac is larger.
|
||||||
|
|
||||||
|
For Windows systems, there are currently fewer extensions supported,
|
||||||
|
so only `cli` and `micro` that run the minimum extension combination of SPC itself are provided: [Extension-Combination - spc-min](https://dl.static-php.dev/static-php-cli/windows/spc-min/).
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
### Compilation Requirements
|
### Compilation Requirements
|
||||||
@@ -98,7 +97,6 @@ Currently supported PHP versions for compilation:
|
|||||||
| 8.1 | :heavy_check_mark: | PHP official has security fixes only |
|
| 8.1 | :heavy_check_mark: | PHP official has security fixes only |
|
||||||
| 8.2 | :heavy_check_mark: | |
|
| 8.2 | :heavy_check_mark: | |
|
||||||
| 8.3 | :heavy_check_mark: | |
|
| 8.3 | :heavy_check_mark: | |
|
||||||
| 8.4 | :x: | WIP |
|
|
||||||
|
|
||||||
### Supported Extensions
|
### Supported Extensions
|
||||||
|
|
||||||
@@ -123,7 +121,7 @@ and at the same time define the extensions to be compiled by yourself.
|
|||||||
|
|
||||||
If you enable `debug`, all logs will be output at build time, including compiled logs, for troubleshooting.
|
If you enable `debug`, all logs will be output at build time, including compiled logs, for troubleshooting.
|
||||||
|
|
||||||
### Build Locally (using SPC binary, recommended)
|
### Build Locally (using SPC binary)
|
||||||
|
|
||||||
This project provides a binary file of static-php-cli: `spc`.
|
This project provides a binary file of static-php-cli: `spc`.
|
||||||
You can use `spc` binary instead of installing any runtime like golang app.
|
You can use `spc` binary instead of installing any runtime like golang app.
|
||||||
@@ -134,15 +132,15 @@ Download from self-hosted nightly builds using commands below:
|
|||||||
```bash
|
```bash
|
||||||
# Download from self-hosted nightly builds (sync with main branch)
|
# Download from self-hosted nightly builds (sync with main branch)
|
||||||
# For Linux x86_64
|
# For Linux x86_64
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||||
# For Linux aarch64
|
# For Linux aarch64
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
||||||
# macOS x86_64 (Intel)
|
# macOS x86_64 (Intel)
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||||
# macOS aarch64 (Apple)
|
# macOS aarch64 (Apple)
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
||||||
# Windows (x86_64, win10 build 17063 or later)
|
# Windows (x86_64, win10 build 17063 or later)
|
||||||
curl.exe -fsSL -o spc.exehttps://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
curl.exe -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
||||||
|
|
||||||
# Add execute perm (Linux and macOS only)
|
# Add execute perm (Linux and macOS only)
|
||||||
chmod +x ./spc
|
chmod +x ./spc
|
||||||
@@ -157,9 +155,6 @@ Self-hosted `spc` is built by GitHub Actions, you can also download from Actions
|
|||||||
|
|
||||||
### Build Locally (using git source)
|
### Build Locally (using git source)
|
||||||
|
|
||||||
If you need to modify the static-php-cli source code, or have problems using the spc binary build,
|
|
||||||
you can download static-php-cli using the git source code.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# just clone me!
|
# just clone me!
|
||||||
git clone https://github.com/crazywhalecc/static-php-cli.git
|
git clone https://github.com/crazywhalecc/static-php-cli.git
|
||||||
@@ -193,16 +188,14 @@ Basic usage for building php with some extensions:
|
|||||||
./bin/spc download --all
|
./bin/spc download --all
|
||||||
# only fetch necessary sources by needed extensions (recommended)
|
# only fetch necessary sources by needed extensions (recommended)
|
||||||
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
||||||
# download pre-built libraries first (save time for compiling dependencies)
|
# download different PHP version (--with-php=x.y, recommend 7.3 ~ 8.3)
|
||||||
./bin/spc download --for-extensions="openssl,curl,mbstring,mbregex" --prefer-pre-built
|
|
||||||
# download different PHP version (--with-php=x.y or --with-php=x.y.z, recommend 8.1 ~ 8.3)
|
|
||||||
./bin/spc download --for-extensions="openssl,curl,mbstring" --with-php=8.1
|
./bin/spc download --for-extensions="openssl,curl,mbstring" --with-php=8.1
|
||||||
|
|
||||||
# with bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl extension, build both CLI and phpmicro SAPI
|
# with bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl extension, build both CLI and phpmicro SAPI
|
||||||
./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro
|
./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro
|
||||||
# build thread-safe (ZTS) version (--enable-zts)
|
# build thread-safe (ZTS) version (--enable-zts)
|
||||||
./bin/spc build "curl,phar" --enable-zts --build-cli
|
./bin/spc build "curl,phar" --enable-zts --build-cli
|
||||||
# build, pack executable with UPX (linux and windows only) (reduce binary size for 30~50%)
|
# build, pack executable with UPX (--with-upx-pack) (reduce binary size for 30~50%)
|
||||||
./bin/spc build "curl,phar" --enable-zts --build-cli --with-upx-pack
|
./bin/spc build "curl,phar" --enable-zts --build-cli --with-upx-pack
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -189,16 +189,6 @@
|
|||||||
"gmp"
|
"gmp"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"gmssl": {
|
|
||||||
"support": {
|
|
||||||
"BSD": "wip"
|
|
||||||
},
|
|
||||||
"type": "external",
|
|
||||||
"source": "ext-gmssl",
|
|
||||||
"lib-depends": [
|
|
||||||
"gmssl"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"iconv": {
|
"iconv": {
|
||||||
"support": {
|
"support": {
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
@@ -215,14 +205,11 @@
|
|||||||
},
|
},
|
||||||
"igbinary": {
|
"igbinary": {
|
||||||
"support": {
|
"support": {
|
||||||
|
"Windows": "wip",
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "igbinary",
|
"source": "igbinary"
|
||||||
"ext-suggests": [
|
|
||||||
"session",
|
|
||||||
"apcu"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"imagick": {
|
"imagick": {
|
||||||
"support": {
|
"support": {
|
||||||
@@ -370,15 +357,6 @@
|
|||||||
"zlib"
|
"zlib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"msgpack": {
|
|
||||||
"support": {
|
|
||||||
"BSD": "wip"
|
|
||||||
},
|
|
||||||
"type": "external",
|
|
||||||
"source": "msgpack",
|
|
||||||
"arg-type-unix": "with",
|
|
||||||
"arg-type-win": "enable"
|
|
||||||
},
|
|
||||||
"mysqli": {
|
"mysqli": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "with",
|
"arg-type": "with",
|
||||||
@@ -405,7 +383,7 @@
|
|||||||
},
|
},
|
||||||
"opcache": {
|
"opcache": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type-unix": "custom"
|
"arg-type": "custom"
|
||||||
},
|
},
|
||||||
"openssl": {
|
"openssl": {
|
||||||
"notes": true,
|
"notes": true,
|
||||||
@@ -559,6 +537,7 @@
|
|||||||
},
|
},
|
||||||
"redis": {
|
"redis": {
|
||||||
"support": {
|
"support": {
|
||||||
|
"Windows": "wip",
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "external",
|
"type": "external",
|
||||||
@@ -568,7 +547,7 @@
|
|||||||
"session",
|
"session",
|
||||||
"igbinary"
|
"igbinary"
|
||||||
],
|
],
|
||||||
"lib-suggests-unix": [
|
"lib-suggests": [
|
||||||
"zstd",
|
"zstd",
|
||||||
"liblz4"
|
"liblz4"
|
||||||
]
|
]
|
||||||
@@ -609,7 +588,7 @@
|
|||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"snappy"
|
"snappy"
|
||||||
],
|
],
|
||||||
"ext-suggests": [
|
"ext-suggest": [
|
||||||
"apcu"
|
"apcu"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
1375
config/lib.json
1375
config/lib.json
File diff suppressed because it is too large
Load Diff
@@ -83,15 +83,6 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ext-gmssl": {
|
|
||||||
"type": "ghtar",
|
|
||||||
"repo": "gmssl/GmSSL-PHP",
|
|
||||||
"path": "php-src/ext/gmssl",
|
|
||||||
"license": {
|
|
||||||
"type": "file",
|
|
||||||
"path": "LICENSE"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ext-imagick": {
|
"ext-imagick": {
|
||||||
"type": "url",
|
"type": "url",
|
||||||
"url": "https://pecl.php.net/get/imagick",
|
"url": "https://pecl.php.net/get/imagick",
|
||||||
@@ -203,14 +194,6 @@
|
|||||||
"text": "Since version 6, GMP is distributed under the dual licenses, GNU LGPL v3 and GNU GPL v2. These licenses make the library free to use, share, and improve, and allow you to pass on the result. The GNU licenses give freedoms, but also set firm restrictions on the use with non-free programs."
|
"text": "Since version 6, GMP is distributed under the dual licenses, GNU LGPL v3 and GNU GPL v2. These licenses make the library free to use, share, and improve, and allow you to pass on the result. The GNU licenses give freedoms, but also set firm restrictions on the use with non-free programs."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gmssl": {
|
|
||||||
"type": "ghtar",
|
|
||||||
"repo": "guanzhi/GmSSL",
|
|
||||||
"license": {
|
|
||||||
"type": "file",
|
|
||||||
"path": "LICENSE"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"icu": {
|
"icu": {
|
||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "unicode-org/icu",
|
"repo": "unicode-org/icu",
|
||||||
@@ -347,6 +330,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"rev": "master",
|
"rev": "master",
|
||||||
"url": "https://github.com/static-php/libiconv-win.git",
|
"url": "https://github.com/static-php/libiconv-win.git",
|
||||||
|
"provide-pre-built": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "source/COPYING"
|
"path": "source/COPYING"
|
||||||
@@ -514,7 +498,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"path": "php-src/sapi/micro",
|
"path": "php-src/sapi/micro",
|
||||||
"rev": "master",
|
"rev": "master",
|
||||||
"url": "https://github.com/static-php/phpmicro",
|
"url": "https://github.com/easysoft/phpmicro",
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -531,16 +515,6 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"msgpack": {
|
|
||||||
"type": "url",
|
|
||||||
"url": "https://pecl.php.net/get/msgpack",
|
|
||||||
"path": "php-src/ext/msgpack",
|
|
||||||
"filename": "msgpack.tgz",
|
|
||||||
"license": {
|
|
||||||
"type": "file",
|
|
||||||
"path": "LICENSE"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ncurses": {
|
"ncurses": {
|
||||||
"type": "filelist",
|
"type": "filelist",
|
||||||
"url": "https://ftp.gnu.org/pub/gnu/ncurses/",
|
"url": "https://ftp.gnu.org/pub/gnu/ncurses/",
|
||||||
@@ -573,15 +547,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"openssl": {
|
"openssl": {
|
||||||
"type": "ghrel",
|
"type": "filelist",
|
||||||
"repo": "openssl/openssl",
|
"url": "https://www.openssl.org/source/",
|
||||||
"match": "openssl.+\\.tar\\.gz",
|
"regex": "/href=\"(?<file>openssl-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
||||||
"prefer-stable": true,
|
|
||||||
"alt": {
|
|
||||||
"type": "filelist",
|
|
||||||
"url": "https://www.openssl.org/source/",
|
|
||||||
"regex": "/href=\"(?<file>openssl-(?<version>[^\"]+)\\.tar\\.gz)\"/"
|
|
||||||
},
|
|
||||||
"provide-pre-built": true,
|
"provide-pre-built": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
@@ -676,14 +644,11 @@
|
|||||||
"redis": {
|
"redis": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"path": "php-src/ext/redis",
|
"path": "php-src/ext/redis",
|
||||||
"rev": "release/6.0.2",
|
"rev": "5.3.7",
|
||||||
"url": "https://github.com/phpredis/phpredis",
|
"url": "https://github.com/phpredis/phpredis",
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": [
|
"path": "COPYING"
|
||||||
"LICENSE",
|
|
||||||
"COPYING"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"snappy": {
|
"snappy": {
|
||||||
|
|||||||
@@ -10,11 +10,8 @@
|
|||||||
<h2>{{ I18N[lang].selectExt }}{{ checkedExts.length > 0 ? (' (' + checkedExts.length + ')') : '' }}</h2>
|
<h2>{{ I18N[lang].selectExt }}{{ checkedExts.length > 0 ? (' (' + checkedExts.length + ')') : '' }}</h2>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div v-for="(item, index) in ext" class="ext-item">
|
<div v-for="(item, index) in ext" class="ext-item">
|
||||||
<span v-if="isSupported(index, selectedSystem)">
|
<input type="checkbox" :id="index" :value="index" v-model="checkedExts" :disabled="extDisableList.indexOf(index) !== -1">
|
||||||
<input type="checkbox" :id="index" :value="index" v-model="checkedExts" :disabled="extDisableList.indexOf(index) !== -1">
|
<label :for="index">{{ index }}</label>
|
||||||
<label :for="index">{{ index }}</label>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="my-btn" v-if="selectedSystem !== 'windows'" @click="selectCommon">{{ I18N[lang].selectCommon }}</div>
|
<div class="my-btn" v-if="selectedSystem !== 'windows'" @click="selectCommon">{{ I18N[lang].selectCommon }}</div>
|
||||||
@@ -49,87 +46,66 @@
|
|||||||
<p>{{ I18N[lang].windowsSAPIUnavailable }}</p>
|
<p>{{ I18N[lang].windowsSAPIUnavailable }}</p>
|
||||||
</div>
|
</div>
|
||||||
<h2>{{ I18N[lang].buildOptions }}</h2>
|
<h2>{{ I18N[lang].buildOptions }}</h2>
|
||||||
<!-- Refactor all build options in table -->
|
<div class="option-line">
|
||||||
<table>
|
<span class="option-title">{{ I18N[lang].buildEnvironment }}</span>
|
||||||
<!-- buildEnvironment -->
|
<select v-model="selectedEnv">
|
||||||
<tr>
|
<option value="native">{{ I18N[lang].buildEnvNative }}</option>
|
||||||
<td>{{ I18N[lang].buildEnvironment }}</td>
|
<option value="spc">{{ I18N[lang].buildEnvSpc }}</option>
|
||||||
<td>
|
<option value="docker" v-if="selectedSystem !== 'windows'">{{ I18N[lang].buildEnvDocker }}</option>
|
||||||
<select v-model="selectedEnv">
|
</select>
|
||||||
<option value="native">{{ I18N[lang].buildEnvNative }}</option>
|
</div>
|
||||||
<option value="spc">{{ I18N[lang].buildEnvSpc }}</option>
|
<div v-if="selectedEnv === 'spc'" class="option-line">
|
||||||
<option value="docker" v-if="selectedSystem !== 'windows'">{{ I18N[lang].buildEnvDocker }}</option>
|
<span class="option-title">{{ I18N[lang].selectedArch }}</span>
|
||||||
</select>
|
<select v-model="selectedArch">
|
||||||
</td>
|
<option value="x86_64">x86_64 (amd64)</option>
|
||||||
</tr>
|
<option value="aarch64" v-if="selectedSystem !== 'windows'">aarch64 (arm64)</option>
|
||||||
<!-- Download PHP version -->
|
</select>
|
||||||
<tr>
|
</div>
|
||||||
<td>{{ I18N[lang].downloadPhpVersion }}</td>
|
<div class="option-line">
|
||||||
<td>
|
<span class="option-title">{{ I18N[lang].downloadPhpVersion }}</span>
|
||||||
<select v-model="selectedPhpVersion">
|
<select v-model="selectedPhpVersion">
|
||||||
<option v-for="item in availablePhpVersions" :value="item">{{ item }}</option>
|
<option v-for="item in availablePhpVersions" :value="item">{{ item }}</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
<div class="option-line">
|
||||||
<!-- Enable debug message -->
|
<span class="option-title">{{ I18N[lang].useDebug }}</span>
|
||||||
<tr>
|
<input type="radio" id="debug-yes" :value="1" v-model="debug" />
|
||||||
<td>{{ I18N[lang].useDebug }}</td>
|
<label for="debug-yes">{{ I18N[lang].yes }}</label>
|
||||||
<td>
|
|
||||||
<input type="radio" id="debug-yes" :value="1" v-model="debug" />
|
|
||||||
<label for="debug-yes">{{ I18N[lang].yes }}</label>
|
|
||||||
<input type="radio" id="debug-no" :value="0" v-model="debug" />
|
|
||||||
<label for="debug-no">{{ I18N[lang].no }}</label>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<!-- Enable ZTS -->
|
|
||||||
<tr>
|
|
||||||
<td>{{ I18N[lang].useZTS }}</td>
|
|
||||||
<td>
|
|
||||||
<input type="radio" id="zts-yes" :value="1" v-model="zts" />
|
|
||||||
<label for="zts-yes">{{ I18N[lang].yes }}</label>
|
|
||||||
<input type="radio" id="zts-no" :value="0" v-model="zts" />
|
|
||||||
<label for="zts-no">{{ I18N[lang].no }}</label>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<!-- download corresponding extensions -->
|
|
||||||
<tr>
|
|
||||||
<td>{{ I18N[lang].resultShowDownload }}</td>
|
|
||||||
<td>
|
|
||||||
<input type="radio" id="show-download-yes" :value="1" v-model="downloadByExt" />
|
|
||||||
<label for="show-download-yes">{{ I18N[lang].yes }}</label>
|
|
||||||
<input type="radio" id="show-download-no" :value="0" v-model="downloadByExt" />
|
|
||||||
<label for="show-download-no">{{ I18N[lang].no }}</label>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<!-- Download pre-built -->
|
|
||||||
<tr>
|
|
||||||
<td>{{ I18N[lang].usePreBuilt }}</td>
|
|
||||||
<td>
|
|
||||||
<input type="radio" id="pre-built-yes" :value="1" v-model="preBuilt" />
|
|
||||||
<label for="pre-built-yes">{{ I18N[lang].yes }}</label>
|
|
||||||
<input type="radio" id="pre-built-no" :value="0" v-model="preBuilt" />
|
|
||||||
<label for="pre-built-no">{{ I18N[lang].no }}</label>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<!-- Enable UPX -->
|
|
||||||
<tr v-if="selectedSystem !== 'macos'">
|
|
||||||
<td>{{ I18N[lang].useUPX }}</td>
|
|
||||||
<td>
|
|
||||||
<input type="radio" id="upx-yes" :value="1" v-model="enableUPX" />
|
|
||||||
<label for="upx-yes">{{ I18N[lang].yes }}</label>
|
|
||||||
<input type="radio" id="upx-no" :value="0" v-model="enableUPX" />
|
|
||||||
<label for="upx-no">{{ I18N[lang].no }}</label>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
<input type="radio" id="debug-no" :value="0" v-model="debug" />
|
||||||
|
<label for="debug-no">{{ I18N[lang].no }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="option-line">
|
||||||
|
<span class="option-title">{{ I18N[lang].useZTS }}</span>
|
||||||
|
<input type="radio" id="zts-yes" :value="1" v-model="zts" />
|
||||||
|
<label for="zts-yes">{{ I18N[lang].yes }}</label>
|
||||||
|
|
||||||
|
<input type="radio" id="zts-no" :value="0" v-model="zts" />
|
||||||
|
<label for="zts-no">{{ I18N[lang].no }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="option-line">
|
||||||
|
<span class="option-title">{{ I18N[lang].resultShowDownload }}</span>
|
||||||
|
<input type="radio" id="show-download-yes" :value="1" v-model="downloadByExt" />
|
||||||
|
<label for="show-download-yes">{{ I18N[lang].yes }}</label>
|
||||||
|
|
||||||
|
<input type="radio" id="show-download-no" :value="0" v-model="downloadByExt" />
|
||||||
|
<label for="show-download-no">{{ I18N[lang].no }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="option-line" v-if="selectedSystem !== 'macos'">
|
||||||
|
<span class="option-title">{{ I18N[lang].useUPX }}</span>
|
||||||
|
<input type="radio" id="upx-yes" :value="1" v-model="enableUPX" />
|
||||||
|
<label for="upx-yes">{{ I18N[lang].yes }}</label>
|
||||||
|
|
||||||
|
<input type="radio" id="upx-no" :value="0" v-model="enableUPX" />
|
||||||
|
<label for="upx-no">{{ I18N[lang].no }}</label>
|
||||||
|
</div>
|
||||||
<h2>{{ I18N[lang].hardcodedINI }}</h2>
|
<h2>{{ I18N[lang].hardcodedINI }}</h2>
|
||||||
<textarea class="textarea" :placeholder="I18N[lang].hardcodedINIPlacehoder" v-model="hardcodedINIData" rows="5" />
|
<textarea class="textarea" :placeholder="I18N[lang].hardcodedINIPlacehoder" v-model="hardcodedINIData" rows="5" />
|
||||||
<h2>{{ I18N[lang].resultShow }}</h2>
|
<h2>{{ I18N[lang].resultShow }}</h2>
|
||||||
<div v-if="selectedEnv === 'spc'" class="command-container">
|
<div v-if="selectedEnv === 'spc'" class="command-container">
|
||||||
<b>{{ I18N[lang].downloadSPCBinaryCommand }}</b>
|
<b>{{ I18N[lang].downloadSPCBinaryCommand }}</b>
|
||||||
<div class="command-preview" v-if="selectedSystem !== 'windows'">
|
<div class="command-preview" v-if="selectedSystem !== 'windows'">
|
||||||
curl -fsSL -o spc.tgz https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-{{ selectedSystem }}-{{ selectedArch }}.tar.gz && tar -zxvf spc.tgz && rm spc.tgz<br>
|
curl -o spc.tgz https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-{{ selectedSystem }}-{{ selectedArch }}.tar.gz && tar -zxvf spc.tgz && rm spc.tgz<br>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div class="warning custom-block">
|
<div class="warning custom-block">
|
||||||
@@ -140,11 +116,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="downloadByExt" class="command-container">
|
<div v-if="downloadByExt" class="command-container">
|
||||||
<b>{{ I18N[lang].downloadExtOnlyCommand }}</b>
|
<b>{{ I18N[lang].downloadExtOnlyCommand }}</b>
|
||||||
<div class="command-preview">{{ spcCommand }} download --with-php={{ selectedPhpVersion }} --for-extensions "{{ extList }}"{{ preBuilt ? ' --prefer-pre-built' : '' }}{{ debug ? ' --debug' : '' }}</div>
|
<div class="command-preview">{{ spcCommand }} download --with-php={{ selectedPhpVersion }} --for-extensions "{{ extList }}"{{ debug ? ' --debug' : '' }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="command-container">
|
<div v-else class="command-container">
|
||||||
<b>{{ I18N[lang].downloadAllCommand }}</b>
|
<b>{{ I18N[lang].downloadAllCommand }}</b>
|
||||||
<div class="command-preview">{{ spcCommand }} download --all --with-php={{ selectedPhpVersion }}{{ preBuilt ? ' --prefer-pre-built' : '' }}{{ debug ? ' --debug' : '' }}</div>
|
<div class="command-preview">{{ spcCommand }} download --all --with-php={{ selectedPhpVersion }}{{ debug ? ' --debug' : '' }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="command-container" v-if="enableUPX">
|
<div class="command-container" v-if="enableUPX">
|
||||||
<b>{{ I18N[lang].downloadUPXCommand }}</b>
|
<b>{{ I18N[lang].downloadUPXCommand }}</b>
|
||||||
@@ -186,14 +162,6 @@ const osList = [
|
|||||||
{ os: 'windows', label: 'Windows', disabled: false },
|
{ os: 'windows', label: 'Windows', disabled: false },
|
||||||
];
|
];
|
||||||
|
|
||||||
const isSupported = (extName, os) => {
|
|
||||||
// Convert os to target: linux->Linux, macos->Darwin, windows->Windows (using map)
|
|
||||||
const a = new Map([['linux', 'Linux'], ['macos', 'Darwin'], ['windows', 'Windows']]);
|
|
||||||
const osName = a.get(os);
|
|
||||||
const osSupport = ext.value[extName]?.support?.[osName] ?? 'yes';
|
|
||||||
return osSupport === 'yes' || osSupport === 'partial';
|
|
||||||
};
|
|
||||||
|
|
||||||
const availablePhpVersions = [
|
const availablePhpVersions = [
|
||||||
'7.4',
|
'7.4',
|
||||||
'8.0',
|
'8.0',
|
||||||
@@ -233,9 +201,8 @@ const I18N = {
|
|||||||
depTips: '选择扩展后,不可选中的项目为必需的依赖,编译的依赖库列表中可选的为现有扩展和依赖库的可选依赖。选择可选依赖后,将生成 --with-libs 参数。',
|
depTips: '选择扩展后,不可选中的项目为必需的依赖,编译的依赖库列表中可选的为现有扩展和依赖库的可选依赖。选择可选依赖后,将生成 --with-libs 参数。',
|
||||||
microUnavailable: 'micro 不支持 PHP 7.4 及更早版本!',
|
microUnavailable: 'micro 不支持 PHP 7.4 及更早版本!',
|
||||||
windowsSAPIUnavailable: 'Windows 目前不支持 fpm、embed 构建!',
|
windowsSAPIUnavailable: 'Windows 目前不支持 fpm、embed 构建!',
|
||||||
useUPX: '是否开启 UPX 压缩(减小二进制体积)',
|
useUPX: '是否开启 UPX 压缩(减小二进制体积,但很少见的情况下 micro SAPI 无法使用)',
|
||||||
windowsDownSPCWarning: 'Windows 下请手动下载 spc.exe 二进制文件并解压到当前目录!',
|
windowsDownSPCWarning: 'Windows 下请手动下载 spc.exe 二进制文件并解压到当前目录!',
|
||||||
usePreBuilt: '如果可能,下载预编译的依赖库(减少编译时间)',
|
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
selectExt: 'Select Extensions',
|
selectExt: 'Select Extensions',
|
||||||
@@ -267,9 +234,8 @@ const I18N = {
|
|||||||
depTips: 'After selecting the extensions, the unselectable items are essential dependencies. In the compiled dependencies list, optional dependencies consist of existing extensions and optional dependencies of libraries. Optional dependencies will be added in --with-libs parameter.',
|
depTips: 'After selecting the extensions, the unselectable items are essential dependencies. In the compiled dependencies list, optional dependencies consist of existing extensions and optional dependencies of libraries. Optional dependencies will be added in --with-libs parameter.',
|
||||||
microUnavailable: 'Micro does not support PHP 7.4 and earlier versions!',
|
microUnavailable: 'Micro does not support PHP 7.4 and earlier versions!',
|
||||||
windowsSAPIUnavailable: 'Windows does not support fpm and embed build!',
|
windowsSAPIUnavailable: 'Windows does not support fpm and embed build!',
|
||||||
useUPX: 'Enable UPX compression (reduce binary size)',
|
useUPX: 'Enable UPX compression (reduce binary size, but in rare cases micro SAPI doesn\'t work with UPX)',
|
||||||
windowsDownSPCWarning: 'Please download the spc.exe binary file manually and extract it to the current directory on Windows!',
|
windowsDownSPCWarning: 'Please download the spc.exe binary file manually and extract it to the current directory on Windows!',
|
||||||
usePreBuilt: 'Download pre-built dependencies if possible (reduce compile time)',
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -339,9 +305,6 @@ const zts = ref(0);
|
|||||||
// chosen download by extensions
|
// chosen download by extensions
|
||||||
const downloadByExt = ref(1);
|
const downloadByExt = ref(1);
|
||||||
|
|
||||||
// use pre-built
|
|
||||||
const preBuilt = ref(1);
|
|
||||||
|
|
||||||
// chosen upx
|
// chosen upx
|
||||||
const enableUPX = ref(0);
|
const enableUPX = ref(0);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export default {
|
|||||||
{text: 'Extension Notes', link: '/en/guide/extension-notes'},
|
{text: 'Extension Notes', link: '/en/guide/extension-notes'},
|
||||||
{text: 'Command Generator', link: '/en/guide/cli-generator'},
|
{text: 'Command Generator', link: '/en/guide/cli-generator'},
|
||||||
{text: 'Environment Variables', link: '/en/guide/env-vars', collapsed: true,},
|
{text: 'Environment Variables', link: '/en/guide/env-vars', collapsed: true,},
|
||||||
{text: 'Dependency Table', link: '/en/guide/deps-map'},
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export default {
|
|||||||
{text: '扩展注意事项', link: '/zh/guide/extension-notes'},
|
{text: '扩展注意事项', link: '/zh/guide/extension-notes'},
|
||||||
{text: '编译命令生成器', link: '/zh/guide/cli-generator'},
|
{text: '编译命令生成器', link: '/zh/guide/cli-generator'},
|
||||||
{text: '环境变量列表', link: '/zh/guide/env-vars'},
|
{text: '环境变量列表', link: '/zh/guide/env-vars'},
|
||||||
{text: '依赖关系图表', link: '/zh/guide/deps-map'},
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ The following is the source download configuration corresponding to the `libeven
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "libevent/libevent",
|
"repo": "libevent/libevent",
|
||||||
"match": "libevent.+\\.tar\\.gz",
|
"match": "libevent.+\\.tar\\.gz",
|
||||||
"provide-pre-built": true,
|
"license": {
|
||||||
"license": {
|
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
@@ -56,8 +55,6 @@ Each source file in source.json has the following params:
|
|||||||
- `license`: the open source license of the source code, see **Open Source License** section below
|
- `license`: the open source license of the source code, see **Open Source License** section below
|
||||||
- `type`: must be one of the types mentioned above
|
- `type`: must be one of the types mentioned above
|
||||||
- `path` (optional): release the source code to the specified directory instead of `source/{name}`
|
- `path` (optional): release the source code to the specified directory instead of `source/{name}`
|
||||||
- `provide-pre-built` (optional): whether to provide precompiled binary files.
|
|
||||||
If `true`, it will automatically try to download precompiled binary files when running `bin/spc download`
|
|
||||||
|
|
||||||
::: tip
|
::: tip
|
||||||
The `path` parameter in `source.json` can specify a relative or absolute path. When specified as a relative path, the path is based on `source/`.
|
The `path` parameter in `source.json` can specify a relative or absolute path. When specified as a relative path, the path is based on `source/`.
|
||||||
@@ -317,24 +314,3 @@ When an open source project has multiple licenses, multiple files can be specifi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
When the license of an open source project uses different files between versions,
|
|
||||||
`path` can be used as an array to list the possible license files:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"redis": {
|
|
||||||
"type": "git",
|
|
||||||
"path": "php-src/ext/redis",
|
|
||||||
"rev": "release/6.0.2",
|
|
||||||
"url": "https://github.com/phpredis/phpredis",
|
|
||||||
"license": {
|
|
||||||
"type": "file",
|
|
||||||
"path": [
|
|
||||||
"LICENSE",
|
|
||||||
"COPYING"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ The project is mainly divided into several folders:
|
|||||||
|
|
||||||
- `bin/`: used to store program entry files, including `bin/spc`, `bin/spc-alpine-docker`, `bin/setup-runtime`.
|
- `bin/`: used to store program entry files, including `bin/spc`, `bin/spc-alpine-docker`, `bin/setup-runtime`.
|
||||||
- `config/`: Contains all the extensions and dependent libraries supported by the project,
|
- `config/`: Contains all the extensions and dependent libraries supported by the project,
|
||||||
as well as the download link and download methods of these sources. It is divided into files: `lib.json`, `ext.json`, `source.json`, `pkg.json`, `pre-built.json` .
|
as well as the download link and download methods of these sources. It is divided into files: `lib.json`, `ext.json`, `source.json`, `pkg.json` .
|
||||||
- `src/`: The core code of the project, including the entire framework and commands for compiling various extensions and libraries.
|
- `src/`: The core code of the project, including the entire framework and commands for compiling various extensions and libraries.
|
||||||
- `vendor/`: The directory that Composer depends on, you do not need to make any modifications to it.
|
- `vendor/`: The directory that Composer depends on, you do not need to make any modifications to it.
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
outline: 'deep'
|
|
||||||
---
|
|
||||||
|
|
||||||
# Dependency Table
|
|
||||||
|
|
||||||
When compiling PHP, each extension and library has dependencies, which may be required or optional.
|
|
||||||
You can choose whether to include these optional dependencies.
|
|
||||||
|
|
||||||
For example, when compiling the `gd` extension under Linux,
|
|
||||||
the `zlib,libpng` libraries and the `zlib` extension are forced to be compiled,
|
|
||||||
while the `libavif,libwebp,libjpeg,freetype` libraries are optional libraries and will not be compiled by default
|
|
||||||
unless specified by the `--with-libs=avif,webp,jpeg,freetype` option.
|
|
||||||
|
|
||||||
- For optional extensions (optional features of extensions), you need to specify them manually at compile time, for example, to enable igbinary support for Redis: `bin/spc build redis,igbinary`.
|
|
||||||
- For optional libraries, you need to compile and specify them through the `--with-libs=XXX` option.
|
|
||||||
- If you want to enable all optional extensions, you can use `bin/spc build redis --with-suggested-exts`.
|
|
||||||
- If you want to enable all optional libraries, you can use `--with-suggested-libs`.
|
|
||||||
|
|
||||||
## Extension Dependency Table
|
|
||||||
|
|
||||||
<!--@include: ../../deps-map-ext.md-->
|
|
||||||
|
|
||||||
## Library Dependency Table
|
|
||||||
|
|
||||||
<!--@include: ../../deps-map-lib.md-->
|
|
||||||
@@ -44,29 +44,27 @@ These environment variables are system-specific and will only take effect on a s
|
|||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
| var name | default value | comment |
|
| var name | default value | comment |
|
||||||
|---------------------|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
|
|----------------|------------------------------|---------------------------|
|
||||||
| `PHP_SDK_PATH` | `{pwd}\php-sdk-binary-tools` | PHP SDK tools path |
|
| `PHP_SDK_PATH` | `{pwd}\php-sdk-binary-tools` | PHP SDK tools path |
|
||||||
| `UPX_EXEC` | `$PKG_ROOT_PATH\bin\upx.exe` | UPX compression tool path |
|
| `UPX_EXEC` | `$PKG_ROOT_PATH\bin\upx.exe` | UPX compression tool path |
|
||||||
| `SPC_MICRO_PATCHES` | `static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,cli_static` | Used phpmicro [patches](https://github.com/easysoft/phpmicro/blob/master/patches/Readme.md) |
|
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||
| var name | default value | comment |
|
| var name | default value | comment |
|
||||||
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
|
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
|
||||||
| `CC` | `clang` | C Compiler |
|
| `CC` | `clang` | C Compiler |
|
||||||
| `CXX` | `clang++` | C++ Compiler |
|
| `CXX` | `clang++` | C++ Compiler |
|
||||||
| `SPC_DEFAULT_C_FLAGS` | `--target=arm64-apple-darwin` or `--target=x86_64-apple-darwin` | Default C flags (not the same as `CFLAGS`) |
|
| `SPC_DEFAULT_C_FLAGS` | `--target=arm64-apple-darwin` or `--target=x86_64-apple-darwin` | Default C flags (not the same as `CFLAGS`) |
|
||||||
| `SPC_DEFAULT_CXX_FLAGS` | `--target=arm64-apple-darwin` or `--target=x86_64-apple-darwin` | Default C flags (not the same as `CPPFLAGS`) |
|
| `SPC_DEFAULT_CXX_FLAGS` | `--target=arm64-apple-darwin` or `--target=x86_64-apple-darwin` | Default C flags (not the same as `CPPFLAGS`) |
|
||||||
| `SPC_CMD_PREFIX_PHP_BUILDCONF` | `./buildconf --force` | PHP `buildconf` command prefix |
|
| `SPC_CMD_PREFIX_PHP_BUILDCONF` | `./buildconf --force` | PHP `buildconf` command prefix |
|
||||||
| `SPC_CMD_PREFIX_PHP_CONFIGURE` | `./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg` | PHP `configure` command prefix |
|
| `SPC_CMD_PREFIX_PHP_CONFIGURE` | `./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg` | PHP `configure` command prefix |
|
||||||
| `SPC_CMD_PREFIX_PHP_MAKE` | `make -j$SPC_CONCURRENCY` | PHP `make` command prefix |
|
| `SPC_CMD_PREFIX_PHP_MAKE` | `make -j$SPC_CONCURRENCY` | PHP `make` command prefix |
|
||||||
| `SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS` | `$SPC_DEFAULT_C_FLAGS -Werror=unknown-warning-option` | `CFLAGS` variable of PHP `configure` command |
|
| `SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS` | `$SPC_DEFAULT_C_FLAGS -Werror=unknown-warning-option` | `CFLAGS` variable of PHP `configure` command |
|
||||||
| `SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS` | `-I$BUILD_INCLUDE_PATH` | `CPPFLAGS` variable of PHP `configure` command |
|
| `SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS` | `-I$BUILD_INCLUDE_PATH` | `CPPFLAGS` variable of PHP `configure` command |
|
||||||
| `SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS` | `-L$BUILD_LIB_PATH` | `LDFLAGS` variable of PHP `configure` command |
|
| `SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS` | `-L$BUILD_LIB_PATH` | `LDFLAGS` variable of PHP `configure` command |
|
||||||
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS` | `-g0 -Os` or `-g -O0` (the latter when using `--no-strip`) | `EXTRA_CFLAGS` variable of PHP `make` command |
|
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS` | `-g0 -Os` or `-g -O0` (the latter when using `--no-strip`) | `EXTRA_CFLAGS` variable of PHP `make` command |
|
||||||
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS` | `-lresolv` | Extra `EXTRA_LIBS` variables for PHP `make` command |
|
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS` | `-lresolv` | Extra `EXTRA_LIBS` variables for PHP `make` command |
|
||||||
| `SPC_MICRO_PATCHES` | `static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,macos_iconv` | Used phpmicro [patches](https://github.com/easysoft/phpmicro/blob/master/patches/Readme.md) |
|
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
@@ -92,7 +90,6 @@ These environment variables are system-specific and will only take effect on a s
|
|||||||
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS` | empty | Extra `EXTRA_LIBS` variables for PHP `make` command |
|
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS` | empty | Extra `EXTRA_LIBS` variables for PHP `make` command |
|
||||||
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM` | `-all-static` (when using `clang`: `-Xcompiler -fuse-ld=lld -all-static`) | Additional `LDFLAGS` variable for `make` command |
|
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM` | `-all-static` (when using `clang`: `-Xcompiler -fuse-ld=lld -all-static`) | Additional `LDFLAGS` variable for `make` command |
|
||||||
| `SPC_NO_MUSL_PATH` | empty | Whether to not insert the PATH of the musl toolchain (not inserted when the value is `yes`) |
|
| `SPC_NO_MUSL_PATH` | empty | Whether to not insert the PATH of the musl toolchain (not inserted when the value is `yes`) |
|
||||||
| `SPC_MICRO_PATCHES` | `static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream` | Used phpmicro [patches](https://github.com/easysoft/phpmicro/blob/master/patches/Readme.md) |
|
|
||||||
> `{ld_lib_path}` value is `/usr/local/musl/$GNU_ARCH-linux-musl/lib`。
|
> `{ld_lib_path}` value is `/usr/local/musl/$GNU_ARCH-linux-musl/lib`。
|
||||||
|
|
||||||
### FreeBSD
|
### FreeBSD
|
||||||
|
|||||||
@@ -14,6 +14,14 @@ Some extensions or libraries that the extension depends on will have some option
|
|||||||
For example, the gd library optionally supports libwebp, freetype, etc.
|
For example, the gd library optionally supports libwebp, freetype, etc.
|
||||||
If you only use `bin/spc build gd --build-cli` they will not be included (static-php-cli defaults to the minimum dependency principle).
|
If you only use `bin/spc build gd --build-cli` they will not be included (static-php-cli defaults to the minimum dependency principle).
|
||||||
|
|
||||||
For more information about optional libraries, see [Extensions, Library Dependency Map](./deps-map).
|
You can use `--with-libs=` to add these libraries when compiling.
|
||||||
For optional libraries, you can also select an extension from the [Command Generator](./cli-generator) and then select optional libraries.
|
When the dependent libraries of this compilation include them, gd will automatically use them to enable these features.
|
||||||
|
(For example: `bin/spc build gd --with-libs=libwebp,freetype --build-cli`)
|
||||||
|
|
||||||
|
Alternatively you can use `--with-suggested-exts` and `--with-suggested-libs` to enable all optional dependencies of these extensions and libraries.
|
||||||
|
(For example: `bin/spc build gd --with-suggested-libs --build-cli`)
|
||||||
|
|
||||||
|
If you don't know whether an extension has optional features,
|
||||||
|
you can check the [spc configuration file](https://github.com/crazywhalecc/static-php-cli/tree/main/config)
|
||||||
|
or use the command `bin/spc dev:extensions` (library dependency is `lib-suggests`, extension dependency is `ext-suggests`).
|
||||||
:::
|
:::
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ Here's how to download from self-hosted server:
|
|||||||
```bash
|
```bash
|
||||||
# Download from self-hosted nightly builds (sync with main branch)
|
# Download from self-hosted nightly builds (sync with main branch)
|
||||||
# For Linux x86_64
|
# For Linux x86_64
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||||
# For Linux aarch64
|
# For Linux aarch64
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
||||||
# macOS x86_64 (Intel)
|
# macOS x86_64 (Intel)
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||||
# macOS aarch64 (Apple)
|
# macOS aarch64 (Apple)
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
||||||
# Windows (x86_64, win10 build 17063 or later)
|
# Windows (x86_64, win10 build 17063 or later)
|
||||||
curl.exe -fsSL -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
curl.exe -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
||||||
|
|
||||||
# Add execute perm (Linux and macOS only)
|
# Add execute perm (Linux and macOS only)
|
||||||
chmod +x ./spc
|
chmod +x ./spc
|
||||||
@@ -143,7 +143,6 @@ including php-src and the source code of various dependent libraries.
|
|||||||
bin/spc download --all
|
bin/spc download --all
|
||||||
|
|
||||||
# Download all dependent packages, and specify the main version of PHP to download, optional: 7.3, 7.4, 8.0, 8.1, 8.2, 8.3
|
# Download all dependent packages, and specify the main version of PHP to download, optional: 7.3, 7.4, 8.0, 8.1, 8.2, 8.3
|
||||||
# Also supports specific version of php release: 8.3.10, 8.2.22, etc.
|
|
||||||
bin/spc download --all --with-php=8.2
|
bin/spc download --all --with-php=8.2
|
||||||
|
|
||||||
# Show download progress bar while downloading (curl)
|
# Show download progress bar while downloading (curl)
|
||||||
@@ -158,9 +157,6 @@ bin/spc download php-src,micro,zstd,ext-zstd
|
|||||||
# Download only extensions and libraries to be compiled (use extensions, including suggested libraries)
|
# Download only extensions and libraries to be compiled (use extensions, including suggested libraries)
|
||||||
bin/spc download --for-extensions=openssl,swoole,zip,pcntl,zstd
|
bin/spc download --for-extensions=openssl,swoole,zip,pcntl,zstd
|
||||||
|
|
||||||
# Download resources, prefer to download dependencies with pre-built packages (reduce the time to compile dependencies)
|
|
||||||
bin/spc download --for-extensions="curl,pcntl,xml,mbstring" --prefer-pre-built
|
|
||||||
|
|
||||||
# Download only the extensions and dependent libraries to be compiled (use extensions, excluding suggested libraries)
|
# Download only the extensions and dependent libraries to be compiled (use extensions, excluding suggested libraries)
|
||||||
bin/spc download --for-extensions=openssl,swoole,zip,pcntl --without-suggestions
|
bin/spc download --for-extensions=openssl,swoole,zip,pcntl --without-suggestions
|
||||||
|
|
||||||
@@ -171,7 +167,7 @@ bin/spc download --for-libs=liblz4,libevent --for-extensions=pcntl,rar,xml
|
|||||||
bin/spc download --for-libs=liblz4,libevent --without-suggestions
|
bin/spc download --for-libs=liblz4,libevent --without-suggestions
|
||||||
|
|
||||||
# When downloading sources, ignore some source caches (always force download, e.g. switching PHP version)
|
# When downloading sources, ignore some source caches (always force download, e.g. switching PHP version)
|
||||||
bin/spc download --for-extensions=curl,pcntl,xml --ignore-cache-sources=php-src --with-php=8.3.10
|
bin/spc download --for-extensions=curl,pcntl,xml --ignore-cache-sources=php-src --with-php=8.3
|
||||||
|
|
||||||
# Set retry times (default is 0)
|
# Set retry times (default is 0)
|
||||||
bin/spc download --all --retry=2
|
bin/spc download --all --retry=2
|
||||||
@@ -204,19 +200,6 @@ bin/spc download --all -U "php-src:https://downloads.php.net/~eric/php-8.3.0beta
|
|||||||
bin/spc download --all -U "curl:https://curl.se/download/curl-7.88.1.tar.gz"
|
bin/spc download --all -U "curl:https://curl.se/download/curl-7.88.1.tar.gz"
|
||||||
```
|
```
|
||||||
|
|
||||||
If the source you download is not a link, but a git repository, you can use `-G` or `--custom-git` to rewrite the download link,
|
|
||||||
so that the downloader can force the use of the specified git repository to download packages from this source.
|
|
||||||
The usage method is `{source-name}:{branch}:{url}`, which can rewrite the download link of multiple libraries at the same time.
|
|
||||||
It is also available when downloading with the `--for-extensions` option.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Specifying to download the source code of the PHP extension from the specified branch of the git repository
|
|
||||||
bin/spc download --for-extensions=redis -G "php-src:master:https://github.com/php/php-src.git"
|
|
||||||
|
|
||||||
# Download the latest code from the master branch of the swoole-src repository instead of PECL release version
|
|
||||||
bin/spc download --for-extensions=swoole -G "swoole:master:https://github.com/swoole/swoole-src.git"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Command - doctor
|
## Command - doctor
|
||||||
|
|
||||||
If you can run `bin/spc` normally but cannot compile static PHP or dependent libraries normally,
|
If you can run `bin/spc` normally but cannot compile static PHP or dependent libraries normally,
|
||||||
@@ -405,8 +388,6 @@ when you use static-php-cli to build PHP or modify and enhance the static-php-cl
|
|||||||
- `dev:sort-config`: Sort the list of configuration files in the `config/` directory in alphabetical order
|
- `dev:sort-config`: Sort the list of configuration files in the `config/` directory in alphabetical order
|
||||||
- `dev:lib-ver <lib-name>`: Read the version from the source code of the dependency library (only available for specific dependency libraries)
|
- `dev:lib-ver <lib-name>`: Read the version from the source code of the dependency library (only available for specific dependency libraries)
|
||||||
- `dev:ext-ver <ext-name>`: Read the corresponding version from the source code of the extension (only available for specific extensions)
|
- `dev:ext-ver <ext-name>`: Read the corresponding version from the source code of the extension (only available for specific extensions)
|
||||||
- `dev:pack-lib <lib-name>`: Package the specified library into a tar.gz file (maintainer only)
|
|
||||||
- `dev:gen-ext-docs`: Generate extension documentation (maintainer only)
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# output all extensions information
|
# output all extensions information
|
||||||
@@ -542,12 +523,3 @@ Commonly used objects and functions using the `-P` function are:
|
|||||||
static-php-cli has many open methods, which cannot be listed in the docs,
|
static-php-cli has many open methods, which cannot be listed in the docs,
|
||||||
but as long as it is a `public function` and is not marked as `@internal`, it theoretically can be called.
|
but as long as it is a `public function` and is not marked as `@internal`, it theoretically can be called.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Multiple builds
|
|
||||||
|
|
||||||
If you need to build multiple times locally, the following method can save you time downloading resources and compiling.
|
|
||||||
|
|
||||||
- If you only switch the PHP version without changing the dependent libraries, you can use `bin/spc switch-php-version` to quickly switch the PHP version, and then re-run the same `build` command.
|
|
||||||
- If you want to rebuild once, but do not re-download the source code, you can first `rm -rf buildroot source` to delete the compilation directory and source code directory, and then rebuild.
|
|
||||||
- If you want to update a version of a dependency, you can use `bin/spc del-download <source-name>` to delete the specified source code, and then use `download <source-name>` to download it again.
|
|
||||||
- If you want to update all dependent versions, you can use `bin/spc download --clean` to delete all downloaded sources, and then download them again.
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ static-php-cli 的下载资源模块是一个主要的功能,它包含了所
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "libevent/libevent",
|
"repo": "libevent/libevent",
|
||||||
"match": "libevent.+\\.tar\\.gz",
|
"match": "libevent.+\\.tar\\.gz",
|
||||||
"provide-pre-built": true,
|
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -45,7 +44,6 @@ source.json 中每个源文件拥有以下字段:
|
|||||||
- `license`: 源代码的开源许可证,见下方 **开源许可证** 章节
|
- `license`: 源代码的开源许可证,见下方 **开源许可证** 章节
|
||||||
- `type`: 必须为上面提到的类型之一
|
- `type`: 必须为上面提到的类型之一
|
||||||
- `path`(可选): 释放源码到指定目录而非 `source/{name}`
|
- `path`(可选): 释放源码到指定目录而非 `source/{name}`
|
||||||
- `provide-pre-built`(可选): 是否提供预编译的二进制文件,如果为 `true`,则会在 `bin/spc download` 时尝试自动下载预编译的二进制文件
|
|
||||||
|
|
||||||
::: tip
|
::: tip
|
||||||
`source.json` 中的 `path` 参数可指定相对路径或绝对路径。当指定为相对路径时,路径基于 `source/`。
|
`source.json` 中的 `path` 参数可指定相对路径或绝对路径。当指定为相对路径时,路径基于 `source/`。
|
||||||
@@ -297,23 +295,3 @@ pkg.json 存放的是非源码类型的文件资源,例如 musl-toolchain、UP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
当一个开源项目的许可证在不同版本间使用不同的文件,`path` 参数可以使用数组将可能的许可证文件列出:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"redis": {
|
|
||||||
"type": "git",
|
|
||||||
"path": "php-src/ext/redis",
|
|
||||||
"rev": "release/6.0.2",
|
|
||||||
"url": "https://github.com/phpredis/phpredis",
|
|
||||||
"license": {
|
|
||||||
"type": "file",
|
|
||||||
"path": [
|
|
||||||
"LICENSE",
|
|
||||||
"COPYING"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ static-php-cli 主要包含三种逻辑组件:资源、依赖库、扩展。
|
|||||||
项目主要分为几个文件夹:
|
项目主要分为几个文件夹:
|
||||||
|
|
||||||
- `bin/`: 用于存放程序入口文件,包含 `bin/spc`、`bin/spc-alpine-docker`、`bin/setup-runtime`。
|
- `bin/`: 用于存放程序入口文件,包含 `bin/spc`、`bin/spc-alpine-docker`、`bin/setup-runtime`。
|
||||||
- `config/`: 包含了所有项目支持的扩展、依赖库以及这些资源下载的地址、下载方式等,:`lib.json`、`ext.json`、`source.json`、`pkg.json`、`pre-built.json`。
|
- `config/`: 包含了所有项目支持的扩展、依赖库以及这些资源下载的地址、下载方式等,分为四个文件:`lib.json`、`ext.json`、`source.json`、`pkg.json`。
|
||||||
- `src/SPC/`: 项目的核心代码,包含了整个框架以及编译各种扩展和库的命令。
|
- `src/SPC/`: 项目的核心代码,包含了整个框架以及编译各种扩展和库的命令。
|
||||||
- `src/globals/`: 项目的全局方法和常量、运行时需要的测试文件(例如:扩展的可用性检查代码)。
|
- `src/globals/`: 项目的全局方法和常量、运行时需要的测试文件(例如:扩展的可用性检查代码)。
|
||||||
- `vendor/`: Composer 依赖的目录,你无需对它做出任何修改。
|
- `vendor/`: Composer 依赖的目录,你无需对它做出任何修改。
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
outline: 'deep'
|
|
||||||
---
|
|
||||||
|
|
||||||
# 依赖关系图表
|
|
||||||
|
|
||||||
在编译 PHP 时,每个扩展、库都有依赖关系,这些依赖关系可能是必需的,也可能是可选的。在编译 PHP 时,可以选择是否包含这些可选的依赖关系。
|
|
||||||
|
|
||||||
例如,在 Linux 下编译 `gd` 扩展时,会强制编译 `zlib,libpng` 库和 `zlib` 扩展,而 `libavif,libwebp,libjpeg,freetype` 库都是可选的库,默认不会编译,除非通过 `--with-libs=avif,webp,jpeg,freetype` 选项指定。
|
|
||||||
|
|
||||||
- 对于可选扩展(扩展的可选特性),需手动在编译时指定,例如启用 Redis 的 igbinary 支持:`bin/spc build redis,igbinary`。
|
|
||||||
- 对于可选库,需通过 `--with-libs=XXX` 选项编译指定。
|
|
||||||
- 如果想启用所有的可选扩展,可以使用 `bin/spc build redis --with-suggested-exts` 参数。
|
|
||||||
- 如果想启用所有的可选库,可以使用 `--with-suggested-libs` 参数。
|
|
||||||
|
|
||||||
## 扩展的依赖图
|
|
||||||
|
|
||||||
<!--@include: ../../deps-map-ext.md-->
|
|
||||||
|
|
||||||
## 库的依赖表
|
|
||||||
|
|
||||||
<!--@include: ../../deps-map-lib.md-->
|
|
||||||
@@ -42,56 +42,52 @@ SPC_CONCURRENCY=4 bin/spc build mbstring,pcntl --build-cli
|
|||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
| var name | default value | comment |
|
| var name | default value | comment |
|
||||||
|---------------------|-----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------|
|
|----------------|------------------------------|-----------------|
|
||||||
| `PHP_SDK_PATH` | `{pwd}\php-sdk-binary-tools` | PHP SDK 工具的安装目录 |
|
| `PHP_SDK_PATH` | `{pwd}\php-sdk-binary-tools` | PHP SDK 工具的安装目录 |
|
||||||
| `UPX_EXEC` | `$PKG_ROOT_PATH\bin\upx.exe` | UPX 压缩工具的路径 |
|
| `UPX_EXEC` | `$PKG_ROOT_PATH\bin\upx.exe` | UPX 压缩工具的路径 |
|
||||||
| `SPC_MICRO_PATCHES` | `static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,cli_static` | 使用的 phpmicro [patches](https://github.com/easysoft/phpmicro/blob/master/patches/Readme.md) |
|
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||
| var name | default value | comment |
|
| var name | default value | comment |
|
||||||
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------|
|
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
|
||||||
| `CC` | `clang` | C 编译器 |
|
| `CC` | `clang` | C 编译器 |
|
||||||
| `CXX` | `clang++` | C++ 编译器 |
|
| `CXX` | `clang++` | C++ 编译器 |
|
||||||
| `SPC_DEFAULT_C_FLAGS` | `--target=arm64-apple-darwin` 或 `--target=x86_64-apple-darwin` | 默认 C 编译标志(与 `CFLAGS` 不同) |
|
| `SPC_DEFAULT_C_FLAGS` | `--target=arm64-apple-darwin` 或 `--target=x86_64-apple-darwin` | 默认 C 编译标志(与 `CFLAGS` 不同) |
|
||||||
| `SPC_DEFAULT_CXX_FLAGS` | `--target=arm64-apple-darwin` 或 `--target=x86_64-apple-darwin` | 默认 C++ 编译标志(与 `CXXFLAGS` 不同) |
|
| `SPC_DEFAULT_CXX_FLAGS` | `--target=arm64-apple-darwin` 或 `--target=x86_64-apple-darwin` | 默认 C++ 编译标志(与 `CXXFLAGS` 不同) |
|
||||||
| `SPC_CMD_PREFIX_PHP_BUILDCONF` | `./buildconf --force` | 编译 PHP `buildconf` 命令前缀 |
|
| `SPC_CMD_PREFIX_PHP_BUILDCONF` | `./buildconf --force` | 编译 PHP `buildconf` 命令前缀 |
|
||||||
| `SPC_CMD_PREFIX_PHP_CONFIGURE` | `./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg` | 编译 PHP `configure` 命令前缀 |
|
| `SPC_CMD_PREFIX_PHP_CONFIGURE` | `./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg` | 编译 PHP `configure` 命令前缀 |
|
||||||
| `SPC_CMD_PREFIX_PHP_MAKE` | `make -j$SPC_CONCURRENCY` | 编译 PHP `make` 命令前缀 |
|
| `SPC_CMD_PREFIX_PHP_MAKE` | `make -j$SPC_CONCURRENCY` | 编译 PHP `make` 命令前缀 |
|
||||||
| `SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS` | `$SPC_DEFAULT_C_FLAGS -Werror=unknown-warning-option` | PHP `configure` 命令的 `CFLAGS` 变量 |
|
| `SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS` | `$SPC_DEFAULT_C_FLAGS -Werror=unknown-warning-option` | PHP `configure` 命令的 `CFLAGS` 变量 |
|
||||||
| `SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS` | `-I$BUILD_INCLUDE_PATH` | PHP `configure` 命令的 `CPPFLAGS` 变量 |
|
| `SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS` | `-I$BUILD_INCLUDE_PATH` | PHP `configure` 命令的 `CPPFLAGS` 变量 |
|
||||||
| `SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS` | `-L$BUILD_LIB_PATH` | PHP `configure` 命令的 `LDFLAGS` 变量 |
|
| `SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS` | `-L$BUILD_LIB_PATH` | PHP `configure` 命令的 `LDFLAGS` 变量 |
|
||||||
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS` | `-g0 -Os` 或 `-g -O0`(当使用 `--no-strip` 时为后者) | PHP `make` 命令的 `EXTRA_CFLAGS` 变量 |
|
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS` | `-g0 -Os` 或 `-g -O0`(当使用 `--no-strip` 时为后者) | PHP `make` 命令的 `EXTRA_CFLAGS` 变量 |
|
||||||
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS` | `-lresolv` | PHP `make` 命令的额外 `EXTRA_LIBS` 变量 |
|
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS` | `-lresolv` | PHP `make` 命令的额外 `EXTRA_LIBS` 变量 |
|
||||||
| `SPC_MICRO_PATCHES` | `static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,macos_iconv` | 使用的 phpmicro [patches](https://github.com/easysoft/phpmicro/blob/master/patches/Readme.md) |
|
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
| var name | default value | comment |
|
| var name | default value | comment |
|
||||||
|----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------|
|
|----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
|
||||||
| `UPX_EXEC` | `$PKG_ROOT_PATH/bin/upx` | UPX 压缩工具的路径 |
|
| `UPX_EXEC` | `$PKG_ROOT_PATH/bin/upx` | UPX 压缩工具的路径 |
|
||||||
| `GNU_ARCH` | `x86_64` 或 `aarch64` | 当前环境的 CPU 架构 |
|
| `GNU_ARCH` | `x86_64` 或 `aarch64` | 当前环境的 CPU 架构 |
|
||||||
| `CC` | Alpine: `gcc`, Other: `$GNU_ARCH-linux-musl-gcc` | C 编译器 |
|
| `CC` | Alpine: `gcc`, Other: `$GNU_ARCH-linux-musl-gcc` | C 编译器 |
|
||||||
| `CXX` | Alpine: `g++`, Other: `$GNU_ARCH-linux-musl-g++` | C++ 编译器 |
|
| `CXX` | Alpine: `g++`, Other: `$GNU_ARCH-linux-musl-g++` | C++ 编译器 |
|
||||||
| `AR` | Alpine: `ar`, Other: `$GNU_ARCH-linux-musl-ar` | 静态库工具 |
|
| `AR` | Alpine: `ar`, Other: `$GNU_ARCH-linux-musl-ar` | 静态库工具 |
|
||||||
| `LD` | `ld.gold` | 链接器 |
|
| `LD` | `ld.gold` | 链接器 |
|
||||||
| `PATH` | `/usr/local/musl/bin:/usr/local/musl/$GNU_ARCH-linux-musl/bin:$PATH` | 系统 PATH |
|
| `PATH` | `/usr/local/musl/bin:/usr/local/musl/$GNU_ARCH-linux-musl/bin:$PATH` | 系统 PATH |
|
||||||
| `SPC_DEFAULT_C_FLAGS` | empty | 默认 C 编译标志 |
|
| `SPC_DEFAULT_C_FLAGS` | empty | 默认 C 编译标志 |
|
||||||
| `SPC_DEFAULT_CXX_FLAGS` | empty | 默认 C++ 编译标志 |
|
| `SPC_DEFAULT_CXX_FLAGS` | empty | 默认 C++ 编译标志 |
|
||||||
| `SPC_CMD_PREFIX_PHP_BUILDCONF` | `./buildconf --force` | 编译 PHP `buildconf` 命令前缀 |
|
| `SPC_CMD_PREFIX_PHP_BUILDCONF` | `./buildconf --force` | 编译 PHP `buildconf` 命令前缀 |
|
||||||
| `SPC_CMD_PREFIX_PHP_CONFIGURE` | `LD_LIBRARY_PATH={ld_lib_path} ./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg` | 编译 PHP `configure` 命令前缀 |
|
| `SPC_CMD_PREFIX_PHP_CONFIGURE` | `LD_LIBRARY_PATH={ld_lib_path} ./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-cgi --disable-phpdbg` | 编译 PHP `configure` 命令前缀 |
|
||||||
| `SPC_CMD_PREFIX_PHP_MAKE` | `make -j$SPC_CONCURRENCY` | 编译 PHP `make` 命令前缀 |
|
| `SPC_CMD_PREFIX_PHP_MAKE` | `make -j$SPC_CONCURRENCY` | 编译 PHP `make` 命令前缀 |
|
||||||
| `SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS` | `$SPC_DEFAULT_C_FLAGS` | PHP `configure` 命令的 `CFLAGS` 变量 |
|
| `SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS` | `$SPC_DEFAULT_C_FLAGS` | PHP `configure` 命令的 `CFLAGS` 变量 |
|
||||||
| `SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS` | `-I$BUILD_INCLUDE_PATH` | PHP `configure` 命令的 `CPPFLAGS` 变量 |
|
| `SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS` | `-I$BUILD_INCLUDE_PATH` | PHP `configure` 命令的 `CPPFLAGS` 变量 |
|
||||||
| `SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS` | `-L$BUILD_LIB_PATH` | PHP `configure` 命令的 `LDFLAGS` 变量 |
|
| `SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS` | `-L$BUILD_LIB_PATH` | PHP `configure` 命令的 `LDFLAGS` 变量 |
|
||||||
| `SPC_CMD_VAR_PHP_CONFIGURE_LIBS` | `-ldl -lpthread` | PHP `configure` 命令的 `LIBS` 变量 |
|
| `SPC_CMD_VAR_PHP_CONFIGURE_LIBS` | `-ldl -lpthread` | PHP `configure` 命令的 `LIBS` 变量 |
|
||||||
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS` | `-g0 -Os -fno-ident -fPIE` 或 `-g -O0 -fno-ident -fPIE`(当使用 `--no-strip` 时为后者) | PHP `make` 命令的 `EXTRA_CFLAGS` 变量 |
|
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS` | `-g0 -Os -fno-ident -fPIE` 或 `-g -O0 -fno-ident -fPIE`(当使用 `--no-strip` 时为后者) | PHP `make` 命令的 `EXTRA_CFLAGS` 变量 |
|
||||||
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS` | empty | PHP `make` 命令的额外 `EXTRA_LIBS` 变量 |
|
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS` | empty | PHP `make` 命令的额外 `EXTRA_LIBS` 变量 |
|
||||||
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM` | `-all-static`(当使用 `clang` 时:`-Xcompiler -fuse-ld=lld -all-static`) | `make` 命令的额外 `LDFLAGS` 变量(用于编译程序) |
|
| `SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM` | `-all-static`(当使用 `clang` 时:`-Xcompiler -fuse-ld=lld -all-static`) | `make` 命令的额外 `LDFLAGS` 变量(用于编译程序) |
|
||||||
| `SPC_NO_MUSL_PATH` | empty | 是否不插入 musl 工具链的 PATH(值为 `yes` 时不插入) |
|
| `SPC_NO_MUSL_PATH` | empty | 是否不插入 musl 工具链的 PATH(值为 `yes` 时不插入) |
|
||||||
| `SPC_MICRO_PATCHES` | `static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream` | 使用的 phpmicro [patches](https://github.com/easysoft/phpmicro/blob/master/patches/Readme.md) |
|
|
||||||
|
|
||||||
> `{ld_lib_path}` 值为 `/usr/local/musl/$GNU_ARCH-linux-musl/lib`。
|
> `{ld_lib_path}` 值为 `/usr/local/musl/$GNU_ARCH-linux-musl/lib`。
|
||||||
|
|
||||||
### FreeBSD
|
### FreeBSD
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ event 扩展在 macOS 系统下编译后暂无法使用 `openpty` 特性。相
|
|||||||
|
|
||||||
parallel 扩展只支持 PHP 8.0 及以上版本,并只支持 ZTS 构建(`--enable-zts`)。
|
parallel 扩展只支持 PHP 8.0 及以上版本,并只支持 ZTS 构建(`--enable-zts`)。
|
||||||
|
|
||||||
## spx
|
# spx
|
||||||
|
|
||||||
1. [SPX 扩展](https://github.com/NoiseByNorthwest/php-spx) 只支持非线程模式。
|
1. [SPX 扩展](https://github.com/NoiseByNorthwest/php-spx) 只支持非线程模式。
|
||||||
2. SPX 目前不支持 Windows,且官方仓库也不支持静态编译,static-php-cli 使用了 [修改版本](https://github.com/static-php/php-spx)。
|
2. SPX 目前不支持 Windows,且官方仓库也不支持静态编译,static-php-cli 使用了 [修改版本](https://github.com/static-php/php-spx)。
|
||||||
|
|||||||
@@ -13,5 +13,12 @@
|
|||||||
有些扩展或扩展依赖的库会有一些可选的特性,例如 gd 库可选支持 libwebp、freetype 等。
|
有些扩展或扩展依赖的库会有一些可选的特性,例如 gd 库可选支持 libwebp、freetype 等。
|
||||||
如果你只使用 `bin/spc build gd --build-cli` 是不会包含它们(static-php-cli 默认为最小依赖原则)。
|
如果你只使用 `bin/spc build gd --build-cli` 是不会包含它们(static-php-cli 默认为最小依赖原则)。
|
||||||
|
|
||||||
有关编译可选库,请参考 [扩展、库的依赖关系图表](./deps-map)。对于可选的库,你也可以从 [编译命令生成器](./cli-generator) 中选择扩展后展开选择可选库。
|
你可以在编译时使用 `--with-libs=` 加入这些库,当本次编译的依赖库中包含它们,gd 会自动依赖它们启用这些特性。
|
||||||
|
(如:`bin/spc build gd --with-libs=libwebp,freetype --build-cli`)
|
||||||
|
|
||||||
|
或者你也可以使用 `--with-suggested-exts` 和 `--with-suggested-libs` 启用这些扩展和库所有可选的依赖。
|
||||||
|
(如:`bin/spc build gd --with-suggested-libs --build-cli`)
|
||||||
|
|
||||||
|
如果你不知道某个扩展是否有可选特性,可以通过查看 [spc 配置文件](https://github.com/crazywhalecc/static-php-cli/tree/main/config)
|
||||||
|
或使用命令 `bin/spc dev:extensions` 查看(库依赖为 `lib-suggests`,扩展依赖为 `ext-suggests`)。
|
||||||
:::
|
:::
|
||||||
|
|||||||
@@ -11,15 +11,15 @@
|
|||||||
```bash
|
```bash
|
||||||
# Download from self-hosted nightly builds (sync with main branch)
|
# Download from self-hosted nightly builds (sync with main branch)
|
||||||
# For Linux x86_64
|
# For Linux x86_64
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||||
# For Linux aarch64
|
# For Linux aarch64
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
||||||
# macOS x86_64 (Intel)
|
# macOS x86_64 (Intel)
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||||
# macOS aarch64 (Apple)
|
# macOS aarch64 (Apple)
|
||||||
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
||||||
# Windows (x86_64, win10 build 17063 or later)
|
# Windows (x86_64, win10 build 17063 or later)
|
||||||
curl.exe -fsSL -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
curl.exe -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
||||||
|
|
||||||
# Add execute perm (Linux and macOS only)
|
# Add execute perm (Linux and macOS only)
|
||||||
chmod +x ./spc
|
chmod +x ./spc
|
||||||
@@ -132,16 +132,13 @@ bin/spc download --for-libs=liblz4,libevent --for-extensions=pcntl,rar,xml
|
|||||||
# 仅下载要编译的库(包括其依赖,使用库名,不包含可选库)
|
# 仅下载要编译的库(包括其依赖,使用库名,不包含可选库)
|
||||||
bin/spc download --for-libs=liblz4,libevent --without-suggestions
|
bin/spc download --for-libs=liblz4,libevent --without-suggestions
|
||||||
|
|
||||||
# 下载资源时,忽略部分资源的缓存,强制下载(如切换特定 PHP 版本)
|
# 下载资源时,忽略部分资源的缓存,强制下载(如切换 PHP 版本)
|
||||||
bin/spc download --for-extensions=curl,pcntl,xml --ignore-cache-sources=php-src --with-php=8.3.10
|
bin/spc download --for-extensions=curl,pcntl,xml --ignore-cache-sources=php-src --with-php=8.3
|
||||||
|
|
||||||
# 下载资源时,优先下载有预编译包的依赖库(减少编译依赖的时间)
|
|
||||||
bin/spc download --for-extensions="curl,pcntl,xml,mbstring" --prefer-pre-built
|
|
||||||
|
|
||||||
# 下载所有依赖包
|
# 下载所有依赖包
|
||||||
bin/spc download --all
|
bin/spc download --all
|
||||||
|
|
||||||
# 下载所有依赖包,并指定下载的 PHP 主版本,可选:7.3,7.4,8.0,8.1,8.2,8.3,也可以使用特定的版本,如 8.3.10。
|
# 下载所有依赖包,并指定下载的 PHP 主版本,可选:7.3,7.4,8.0,8.1,8.2,8.3。
|
||||||
bin/spc download --all --with-php=8.2
|
bin/spc download --all --with-php=8.2
|
||||||
|
|
||||||
# 下载时显示下载进度条(curl)
|
# 下载时显示下载进度条(curl)
|
||||||
@@ -176,17 +173,6 @@ bin/spc download --all -U "php-src:https://downloads.php.net/~eric/php-8.3.0beta
|
|||||||
bin/spc download --all -U "curl:https://curl.se/download/curl-7.88.1.tar.gz"
|
bin/spc download --all -U "curl:https://curl.se/download/curl-7.88.1.tar.gz"
|
||||||
```
|
```
|
||||||
|
|
||||||
如果你下载的资源不是链接,而是一个 Git 仓库,你可以使用 `-G` 或 `--custom-git` 重写下载链接,让下载器强制使用你指定的 Git 仓库下载此 source 的包。
|
|
||||||
使用方法为 `{source-name}:{branch}:{url}` 即可,可同时重写多个库的下载地址。在使用 `--for-extensions` 选项下载时同样可用。
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 例如:下载 master 分支的 php-src
|
|
||||||
bin/spc download --for-extensions=redis,phar -G "php-src:master:https://github.com/php/php-src.git"
|
|
||||||
|
|
||||||
# 从 swoole-src 仓库下载 master 分支的最新代码,而不是发行版
|
|
||||||
bin/spc download --for-extensions=swoole -G "swoole:master:https://github.com/swoole/swoole-src.git"
|
|
||||||
```
|
|
||||||
|
|
||||||
## 命令 doctor - 环境检查
|
## 命令 doctor - 环境检查
|
||||||
|
|
||||||
如果你可以正常运行 `bin/spc` 但无法正常编译静态的 PHP 或依赖库,可以先运行 `bin/spc doctor` 检查系统自身是否缺少依赖。
|
如果你可以正常运行 `bin/spc` 但无法正常编译静态的 PHP 或依赖库,可以先运行 `bin/spc doctor` 检查系统自身是否缺少依赖。
|
||||||
@@ -360,8 +346,6 @@ bin/spc extract php-src,libxml2
|
|||||||
- `dev:sort-config`: 对 `config/` 目录下的配置文件的列表按照字母表排序
|
- `dev:sort-config`: 对 `config/` 目录下的配置文件的列表按照字母表排序
|
||||||
- `dev:lib-ver <lib-name>`: 从依赖库的源码中读取版本(仅特定依赖库可用)
|
- `dev:lib-ver <lib-name>`: 从依赖库的源码中读取版本(仅特定依赖库可用)
|
||||||
- `dev:ext-ver <ext-name>`: 从扩展的源码中读取对应版本(仅特定扩展可用)
|
- `dev:ext-ver <ext-name>`: 从扩展的源码中读取对应版本(仅特定扩展可用)
|
||||||
- `dev:pack-lib <lib-name>`: 打包指定的依赖库(仅发布者可用)
|
|
||||||
- `dev:gen-ext-docs`: 生成扩展文档(仅发布者可用)
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 输出所有扩展
|
# 输出所有扩展
|
||||||
@@ -482,12 +466,3 @@ memory_limit => 8G => 8G
|
|||||||
::: tip
|
::: tip
|
||||||
static-php-cli 开放的方法非常多,文档中无法一一列举,但只要是 `public function` 并且不被标注为 `@internal`,均可调用。
|
static-php-cli 开放的方法非常多,文档中无法一一列举,但只要是 `public function` 并且不被标注为 `@internal`,均可调用。
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## 多次构建
|
|
||||||
|
|
||||||
如果你在本地要多次构建,以下方法可以为你节省下载资源、编译的时间。
|
|
||||||
|
|
||||||
- 仅切换 PHP 版本,不更换依赖库版本时,可以使用 `bin/spc switch-php-version` 快速切换 PHP 版本,然后重新运行同样的 `build` 命令。
|
|
||||||
- 如果你想重新构建一次,但不重新下载源码,可以先 `rm -rf buildroot source` 删除编译目录和源码目录,然后重新构建。
|
|
||||||
- 如果你想更新某个依赖的版本,可以使用 `bin/spc del-download <source-name>` 删除指定的源码,然后使用 `download <source-name>` 重新下载。
|
|
||||||
- 如果你想更新所有依赖的版本,可以使用 `bin/spc download --clean` 删除所有下载的源码,然后重新下载。
|
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ use SPC\command\BuildLibsCommand;
|
|||||||
use SPC\command\DeleteDownloadCommand;
|
use SPC\command\DeleteDownloadCommand;
|
||||||
use SPC\command\dev\AllExtCommand;
|
use SPC\command\dev\AllExtCommand;
|
||||||
use SPC\command\dev\ExtVerCommand;
|
use SPC\command\dev\ExtVerCommand;
|
||||||
use SPC\command\dev\GenerateExtDepDocsCommand;
|
|
||||||
use SPC\command\dev\GenerateExtDocCommand;
|
use SPC\command\dev\GenerateExtDocCommand;
|
||||||
use SPC\command\dev\GenerateLibDepDocsCommand;
|
|
||||||
use SPC\command\dev\LibVerCommand;
|
use SPC\command\dev\LibVerCommand;
|
||||||
use SPC\command\dev\PackLibCommand;
|
use SPC\command\dev\PackLibCommand;
|
||||||
use SPC\command\dev\PhpVerCommand;
|
use SPC\command\dev\PhpVerCommand;
|
||||||
@@ -30,7 +28,7 @@ use Symfony\Component\Console\Application;
|
|||||||
*/
|
*/
|
||||||
final class ConsoleApplication extends Application
|
final class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const VERSION = '2.3.4';
|
public const VERSION = '2.3.0';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -57,8 +55,6 @@ final class ConsoleApplication extends Application
|
|||||||
new ExtVerCommand(),
|
new ExtVerCommand(),
|
||||||
new SortConfigCommand(),
|
new SortConfigCommand(),
|
||||||
new GenerateExtDocCommand(),
|
new GenerateExtDocCommand(),
|
||||||
new GenerateExtDepDocsCommand(),
|
|
||||||
new GenerateLibDepDocsCommand(),
|
|
||||||
new PackLibCommand(),
|
new PackLibCommand(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -180,8 +180,8 @@ class Extension
|
|||||||
if (file_exists(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php')) {
|
if (file_exists(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php')) {
|
||||||
// Trim additional content & escape special characters to allow inline usage
|
// Trim additional content & escape special characters to allow inline usage
|
||||||
$test = str_replace(
|
$test = str_replace(
|
||||||
['<?php', 'declare(strict_types=1);', "\n", '"', '$', '!'],
|
['<?php', 'declare(strict_types=1);', "\n", '"', '$'],
|
||||||
['', '', '', '\"', '\$', '"\'!\'"'],
|
['', '', '', '\"', '\$'],
|
||||||
file_get_contents(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php')
|
file_get_contents(ROOT_DIR . '/src/globals/ext-tests/' . $this->getName() . '.php')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace SPC\builder\extension;
|
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
|
||||||
use SPC\store\FileSystem;
|
|
||||||
use SPC\util\CustomExt;
|
|
||||||
|
|
||||||
#[CustomExt('gmssl')]
|
|
||||||
class gmssl extends Extension
|
|
||||||
{
|
|
||||||
public function patchBeforeBuildconf(): bool
|
|
||||||
{
|
|
||||||
if (str_contains(file_get_contents(SOURCE_PATH . '/php-src/ext/gmssl/config.w32'), 'CHECK_LIB(')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gmssl/config.w32', 'AC_DEFINE(', 'CHECK_LIB("gmssl.lib", "gmssl", PHP_GMSSL);' . PHP_EOL . 'AC_DEFINE(');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,23 +6,11 @@ namespace SPC\builder\extension;
|
|||||||
|
|
||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\store\FileSystem;
|
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
#[CustomExt('imap')]
|
#[CustomExt('imap')]
|
||||||
class imap extends Extension
|
class imap extends Extension
|
||||||
{
|
{
|
||||||
public function patchBeforeBuildconf(): bool
|
|
||||||
{
|
|
||||||
if ($this->builder->getLib('openssl')) {
|
|
||||||
// sometimes imap with openssl does not contain zlib (required by openssl)
|
|
||||||
// we need to add it manually
|
|
||||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/imap/config.m4', 'TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD"', 'TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD -lz"');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ namespace SPC\builder\extension;
|
|||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\store\SourcePatcher;
|
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
#[CustomExt('opcache')]
|
#[CustomExt('opcache')]
|
||||||
@@ -24,24 +23,6 @@ class opcache extends Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function patchBeforeBuildconf(): bool
|
|
||||||
{
|
|
||||||
if (file_exists(SOURCE_PATH . '/php-src/.opcache_patched')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// if 8.2.0 <= PHP_VERSION < 8.2.23, we need to patch from legacy patch file
|
|
||||||
if (version_compare($this->builder->getPHPVersion(), '8.2.0', '>=') && version_compare($this->builder->getPHPVersion(), '8.2.23', '<')) {
|
|
||||||
SourcePatcher::patchFile('spc_fix_static_opcache_before_80222.patch', SOURCE_PATH . '/php-src');
|
|
||||||
}
|
|
||||||
// if 8.3.0 <= PHP_VERSION < 8.3.11, we need to patch from legacy patch file
|
|
||||||
elseif (version_compare($this->builder->getPHPVersion(), '8.3.0', '>=') && version_compare($this->builder->getPHPVersion(), '8.3.11', '<')) {
|
|
||||||
SourcePatcher::patchFile('spc_fix_static_opcache_before_80310.patch', SOURCE_PATH . '/php-src');
|
|
||||||
} else {
|
|
||||||
SourcePatcher::patchMicro(items: ['static_opcache']);
|
|
||||||
}
|
|
||||||
return file_put_contents(SOURCE_PATH . '/php-src/.opcache_patched', '1') !== false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(): string
|
||||||
{
|
{
|
||||||
return '--enable-opcache';
|
return '--enable-opcache';
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace SPC\builder\extension;
|
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
|
||||||
use SPC\builder\macos\MacOSBuilder;
|
|
||||||
use SPC\exception\FileSystemException;
|
|
||||||
use SPC\store\FileSystem;
|
|
||||||
use SPC\util\CustomExt;
|
|
||||||
|
|
||||||
#[CustomExt('rar')]
|
|
||||||
class rar extends Extension
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @throws FileSystemException
|
|
||||||
*/
|
|
||||||
public function patchBeforeBuildconf(): bool
|
|
||||||
{
|
|
||||||
// workaround for newer Xcode clang (>= 15.0)
|
|
||||||
if ($this->builder instanceof MacOSBuilder) {
|
|
||||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/rar/config.m4', '-Wall -fvisibility=hidden', '-Wall -Wno-incompatible-function-pointer-types -fvisibility=hidden');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,12 +23,4 @@ class redis extends Extension
|
|||||||
}
|
}
|
||||||
return $arg;
|
return $arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWindowsConfigureArg(): string
|
|
||||||
{
|
|
||||||
$arg = '--enable-redis';
|
|
||||||
$arg .= $this->builder->getExt('session') ? ' --enable-redis-session' : ' --disable-redis-session';
|
|
||||||
$arg .= $this->builder->getExt('igbinary') ? ' --enable-redis-igbinary' : ' --disable-redis-igbinary';
|
|
||||||
return $arg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace SPC\builder\linux\library;
|
|
||||||
|
|
||||||
class gmssl extends LinuxLibraryBase
|
|
||||||
{
|
|
||||||
use \SPC\builder\unix\library\gmssl;
|
|
||||||
|
|
||||||
public const NAME = 'gmssl';
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC\builder\linux\library;
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
use SPC\store\FileSystem;
|
|
||||||
|
|
||||||
class icu extends LinuxLibraryBase
|
class icu extends LinuxLibraryBase
|
||||||
{
|
{
|
||||||
use \SPC\builder\unix\library\icu;
|
use \SPC\builder\unix\library\icu;
|
||||||
@@ -14,7 +12,7 @@ class icu extends LinuxLibraryBase
|
|||||||
|
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
$cppflags = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1"';
|
$cppflags = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1"';
|
||||||
$cxxflags = 'CXXFLAGS="-std=c++17"';
|
$cxxflags = 'CXXFLAGS="-std=c++17"';
|
||||||
$ldflags = 'LDFLAGS="-static"';
|
$ldflags = 'LDFLAGS="-static"';
|
||||||
shell()->cd($this->source_dir . '/source')
|
shell()->cd($this->source_dir . '/source')
|
||||||
@@ -28,7 +26,7 @@ class icu extends LinuxLibraryBase
|
|||||||
'--enable-extras=no ' .
|
'--enable-extras=no ' .
|
||||||
'--enable-icuio=yes ' .
|
'--enable-icuio=yes ' .
|
||||||
'--enable-dyload=no ' .
|
'--enable-dyload=no ' .
|
||||||
'--enable-tools=yes ' .
|
'--enable-tools=no ' .
|
||||||
'--enable-tests=no ' .
|
'--enable-tests=no ' .
|
||||||
'--enable-samples=no ' .
|
'--enable-samples=no ' .
|
||||||
'--prefix=' . BUILD_ROOT_PATH
|
'--prefix=' . BUILD_ROOT_PATH
|
||||||
@@ -38,6 +36,5 @@ class icu extends LinuxLibraryBase
|
|||||||
->exec('make install');
|
->exec('make install');
|
||||||
|
|
||||||
$this->patchPkgconfPrefix(['icu-i18n.pc', 'icu-io.pc', 'icu-uc.pc'], PKGCONF_PATCH_PREFIX);
|
$this->patchPkgconfPrefix(['icu-i18n.pc', 'icu-io.pc', 'icu-uc.pc'], PKGCONF_PATCH_PREFIX);
|
||||||
FileSystem::removeDir(BUILD_LIB_PATH . '/icu');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class imap extends LinuxLibraryBase
|
|||||||
->exec('chmod +x src/osdep/unix/drivers')
|
->exec('chmod +x src/osdep/unix/drivers')
|
||||||
->exec('chmod +x src/osdep/unix/mkauths')
|
->exec('chmod +x src/osdep/unix/mkauths')
|
||||||
->exec(
|
->exec(
|
||||||
"yes | make slx {$ssl_options} EXTRACFLAGS='-fPIC -fpermissive'"
|
"yes | make slx {$ssl_options}"
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
shell()
|
shell()
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace SPC\builder\macos\library;
|
|
||||||
|
|
||||||
class gmssl extends MacOSLibraryBase
|
|
||||||
{
|
|
||||||
use \SPC\builder\unix\library\gmssl;
|
|
||||||
|
|
||||||
public const NAME = 'gmssl';
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC\builder\macos\library;
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
use SPC\store\FileSystem;
|
|
||||||
|
|
||||||
class icu extends MacOSLibraryBase
|
class icu extends MacOSLibraryBase
|
||||||
{
|
{
|
||||||
use \SPC\builder\unix\library\icu;
|
use \SPC\builder\unix\library\icu;
|
||||||
@@ -16,12 +14,11 @@ class icu extends MacOSLibraryBase
|
|||||||
{
|
{
|
||||||
$root = BUILD_ROOT_PATH;
|
$root = BUILD_ROOT_PATH;
|
||||||
shell()->cd($this->source_dir . '/source')
|
shell()->cd($this->source_dir . '/source')
|
||||||
->exec("./runConfigureICU MacOSX --enable-static --disable-shared --disable-extras --disable-samples --disable-tests --prefix={$root}")
|
->exec("./runConfigureICU MacOSX --enable-static --disable-shared --disable-extras --disable-samples --disable-tests --disable-tools --prefix={$root}")
|
||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
->exec("make -j{$this->builder->concurrency}")
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
->exec('make install');
|
->exec('make install');
|
||||||
|
|
||||||
$this->patchPkgconfPrefix(['icu-i18n.pc', 'icu-io.pc', 'icu-uc.pc'], PKGCONF_PATCH_PREFIX);
|
$this->patchPkgconfPrefix(['icu-i18n.pc', 'icu-io.pc', 'icu-uc.pc'], PKGCONF_PATCH_PREFIX);
|
||||||
FileSystem::removeDir(BUILD_LIB_PATH . '/icu');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ class imap extends MacOSLibraryBase
|
|||||||
} else {
|
} else {
|
||||||
$ssl_options = 'SSLTYPE=none';
|
$ssl_options = 'SSLTYPE=none';
|
||||||
}
|
}
|
||||||
$out = shell()->execWithResult('echo "-include $(xcrun --show-sdk-path)/usr/include/poll.h -include $(xcrun --show-sdk-path)/usr/include/time.h -include $(xcrun --show-sdk-path)/usr/include/utime.h"')[1][0];
|
|
||||||
shell()->cd($this->source_dir)
|
shell()->cd($this->source_dir)
|
||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
->exec('touch ip6')
|
->exec('touch ip6')
|
||||||
@@ -56,7 +55,7 @@ class imap extends MacOSLibraryBase
|
|||||||
->exec('chmod +x src/osdep/unix/drivers')
|
->exec('chmod +x src/osdep/unix/drivers')
|
||||||
->exec('chmod +x src/osdep/unix/mkauths')
|
->exec('chmod +x src/osdep/unix/mkauths')
|
||||||
->exec(
|
->exec(
|
||||||
"yes | make osx {$ssl_options} EXTRACFLAGS='-Wimplicit-function-declaration -Wno-incompatible-function-pointer-types {$out}'"
|
"yes | EXTRACFLAGS='-Wimplicit-function-declaration -include $(xcrun --show-sdk-path)/usr/include/poll.h -include $(xcrun --show-sdk-path)/usr/include/time.h -include $(xcrun --show-sdk-path)/usr/include/utime.h' make osx {$ssl_options}"
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
shell()
|
shell()
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ trait curl
|
|||||||
$extra .= $this->builder->getLib('idn2') ? '-DUSE_LIBIDN2=ON ' : '-DUSE_LIBIDN2=OFF ';
|
$extra .= $this->builder->getLib('idn2') ? '-DUSE_LIBIDN2=ON ' : '-DUSE_LIBIDN2=OFF ';
|
||||||
// lib:psl
|
// lib:psl
|
||||||
$extra .= $this->builder->getLib('psl') ? '-DCURL_USE_LIBPSL=ON ' : '-DCURL_USE_LIBPSL=OFF ';
|
$extra .= $this->builder->getLib('psl') ? '-DCURL_USE_LIBPSL=ON ' : '-DCURL_USE_LIBPSL=OFF ';
|
||||||
// lib:libcares
|
|
||||||
$extra .= $this->builder->getLib('libcares') ? '-DENABLE_ARES=ON ' : '';
|
|
||||||
|
|
||||||
FileSystem::resetDir($this->source_dir . '/build');
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
// compile!
|
// compile!
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace SPC\builder\unix\library;
|
|
||||||
|
|
||||||
use SPC\exception\FileSystemException;
|
|
||||||
use SPC\exception\RuntimeException;
|
|
||||||
use SPC\store\FileSystem;
|
|
||||||
|
|
||||||
trait gmssl
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @throws FileSystemException
|
|
||||||
* @throws RuntimeException
|
|
||||||
*/
|
|
||||||
protected function build(): void
|
|
||||||
{
|
|
||||||
// CMake needs a clean build directory
|
|
||||||
FileSystem::resetDir($this->source_dir . '/build');
|
|
||||||
// Start build
|
|
||||||
shell()->cd($this->source_dir . '/build')
|
|
||||||
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
|
|
||||||
->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF ..")
|
|
||||||
->execWithEnv("cmake --build . -j {$this->builder->concurrency}")
|
|
||||||
->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,7 @@ trait libavif
|
|||||||
// Start build
|
// Start build
|
||||||
shell()->cd($this->source_dir . '/build')
|
shell()->cd($this->source_dir . '/build')
|
||||||
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
|
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
|
||||||
->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DAVIF_LIBYUV=OFF ..")
|
->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF ..")
|
||||||
->execWithEnv("cmake --build . -j {$this->builder->concurrency}")
|
->execWithEnv("cmake --build . -j {$this->builder->concurrency}")
|
||||||
->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH);
|
->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ trait libiconv
|
|||||||
'./configure ' .
|
'./configure ' .
|
||||||
'--enable-static ' .
|
'--enable-static ' .
|
||||||
'--disable-shared ' .
|
'--disable-shared ' .
|
||||||
'--enable-extra-encodings ' .
|
|
||||||
'--prefix='
|
'--prefix='
|
||||||
)
|
)
|
||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ class curl extends WindowsLibraryBase
|
|||||||
|
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
FileSystem::createDir(BUILD_BIN_PATH);
|
|
||||||
cmd()->cd($this->source_dir . '\winbuild')
|
cmd()->cd($this->source_dir . '\winbuild')
|
||||||
->execWithWrapper(
|
->execWithWrapper(
|
||||||
$this->builder->makeSimpleWrapper('nmake'),
|
$this->builder->makeSimpleWrapper('nmake'),
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace SPC\builder\windows\library;
|
|
||||||
|
|
||||||
use SPC\store\FileSystem;
|
|
||||||
|
|
||||||
class gmssl extends WindowsLibraryBase
|
|
||||||
{
|
|
||||||
public const NAME = 'gmssl';
|
|
||||||
|
|
||||||
protected function build(): void
|
|
||||||
{
|
|
||||||
// reset cmake
|
|
||||||
FileSystem::resetDir($this->source_dir . '\builddir');
|
|
||||||
|
|
||||||
// start build
|
|
||||||
cmd()->cd($this->source_dir . '\builddir')
|
|
||||||
->execWithWrapper(
|
|
||||||
$this->builder->makeSimpleWrapper('cmake .. -G "NMake Makefiles" -DWIN32=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" -DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH),
|
|
||||||
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH
|
|
||||||
);
|
|
||||||
|
|
||||||
FileSystem::writeFile($this->source_dir . '\builddir\cmake_install.cmake', 'set(CMAKE_INSTALL_PREFIX "' . str_replace('\\', '/', BUILD_ROOT_PATH) . '")' . PHP_EOL . FileSystem::readFile($this->source_dir . '\builddir\cmake_install.cmake'));
|
|
||||||
|
|
||||||
cmd()->cd($this->source_dir . '\builddir')
|
|
||||||
->execWithWrapper(
|
|
||||||
$this->builder->makeSimpleWrapper('nmake'),
|
|
||||||
'install XCFLAGS=/MT'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,6 @@ class libavif extends WindowsLibraryBase
|
|||||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
'-DAVIF_BUILD_APPS=OFF ' .
|
'-DAVIF_BUILD_APPS=OFF ' .
|
||||||
'-DAVIF_BUILD_TESTS=OFF ' .
|
'-DAVIF_BUILD_TESTS=OFF ' .
|
||||||
'-DAVIF_LIBYUV=OFF ' .
|
|
||||||
'-DAVID_ENABLE_GTEST=OFF ' .
|
'-DAVID_ENABLE_GTEST=OFF ' .
|
||||||
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ class DownloadCommand extends BaseCommand
|
|||||||
$this->addOption('clean', null, null, 'Clean old download cache and source before fetch');
|
$this->addOption('clean', null, null, 'Clean old download cache and source before fetch');
|
||||||
$this->addOption('all', 'A', null, 'Fetch all sources that static-php-cli needed');
|
$this->addOption('all', 'A', null, 'Fetch all sources that static-php-cli needed');
|
||||||
$this->addOption('custom-url', 'U', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Specify custom source download url, e.g "php-src:https://downloads.php.net/~eric/php-8.3.0beta1.tar.gz"');
|
$this->addOption('custom-url', 'U', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Specify custom source download url, e.g "php-src:https://downloads.php.net/~eric/php-8.3.0beta1.tar.gz"');
|
||||||
$this->addOption('custom-git', 'G', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Specify custom source git url, e.g "php-src:master:https://github.com/php/php-src.git"');
|
|
||||||
$this->addOption('from-zip', 'Z', InputOption::VALUE_REQUIRED, 'Fetch from zip archive');
|
$this->addOption('from-zip', 'Z', InputOption::VALUE_REQUIRED, 'Fetch from zip archive');
|
||||||
$this->addOption('for-extensions', 'e', InputOption::VALUE_REQUIRED, 'Fetch by extensions, e.g "openssl,mbstring"');
|
$this->addOption('for-extensions', 'e', InputOption::VALUE_REQUIRED, 'Fetch by extensions, e.g "openssl,mbstring"');
|
||||||
$this->addOption('for-libs', 'l', InputOption::VALUE_REQUIRED, 'Fetch by libraries, e.g "libcares,openssl,onig"');
|
$this->addOption('for-libs', 'l', InputOption::VALUE_REQUIRED, 'Fetch by libraries, e.g "libcares,openssl,onig"');
|
||||||
@@ -124,15 +123,10 @@ class DownloadCommand extends BaseCommand
|
|||||||
// Define PHP major version
|
// Define PHP major version
|
||||||
$ver = $this->php_major_ver = $this->getOption('with-php') ?? '8.1';
|
$ver = $this->php_major_ver = $this->getOption('with-php') ?? '8.1';
|
||||||
define('SPC_BUILD_PHP_VERSION', $ver);
|
define('SPC_BUILD_PHP_VERSION', $ver);
|
||||||
// match x.y
|
|
||||||
preg_match('/^\d+\.\d+$/', $ver, $matches);
|
preg_match('/^\d+\.\d+$/', $ver, $matches);
|
||||||
if (!$matches) {
|
if (!$matches) {
|
||||||
// match x.y.z
|
logger()->error("bad version arg: {$ver}, x.y required!");
|
||||||
preg_match('/^\d+\.\d+\.\d+$/', $ver, $matches);
|
return static::FAILURE;
|
||||||
if (!$matches) {
|
|
||||||
logger()->error("bad version arg: {$ver}, x.y or x.y.z required!");
|
|
||||||
return static::FAILURE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// retry
|
// retry
|
||||||
@@ -180,12 +174,6 @@ class DownloadCommand extends BaseCommand
|
|||||||
[$source_name, $url] = explode(':', $value, 2);
|
[$source_name, $url] = explode(':', $value, 2);
|
||||||
$custom_urls[$source_name] = $url;
|
$custom_urls[$source_name] = $url;
|
||||||
}
|
}
|
||||||
// Process -G options
|
|
||||||
$custom_gits = [];
|
|
||||||
foreach ($this->input->getOption('custom-git') as $value) {
|
|
||||||
[$source_name, $branch, $url] = explode(':', $value, 3);
|
|
||||||
$custom_gits[$source_name] = [$branch, $url];
|
|
||||||
}
|
|
||||||
|
|
||||||
// If passing --prefer-pre-built option, we need to load pre-built library list from pre-built.json targeted releases
|
// If passing --prefer-pre-built option, we need to load pre-built library list from pre-built.json targeted releases
|
||||||
if ($this->getOption('prefer-pre-built')) {
|
if ($this->getOption('prefer-pre-built')) {
|
||||||
@@ -218,18 +206,6 @@ class DownloadCommand extends BaseCommand
|
|||||||
}
|
}
|
||||||
logger()->info("Fetching source {$source} from custom url [{$ni}/{$cnt}]");
|
logger()->info("Fetching source {$source} from custom url [{$ni}/{$cnt}]");
|
||||||
Downloader::downloadSource($source, $new_config, true);
|
Downloader::downloadSource($source, $new_config, true);
|
||||||
} elseif (isset($custom_gits[$source])) {
|
|
||||||
$config = Config::getSource($source);
|
|
||||||
$new_config = [
|
|
||||||
'type' => 'git',
|
|
||||||
'rev' => $custom_gits[$source][0],
|
|
||||||
'url' => $custom_gits[$source][1],
|
|
||||||
];
|
|
||||||
if (isset($config['path'])) {
|
|
||||||
$new_config['path'] = $config['path'];
|
|
||||||
}
|
|
||||||
logger()->info("Fetching source {$source} from custom git [{$ni}/{$cnt}]");
|
|
||||||
Downloader::downloadSource($source, $new_config, true);
|
|
||||||
} else {
|
} else {
|
||||||
$config = Config::getSource($source);
|
$config = Config::getSource($source);
|
||||||
// Prefer pre-built, we need to search pre-built library
|
// Prefer pre-built, we need to search pre-built library
|
||||||
|
|||||||
@@ -32,12 +32,8 @@ class SwitchPhpVersionCommand extends BaseCommand
|
|||||||
{
|
{
|
||||||
$php_ver = $this->input->getArgument('php-major-version');
|
$php_ver = $this->input->getArgument('php-major-version');
|
||||||
if (!in_array($php_ver, ['7.4', '8.0', '8.1', '8.2', '8.3'])) {
|
if (!in_array($php_ver, ['7.4', '8.0', '8.1', '8.2', '8.3'])) {
|
||||||
// match x.y.z
|
$this->output->writeln('<error>Invalid PHP major version ' . $php_ver . ' !</error>');
|
||||||
preg_match('/^\d+\.\d+\.\d+$/', $php_ver, $matches);
|
return static::FAILURE;
|
||||||
if (!$matches) {
|
|
||||||
$this->output->writeln('<error>Invalid PHP version ' . $php_ver . ' !</error>');
|
|
||||||
return static::FAILURE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect if downloads/.lock.json exists
|
// detect if downloads/.lock.json exists
|
||||||
|
|||||||
@@ -1,166 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace SPC\command\dev;
|
|
||||||
|
|
||||||
use SPC\command\BaseCommand;
|
|
||||||
use SPC\store\FileSystem;
|
|
||||||
use SPC\util\ConfigValidator;
|
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
|
||||||
|
|
||||||
#[AsCommand('dev:gen-ext-dep-docs', 'Generate ext dependency map markdown', [], true)]
|
|
||||||
class GenerateExtDepDocsCommand extends BaseCommand
|
|
||||||
{
|
|
||||||
protected bool $no_motd = true;
|
|
||||||
|
|
||||||
public function handle(): int
|
|
||||||
{
|
|
||||||
// Get ext.json
|
|
||||||
$exts = json_decode(FileSystem::readFile(ROOT_DIR . '/config/ext.json'), true);
|
|
||||||
ConfigValidator::validateExts($exts);
|
|
||||||
|
|
||||||
// Markdown table needs format, we need to calculate the max length of each column
|
|
||||||
$content = '';
|
|
||||||
|
|
||||||
// Calculate table column max length
|
|
||||||
$max_linux = [0, 20, 19, 20, 19];
|
|
||||||
$max_macos = [0, 20, 19, 20, 19];
|
|
||||||
$max_windows = [0, 20, 19, 20, 19];
|
|
||||||
$max_freebsd = [0, 20, 19, 20, 19];
|
|
||||||
|
|
||||||
$md_lines_linux = [];
|
|
||||||
$md_lines_macos = [];
|
|
||||||
$md_lines_windows = [];
|
|
||||||
$md_lines_freebsd = [];
|
|
||||||
|
|
||||||
foreach ($exts as $ext_name => $ext) {
|
|
||||||
$line_linux = [
|
|
||||||
"<b>{$ext_name}</b>",
|
|
||||||
implode('<br>', $ext['ext-depends-linux'] ?? $ext['ext-depends-unix'] ?? $ext['ext-depends'] ?? []),
|
|
||||||
implode('<br>', $ext['ext-suggests-linux'] ?? $ext['ext-suggests-unix'] ?? $ext['ext-suggests'] ?? []),
|
|
||||||
implode('<br>', $ext['lib-depends-linux'] ?? $ext['lib-depends-unix'] ?? $ext['lib-depends'] ?? []),
|
|
||||||
implode('<br>', $ext['lib-suggests-linux'] ?? $ext['lib-suggests-unix'] ?? $ext['lib-suggests'] ?? []),
|
|
||||||
];
|
|
||||||
$this->applyMaxLen($max_linux, $line_linux);
|
|
||||||
if ($this->isSupported($ext, 'Linux') && !$this->isEmptyLine($line_linux)) {
|
|
||||||
$md_lines_linux[] = $line_linux;
|
|
||||||
}
|
|
||||||
$line_macos = [
|
|
||||||
"<b>{$ext_name}</b>",
|
|
||||||
implode('<br>', $ext['ext-depends-macos'] ?? $ext['ext-depends-unix'] ?? $ext['ext-depends'] ?? []),
|
|
||||||
implode('<br>', $ext['ext-suggests-macos'] ?? $ext['ext-suggests-unix'] ?? $ext['ext-suggests'] ?? []),
|
|
||||||
implode('<br>', $ext['lib-depends-macos'] ?? $ext['lib-depends-unix'] ?? $ext['lib-depends'] ?? []),
|
|
||||||
implode('<br>', $ext['lib-suggests-macos'] ?? $ext['lib-suggests-unix'] ?? $ext['lib-suggests'] ?? []),
|
|
||||||
];
|
|
||||||
$this->applyMaxLen($max_macos, $line_macos);
|
|
||||||
if ($this->isSupported($ext, 'macOS') && !$this->isEmptyLine($line_macos)) {
|
|
||||||
$md_lines_macos[] = $line_macos;
|
|
||||||
}
|
|
||||||
$line_windows = [
|
|
||||||
"<b>{$ext_name}</b>",
|
|
||||||
implode('<br>', $ext['ext-depends-windows'] ?? $ext['ext-depends-win'] ?? $ext['ext-depends'] ?? []),
|
|
||||||
implode('<br>', $ext['ext-suggests-windows'] ?? $ext['ext-suggests-win'] ?? $ext['ext-suggests'] ?? []),
|
|
||||||
implode('<br>', $ext['lib-depends-windows'] ?? $ext['lib-depends-win'] ?? $ext['lib-depends'] ?? []),
|
|
||||||
implode('<br>', $ext['lib-suggests-windows'] ?? $ext['lib-suggests-win'] ?? $ext['lib-suggests'] ?? []),
|
|
||||||
];
|
|
||||||
$this->applyMaxLen($max_windows, $line_windows);
|
|
||||||
if ($this->isSupported($ext, 'Windows') && !$this->isEmptyLine($line_windows)) {
|
|
||||||
$md_lines_windows[] = $line_windows;
|
|
||||||
}
|
|
||||||
$line_freebsd = [
|
|
||||||
"<b>{$ext_name}</b>",
|
|
||||||
implode('<br>', $ext['ext-depends-freebsd'] ?? $ext['ext-depends-bsd'] ?? $ext['ext-depends-unix'] ?? $ext['ext-depends'] ?? []),
|
|
||||||
implode('<br>', $ext['ext-suggests-freebsd'] ?? $ext['ext-suggests-bsd'] ?? $ext['ext-suggests-unix'] ?? $ext['ext-suggests'] ?? []),
|
|
||||||
implode('<br>', $ext['lib-depends-freebsd'] ?? $ext['lib-depends-bsd'] ?? $ext['lib-depends-unix'] ?? $ext['lib-depends'] ?? []),
|
|
||||||
implode('<br>', $ext['lib-suggests-freebsd'] ?? $ext['lib-suggests-bsd'] ?? $ext['lib-suggests-unix'] ?? $ext['lib-suggests'] ?? []),
|
|
||||||
];
|
|
||||||
$this->applyMaxLen($max_freebsd, $line_freebsd);
|
|
||||||
if ($this->isSupported($ext, 'BSD') && !$this->isEmptyLine($line_freebsd)) {
|
|
||||||
$md_lines_freebsd[] = $line_freebsd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate markdown
|
|
||||||
if (!empty($md_lines_linux)) {
|
|
||||||
$content .= "### Linux\n\n";
|
|
||||||
$content .= '| ';
|
|
||||||
$pads = ['Extension Name', 'Required Extensions', 'Suggested Extensions', 'Required Libraries', 'Suggested Libraries'];
|
|
||||||
// 生成首行
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad($pad, $max_linux[$i]), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
// 生成第二行表格分割符 | --- | --- | --- | --- | --- |
|
|
||||||
$content .= '| ';
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad('', $max_linux[$i], '-'), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
foreach ($md_lines_linux as $line) {
|
|
||||||
$content .= '| ' . implode(' | ', array_map(fn ($i, $pad) => str_pad($line[$i], $max_linux[$i]), array_keys($line), $line)) . ' |' . PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!empty($md_lines_macos)) {
|
|
||||||
$content .= "\n\n### macOS\n\n";
|
|
||||||
$content .= '| ';
|
|
||||||
$pads = ['Extension Name', 'Required Extensions', 'Suggested Extensions', 'Required Libraries', 'Suggested Libraries'];
|
|
||||||
// 生成首行
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad($pad, $max_macos[$i]), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
// 生成第二行表格分割符 | --- | --- | --- | --- | --- |
|
|
||||||
$content .= '| ';
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad('', $max_macos[$i], '-'), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
foreach ($md_lines_macos as $line) {
|
|
||||||
$content .= '| ' . implode(' | ', array_map(fn ($i, $pad) => str_pad($line[$i], $max_macos[$i]), array_keys($line), $line)) . ' |' . PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!empty($md_lines_windows)) {
|
|
||||||
$content .= "\n\n### Windows\n\n";
|
|
||||||
$content .= '| ';
|
|
||||||
$pads = ['Extension Name', 'Required Extensions', 'Suggested Extensions', 'Required Libraries', 'Suggested Libraries'];
|
|
||||||
// 生成首行
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad($pad, $max_windows[$i]), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
// 生成第二行表格分割符 | --- | --- | --- | --- | --- |
|
|
||||||
$content .= '| ';
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad('', $max_windows[$i], '-'), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
foreach ($md_lines_windows as $line) {
|
|
||||||
$content .= '| ' . implode(' | ', array_map(fn ($i, $pad) => str_pad($line[$i], $max_windows[$i]), array_keys($line), $line)) . ' |' . PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!empty($md_lines_freebsd)) {
|
|
||||||
$content .= "\n\n### FreeBSD\n\n";
|
|
||||||
$content .= '| ';
|
|
||||||
$pads = ['Extension Name', 'Required Extensions', 'Suggested Extensions', 'Required Libraries', 'Suggested Libraries'];
|
|
||||||
// 生成首行
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad($pad, $max_freebsd[$i]), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
// 生成第二行表格分割符 | --- | --- | --- | --- | --- |
|
|
||||||
$content .= '| ';
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad('', $max_freebsd[$i], '-'), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
foreach ($md_lines_freebsd as $line) {
|
|
||||||
$content .= '| ' . implode(' | ', array_map(fn ($i, $pad) => str_pad($line[$i], $max_freebsd[$i]), array_keys($line), $line)) . ' |' . PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->output->writeln($content);
|
|
||||||
return static::SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function applyMaxLen(array &$max, array $lines): void
|
|
||||||
{
|
|
||||||
foreach ($max as $k => $v) {
|
|
||||||
$max[$k] = max($v, strlen($lines[$k]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function isSupported(array $ext, string $os): bool
|
|
||||||
{
|
|
||||||
return !in_array($ext['support'][$os] ?? 'yes', ['no', 'wip']);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function isEmptyLine(array $line): bool
|
|
||||||
{
|
|
||||||
return $line[1] === '' && $line[2] === '' && $line[3] === '' && $line[4] === '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace SPC\command\dev;
|
|
||||||
|
|
||||||
use SPC\command\BaseCommand;
|
|
||||||
use SPC\store\Config;
|
|
||||||
use SPC\store\FileSystem;
|
|
||||||
use SPC\util\ConfigValidator;
|
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
|
||||||
|
|
||||||
#[AsCommand('dev:gen-lib-dep-docs', 'Generate lib dependency map markdown', [], true)]
|
|
||||||
class GenerateLibDepDocsCommand extends BaseCommand
|
|
||||||
{
|
|
||||||
protected bool $no_motd = true;
|
|
||||||
|
|
||||||
protected array $support_lib_list = [];
|
|
||||||
|
|
||||||
public function handle(): int
|
|
||||||
{
|
|
||||||
foreach (['linux', 'macos', 'windows', 'freebsd'] as $os) {
|
|
||||||
$this->support_lib_list[$os] = [];
|
|
||||||
$classes = FileSystem::getClassesPsr4(
|
|
||||||
FileSystem::convertPath(ROOT_DIR . '/src/SPC/builder/' . $os . '/library'),
|
|
||||||
'SPC\builder\\' . $os . '\library'
|
|
||||||
);
|
|
||||||
foreach ($classes as $class) {
|
|
||||||
if (defined($class . '::NAME') && $class::NAME !== 'unknown' && Config::getLib($class::NAME) !== null) {
|
|
||||||
$this->support_lib_list[$os][$class::NAME] = $class;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get lib.json
|
|
||||||
$libs = json_decode(FileSystem::readFile(ROOT_DIR . '/config/lib.json'), true);
|
|
||||||
ConfigValidator::validateLibs($libs);
|
|
||||||
|
|
||||||
// Markdown table needs format, we need to calculate the max length of each column
|
|
||||||
$content = '';
|
|
||||||
|
|
||||||
// Calculate table column max length
|
|
||||||
$max_linux = [0, 20, 19];
|
|
||||||
$max_macos = [0, 20, 19];
|
|
||||||
$max_windows = [0, 20, 19];
|
|
||||||
$max_freebsd = [0, 20, 19];
|
|
||||||
|
|
||||||
$md_lines_linux = [];
|
|
||||||
$md_lines_macos = [];
|
|
||||||
$md_lines_windows = [];
|
|
||||||
$md_lines_freebsd = [];
|
|
||||||
|
|
||||||
foreach ($libs as $lib_name => $lib) {
|
|
||||||
$line_linux = [
|
|
||||||
"<b>{$lib_name}</b>",
|
|
||||||
implode('<br>', $lib['lib-depends-linux'] ?? $lib['lib-depends-unix'] ?? $lib['lib-depends'] ?? []),
|
|
||||||
implode('<br>', $lib['lib-suggests-linux'] ?? $lib['lib-suggests-unix'] ?? $lib['lib-suggests'] ?? []),
|
|
||||||
];
|
|
||||||
$this->applyMaxLen($max_linux, $line_linux);
|
|
||||||
if ($this->isSupported($lib_name, 'linux') && !$this->isEmptyLine($line_linux)) {
|
|
||||||
$md_lines_linux[] = $line_linux;
|
|
||||||
}
|
|
||||||
$line_macos = [
|
|
||||||
"<b>{$lib_name}</b>",
|
|
||||||
implode('<br>', $lib['lib-depends-macos'] ?? $lib['lib-depends-unix'] ?? $lib['lib-depends'] ?? []),
|
|
||||||
implode('<br>', $lib['lib-suggests-macos'] ?? $lib['lib-suggests-unix'] ?? $lib['lib-suggests'] ?? []),
|
|
||||||
];
|
|
||||||
$this->applyMaxLen($max_macos, $line_macos);
|
|
||||||
if ($this->isSupported($lib_name, 'macos') && !$this->isEmptyLine($line_macos)) {
|
|
||||||
$md_lines_macos[] = $line_macos;
|
|
||||||
}
|
|
||||||
$line_windows = [
|
|
||||||
"<b>{$lib_name}</b>",
|
|
||||||
implode('<br>', $lib['lib-depends-windows'] ?? $lib['lib-depends-win'] ?? $lib['lib-depends'] ?? []),
|
|
||||||
implode('<br>', $lib['lib-suggests-windows'] ?? $lib['lib-suggests-win'] ?? $lib['lib-suggests'] ?? []),
|
|
||||||
];
|
|
||||||
$this->applyMaxLen($max_windows, $line_windows);
|
|
||||||
if ($this->isSupported($lib_name, 'windows') && !$this->isEmptyLine($line_windows)) {
|
|
||||||
$md_lines_windows[] = $line_windows;
|
|
||||||
}
|
|
||||||
$line_freebsd = [
|
|
||||||
"<b>{$lib_name}</b>",
|
|
||||||
implode('<br>', $lib['lib-depends-freebsd'] ?? $lib['lib-depends-bsd'] ?? $lib['lib-depends-unix'] ?? $lib['lib-depends'] ?? []),
|
|
||||||
implode('<br>', $lib['lib-suggests-freebsd'] ?? $lib['lib-suggests-bsd'] ?? $lib['lib-suggests-unix'] ?? $lib['lib-suggests'] ?? []),
|
|
||||||
];
|
|
||||||
$this->applyMaxLen($max_freebsd, $line_freebsd);
|
|
||||||
if ($this->isSupported($lib_name, 'freebsd') && !$this->isEmptyLine($line_freebsd)) {
|
|
||||||
$md_lines_freebsd[] = $line_freebsd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate markdown
|
|
||||||
if (!empty($md_lines_linux)) {
|
|
||||||
$content .= "### Linux\n\n";
|
|
||||||
$content .= '| ';
|
|
||||||
$pads = ['Library Name', 'Required Libraries', 'Suggested Libraries'];
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad($pad, $max_linux[$i]), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
$content .= '| ';
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad('', $max_linux[$i], '-'), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
foreach ($md_lines_linux as $line) {
|
|
||||||
$content .= '| ' . implode(' | ', array_map(fn ($i, $pad) => str_pad($line[$i], $max_linux[$i]), array_keys($line), $line)) . ' |' . PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($md_lines_macos)) {
|
|
||||||
$content .= "### macOS\n\n";
|
|
||||||
$content .= '| ';
|
|
||||||
$pads = ['Library Name', 'Required Libraries', 'Suggested Libraries'];
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad($pad, $max_macos[$i]), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
$content .= '| ';
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad('', $max_macos[$i], '-'), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
foreach ($md_lines_macos as $line) {
|
|
||||||
$content .= '| ' . implode(' | ', array_map(fn ($i, $pad) => str_pad($line[$i], $max_macos[$i]), array_keys($line), $line)) . ' |' . PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($md_lines_windows)) {
|
|
||||||
$content .= "### Windows\n\n";
|
|
||||||
$content .= '| ';
|
|
||||||
$pads = ['Library Name', 'Required Libraries', 'Suggested Libraries'];
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad($pad, $max_windows[$i]), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
$content .= '| ';
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad('', $max_windows[$i], '-'), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
foreach ($md_lines_windows as $line) {
|
|
||||||
$content .= '| ' . implode(' | ', array_map(fn ($i, $pad) => str_pad($line[$i], $max_windows[$i]), array_keys($line), $line)) . ' |' . PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($md_lines_freebsd)) {
|
|
||||||
$content .= "### FreeBSD\n\n";
|
|
||||||
$content .= '| ';
|
|
||||||
$pads = ['Library Name', 'Required Libraries', 'Suggested Libraries'];
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad($pad, $max_freebsd[$i]), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
$content .= '| ';
|
|
||||||
$content .= implode(' | ', array_map(fn ($i, $pad) => str_pad('', $max_freebsd[$i], '-'), array_keys($pads), $pads));
|
|
||||||
$content .= ' |' . PHP_EOL;
|
|
||||||
foreach ($md_lines_freebsd as $line) {
|
|
||||||
$content .= '| ' . implode(' | ', array_map(fn ($i, $pad) => str_pad($line[$i], $max_freebsd[$i]), array_keys($line), $line)) . ' |' . PHP_EOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->output->writeln($content);
|
|
||||||
return static::SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function applyMaxLen(array &$max, array $lines): void
|
|
||||||
{
|
|
||||||
foreach ($max as $k => $v) {
|
|
||||||
$max[$k] = max($v, strlen($lines[$k]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function isSupported(string $ext_name, string $os): bool
|
|
||||||
{
|
|
||||||
if (!in_array($os, ['linux', 'macos', 'freebsd', 'windows'])) {
|
|
||||||
throw new \InvalidArgumentException('Invalid os: ' . $os);
|
|
||||||
}
|
|
||||||
return isset($this->support_lib_list[$os][$ext_name]);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function isEmptyLine(array $line): bool
|
|
||||||
{
|
|
||||||
return $line[1] === '' && $line[2] === '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -57,9 +57,6 @@ class SourcePatcher
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// patch php-src/build/php.m4 PKG_CHECK_MODULES -> PKG_CHECK_MODULES_STATIC
|
|
||||||
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/build/php.m4', 'PKG_CHECK_MODULES(', 'PKG_CHECK_MODULES_STATIC(');
|
|
||||||
|
|
||||||
if ($builder->getOption('enable-micro-win32')) {
|
if ($builder->getOption('enable-micro-win32')) {
|
||||||
SourcePatcher::patchMicroWin32();
|
SourcePatcher::patchMicroWin32();
|
||||||
} else {
|
} else {
|
||||||
@@ -88,7 +85,7 @@ class SourcePatcher
|
|||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
*/
|
*/
|
||||||
public static function patchMicro(string $name = '', string $target = '', ?array $items = null): bool
|
public static function patchMicro(): bool
|
||||||
{
|
{
|
||||||
if (!file_exists(SOURCE_PATH . '/php-src/sapi/micro/php_micro.c')) {
|
if (!file_exists(SOURCE_PATH . '/php-src/sapi/micro/php_micro.c')) {
|
||||||
return false;
|
return false;
|
||||||
@@ -108,13 +105,22 @@ class SourcePatcher
|
|||||||
// $check = !defined('DEBUG_MODE') ? ' -q' : '';
|
// $check = !defined('DEBUG_MODE') ? ' -q' : '';
|
||||||
// f_passthru('cd ' . SOURCE_PATH . '/php-src && git checkout' . $check . ' HEAD');
|
// f_passthru('cd ' . SOURCE_PATH . '/php-src && git checkout' . $check . ' HEAD');
|
||||||
|
|
||||||
if ($items !== null) {
|
$default = [
|
||||||
$spc_micro_patches = $items;
|
'static_opcache',
|
||||||
} else {
|
'static_extensions_win32',
|
||||||
$spc_micro_patches = getenv('SPC_MICRO_PATCHES');
|
'cli_checks',
|
||||||
$spc_micro_patches = $spc_micro_patches === false ? [] : explode(',', $spc_micro_patches);
|
'disable_huge_page',
|
||||||
|
'vcruntime140',
|
||||||
|
'win32',
|
||||||
|
'zend_stream',
|
||||||
|
];
|
||||||
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
|
$default[] = 'cli_static';
|
||||||
}
|
}
|
||||||
$patch_list = $spc_micro_patches;
|
if (PHP_OS_FAMILY === 'Darwin') {
|
||||||
|
$default[] = 'macos_iconv';
|
||||||
|
}
|
||||||
|
$patch_list = $default;
|
||||||
$patches = [];
|
$patches = [];
|
||||||
$serial = ['80', '81', '82', '83', '84'];
|
$serial = ['80', '81', '82', '83', '84'];
|
||||||
foreach ($patch_list as $patchName) {
|
foreach ($patch_list as $patchName) {
|
||||||
@@ -133,14 +139,12 @@ class SourcePatcher
|
|||||||
throw new RuntimeException("failed finding patch {$patchName}");
|
throw new RuntimeException("failed finding patch {$patchName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($patches as $patch) {
|
$patchesStr = str_replace('/', DIRECTORY_SEPARATOR, implode(' ', $patches));
|
||||||
logger()->info("Patching micro with {$patch}");
|
|
||||||
$patchesStr = str_replace('/', DIRECTORY_SEPARATOR, $patch);
|
f_passthru(
|
||||||
f_passthru(
|
'cd ' . SOURCE_PATH . '/php-src && ' .
|
||||||
'cd ' . SOURCE_PATH . '/php-src && ' .
|
(PHP_OS_FAMILY === 'Windows' ? 'type' : 'cat') . ' ' . $patchesStr . ' | patch -p1 '
|
||||||
(PHP_OS_FAMILY === 'Windows' ? 'type' : 'cat') . ' ' . $patchesStr . ' | patch -p1 '
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -198,19 +202,6 @@ class SourcePatcher
|
|||||||
'PHP_ADD_INCLUDE([$ext_srcdir])',
|
'PHP_ADD_INCLUDE([$ext_srcdir])',
|
||||||
"PHP_ADD_INCLUDE( [\$ext_srcdir] )\n PHP_ADD_INCLUDE([\$abs_srcdir/ext])"
|
"PHP_ADD_INCLUDE( [\$ext_srcdir] )\n PHP_ADD_INCLUDE([\$abs_srcdir/ext])"
|
||||||
);
|
);
|
||||||
// swoole 5.1.3 build fix
|
|
||||||
// get swoole version first
|
|
||||||
$file = SOURCE_PATH . '/php-src/ext/swoole/include/swoole_version.h';
|
|
||||||
// Match #define SWOOLE_VERSION "5.1.3"
|
|
||||||
$pattern = '/#define SWOOLE_VERSION "(.+)"/';
|
|
||||||
if (preg_match($pattern, file_get_contents($file), $matches)) {
|
|
||||||
$version = $matches[1];
|
|
||||||
} else {
|
|
||||||
$version = '1.0.0';
|
|
||||||
}
|
|
||||||
if ($version === '5.1.3') {
|
|
||||||
self::patchFile('spc_fix_swoole_50513.patch', SOURCE_PATH . '/php-src/ext/swoole');
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,17 +398,14 @@ class SourcePatcher
|
|||||||
if (preg_match('/PHP_VERSION_ID (\d+)/', $file, $match) !== 0) {
|
if (preg_match('/PHP_VERSION_ID (\d+)/', $file, $match) !== 0) {
|
||||||
$ver_id = intval($match[1]);
|
$ver_id = intval($match[1]);
|
||||||
if ($ver_id < 80000) {
|
if ($ver_id < 80000) {
|
||||||
self::patchFile('spc_fix_alpine_build_php80.patch', SOURCE_PATH . '/php-src');
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
if ($ver_id < 80100) {
|
if ($ver_id < 80100) {
|
||||||
self::patchFile('spc_fix_libxml2_12_php80.patch', SOURCE_PATH . '/php-src');
|
self::patchFile('spc_fix_libxml2_12_php80.patch', SOURCE_PATH . '/php-src');
|
||||||
self::patchFile('spc_fix_alpine_build_php80.patch', SOURCE_PATH . '/php-src');
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ($ver_id < 80200) {
|
if ($ver_id < 80200) {
|
||||||
self::patchFile('spc_fix_libxml2_12_php81.patch', SOURCE_PATH . '/php-src');
|
self::patchFile('spc_fix_libxml2_12_php81.patch', SOURCE_PATH . '/php-src');
|
||||||
self::patchFile('spc_fix_alpine_build_php80.patch', SOURCE_PATH . '/php-src');
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ class GlobalEnvManager
|
|||||||
// Windows need php-sdk binary tools
|
// Windows need php-sdk binary tools
|
||||||
self::initIfNotExists('PHP_SDK_PATH', WORKING_DIR . DIRECTORY_SEPARATOR . 'php-sdk-binary-tools');
|
self::initIfNotExists('PHP_SDK_PATH', WORKING_DIR . DIRECTORY_SEPARATOR . 'php-sdk-binary-tools');
|
||||||
self::initIfNotExists('UPX_EXEC', PKG_ROOT_PATH . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'upx.exe');
|
self::initIfNotExists('UPX_EXEC', PKG_ROOT_PATH . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'upx.exe');
|
||||||
self::initIfNotExists('SPC_MICRO_PATCHES', 'static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,cli_static');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function initLinuxEnv(BuilderBase $builder): void
|
private static function initLinuxEnv(BuilderBase $builder): void
|
||||||
@@ -91,9 +90,6 @@ class GlobalEnvManager
|
|||||||
self::initIfNotExists('SPC_DEFAULT_CXX_FLAGS', '');
|
self::initIfNotExists('SPC_DEFAULT_CXX_FLAGS', '');
|
||||||
self::initIfNotExists('SPC_EXTRA_LIBS', '');
|
self::initIfNotExists('SPC_EXTRA_LIBS', '');
|
||||||
|
|
||||||
// SPC_MICRO_PATCHES for linux
|
|
||||||
self::initIfNotExists('SPC_MICRO_PATCHES', 'static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream');
|
|
||||||
|
|
||||||
// Init linux-only env
|
// Init linux-only env
|
||||||
self::initIfNotExists('UPX_EXEC', PKG_ROOT_PATH . '/bin/upx');
|
self::initIfNotExists('UPX_EXEC', PKG_ROOT_PATH . '/bin/upx');
|
||||||
self::initIfNotExists('GNU_ARCH', arch2gnu(php_uname('m')));
|
self::initIfNotExists('GNU_ARCH', arch2gnu(php_uname('m')));
|
||||||
@@ -144,9 +140,6 @@ class GlobalEnvManager
|
|||||||
// Init extra libs (will be appended before `before-php-buildconf` event point)
|
// Init extra libs (will be appended before `before-php-buildconf` event point)
|
||||||
self::initIfNotExists('SPC_EXTRA_LIBS', '');
|
self::initIfNotExists('SPC_EXTRA_LIBS', '');
|
||||||
|
|
||||||
// SPC_MICRO_PATCHES for macOS
|
|
||||||
self::initIfNotExists('SPC_MICRO_PATCHES', 'static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,macos_iconv');
|
|
||||||
|
|
||||||
$init_spc_cmd_maps = [
|
$init_spc_cmd_maps = [
|
||||||
// Init default build command prefix
|
// Init default build command prefix
|
||||||
'SPC_CMD_PREFIX_PHP_BUILDCONF' => './buildconf --force',
|
'SPC_CMD_PREFIX_PHP_BUILDCONF' => './buildconf --force',
|
||||||
|
|||||||
@@ -118,26 +118,20 @@ class LicenseDumper
|
|||||||
/**
|
/**
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
private function loadSourceFile(string $source_name, int $index, null|array|string $in_path, ?string $custom_base_path = null): string
|
private function loadSourceFile(string $source_name, int $index, ?string $in_path, ?string $custom_base_path = null): string
|
||||||
{
|
{
|
||||||
if (is_null($in_path)) {
|
if (is_null($in_path)) {
|
||||||
throw new RuntimeException('source [' . $source_name . '] license file is not set, please check config/source.json');
|
throw new RuntimeException('source [' . $source_name . '] license file is not set, please check config/source.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($in_path)) {
|
if (file_exists(SOURCE_PATH . '/' . ($custom_base_path ?? $source_name) . '/' . $in_path)) {
|
||||||
$in_path = [$in_path];
|
return file_get_contents(SOURCE_PATH . '/' . ($custom_base_path ?? $source_name) . '/' . $in_path);
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($in_path as $item) {
|
|
||||||
if (file_exists(SOURCE_PATH . '/' . ($custom_base_path ?? $source_name) . '/' . $item)) {
|
|
||||||
return file_get_contents(SOURCE_PATH . '/' . ($custom_base_path ?? $source_name) . '/' . $item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists(BUILD_ROOT_PATH . '/source-licenses/' . $source_name . '/' . $index . '.txt')) {
|
if (file_exists(BUILD_ROOT_PATH . '/source-licenses/' . $source_name . '/' . $index . '.txt')) {
|
||||||
return file_get_contents(BUILD_ROOT_PATH . '/source-licenses/' . $source_name . '/' . $index . '.txt');
|
return file_get_contents(BUILD_ROOT_PATH . '/source-licenses/' . $source_name . '/' . $index . '.txt');
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RuntimeException('Cannot find any license file in source [' . $source_name . '] directory!');
|
throw new RuntimeException('source [' . $source_name . '] license file [' . $in_path . '] not exist');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
assert(function_exists('gmssl_rand_bytes'));
|
|
||||||
assert(function_exists('gmssl_sm3'));
|
|
||||||
|
|
||||||
assert(bin2hex(gmssl_sm3('123456')) === '207cf410532f92a47dee245ce9b11ff71f578ebd763eb3bbea44ebd043d018fb');
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
assert(function_exists('iconv'));
|
|
||||||
assert(iconv('UTF-8', 'CP437', 'foo') === 'foo');
|
|
||||||
@@ -3,6 +3,3 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
assert(class_exists(NumberFormatter::class));
|
assert(class_exists(NumberFormatter::class));
|
||||||
assert(function_exists('locale_get_default'));
|
|
||||||
$fmt = new NumberFormatter('de-DE', NumberFormatter::DECIMAL);
|
|
||||||
assert(strval($fmt->parse('1.100')) === '1100');
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
assert(function_exists('msgpack_pack'));
|
|
||||||
assert(function_exists('msgpack_unpack'));
|
|
||||||
assert(msgpack_unpack(msgpack_pack(['foo', 'bar'])) === ['foo', 'bar']);
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
diff --git a/main/streams/cast.c b/main/streams/cast.c
|
|
||||||
index 0978ca4d..677fc6dc 100644
|
|
||||||
--- a/main/streams/cast.c
|
|
||||||
+++ b/main/streams/cast.c
|
|
||||||
@@ -102,6 +102,9 @@ static ssize_t stream_cookie_writer(void *cookie, const char *buffer, size_t siz
|
|
||||||
|
|
||||||
# ifdef COOKIE_SEEKER_USES_OFF64_T
|
|
||||||
static int stream_cookie_seeker(void *cookie, off64_t *position, int whence)
|
|
||||||
+# else
|
|
||||||
+static int stream_cookie_seeker(void *cookie, off_t *position, int whence)
|
|
||||||
+# endif
|
|
||||||
{
|
|
||||||
|
|
||||||
*position = php_stream_seek((php_stream *)cookie, (zend_off_t)*position, whence);
|
|
||||||
@@ -111,13 +114,6 @@ static int stream_cookie_seeker(void *cookie, off64_t *position, int whence)
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
-# else
|
|
||||||
-static int stream_cookie_seeker(void *cookie, zend_off_t position, int whence)
|
|
||||||
-{
|
|
||||||
-
|
|
||||||
- return php_stream_seek((php_stream *)cookie, position, whence);
|
|
||||||
-}
|
|
||||||
-# endif
|
|
||||||
|
|
||||||
static int stream_cookie_closer(void *cookie)
|
|
||||||
{
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
diff --git a/build/order_by_dep.awk b/build/order_by_dep.awk
|
|
||||||
index 1e71ea2069..3da32d8830 100644
|
|
||||||
--- a/build/order_by_dep.awk
|
|
||||||
+++ b/build/order_by_dep.awk
|
|
||||||
@@ -37,6 +37,11 @@ function get_module_index(name, i)
|
|
||||||
function do_deps(mod_idx, module_name, mod_name_len, dep, ext, val, depidx)
|
|
||||||
{
|
|
||||||
module_name = mods[mod_idx];
|
|
||||||
+ # TODO: real skip zend extension
|
|
||||||
+ if (module_name == "opcache") {
|
|
||||||
+ delete mods[mod_idx];
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
mod_name_len = length(module_name);
|
|
||||||
|
|
||||||
for (ext in mod_deps) {
|
|
||||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
|
||||||
index 5f6b854d47..ea15c0d5bc 100644
|
|
||||||
--- a/ext/opcache/ZendAccelerator.c
|
|
||||||
+++ b/ext/opcache/ZendAccelerator.c
|
|
||||||
@@ -91,7 +91,10 @@ typedef int gid_t;
|
|
||||||
#include <immintrin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#ifdef COMPILE_DL_OPCACHE
|
|
||||||
+// avoid symbol conflict
|
|
||||||
ZEND_EXTENSION();
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#ifndef ZTS
|
|
||||||
zend_accel_globals accel_globals;
|
|
||||||
@@ -4808,7 +4811,11 @@ static int accel_finish_startup(void)
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef COMPILE_DL_OPCACHE
|
|
||||||
ZEND_EXT_API zend_extension zend_extension_entry = {
|
|
||||||
+#else
|
|
||||||
+zend_extension opcache_zend_extension_entry = {
|
|
||||||
+#endif
|
|
||||||
ACCELERATOR_PRODUCT_NAME, /* name */
|
|
||||||
PHP_VERSION, /* version */
|
|
||||||
"Zend Technologies", /* author */
|
|
||||||
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
|
|
||||||
index 2a83fa2455..7b3b37182e 100644
|
|
||||||
--- a/ext/opcache/config.m4
|
|
||||||
+++ b/ext/opcache/config.m4
|
|
||||||
@@ -21,7 +21,8 @@ PHP_ARG_ENABLE([opcache-jit],
|
|
||||||
if test "$PHP_OPCACHE" != "no"; then
|
|
||||||
|
|
||||||
dnl Always build as shared extension
|
|
||||||
- ext_shared=yes
|
|
||||||
+ dnl why?
|
|
||||||
+ dnl ext_shared=yes
|
|
||||||
|
|
||||||
if test "$PHP_HUGE_CODE_PAGES" = "yes"; then
|
|
||||||
AC_DEFINE(HAVE_HUGE_CODE_PAGES, 1, [Define to enable copying PHP CODE pages into HUGE PAGES (experimental)])
|
|
||||||
@@ -327,7 +328,9 @@ int main() {
|
|
||||||
shared_alloc_mmap.c \
|
|
||||||
shared_alloc_posix.c \
|
|
||||||
$ZEND_JIT_SRC,
|
|
||||||
- shared,,"-Wno-implicit-fallthrough -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
|
|
||||||
+ $ext_shared,,"-Wno-implicit-fallthrough -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
|
|
||||||
+
|
|
||||||
+ AC_DEFINE(HAVE_OPCACHE, 1, [opcache enabled])
|
|
||||||
|
|
||||||
PHP_ADD_EXTENSION_DEP(opcache, pcre)
|
|
||||||
|
|
||||||
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
|
|
||||||
index 764a2edaab..95427090ce 100644
|
|
||||||
--- a/ext/opcache/config.w32
|
|
||||||
+++ b/ext/opcache/config.w32
|
|
||||||
@@ -16,7 +16,9 @@ if (PHP_OPCACHE != "no") {
|
|
||||||
zend_persist_calc.c \
|
|
||||||
zend_file_cache.c \
|
|
||||||
zend_shared_alloc.c \
|
|
||||||
- shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
|
||||||
+ shared_alloc_win32.c", PHP_OPCACHE_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
|
||||||
+
|
|
||||||
+ AC_DEFINE('HAVE_OPCACHE', 1, 'opcache enabled');
|
|
||||||
|
|
||||||
if (PHP_OPCACHE_JIT == "yes") {
|
|
||||||
if (CHECK_HEADER_ADD_INCLUDE("dynasm/dasm_x86.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
|
|
||||||
diff --git a/main/main.c b/main/main.c
|
|
||||||
index 8c16f01b11..0560348a06 100644
|
|
||||||
--- a/main/main.c
|
|
||||||
+++ b/main/main.c
|
|
||||||
@@ -2011,6 +2011,18 @@ void dummy_invalid_parameter_handler(
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+// this can be moved to other place
|
|
||||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
|
||||||
+extern zend_extension opcache_zend_extension_entry;
|
|
||||||
+extern void zend_register_extension(zend_extension *new_extension, void *handle);
|
|
||||||
+
|
|
||||||
+int zend_load_static_extensions(void)
|
|
||||||
+{
|
|
||||||
+ zend_register_extension(&opcache_zend_extension_entry, NULL /*opcache cannot be unloaded*/);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
/* {{{ php_module_startup */
|
|
||||||
int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint32_t num_additional_modules)
|
|
||||||
{
|
|
||||||
@@ -2253,6 +2265,9 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
|
|
||||||
ahead of all other internals
|
|
||||||
*/
|
|
||||||
php_ini_register_extensions();
|
|
||||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
|
||||||
+ zend_load_static_extensions();
|
|
||||||
+#endif
|
|
||||||
zend_startup_modules();
|
|
||||||
|
|
||||||
/* start Zend extensions */
|
|
||||||
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
|
|
||||||
index 1a2dfe43b4..ae405f035a 100644
|
|
||||||
--- a/win32/build/confutils.js
|
|
||||||
+++ b/win32/build/confutils.js
|
|
||||||
@@ -1535,6 +1535,8 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // TODO: real skip zend extensions
|
|
||||||
+ if (extname != 'opcache')
|
|
||||||
extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
|
|
||||||
|
|
||||||
DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
diff --git a/build/order_by_dep.awk b/build/order_by_dep.awk
|
|
||||||
index 1e71ea2069..3da32d8830 100644
|
|
||||||
--- a/build/order_by_dep.awk
|
|
||||||
+++ b/build/order_by_dep.awk
|
|
||||||
@@ -37,6 +37,11 @@ function get_module_index(name, i)
|
|
||||||
function do_deps(mod_idx, module_name, mod_name_len, dep, ext, val, depidx)
|
|
||||||
{
|
|
||||||
module_name = mods[mod_idx];
|
|
||||||
+ # TODO: real skip zend extension
|
|
||||||
+ if (module_name == "opcache") {
|
|
||||||
+ delete mods[mod_idx];
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
mod_name_len = length(module_name);
|
|
||||||
|
|
||||||
for (ext in mod_deps) {
|
|
||||||
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
|
|
||||||
index ec33c69eb2..b8ce7e3eca 100644
|
|
||||||
--- a/ext/opcache/ZendAccelerator.c
|
|
||||||
+++ b/ext/opcache/ZendAccelerator.c
|
|
||||||
@@ -93,7 +93,10 @@ typedef int gid_t;
|
|
||||||
#include <immintrin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#ifdef COMPILE_DL_OPCACHE
|
|
||||||
+// avoid symbol conflict
|
|
||||||
ZEND_EXTENSION();
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#ifndef ZTS
|
|
||||||
zend_accel_globals accel_globals;
|
|
||||||
@@ -4814,7 +4817,11 @@ static int accel_finish_startup(void)
|
|
||||||
#endif /* ZEND_WIN32 */
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef COMPILE_DL_OPCACHE
|
|
||||||
ZEND_EXT_API zend_extension zend_extension_entry = {
|
|
||||||
+#else
|
|
||||||
+zend_extension opcache_zend_extension_entry = {
|
|
||||||
+#endif
|
|
||||||
ACCELERATOR_PRODUCT_NAME, /* name */
|
|
||||||
PHP_VERSION, /* version */
|
|
||||||
"Zend Technologies", /* author */
|
|
||||||
diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
|
|
||||||
index 2a83fa2455..7b3b37182e 100644
|
|
||||||
--- a/ext/opcache/config.m4
|
|
||||||
+++ b/ext/opcache/config.m4
|
|
||||||
@@ -21,7 +21,8 @@ PHP_ARG_ENABLE([opcache-jit],
|
|
||||||
if test "$PHP_OPCACHE" != "no"; then
|
|
||||||
|
|
||||||
dnl Always build as shared extension
|
|
||||||
- ext_shared=yes
|
|
||||||
+ dnl why?
|
|
||||||
+ dnl ext_shared=yes
|
|
||||||
|
|
||||||
if test "$PHP_HUGE_CODE_PAGES" = "yes"; then
|
|
||||||
AC_DEFINE(HAVE_HUGE_CODE_PAGES, 1, [Define to enable copying PHP CODE pages into HUGE PAGES (experimental)])
|
|
||||||
@@ -327,7 +328,9 @@ int main() {
|
|
||||||
shared_alloc_mmap.c \
|
|
||||||
shared_alloc_posix.c \
|
|
||||||
$ZEND_JIT_SRC,
|
|
||||||
- shared,,"-Wno-implicit-fallthrough -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
|
|
||||||
+ $ext_shared,,"-Wno-implicit-fallthrough -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
|
|
||||||
+
|
|
||||||
+ AC_DEFINE(HAVE_OPCACHE, 1, [opcache enabled])
|
|
||||||
|
|
||||||
PHP_ADD_EXTENSION_DEP(opcache, pcre)
|
|
||||||
|
|
||||||
diff --git a/ext/opcache/config.w32 b/ext/opcache/config.w32
|
|
||||||
index 764a2edaab..95427090ce 100644
|
|
||||||
--- a/ext/opcache/config.w32
|
|
||||||
+++ b/ext/opcache/config.w32
|
|
||||||
@@ -16,7 +16,9 @@ if (PHP_OPCACHE != "no") {
|
|
||||||
zend_persist_calc.c \
|
|
||||||
zend_file_cache.c \
|
|
||||||
zend_shared_alloc.c \
|
|
||||||
- shared_alloc_win32.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
|
||||||
+ shared_alloc_win32.c", PHP_OPCACHE_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
|
|
||||||
+
|
|
||||||
+ AC_DEFINE('HAVE_OPCACHE', 1, 'opcache enabled');
|
|
||||||
|
|
||||||
if (PHP_OPCACHE_JIT == "yes") {
|
|
||||||
if (CHECK_HEADER_ADD_INCLUDE("dynasm/dasm_x86.h", "CFLAGS_OPCACHE", PHP_OPCACHE + ";ext\\opcache\\jit")) {
|
|
||||||
diff --git a/main/main.c b/main/main.c
|
|
||||||
index 6fdfbce13e..bcccfad6e3 100644
|
|
||||||
--- a/main/main.c
|
|
||||||
+++ b/main/main.c
|
|
||||||
@@ -2012,6 +2012,18 @@ void dummy_invalid_parameter_handler(
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+// this can be moved to other place
|
|
||||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
|
||||||
+extern zend_extension opcache_zend_extension_entry;
|
|
||||||
+extern void zend_register_extension(zend_extension *new_extension, void *handle);
|
|
||||||
+
|
|
||||||
+int zend_load_static_extensions(void)
|
|
||||||
+{
|
|
||||||
+ zend_register_extension(&opcache_zend_extension_entry, NULL /*opcache cannot be unloaded*/);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
/* {{{ php_module_startup */
|
|
||||||
zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_module)
|
|
||||||
{
|
|
||||||
@@ -2196,6 +2208,9 @@ zend_result php_module_startup(sapi_module_struct *sf, zend_module_entry *additi
|
|
||||||
ahead of all other internals
|
|
||||||
*/
|
|
||||||
php_ini_register_extensions();
|
|
||||||
+#if defined(HAVE_OPCACHE) && !defined(COMPILE_DL_OPCACHE)
|
|
||||||
+ zend_load_static_extensions();
|
|
||||||
+#endif
|
|
||||||
zend_startup_modules();
|
|
||||||
|
|
||||||
/* start Zend extensions */
|
|
||||||
diff --git a/win32/build/confutils.js b/win32/build/confutils.js
|
|
||||||
index 359c751b7b..01068efcf6 100644
|
|
||||||
--- a/win32/build/confutils.js
|
|
||||||
+++ b/win32/build/confutils.js
|
|
||||||
@@ -1534,6 +1534,8 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // TODO: real skip zend extensions
|
|
||||||
+ if (extname != 'opcache')
|
|
||||||
extension_module_ptrs += '\tphpext_' + extname + '_ptr,\r\n';
|
|
||||||
|
|
||||||
DEFINE('CFLAGS_' + EXT + '_OBJ', '$(CFLAGS_PHP) $(CFLAGS_' + EXT + ')');
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
diff --git a/ext-src/php_swoole_call_stack.h b/ext-src/php_swoole_call_stack.h
|
|
||||||
index 8c89f83..639a303 100644
|
|
||||||
--- a/ext-src/php_swoole_call_stack.h
|
|
||||||
+++ b/ext-src/php_swoole_call_stack.h
|
|
||||||
@@ -18,8 +18,8 @@
|
|
||||||
|
|
||||||
#ifdef ZEND_CHECK_STACK_LIMIT
|
|
||||||
#define HOOK_PHP_CALL_STACK(callback) \
|
|
||||||
- auto __stack_limit = EG(stack_limit); \
|
|
||||||
- auto __stack_base = EG(stack_base); \
|
|
||||||
+ void *__stack_limit = EG(stack_limit); \
|
|
||||||
+ void *__stack_base = EG(stack_base); \
|
|
||||||
EG(stack_base) = (void *) 0; \
|
|
||||||
EG(stack_limit) = (void *) 0; \
|
|
||||||
callback EG(stack_limit) = __stack_limit; \
|
|
||||||
diff --git a/thirdparty/php83/pdo_odbc/odbc_driver.c b/thirdparty/php83/pdo_odbc/odbc_driver.c
|
|
||||||
index c83da64..a5e3a8b 100644
|
|
||||||
--- a/thirdparty/php83/pdo_odbc/odbc_driver.c
|
|
||||||
+++ b/thirdparty/php83/pdo_odbc/odbc_driver.c
|
|
||||||
@@ -25,6 +25,7 @@
|
|
||||||
#include "pdo/php_pdo.h"
|
|
||||||
#include "pdo/php_pdo_driver.h"
|
|
||||||
#include "zend_exceptions.h"
|
|
||||||
+#include <php_odbc_utils.h>
|
|
||||||
|
|
||||||
static void pdo_odbc_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) {
|
|
||||||
pdo_odbc_db_handle *H = (pdo_odbc_db_handle *) dbh->driver_data;
|
|
||||||
@@ -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' => 'gmssl',
|
'Linux', 'Darwin' => 'openssl',
|
||||||
'Windows' => 'gmssl',
|
'Windows' => 'mbstring,pdo_sqlite,openssl',
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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' => 'liblz4',
|
'Linux', 'Darwin' => '',
|
||||||
'Windows' => '',
|
'Windows' => '',
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ $with_libs = match (PHP_OS_FAMILY) {
|
|||||||
// You can use `common`, `bulk`, `minimal` or `none`.
|
// You can use `common`, `bulk`, `minimal` or `none`.
|
||||||
// note: combination is only available for *nix platform. Windows must use `none` combination
|
// note: combination is only available for *nix platform. Windows must use `none` combination
|
||||||
$base_combination = match (PHP_OS_FAMILY) {
|
$base_combination = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'none',
|
'Linux', 'Darwin' => 'minimal',
|
||||||
'Windows' => 'none',
|
'Windows' => 'none',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user