Compare commits

..

37 Commits

Author SHA1 Message Date
crazywhalecc
01c78aa92a Remove redundant license debug msg 2024-07-09 19:31:44 +08:00
crazywhalecc
54573dfbbe Fix swoole with event extension <util.h> conflict bug 2024-07-09 19:31:00 +08:00
crazywhalecc
1d7ded0390 Fix pre-built openssl cannot find source in openssl ext patch 2024-07-09 18:20:27 +08:00
crazywhalecc
65ace41884 Add pkgroot for spc-alpine-docker 2024-07-09 16:15:18 +08:00
crazywhalecc
942786f2d6 Add pkgroot for spc-alpine-docker 2024-07-09 16:14:33 +08:00
crazywhalecc
57dd174aff Provide libevent, libiconv-win, libsodium, libwebp, libyaml, ncurses, readline, unixodbc, xz pre-built libs 2024-07-09 15:05:53 +08:00
crazywhalecc
80effd029f Provide libcares pre-built binary 2024-07-09 11:21:20 +08:00
crazywhalecc
1c79cc9f61 Provide icu pre-built binary 2024-07-09 11:15:34 +08:00
crazywhalecc
491eb5c2f2 Fix pkgconf patch with space between '=' bug 2024-07-09 11:14:58 +08:00
crazywhalecc
8632a4e005 Add onig as pre-built library 2024-07-09 00:44:14 +08:00
crazywhalecc
4b44c3adf7 Adjust shell debug log 2024-07-09 00:44:03 +08:00
crazywhalecc
a950498fd4 Add timer for build libs 2024-07-09 00:43:38 +08:00
crazywhalecc
48294c9c5f Add brotli, libargon2, libavif, libiconv, libpng, libtiff pre-built libs 2024-07-08 13:27:03 +08:00
crazywhalecc
ce155987ad Remove suffix for LicenseDumper and LicenseDumperTest 2024-07-08 12:58:57 +08:00
crazywhalecc
32a98bb8a1 Add license installer for build mode 2024-07-08 12:55:41 +08:00
crazywhalecc
8cec136656 Add openssl to pre-built 2024-07-08 11:21:01 +08:00
crazywhalecc
8ec50c88ca Remove perl.exe check log in doctor 2024-07-08 10:51:09 +08:00
crazywhalecc
5ec194efb2 Remove initSource for sorted libs in WindowsBuilder 2024-07-08 10:46:32 +08:00
crazywhalecc
b8f63ec3b9 Fix windows sqlite portable build 2024-07-08 00:51:30 +08:00
crazywhalecc
125d6ca772 Add liblz4, sqlite for pre-built libs 2024-07-08 00:23:26 +08:00
crazywhalecc
cedd58443d Patch sqlite pkgconf file 2024-07-08 00:07:30 +08:00
crazywhalecc
467c7ae667 Remove icu tools 2024-07-08 00:06:59 +08:00
crazywhalecc
0c30fc2039 Fix alpine-docker ssl bug 2024-07-07 22:57:42 +08:00
crazywhalecc
28b336c666 Fix CI quote 2024-07-07 22:53:45 +08:00
crazywhalecc
884d7bf56a Add aarch64-linux to CI 2024-07-07 22:51:22 +08:00
crazywhalecc
9c8b525f89 Fix CI 2024-07-07 22:32:01 +08:00
crazywhalecc
6cb2b3f28c Fix CI 2024-07-07 22:29:52 +08:00
crazywhalecc
9a954bd75f Fix CI 2024-07-07 22:13:58 +08:00
crazywhalecc
730d304ca2 Use bash in windows 2024-07-07 22:11:46 +08:00
crazywhalecc
768fd0d4a0 Fix CI 2024-07-07 22:08:56 +08:00
crazywhalecc
ac5f1919b4 Fix CI 2024-07-07 21:49:39 +08:00
crazywhalecc
cc7f9fb44f Remove windows with pkg-config 2024-07-07 21:41:48 +08:00
crazywhalecc
91e089d74a Remove windows with pkg-config 2024-07-07 21:40:57 +08:00
crazywhalecc
14ce15c85e Add pack-lib tests 2024-07-07 21:39:22 +08:00
crazywhalecc
fc617134ca Add pack-lib tests 2024-07-07 21:34:04 +08:00
crazywhalecc
ff8863d5a1 Code style fix and comment addition 2024-07-07 21:18:30 +08:00
crazywhalecc
fc053253e7 Add pre-built lib feature 2024-07-07 20:45:18 +08:00
31 changed files with 801 additions and 965 deletions

View File

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

View File

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

View File

@@ -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,8 +177,6 @@ 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"
# 下载依赖时,优先下载有预编译的库(节省编译依赖的时间)
./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推荐 7.3 ~ 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
@@ -191,7 +184,7 @@ bin/spc --version
./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
``` ```

View File

@@ -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,8 +188,6 @@ 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)
./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, recommend 7.3 ~ 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
@@ -202,7 +195,7 @@ Basic usage for building php with some extensions:
./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
``` ```

View File

@@ -205,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": {
@@ -386,7 +383,7 @@
}, },
"opcache": { "opcache": {
"type": "builtin", "type": "builtin",
"arg-type-unix": "custom" "arg-type": "custom"
}, },
"openssl": { "openssl": {
"notes": true, "notes": true,
@@ -540,6 +537,7 @@
}, },
"redis": { "redis": {
"support": { "support": {
"Windows": "wip",
"BSD": "wip" "BSD": "wip"
}, },
"type": "external", "type": "external",
@@ -549,7 +547,7 @@
"session", "session",
"igbinary" "igbinary"
], ],
"lib-suggests-unix": [ "lib-suggests": [
"zstd", "zstd",
"liblz4" "liblz4"
] ]

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@@ -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/`.

View File

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

View File

@@ -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
@@ -157,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
@@ -391,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
@@ -528,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.

View File

@@ -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/`

View File

@@ -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 依赖的目录,你无需对它做出任何修改。

View File

@@ -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
@@ -135,9 +135,6 @@ 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
# 下载资源时,优先下载有预编译包的依赖库(减少编译依赖的时间)
bin/spc download --for-extensions="curl,pcntl,xml,mbstring" --prefer-pre-built
# 下载所有依赖包 # 下载所有依赖包
bin/spc download --all bin/spc download --all
@@ -349,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
# 输出所有扩展 # 输出所有扩展
@@ -471,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` 删除所有下载的源码,然后重新下载。

View File

@@ -28,7 +28,7 @@ use Symfony\Component\Console\Application;
*/ */
final class ConsoleApplication extends Application final class ConsoleApplication extends Application
{ {
public const VERSION = '2.3.2'; public const VERSION = '2.3.0';
public function __construct() public function __construct()
{ {

View File

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

View File

@@ -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
*/ */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +0,0 @@
<?php
declare(strict_types=1);
assert(function_exists('iconv'));
assert(iconv('UTF-8', 'CP437', 'foo') === 'foo');

View File

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

View File

@@ -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' => 'iconv', 'Linux', 'Darwin' => 'openssl',
'Windows' => 'igbinary,redis,session', '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`).
@@ -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',
}; };