diff --git a/README-zh.md b/README-zh.md index c68d52f8..f677e17d 100755 --- a/README-zh.md +++ b/README-zh.md @@ -43,15 +43,17 @@ static-php-cli(简称 `spc`)有许多特性: 如果你不想自行编译 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 左右。 -- [扩展组合 - minimal](https://dl.static-php.dev/static-php-cli/minimal/):minimal 组合包含了 [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) 个扩展,体积为 3MB 左右。 +| 组合名称 | 组合扩展数 | 系统 | 备注 | +|---------------------------------------------------------------------|----------------------------------------------------------------------------|-------------|--------------| +| [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 左右 | +| [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 二进制体积。 > macOS 当前不支持 UPX,所以上述预编译的 macOS 版本体积可能较大。 -对于 Windows 系统,目前支持的扩展较少,故仅提供 SPC 自身运行的最小扩展组合的 `cli` 和 `micro`:[扩展组合 - spc-min](https://dl.static-php.dev/static-php-cli/windows/spc-min/)。 - ## 使用 static-php-cli 构建 PHP ### 编译环境需求 @@ -110,7 +112,7 @@ static-php-cli(简称 `spc`)有许多特性: 如果你选择了 `debug`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。 -### 本地构建(使用 spc 二进制) +### 本地构建(使用 spc 二进制,推荐) 该项目提供了 static-php-cli 的二进制文件:`spc`。 您可以使用 `spc` 二进制文件,无需安装任何运行时(用起来就像 golang 程序)。 @@ -144,6 +146,8 @@ chmod +x ./spc ### 本地构建(使用 git 源码) +如果你需要修改 static-php-cli 源码,或者使用 spc 二进制构建有问题,你可以使用 git 源码下载 static-php-cli。 + ```bash # clone 仓库即可 git clone https://github.com/crazywhalecc/static-php-cli.git @@ -177,6 +181,8 @@ bin/spc --version ./bin/spc download --all # 只拉取编译指定扩展需要的所有依赖(推荐) ./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) ./bin/spc download --for-extensions="openssl,curl,mbstring" --with-php=8.1 @@ -184,7 +190,7 @@ bin/spc --version ./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro # 编译线程安全版本 (--enable-zts) ./bin/spc build "curl,phar" --enable-zts --build-cli -# 编译后使用 UPX 减小可执行文件体积 (--with-upx-pack) (至少压缩至原来的 30~50%) +# 编译后使用 UPX 减小可执行文件体积 (仅 Linux、Windows 可用) (至少压缩至原来的 30~50%) ./bin/spc build "curl,phar" --enable-zts --build-cli --with-upx-pack ``` diff --git a/README.md b/README.md index 4b000aa8..a386aea4 100755 --- a/README.md +++ b/README.md @@ -49,16 +49,17 @@ 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, which can be downloaded directly according to your needs. -- [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. -- [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. +| Combination | Extension Count | OS | Comment | +|----------------------------------------------------------------------|---------------------------------------------------------------------------|--------------|--------------------------------| +| [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 | +| [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/) | [10](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%. > 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 ### Compilation Requirements @@ -97,6 +98,7 @@ Currently supported PHP versions for compilation: | 8.1 | :heavy_check_mark: | PHP official has security fixes only | | 8.2 | :heavy_check_mark: | | | 8.3 | :heavy_check_mark: | | +| 8.4 | :x: | WIP | ### Supported Extensions @@ -121,7 +123,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. -### Build Locally (using SPC binary) +### Build Locally (using SPC binary, recommended) This project provides a binary file of static-php-cli: `spc`. You can use `spc` binary instead of installing any runtime like golang app. @@ -155,6 +157,9 @@ Self-hosted `spc` is built by GitHub Actions, you can also download from Actions ### 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 # just clone me! git clone https://github.com/crazywhalecc/static-php-cli.git @@ -188,6 +193,8 @@ Basic usage for building php with some extensions: ./bin/spc download --all # only fetch necessary sources by needed extensions (recommended) ./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) ./bin/spc download --for-extensions="openssl,curl,mbstring" --with-php=8.1 @@ -195,7 +202,7 @@ Basic usage for building php with some extensions: ./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro # build thread-safe (ZTS) version (--enable-zts) ./bin/spc build "curl,phar" --enable-zts --build-cli -# build, pack executable with UPX (--with-upx-pack) (reduce binary size for 30~50%) +# build, pack executable with UPX (linux and windows only) (reduce binary size for 30~50%) ./bin/spc build "curl,phar" --enable-zts --build-cli --with-upx-pack ``` diff --git a/docs/.vitepress/components/CliGenerator.vue b/docs/.vitepress/components/CliGenerator.vue index 5ef34495..a3e3bc67 100644 --- a/docs/.vitepress/components/CliGenerator.vue +++ b/docs/.vitepress/components/CliGenerator.vue @@ -10,8 +10,11 @@

{{ I18N[lang].selectExt }}{{ checkedExts.length > 0 ? (' (' + checkedExts.length + ')') : '' }}

- - + + + + +
{{ I18N[lang].selectCommon }}
@@ -46,59 +49,80 @@

{{ I18N[lang].windowsSAPIUnavailable }}

{{ I18N[lang].buildOptions }}

-
- {{ I18N[lang].buildEnvironment }} - -
-
- {{ I18N[lang].selectedArch }} - -
-
- {{ I18N[lang].downloadPhpVersion }} - -
-
- {{ I18N[lang].useDebug }} - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{ I18N[lang].buildEnvironment }} + +
{{ I18N[lang].downloadPhpVersion }} + +
{{ I18N[lang].useDebug }} + + + + +
{{ I18N[lang].useZTS }} + + + + +
{{ I18N[lang].resultShowDownload }} + + + + +
{{ I18N[lang].usePreBuilt }} + + + + +
{{ I18N[lang].useUPX }} + + + + +
- - -
-
- {{ I18N[lang].useZTS }} - - - - - -
-
- {{ I18N[lang].resultShowDownload }} - - - - - -
-
- {{ I18N[lang].useUPX }} - - - - - -

{{ I18N[lang].hardcodedINI }}