mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-17 13:55:35 +08:00
Compare commits
20 Commits
2.3.1
...
b354e017ba
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b354e017ba | ||
|
|
3ce302d0e6 | ||
|
|
a38f9e6344 | ||
|
|
4e08295cea | ||
|
|
73654e5984 | ||
|
|
077da6f6a4 | ||
|
|
0665af2537 | ||
|
|
d5832c22e3 | ||
|
|
d231364c1a | ||
|
|
fdb5c6aa1d | ||
|
|
47ba881870 | ||
|
|
9fd0508417 | ||
|
|
51442dc9ac | ||
|
|
17c27cb7e8 | ||
|
|
c53f1d947c | ||
|
|
3e013cd642 | ||
|
|
4f5177d57e | ||
|
|
9259f8e53d | ||
|
|
e67e13e81f | ||
|
|
874010f225 |
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 https://dl.static-php.dev/static-php-cli/windows/spc-min/php-${{ env.MICRO_VERSION }}-micro-win.zip -o tmp.zip
|
curl -fsSL 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 https://dl.static-php.dev/static-php-cli/minimal/php-${{ env.MICRO_VERSION }}-micro-${{ matrix.operating-system.name }}.tar.gz -o tmp.tgz
|
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
|
||||||
tar -zxvf tmp.tgz
|
tar -zxvf tmp.tgz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -115,17 +115,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
files: dist/${{ matrix.operating-system.filename }}
|
files: dist/${{ matrix.operating-system.filename }}
|
||||||
|
|
||||||
- name: "Deploy to Self-Hosted Server"
|
- name: "Deploy to self-hosted OSS"
|
||||||
if: github.repository == 'crazywhalecc/static-php-cli'
|
if: github.repository == 'crazywhalecc/static-php-cli'
|
||||||
uses: easingthemes/ssh-deploy@main
|
uses: static-php/upload-s3-action@v1.0.0
|
||||||
env:
|
with:
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SERVER_SECRET_KEY }}
|
aws_key_id: ${{ secrets.AWS_KEY_ID }}
|
||||||
ARGS: "-rltgoDzvO"
|
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
SOURCE: "dist/"
|
aws_bucket: ${{ secrets.AWS_BUCKET }}
|
||||||
REMOTE_HOST: ${{ secrets.DEPLOY_SERVER_HOST }}
|
source_dir: "dist/"
|
||||||
REMOTE_PORT: ${{ secrets.DEPLOY_SERVER_PORT }}
|
destination_dir: static-php-cli/spc-bin/nightly/
|
||||||
REMOTE_USER: ${{ secrets.DEPLOY_SERVER_USER }}
|
endpoint: ${{ secrets.AWS_ENDPOINT }}
|
||||||
TARGET: ${{ secrets.DEPLOY_SERVER_TARGET_SPC_NIGHTLY }}
|
|
||||||
|
|
||||||
- name: "Upload Artifact"
|
- name: "Upload Artifact"
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|||||||
4
.github/workflows/tests.yml
vendored
4
.github/workflows/tests.yml
vendored
@@ -120,8 +120,8 @@ jobs:
|
|||||||
php:
|
php:
|
||||||
- "8.0"
|
- "8.0"
|
||||||
- "8.1"
|
- "8.1"
|
||||||
- "8.2"
|
- "8.2.22"
|
||||||
- "8.3"
|
- "8.3.10"
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-13
|
- macos-13
|
||||||
|
|||||||
2
.github/workflows/vitepress-deploy.yml
vendored
2
.github/workflows/vitepress-deploy.yml
vendored
@@ -58,6 +58,8 @@ 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
|
||||||
|
|||||||
12
README-zh.md
12
README-zh.md
@@ -124,15 +124,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 -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||||
# For Linux aarch64
|
# For Linux aarch64
|
||||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
curl -fsSL -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 -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||||
# macOS aarch64 (Apple)
|
# macOS aarch64 (Apple)
|
||||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
curl -fsSL -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 -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
curl.exe -fsSL -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
|
||||||
@@ -184,7 +184,7 @@ bin/spc --version
|
|||||||
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
./bin/spc download --for-extensions="openssl,pcntl,mbstring,pdo_sqlite"
|
||||||
# 下载依赖时,优先下载有预编译的库(节省编译依赖的时间)
|
# 下载依赖时,优先下载有预编译的库(节省编译依赖的时间)
|
||||||
./bin/spc download --for-extensions="openssl,curl,mbstring,mbregex" --prefer-pre-built
|
./bin/spc download --for-extensions="openssl,curl,mbstring,mbregex" --prefer-pre-built
|
||||||
# 下载编译不同版本的 PHP (--with-php=x.y,推荐 7.3 ~ 8.3)
|
# 下载编译不同版本的 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
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -134,15 +134,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 -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||||
# For Linux aarch64
|
# For Linux aarch64
|
||||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
curl -fsSL -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 -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||||
# macOS aarch64 (Apple)
|
# macOS aarch64 (Apple)
|
||||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
curl -fsSL -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 -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
curl.exe -fsSL -o spc.exehttps://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
|
||||||
@@ -195,7 +195,7 @@ Basic usage for building php with some extensions:
|
|||||||
./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 pre-built libraries first (save time for compiling dependencies)
|
||||||
./bin/spc download --for-extensions="openssl,curl,mbstring,mbregex" --prefer-pre-built
|
./bin/spc download --for-extensions="openssl,curl,mbstring,mbregex" --prefer-pre-built
|
||||||
# download different PHP version (--with-php=x.y, recommend 7.3 ~ 8.3)
|
# 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
|
||||||
|
|||||||
@@ -205,11 +205,14 @@
|
|||||||
},
|
},
|
||||||
"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": {
|
||||||
@@ -537,7 +540,6 @@
|
|||||||
},
|
},
|
||||||
"redis": {
|
"redis": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "external",
|
"type": "external",
|
||||||
@@ -547,7 +549,7 @@
|
|||||||
"session",
|
"session",
|
||||||
"igbinary"
|
"igbinary"
|
||||||
],
|
],
|
||||||
"lib-suggests": [
|
"lib-suggests-unix": [
|
||||||
"zstd",
|
"zstd",
|
||||||
"liblz4"
|
"liblz4"
|
||||||
]
|
]
|
||||||
@@ -588,7 +590,7 @@
|
|||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"snappy"
|
"snappy"
|
||||||
],
|
],
|
||||||
"ext-suggest": [
|
"ext-suggests": [
|
||||||
"apcu"
|
"apcu"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -53,7 +53,8 @@
|
|||||||
"libssh2",
|
"libssh2",
|
||||||
"brotli",
|
"brotli",
|
||||||
"nghttp2",
|
"nghttp2",
|
||||||
"zstd"
|
"zstd",
|
||||||
|
"libcares"
|
||||||
],
|
],
|
||||||
"lib-suggests-windows": [
|
"lib-suggests-windows": [
|
||||||
"brotli",
|
"brotli",
|
||||||
|
|||||||
@@ -546,9 +546,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"openssl": {
|
"openssl": {
|
||||||
"type": "filelist",
|
"type": "ghrel",
|
||||||
"url": "https://www.openssl.org/source/",
|
"repo": "openssl/openssl",
|
||||||
"regex": "/href=\"(?<file>openssl-(?<version>[^\"]+)\\.tar\\.gz)\"/",
|
"match": "openssl.+\\.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",
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
<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 -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 -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>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div class="warning custom-block">
|
<div class="warning custom-block">
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ 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,6 +10,7 @@ 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'},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
0
docs/deps-map-ext.md
Normal file
0
docs/deps-map-ext.md
Normal file
0
docs/deps-map-lib.md
Normal file
0
docs/deps-map-lib.md
Normal file
26
docs/en/guide/deps-map.md
Normal file
26
docs/en/guide/deps-map.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
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,27 +44,29 @@ 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_opcache,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_opcache,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
|
||||||
|
|
||||||
@@ -90,6 +92,7 @@ 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_opcache,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,14 +14,6 @@ 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).
|
||||||
|
|
||||||
You can use `--with-libs=` to add these libraries when compiling.
|
For more information about optional libraries, see [Extensions, Library Dependency Map](./deps-map).
|
||||||
When the dependent libraries of this compilation include them, gd will automatically use them to enable these features.
|
For optional libraries, you can also select an extension from the [Command Generator](./cli-generator) and then select optional libraries.
|
||||||
(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 -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||||
# For Linux aarch64
|
# For Linux aarch64
|
||||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
curl -fsSL -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 -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||||
# macOS aarch64 (Apple)
|
# macOS aarch64 (Apple)
|
||||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
curl -fsSL -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 -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
curl.exe -fsSL -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,6 +143,7 @@ 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)
|
||||||
@@ -170,7 +171,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
|
bin/spc download --for-extensions=curl,pcntl,xml --ignore-cache-sources=php-src --with-php=8.3.10
|
||||||
|
|
||||||
# Set retry times (default is 0)
|
# Set retry times (default is 0)
|
||||||
bin/spc download --all --retry=2
|
bin/spc download --all --retry=2
|
||||||
|
|||||||
22
docs/zh/guide/deps-map.md
Normal file
22
docs/zh/guide/deps-map.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
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,52 +42,56 @@ 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_opcache,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_opcache,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_opcache,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,12 +13,5 @@
|
|||||||
有些扩展或扩展依赖的库会有一些可选的特性,例如 gd 库可选支持 libwebp、freetype 等。
|
有些扩展或扩展依赖的库会有一些可选的特性,例如 gd 库可选支持 libwebp、freetype 等。
|
||||||
如果你只使用 `bin/spc build gd --build-cli` 是不会包含它们(static-php-cli 默认为最小依赖原则)。
|
如果你只使用 `bin/spc build gd --build-cli` 是不会包含它们(static-php-cli 默认为最小依赖原则)。
|
||||||
|
|
||||||
你可以在编译时使用 `--with-libs=` 加入这些库,当本次编译的依赖库中包含它们,gd 会自动依赖它们启用这些特性。
|
有关编译可选库,请参考 [扩展、库的依赖关系图表](./deps-map)。对于可选的库,你也可以从 [编译命令生成器](./cli-generator) 中选择扩展后展开选择可选库。
|
||||||
(如:`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 -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
|
||||||
# For Linux aarch64
|
# For Linux aarch64
|
||||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
|
curl -fsSL -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 -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
curl -fsSL -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
|
||||||
# macOS aarch64 (Apple)
|
# macOS aarch64 (Apple)
|
||||||
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-aarch64
|
curl -fsSL -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 -o spc.exe https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
|
curl.exe -fsSL -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,8 +132,8 @@ 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
|
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,mbstring" --prefer-pre-built
|
bin/spc download --for-extensions="curl,pcntl,xml,mbstring" --prefer-pre-built
|
||||||
@@ -141,7 +141,7 @@ 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。
|
# 下载所有依赖包,并指定下载的 PHP 主版本,可选:7.3,7.4,8.0,8.1,8.2,8.3,也可以使用特定的版本,如 8.3.10。
|
||||||
bin/spc download --all --with-php=8.2
|
bin/spc download --all --with-php=8.2
|
||||||
|
|
||||||
# 下载时显示下载进度条(curl)
|
# 下载时显示下载进度条(curl)
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ 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;
|
||||||
@@ -28,7 +30,7 @@ use Symfony\Component\Console\Application;
|
|||||||
*/
|
*/
|
||||||
final class ConsoleApplication extends Application
|
final class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const VERSION = '2.3.1';
|
public const VERSION = '2.3.3';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -55,6 +57,8 @@ 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(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,11 +6,23 @@ 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
|
||||||
*/
|
*/
|
||||||
|
|||||||
28
src/SPC/builder/extension/rar.php
Normal file
28
src/SPC/builder/extension/rar.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?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,4 +23,12 @@ 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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}"
|
"yes | make slx {$ssl_options} EXTRACFLAGS='-fPIC -fpermissive'"
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
shell()
|
shell()
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ 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')
|
||||||
@@ -55,7 +56,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 | 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}"
|
"yes | make osx {$ssl_options} EXTRACFLAGS='-Wimplicit-function-declaration -Wno-incompatible-function-pointer-types {$out}'"
|
||||||
);
|
);
|
||||||
try {
|
try {
|
||||||
shell()
|
shell()
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ 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!
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ trait libiconv
|
|||||||
'./configure ' .
|
'./configure ' .
|
||||||
'--enable-static ' .
|
'--enable-static ' .
|
||||||
'--disable-shared ' .
|
'--disable-shared ' .
|
||||||
|
'--enable-extra-encodings ' .
|
||||||
'--prefix='
|
'--prefix='
|
||||||
)
|
)
|
||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
|
|||||||
@@ -123,10 +123,15 @@ 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) {
|
||||||
logger()->error("bad version arg: {$ver}, x.y required!");
|
// match x.y.z
|
||||||
return static::FAILURE;
|
preg_match('/^\d+\.\d+\.\d+$/', $ver, $matches);
|
||||||
|
if (!$matches) {
|
||||||
|
logger()->error("bad version arg: {$ver}, x.y or x.y.z required!");
|
||||||
|
return static::FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// retry
|
// retry
|
||||||
|
|||||||
@@ -32,8 +32,12 @@ 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'])) {
|
||||||
$this->output->writeln('<error>Invalid PHP major version ' . $php_ver . ' !</error>');
|
// match x.y.z
|
||||||
return static::FAILURE;
|
preg_match('/^\d+\.\d+\.\d+$/', $php_ver, $matches);
|
||||||
|
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
|
||||||
|
|||||||
166
src/SPC/command/dev/GenerateExtDepDocsCommand.php
Normal file
166
src/SPC/command/dev/GenerateExtDepDocsCommand.php
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
<?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] === '';
|
||||||
|
}
|
||||||
|
}
|
||||||
172
src/SPC/command/dev/GenerateLibDepDocsCommand.php
Normal file
172
src/SPC/command/dev/GenerateLibDepDocsCommand.php
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
<?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,6 +57,9 @@ 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 {
|
||||||
@@ -105,22 +108,9 @@ 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');
|
||||||
|
|
||||||
$default = [
|
$spc_micro_patches = getenv('SPC_MICRO_PATCHES');
|
||||||
'static_opcache',
|
$spc_micro_patches = $spc_micro_patches === false ? [] : explode(',', $spc_micro_patches);
|
||||||
'static_extensions_win32',
|
$patch_list = $spc_micro_patches;
|
||||||
'cli_checks',
|
|
||||||
'disable_huge_page',
|
|
||||||
'vcruntime140',
|
|
||||||
'win32',
|
|
||||||
'zend_stream',
|
|
||||||
];
|
|
||||||
if (PHP_OS_FAMILY === 'Windows') {
|
|
||||||
$default[] = 'cli_static';
|
|
||||||
}
|
|
||||||
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) {
|
||||||
@@ -139,12 +129,14 @@ class SourcePatcher
|
|||||||
throw new RuntimeException("failed finding patch {$patchName}");
|
throw new RuntimeException("failed finding patch {$patchName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
$patchesStr = str_replace('/', DIRECTORY_SEPARATOR, implode(' ', $patches));
|
foreach ($patches as $patch) {
|
||||||
|
logger()->info("Patching micro with {$patch}");
|
||||||
f_passthru(
|
$patchesStr = str_replace('/', DIRECTORY_SEPARATOR, $patch);
|
||||||
'cd ' . SOURCE_PATH . '/php-src && ' .
|
f_passthru(
|
||||||
(PHP_OS_FAMILY === 'Windows' ? 'type' : 'cat') . ' ' . $patchesStr . ' | patch -p1 '
|
'cd ' . SOURCE_PATH . '/php-src && ' .
|
||||||
);
|
(PHP_OS_FAMILY === 'Windows' ? 'type' : 'cat') . ' ' . $patchesStr . ' | patch -p1 '
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -202,6 +194,19 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,14 +403,17 @@ 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) {
|
||||||
return false;
|
self::patchFile('spc_fix_alpine_build_php80.patch', SOURCE_PATH . '/php-src');
|
||||||
|
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,6 +64,7 @@ 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_opcache,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
|
||||||
@@ -90,6 +91,9 @@ 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_opcache,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')));
|
||||||
@@ -140,6 +144,9 @@ 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_opcache,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',
|
||||||
|
|||||||
6
src/globals/ext-tests/iconv.php
Normal file
6
src/globals/ext-tests/iconv.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
assert(function_exists('iconv'));
|
||||||
|
assert(iconv('UTF-8', 'CP437', 'foo') === 'foo');
|
||||||
28
src/globals/patch/spc_fix_alpine_build_php80.patch
Normal file
28
src/globals/patch/spc_fix_alpine_build_php80.patch
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
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)
|
||||||
|
{
|
||||||
27
src/globals/patch/spc_fix_swoole_50513.patch
Normal file
27
src/globals/patch/spc_fix_swoole_50513.patch
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
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,8 +19,8 @@ $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' => 'intl',
|
'Linux', 'Darwin' => 'imap,swoole-hook-sqlite,swoole',
|
||||||
'Windows' => 'amqp,apcu',
|
'Windows' => 'igbinary,redis,session',
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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`).
|
||||||
|
|||||||
Reference in New Issue
Block a user