Skip to content

Commit a2f0640

Browse files
authored
Merge pull request #767 from crazywhalecc/docs
patchelf and rename -release tagged extensions from php configure build
2 parents 24e19de + 16a4245 commit a2f0640

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+815
-225
lines changed

README-zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ bin/spc micro:combine my-app.phar -I "memory_limit=4G" -I "disable_functions=sys
278278

279279
如果你知道 [embed SAPI](https://github.com/php/php-src/tree/master/sapi/embed),你应该知道如何使用它。对于有可能编译用到引入其他库的问题,你可以使用 `buildroot/bin/php-config` 来获取编译时的配置。
280280

281-
另外,有关如何使用此功能的高级示例,请查看[如何使用它构建 FrankenPHP 的静态版本](https://github.com/dunglas/frankenphp/blob/main/docs/static.md)
281+
另外,有关如何使用此功能的高级示例,请查看[如何使用它构建 FrankenPHP 的静态版本](https://github.com/php/frankenphp/blob/main/docs/static.md)
282282

283283
## 贡献
284284

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ If you know [embed SAPI](https://github.com/php/php-src/tree/master/sapi/embed),
302302
You may require the introduction of other libraries during compilation,
303303
you can use `buildroot/bin/php-config` to obtain the compile-time configuration.
304304

305-
For an advanced example of how to use this feature, take a look at [how to use it to build a static version of FrankenPHP](https://github.com/dunglas/frankenphp/blob/main/docs/static.md).
305+
For an advanced example of how to use this feature, take a look at [how to use it to build a static version of FrankenPHP](https://github.com/php/frankenphp/blob/main/docs/static.md).
306306

307307
## Contribution
308308

bin/spc-alpine-docker

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ RUN apk update; \
8484
wget \
8585
xz \
8686
gettext-dev \
87-
binutils-gold
87+
binutils-gold \
88+
patchelf
8889
8990
RUN curl -#fSL https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-linux-\$(uname -m).tar.gz | tar -xz -C /usr/local/bin && \
9091
chmod +x /usr/local/bin/php

bin/spc-gnu-docker

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ RUN echo "source scl_source enable devtoolset-10" >> /etc/bashrc
7474
RUN source /etc/bashrc
7575
RUN yum install -y which
7676
77+
RUN curl -fsSL -o patchelf.tgz https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0-$BASE_ARCH.tar.gz && \
78+
mkdir -p /patchelf && \
79+
tar -xzf patchelf.tgz -C /patchelf --strip-components=1 && \
80+
cp /patchelf/bin/patchelf /usr/bin/
81+
7782
RUN curl -o cmake.tgz -fsSL https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-$BASE_ARCH.tar.gz && \
7883
mkdir /cmake && \
7984
tar -xzf cmake.tgz -C /cmake --strip-components 1
@@ -89,7 +94,7 @@ ENV PATH="/app/bin:/cmake/bin:$PATH"
8994
ENV SPC_LIBC=glibc
9095
9196
ADD ./config/env.ini /app/config/env.ini
92-
RUN bin/spc doctor --auto-fix --debug
97+
RUN CC=gcc bin/spc doctor --auto-fix --debug
9398
9499
RUN curl -o make.tgz -fsSL https://ftp.gnu.org/gnu/make/make-4.4.tar.gz && \
95100
tar -zxvf make.tgz && \
@@ -136,7 +141,7 @@ echo 'CC=/opt/rh/devtoolset-10/root/usr/bin/gcc' > /tmp/spc-gnu-docker.env
136141
echo 'CXX=/opt/rh/devtoolset-10/root/usr/bin/g++' >> /tmp/spc-gnu-docker.env
137142
echo 'AR=/opt/rh/devtoolset-10/root/usr/bin/ar' >> /tmp/spc-gnu-docker.env
138143
echo 'LD=/opt/rh/devtoolset-10/root/usr/bin/ld' >> /tmp/spc-gnu-docker.env
139-
echo 'SPC_DEFAULT_C_FLAGS=-fPIE -fPIC' >> /tmp/spc-gnu-docker.env
144+
echo 'SPC_DEFAULT_C_FLAGS=-fPIC' >> /tmp/spc-gnu-docker.env
140145
echo 'SPC_LIBC=glibc' >> /tmp/spc-gnu-docker.env
141146
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-Wl,-O1 -pie"' >> /tmp/spc-gnu-docker.env
142147
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm -lresolv -lutil -lrt"' >> /tmp/spc-gnu-docker.env

config/env.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ SPC_CONCURRENCY=${CPU_COUNT}
4242
SPC_SKIP_PHP_VERSION_CHECK="no"
4343
; Ignore some check item for bin/spc doctor command, comma separated (e.g. SPC_SKIP_DOCTOR_CHECK_ITEMS="if homebrew has installed")
4444
SPC_SKIP_DOCTOR_CHECK_ITEMS=""
45+
; extra modules that xcaddy will include in the FrankenPHP build
46+
SPC_CMD_VAR_FRANKENPHP_XCADDY_MODULES="--with github.com/dunglas/frankenphp/caddy --with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy --with github.com/dunglas/caddy-cbrotli"
47+
4548
; EXTENSION_DIR where the built php will look for extension when a .ini instructs to load them
4649
; only useful for builds targeting not pure-static linking
4750
; default paths
@@ -66,7 +69,7 @@ SPC_LIBC=musl
6669
CC=${SPC_LINUX_DEFAULT_CC}
6770
CXX=${SPC_LINUX_DEFAULT_CXX}
6871
AR=${SPC_LINUX_DEFAULT_AR}
69-
LD=ld.gold
72+
LD=${SPC_LINUX_DEFAULT_LD}
7073
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
7174
SPC_DEFAULT_C_FLAGS="-fPIC -Os"
7275
SPC_DEFAULT_CXX_FLAGS="-fPIC -Os"

config/lib.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,5 +854,14 @@
854854
"zstd.h",
855855
"zstd_errors.h"
856856
]
857+
},
858+
"watcher": {
859+
"source": "watcher",
860+
"static-libs-unix": [
861+
"libwatcher-c.a"
862+
],
863+
"headers": [
864+
"wtr/watcher-c.h"
865+
]
857866
}
858867
}

config/pkg.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,17 @@
4242
"extract-files": {
4343
"upx-*-win64/upx.exe": "{pkg_root_path}/bin/upx.exe"
4444
}
45+
},
46+
"go-xcaddy-x86_64-linux": {
47+
"type": "custom"
48+
},
49+
"go-xcaddy-aarch64-linux": {
50+
"type": "custom"
51+
},
52+
"go-xcaddy-x86_64-macos": {
53+
"type": "custom"
54+
},
55+
"go-xcaddy-aarch64-macos": {
56+
"type": "custom"
4557
}
4658
}

config/source.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,5 +1070,14 @@
10701070
"type": "file",
10711071
"path": "LICENSE"
10721072
}
1073+
},
1074+
"watcher": {
1075+
"type": "ghtar",
1076+
"repo": "e-dant/watcher",
1077+
"prefer-stable": true,
1078+
"license": {
1079+
"type": "file",
1080+
"path": "license"
1081+
}
10731082
}
10741083
}

docs/en/guide/manual-build.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ If the build is successful, you will see the `buildroot/bin` directory in the cu
167167
- fpm: The build result is `buildroot/bin/php-fpm`.
168168
- micro: The build result is `buildroot/bin/micro.sfx`. If you need to further package it with PHP code, please refer to [Packaging micro binary](./manual-build#command-micro-combine).
169169
- embed: See [Using embed](./manual-build#embed-usage).
170+
- frankenphp: The build result is `buildroot/bin/frankenphp`.
170171

171172
If the build fails, you can use the `--debug` parameter to view detailed error information,
172173
or use the `--with-clean` to clear the old compilation results and recompile.
@@ -290,6 +291,7 @@ You need to specify a compilation target, choose from the following parameters:
290291
- `--build-fpm`: Build a fpm sapi (php-fpm, used in conjunction with other traditional fpm architecture software such as nginx)
291292
- `--build-micro`: Build a micro sapi (used to build a standalone executable binary containing PHP code)
292293
- `--build-embed`: Build an embed sapi (used to embed into other C language programs)
294+
- `--build-frankenphp`: Build a [FrankenPHP](https://github.com/php/frankenphp) executable
293295
- `--build-all`: build all above sapi
294296

295297
```bash
@@ -509,6 +511,8 @@ When `bin/spc doctor` automatically repairs the Windows environment, tools such
509511
Here is an example of installing the tool:
510512

511513
- Download and install UPX (Linux and Windows only): `bin/spc install-pkg upx`
514+
- Download and install nasm (Windows only): `bin/spc install-pkg nasm`
515+
- Download and install go-xcaddy: `bin/spc install-pkg go-xcaddy`
512516

513517
## Command - del-download
514518

docs/zh/guide/manual-build.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ bin/spc craft --debug
145145
- fpm: 构建结果为 `buildroot/bin/php-fpm`。
146146
- micro: 构建结果为 `buildroot/bin/micro.sfx`,如需进一步与 PHP 代码打包,请查看 [打包 micro 二进制](./manual-build#命令-micro-combine-打包-micro-二进制)。
147147
- embed: 参见 [embed 使用](./manual-build#embed-使用)。
148+
- frankenphp: 构建结果为 `buildroot/bin/frankenphp`。
148149

149150
如果中途构建出错,你可以使用 `--debug` 参数查看详细的错误信息,或者使用 `--with-clean` 参数清除旧的编译结果,重新编译。
150151

@@ -250,6 +251,7 @@ bin/spc doctor --auto-fix
250251
- `--build-fpm`: 构建一个 fpm sapi(php-fpm,用于和其他传统的 fpm 架构的软件如 nginx 配合使用)
251252
- `--build-micro`: 构建一个 micro sapi(用于构建一个包含 PHP 代码的独立可执行二进制)
252253
- `--build-embed`: 构建一个 embed sapi(用于嵌入到其他 C 语言程序中)
254+
- `--build-frankenphp`: 构建一个 [frankenphp](https://github.com/php/frankenphp) 二进制
253255
- `--build-all`: 构建以上所有 sapi
254256

255257
```bash
@@ -457,6 +459,8 @@ bin/spc dev:sort-config ext
457459
下面是安装工具的示例:
458460

459461
- 下载安装 UPX(仅限 Linux 和 Windows): `bin/spc install-pkg upx`
462+
- 下载安装 nasm(仅限 Windows): `bin/spc install-pkg nasm`
463+
- 下载安装 go-xcaddy: `bin/spc install-pkg go-xcaddy`
460464

461465
## 命令 del-download - 删除已下载的资源
462466

0 commit comments

Comments
 (0)