Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywhalecc committed Jun 30, 2024
1 parent 85a12de commit 8efc431
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 15 deletions.
3 changes: 3 additions & 0 deletions docs/en/develop/source-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ The parameters included are:

- `repo`: GitHub repository name
- `match`: regular expression matching Assets files
- `prefer-stable`: Whether to download stable versions first (default is `false`)

Example (download the libsodium library, matching the libsodium-x.y.tar.gz file in Release):

Expand All @@ -120,6 +121,7 @@ Unlike `ghrel`, `ghtar` will download the `source code (tar.gz)` from the latest
The parameters included are:

- `repo`: GitHub repository name
- `prefer-stable`: Whether to download stable versions first (default is `false`)

Example (brotli library):

Expand All @@ -145,6 +147,7 @@ Compared with `ghtar`, `ghtagtar` can find the latest one from the `tags` list a
The parameters included are:

- `repo`: GitHub repository name
- `prefer-stable`: Whether to download stable versions first (default is `false`)

Example (gmp library):

Expand Down
36 changes: 29 additions & 7 deletions docs/en/guide/manual-build.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,44 @@
# Build (Linux, macOS, FreeBSD)

This section covers the build process for Linux, macOS, and FreeBSD. If you want to build on Windows,
please go to [Build on Windows](./build-on-windows).
also need to read [Build on Windows](./build-on-windows).

### Build locally (using SPC binary)
### Build locally (using SPC binary) (recommended)

This project provides a binary file of static-php-cli.
You can directly download the binary file of the corresponding platform and then use it to build static PHP.
Currently, the platforms supported by `spc` binary are Linux and macOS.

Here's how to download from GitHub Actions:
Here's how to download from self-hosted server:

1. Enter [GitHub Actions](https://github.com/crazywhalecc/static-php-cli/actions/workflows/release-build.yml).
2. Select the latest build task, select `Artifacts`, and download the binary file of the corresponding platform.
3. Unzip the `.zip` file. After decompressing, add execution permissions to it: `chmod +x ./spc`.
```bash
# Download from self-hosted nightly builds (sync with main branch)
# For Linux x86_64
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
# For Linux aarch64
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
# macOS x86_64 (Intel)
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
# macOS aarch64 (Apple)
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)
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)
chmod +x ./spc

# Run (Linux and macOS)
./spc --version
# Run (Windows powershell)
.\spc.exe --version
```

You can also download binaries from a self-hosted server: [enter](https://dl.static-php.dev/static-php-cli/spc-bin/nightly/).
> If you are using the packaged `spc` binary, you will need to replace the leading `bin/spc` with `./spc` in all the commands below.
### Build locally (using source code)

If you have problems using the spc binary, or if you need to modify the static-php-cli source code, download static-php-cli from the source code.

Currently, it supports building on macOS and Linux.
macOS supports the latest version of the operating system and two architectures,
while Linux supports Debian and derivative distributions, as well as Alpine Linux.
Expand Down Expand Up @@ -366,6 +386,8 @@ when you use static-php-cli to build PHP or modify and enhance the static-php-cl
- `dev:extensions`: output all currently supported extension names, or output the specified extension information
- `dev:php-version`: output the currently compiled PHP version (by reading `php_version.h`)
- `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:ext-ver <ext-name>`: Read the corresponding version from the source code of the extension (only available for specific extensions)

```bash
# output all extensions information
Expand Down
3 changes: 3 additions & 0 deletions docs/zh/develop/source-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ ghrel 会从 GitHub Release 中上传的 Assets 下载文件。首先使用 GitH

- `repo`: GitHub 仓库名称
- `match`: 匹配 Assets 文件的正则表达式
- `prefer-stable`: 是否优先下载稳定版本(默认为 `false`

例子(下载 libsodium 库,匹配 Release 中的 libsodium-x.y.tar.gz 文件):

Expand All @@ -107,6 +108,7 @@ ghtar 会从 GitHub Release Tag 下载文件,与 `ghrel` 不同的是,`ghtar
包含的参数有:

- `repo`: GitHub 仓库名称
- `prefer-stable`: 是否优先下载稳定版本(默认为 `false`

例子(brotli 库):

Expand All @@ -130,6 +132,7 @@ ghtar 会从 GitHub Release Tag 下载文件,与 `ghrel` 不同的是,`ghtar
包含的参数有:

- `repo`: GitHub 仓库名称
- `prefer-stable`: 是否优先下载稳定版本(默认为 `false`

例子(gmp 库):

Expand Down
36 changes: 28 additions & 8 deletions docs/zh/guide/manual-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,41 @@

本章节为 Linux、macOS、FreeBSD 的构建过程,如果你要在 Windows 上构建,请到 [在 Windows 上构建](./build-on-windows)

## 手动构建(使用 SPC 二进制)
## 手动构建(使用 SPC 二进制)(推荐)

本项目提供了一个 static-php-cli 的二进制文件,你可以直接下载对应平台的二进制文件,然后使用它来构建静态的 PHP。目前 `spc` 二进制支持的平台有 Linux 和 macOS。

下面是从 GitHub Action 下载的方法
使用以下命令从自托管服务器下载

1. 进入 [GitHub Action](https://github.com/crazywhalecc/static-php-cli/actions/workflows/release-build.yml)
2. 选择一个最新的构建任务,进入后选择 `Artifacts`,下载对应平台的二进制文件。
3. 解压 `.zip` 文件。解压后,为其添加执行权限:`chmod +x ./spc`

你也可以从自托管的服务器下载二进制文件:[进入](https://dl.static-php.dev/static-php-cli/spc-bin/nightly/)
```bash
# Download from self-hosted nightly builds (sync with main branch)
# For Linux x86_64
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64
# For Linux aarch64
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-aarch64
# macOS x86_64 (Intel)
curl -o spc https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-macos-x86_64
# macOS aarch64 (Apple)
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)
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)
chmod +x ./spc

# Run (Linux and macOS)
./spc --version
# Run (Windows powershell)
.\spc.exe --version
```

> 如果你使用的是打包好的 `spc` 二进制,你需要将下面所有命令中 `bin/spc` 开头替换为 `./spc`
## 手动构建(使用源码)

目前支持在 macOS、Linux 上构建,macOS 支持最新版操作系统和两种架构,Linux 支持 Debian、RHEL 及衍生发行版、Alpine Linux。
如果使用 spc 二进制出现问题,或你有修改 static-php-cli 源码需求,请从源码下载 static-php-cli。

目前支持在 macOS、Linux 上构建,macOS 支持最新版操作系统和两种架构,Linux 支持 Debian、RHEL 及衍生发行版、Alpine Linux 等。

因为本项目本身采用 PHP 开发,所以在编译时也需要系统安装 PHP。本项目本身也提供了适用于本项目的静态二进制 php,可以根据实际情况自行选择使用。

Expand Down Expand Up @@ -326,6 +344,8 @@ bin/spc extract php-src,libxml2
- `dev:extensions`: 输出目前所有支持的扩展信息,或者输出指定的扩展信息
- `dev:php-version`: 输出当前编译的 PHP 版本(通过读取 `php_version.h` 实现)
- `dev:sort-config`: 对 `config/` 目录下的配置文件的列表按照字母表排序
- `dev:lib-ver <lib-name>`: 从依赖库的源码中读取版本(仅特定依赖库可用)
- `dev:ext-ver <ext-name>`: 从扩展的源码中读取对应版本(仅特定扩展可用)

```bash
# 输出所有扩展
Expand Down

0 comments on commit 8efc431

Please # to comment.