Skip to content

Commit 6298fa2

Browse files
authored
Merge pull request #1036 from jingjingxyk/build_native_php
Build native php
2 parents 7bfa02d + f1bdf18 commit 6298fa2

File tree

21 files changed

+570
-48
lines changed

21 files changed

+570
-48
lines changed

.github/workflows/linux-aarch64.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ jobs:
145145
./thirdparty/php-src/sapi/cli/php --ri gd
146146
./thirdparty/php-src/sapi/cli/php --ri swoole
147147
./thirdparty/php-src/sapi/cli/php --ri pgsql
148-
ldd ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php
148+
{ ldd ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php } || { echo $? }
149149
file ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php
150150
readelf -h ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php
151151
APP_VERSION=$(./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php -v | head -n 1 | awk '{print $2}')

.github/workflows/linux-x86_64.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ jobs:
206206
./thirdparty/php-src/sapi/cli/php --ri swoole
207207
./thirdparty/php-src/sapi/cli/php --ri pgsql
208208
./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php -v
209-
ldd ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php
209+
{ ldd ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php } || { echo $? }
210210
file ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php
211211
readelf -h ./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php
212212
APP_VERSION=$(./bin/php-${{ env.BUILD_PHP_VERSION }}/bin/php -v | head -n 1 | awk '{print $2}')

docs/ChangeLog.md

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
1-
# [v6.1.0.0-rc1](https://github.com/swoole/swoole-cli/releases/tag/v6.1.0.0-rc1)
1+
## v6.1.1.0
22

3-
| item | value |
4-
|----------------|--------------|
5-
| branch | main |
6-
| tag | v6.1.0.0-rc1 |
7-
| swoole version | v6.1.0-rc1 |
8-
| php version | 8.1.29 |
9-
| release date | 2025-08-31 |
10-
| status | ok |
3+
### 新增
114

12-
## [change info](https://github.com/swoole/swoole-cli/compare/v6.0.2.0...v6.1.0.0-rc1)
5+
1. gcc 动态版的 swoole-cli
6+
2. 新增 `random` 扩展
7+
3. curl 启用 `libind2` 库,支持中文域名解析
8+
4. curl 启用 `libpsl` 库,支持检查域名合法性
139

14-
1. swoole version v6.0.2.0 upgrade to
15-
v6.1.0.0-rc1 , [swoole v6.1.0-rc1 info](https://github.com/swoole/swoole-src/releases/tag/v6.1.0-rc1)
10+
### 变更
1611

17-
# [v5.1.8.0](https://github.com/swoole/swoole-cli/releases/tag/v5.1.8.0)
12+
1. PHP 版本由 `8.1` (8.1.29) 升级为 `8.4` (8.4.14)
13+
2. github macos amd64 构建环境由 `macos-13` 升级为 `macos-15-intel`
14+
3. github macos arm64 构建环境由 `macos-14` 升级为 `macos-15`
15+
4. 扩展 `swoole` 版本由 `v5.1.x`
16+
升级为 `v6.1.1`[swoole v6.1.1 info](https://github.com/swoole/swoole-src/releases/tag/v6.1.0)
17+
5. 扩展 `redis` 版本由 `5.3.7` 升级为 `6.2.0`
18+
6. 扩展 `imagick` 版本由 `3.6.0` 升级为 `3.8.0`
19+
7. `openssl` 库版本由 `v3.1.4` 升级为 `v3.6.0` ( openssl 3.5 支持了 quic 协议堆栈)
20+
8. `curl` 库版本由 `v8.4.0` 升级为 `v8.16.0`
21+
9. `nghttp2` 库版本由 `v1.57.0` 升级为 `v1.68.0`
22+
10. `nghttp3` 库版本由 `v1.0.0` 升级为 `v1.12.0`
23+
11. `ngtcp2` 库版本由 `8.4.0` 升级为 `8.16.0`
24+
12. `curl` 库支持的 `http3` 协议,实现由(`quictls + ngtcp2 + nghttp3`) 变更为 (`openssl + nghttp3`)
1825

19-
| item | value |
20-
|----------------|------------|
21-
| branch | v5.1.x |
22-
| tag | v5.1.8.0 |
23-
| swoole version | v5.1.8 |
24-
| php version | 8.1.29 |
25-
| release date | 2025-08-23 |
26-
| status | ok |
26+
### 优化
2727

28-
## [change info](https://github.com/swoole/swoole-cli/compare/v5.1.7.0...v5.1.8.0)
28+
1. 修复 macos 构建环境下 `libssh2` 功能出现废弃的警告
2929

30-
1. swoole version v5.1.7 upgrade to
31-
v5.1.8 , [swoole v5.1.8 info](https://github.com/swoole/swoole-src/releases/tag/v5.1.8)
30+
### Bug 修复
31+
32+
1. 修复 macos 构建环境下 `gmp` 库链接错误 (启用`-fPIC`)
3233

34+
### 废弃
3335

36+
1. `ngtcp2` 库冻结使用
3437

38+
## v5.1.8.0
39+
40+
1. [change info](https://github.com/swoole/swoole-cli/compare/v5.1.7.0...v5.1.8.0)
41+
1. swoole version v5.1.7 upgrade to
42+
v5.1.8 , [swoole v5.1.8 info](https://github.com/swoole/swoole-src/releases/tag/v5.1.8)

docs/options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,5 +226,6 @@ swoole 启用支持 iouring 特性
226226

227227
with-static-pie
228228
----
229+
linux 环境下启用 static-pie
229230
-static-pie‌:启用静态链接且生成 PIE 可执行文件
230231
-fPIE‌:编译器生成位置无关代码(通常与 -static-pie 配合使用)

docs/tags.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# [v6.1.1.0](https://github.com/swoole/swoole-cli/releases/tag/v6.1.1.0)
2+
3+
| item | value |
4+
|----------------|------------|
5+
| branch | main |
6+
| tag | v6.1.1.0 |
7+
| swoole version | v6.1.1 |
8+
| php version | 8.4.14 |
9+
| release date | 2025-11-10 |
10+
| status | ok |
11+
12+
1. [change info](https://github.com/swoole/swoole-cli/blob/ChangeLog-v6.1.1/docs/ChangeLog.md#v6110)
13+
1. [Code Change Info](https://github.com/swoole/swoole-cli/compare/v6.0.2.0...v6.1.1.0)
14+
1. [faq](https://github.com/swoole/swoole-cli/blob/ChangeLog-v6.1.1/docs/FAQ.md)
15+
16+
# [v6.1.0.0-rc1](https://github.com/swoole/swoole-cli/releases/tag/v6.1.0.0-rc1)
17+
18+
| item | value |
19+
|----------------|--------------|
20+
| branch | main |
21+
| tag | v6.1.0.0-rc1 |
22+
| swoole version | v6.1.0-rc1 |
23+
| php version | 8.1.29 |
24+
| release date | 2025-08-31 |
25+
| status | ok |
26+
27+
## [change info](https://github.com/swoole/swoole-cli/compare/v6.0.2.0...v6.1.0.0-rc1)
28+
29+
1. swoole version v6.0.2.0 upgrade to
30+
v6.1.0.0-rc1 , [swoole v6.1.0-rc1 info](https://github.com/swoole/swoole-src/releases/tag/v6.1.0-rc1)
31+
32+
# [v5.1.8.0](https://github.com/swoole/swoole-cli/releases/tag/v5.1.8.0)
33+
34+
| item | value |
35+
|----------------|------------|
36+
| branch | v5.1.x |
37+
| tag | v5.1.8.0 |
38+
| swoole version | v5.1.8 |
39+
| php version | 8.1.29 |
40+
| release date | 2025-08-23 |
41+
| status | ok |
42+
43+
44+
45+

sapi/scripts/tencent-cloud-object-storage.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cd ${__PROJECT__}
1515
## 下载与安装配置
1616
## https://cloud.tencent.com/document/product/436/63144
1717

18-
APP_VERSION="v1.0.3"
18+
APP_VERSION="v1.0.7"
1919
APP_NAME="coscli"
2020
APP_RUNTIME="${APP_NAME}-${APP_VERSION}"
2121

@@ -116,7 +116,7 @@ test -f ${APP_RUNTIME} || curl -fSLo ${APP_RUNTIME} https://github.com/tencentyu
116116
chmod a+x ${APP_RUNTIME}
117117

118118
BUCKET_NAME=$(grep "\- name: " ${CLOUD_OBJECT_STORAGE_CONFIG} | sed 's/\- name: //g' | sed 's/^ *//;s/ *$//' | tr -d '"')
119-
COSCLI="${__PROJECT__}/var/tencent-cloud-object-storage/${APP_RUNTIME} --config-path ${CLOUD_OBJECT_STORAGE_CONFIG} --log-path ${__PROJECT__}/var/tencent-cloud-object-storage/"
119+
COSCLI="${__PROJECT__}/var/tencent-cloud-object-storage/${APP_RUNTIME} --config-path ${CLOUD_OBJECT_STORAGE_CONFIG}"
120120
COS_BUCKET_FOLDER="cos://${BUCKET_NAME}/dist/"
121121

122122
if [ "${UPLOAD_TYPE}" == 'all' ]; then
@@ -140,18 +140,36 @@ if [ "${UPLOAD_TYPE}" == 'all' ]; then
140140
${COSCLI} cp swoole-cli-${SWOOLE_VERSION}-linux-x64.tar.xz ${COS_BUCKET_FOLDER}
141141
${COSCLI} cp swoole-cli-${SWOOLE_VERSION}-macos-arm64.tar.xz ${COS_BUCKET_FOLDER}
142142
${COSCLI} cp swoole-cli-${SWOOLE_VERSION}-macos-x64.tar.xz ${COS_BUCKET_FOLDER}
143+
status=$?
144+
if [[ $status -ne 0 ]]; then
145+
echo $status
146+
cat ${__PROJECT__}/var/tencent-cloud-object-storage/coscli.log
147+
exit 1
148+
fi
143149
cd ${__PROJECT__}
144150
exit 0
145151
fi
146152

147153
if [ "${UPLOAD_TYPE}" == 'single' ]; then
148154
${COSCLI} cp ${UPLOAD_FILE} ${COS_BUCKET_FOLDER}
155+
status=$?
156+
if [[ $status -ne 0 ]]; then
157+
echo $status
158+
cat ${__PROJECT__}/var/tencent-cloud-object-storage/coscli.log
159+
exit 1
160+
fi
149161
exit 0
150162
fi
151163

152164
if [ "${UPLOAD_TYPE}" == 'show' ]; then
153165
# cat ${CLOUD_OBJECT_STORAGE_CONFIG}
154166
# ${COSCLI} --help
155167
${COSCLI} ls ${COS_BUCKET_FOLDER}
168+
status=$?
169+
if [[ $status -ne 0 ]]; then
170+
echo $status
171+
cat ${__PROJECT__}/var/tencent-cloud-object-storage/coscli.log
172+
exit 1
173+
fi
156174
exit 0
157175
fi

sapi/src/builder/extension/swoole.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282

8383
# 新版macos getdtablesize 函数缺失
8484
# sed -i '' 's/getdtablesize();/sysconf(_SC_OPEN_MAX);/' ext/standard/php_fopen_wrapper.c
85-
$libc = $p->isMacos() ? '-lc++ ' : '-lstdc++';
85+
86+
$libc = $p->isMacos() ? '-lc++' : '-lstdc++';
8687

8788
# cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/_pthread
8889
# 或者

sapi/src/builder/extension/zlib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
$p->addExtension(
99
(new Extension('zlib'))
1010
->withHomePage('https://www.php.net/zlib')
11-
->withOptions('--with-zlib --with-zlib-dir=' . ZLIB_PREFIX)
11+
->withOptions('--with-zlib=' . ZLIB_PREFIX)
1212
->withDependentLibraries('zlib')
1313
);
1414
};

sapi/src/builder/library/imagemagick.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,28 @@
1111
->withHomePage('https://imagemagick.org/index.php')
1212
->withManual('https://github.com/ImageMagick/ImageMagick.git')
1313
->withLicense('https://imagemagick.org/script/license.php', Library::LICENSE_APACHE2)
14-
->withUrl('https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.1.1-20.tar.gz')
15-
->withFile('ImageMagick-v7.1.1-20.tar.gz')
16-
->withFileHash('md5', '90eb1a9263b47b7e844eb817fe08932c')
14+
->withUrl('https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.1.2-8.tar.gz')
15+
->withFile('ImageMagick-v7.1.2-8.tar.gz')
16+
//->withFileHash('md5', '90eb1a9263b47b7e844eb817fe08932c')
1717
->withPrefix($imagemagick_prefix)
18+
->withBuildCached(false)
19+
->withInstallCached(false)
1820
->withConfigure(
1921
<<<EOF
2022
./configure --help
2123
PACKAGES_NAMES="libjpeg libturbojpeg libwebp libwebpdecoder libwebpdemux libwebpmux libpng freetype2"
2224
PACKAGES_NAMES="\${PACKAGES_NAMES} libbrotlicommon libbrotlidec libbrotlienc libzip zlib libzstd liblzma"
2325
PACKAGES_NAMES="\${PACKAGES_NAMES} libcrypto libssl openssl"
2426
PACKAGES_NAMES="\${PACKAGES_NAMES} libxml-2.0"
27+
PACKAGES_NAMES="\${PACKAGES_NAMES} libheif lcms2 libraw libraw_r libtiff-4 "
2528
CPPFLAGS="\$(pkg-config --cflags-only-I --static \$PACKAGES_NAMES ) -I{$bzip2_prefix}/include" \
2629
LDFLAGS="\$(pkg-config --libs-only-L --static \$PACKAGES_NAMES ) -L{$bzip2_prefix}/lib" \
2730
LIBS="\$(pkg-config --libs-only-l --static \$PACKAGES_NAMES ) -lbz2" \
2831
./configure \
2932
--prefix={$imagemagick_prefix} \
3033
--enable-shared=no \
3134
--enable-static=yes \
35+
--with-pic \
3236
--with-zip \
3337
--with-zlib \
3438
--with-lzma \
@@ -38,9 +42,10 @@
3842
--with-webp \
3943
--with-xml \
4044
--with-freetype \
41-
--without-raw \
42-
--without-tiff \
43-
--without-lcms \
45+
--with-heic \
46+
--with-raw \
47+
--with-tiff \
48+
--with-lcms \
4449
--enable-zero-configuration \
4550
--enable-bounds-checking \
4651
--enable-hdri \
@@ -52,7 +57,6 @@
5257
--without-djvu \
5358
--without-rsvg \
5459
--without-fontconfig \
55-
--without-heic \
5660
--without-jbig \
5761
--without-jxl \
5862
--without-openjp2 \
@@ -96,7 +100,11 @@
96100
'libpng',
97101
'libgif',
98102
'openssl',
99-
'libzstd'
103+
'libzstd',
104+
'libheif',
105+
'lcms2',
106+
'libraw',
107+
'libtiff'
100108
)
101109
);
102110
};

sapi/src/builder/library/lcms2.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
use SwooleCli\Library;
4+
use SwooleCli\Preprocessor;
5+
6+
return function (Preprocessor $p) {
7+
$lcms2_prefix = LCMS2_PREFIX;
8+
$libjpeg_prefix = JPEG_PREFIX;
9+
$libtiff_prefix = LIBTIFF_PREFIX;
10+
$lib = new Library('lcms2');
11+
$lib->withHomePage('https://littlecms.com/color-engine/')
12+
->withLicense('https://www.opensource.org/licenses/mit-license.php', Library::LICENSE_MIT)
13+
->withUrl('https://sourceforge.net/projects/lcms/files/lcms/2.17/lcms2-2.17.tar.gz')
14+
->withManual('https://lfs.lug.org.cn/blfs/view/10.0/general/lcms2.html')
15+
->withPrefix($lcms2_prefix)
16+
->withConfigure(
17+
<<<EOF
18+
./configure --help
19+
20+
PACKAGES="zlib"
21+
CPPFLAGS="\$(pkg-config --cflags-only-I --static \$PACKAGES )" \
22+
LDFLAGS="\$(pkg-config --libs-only-L --static \$PACKAGES )" \
23+
LIBS="\$(pkg-config --libs-only-l --static \$PACKAGES )" \
24+
./configure \
25+
--prefix={$lcms2_prefix} \
26+
--enable-shared=no \
27+
--enable-static=yes \
28+
--with-jpeg={$libjpeg_prefix} \
29+
--with-tiff={$libtiff_prefix} \
30+
--with-pic
31+
32+
EOF
33+
)
34+
->withBinPath($lcms2_prefix . '/bin/')
35+
->withPkgName('lcms2')
36+
->withDependentLibraries('zlib', 'libjpeg', 'libtiff');
37+
38+
$p->addLibrary($lib);
39+
};

0 commit comments

Comments
 (0)