Skip to content

Commit 528a0d9

Browse files
authored
Merge pull request #999 from jingjingxyk/build_native_php
Build native php
2 parents 38c9cc5 + 9c8e626 commit 528a0d9

File tree

12 files changed

+75
-228
lines changed

12 files changed

+75
-228
lines changed

.github/workflows/auto-cache-pool-tarball.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
php prepare.php --show-tarball-hash=1 --with-php-version=8.3.23
9494
php prepare.php --show-tarball-hash=1 --with-php-version=8.4.10
9595
96-
echo 'cygwin: https://www.cygwin.com/COPYING' > bin/LICENSE
96+
echo 'cygwin: https://www.cygwin.com/COPYING' >> bin/LICENSE
9797
cd ${{ github.workspace }}/pool/
9898
zip -9 -r ${WORK_DIR}/all-deps.zip ext lib php-tar
9999
HASH=$(sha256sum ${WORK_DIR}/all-deps.zip | awk '{print $1}')

.github/workflows/linux-mips64le.yaml

Lines changed: 0 additions & 196 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66

77
`php-cli` 是一个 `PHP`的 运行时 ,默认包含 swoole 扩展
88

9-
109
> 本项目 派生于 [swoole-cli](https://github.com/swoole/swoole-cli/)
1110
12-
1311
> 代码与 swoole-cli 项目的 build_native_php 分支的代码 保持一致
1412
1513
> 构建流程 与 swoole-cli 构建流程一致

sapi/quickstart/README.md

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
## 一个脚本执行整个构建流程
44

5-
> 定制 build-release-php.sh 脚本 即可开始构建
5+
> 定制 build-release-php.sh 即可开始构建
66
77
```bash
88

9-
cp build-release-example.sh build-release-php.sh
9+
cp build-release-example.sh build-release-php.sh
1010

11-
bash build-release-php.sh
11+
bash build-release-php.sh
1212

1313
```
1414

@@ -22,6 +22,50 @@ bash build-release-php.sh
2222

2323
## [wsl](../../docs/wsl.md)
2424

25+
## 准备 PHP 运行时
26+
27+
```bash
28+
# 准备 PHP 运行时
29+
bash sapi/setup-php-runtime.sh
30+
31+
# 准备PHP 运行时 使用代理
32+
bash sapi/setup-php-runtime.sh --proxy http://192.168.3.26:8015
33+
34+
# 准备PHP 运行时 使用镜像 (镜像源 https://www.swoole.com/download)
35+
bash sapi/setup-php-runtime.sh --mirror china
36+
37+
38+
# 验证
39+
shopt -s expand_aliases
40+
__DIR__=$(pwd)
41+
export PATH="${__DIR__}/runtime/php/:$PATH"
42+
alias php="php -d curl.cainfo=${__DIR__}/runtime/php/cacert.pem -d openssl.cafile=${__DIR__}/runtime/php/cacert.pem"
43+
44+
php -v
45+
composer -v
46+
47+
```
48+
49+
## 准备依赖库源码
50+
51+
```bash
52+
53+
# 源码来源 https://github.com/swoole/swoole-cli/releases/download/${TAG}/all-deps.zip
54+
55+
bash sapi/download-box/download-box-get-archive-from-server.sh
56+
57+
```
58+
59+
## 准备 swoole 源码
60+
61+
> 拉取 swoole-cli 源码时没有拉取子模块,就需要执行这一步
62+
63+
```bash
64+
65+
git submodule update --init -f
66+
67+
```
68+
2569
## 准备运行环境 (linux/macos/windows)
2670

2771
1. [ linux 快速启动 容器 构建环环境 ](linux/README.md)

sapi/quickstart/windows/msys2-build/install-msys2.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,17 @@ fi
5151
pacman -S --needed --noconfirm git curl wget openssl
5252
pacman -S --needed --noconfirm zip unzip xz gcc gcc-libs cmake make
5353
pacman -S --needed --noconfirm re2c
54-
pacman -S --needed --noconfirm openssl-devel libreadline
5554
pacman -S --needed --noconfirm lzip
5655
pacman -S --needed --noconfirm zip unzip
5756
pacman -S --needed --noconfirm zlib-devel
5857
pacman -S --needed --noconfirm bison automake autoconf libtool coreutils
58+
pacman -S --needed --noconfirm openssl-devel libreadline-devel libiconv-devel
5959
pacman -S --needed --noconfirm libcurl-devel libxml2-devel libxslt-devel
6060
pacman -S --needed --noconfirm libbz2-devel liblz4-devel liblzma-devel libcares-devel
61-
pacman -S --needed --noconfirm libyaml-devel libzstd-devel libreadline-devel
62-
pacman -S --needed --noconfirm libssh2-devel libidn2-devel gettext-devel
6361
pacman -S --needed --noconfirm libzstd-devel
64-
pacman -S --needed --noconfirm icu-devel
65-
pacman -S --needed --noconfirm libsqlite-devel libsqlite
62+
pacman -S --needed --noconfirm libyaml-devel
63+
pacman -S --needed --noconfirm libssh2-devel libidn2-devel gettext-devel
64+
pacman -S --needed --noconfirm libsqlite-devel
6665
pacman -S --needed --noconfirm libedit-devel
6766
pacman -S --needed --noconfirm gmp-devel
6867
pacman -S --needed --noconfirm brotli-devel

sapi/src/builder/extension/swoole_latest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
use SwooleCli\Extension;
55

66
return function (Preprocessor $p) {
7-
$file = "swoole-latest.tar.gz";
7+
$swoole_tag = 'master';
8+
$file = "swoole-v{$swoole_tag}.tar.gz";
89
$options = [];
910

1011
if ($p->getBuildType() === 'debug') {
@@ -42,15 +43,16 @@
4243
$p->withExportVariable('URING_LIBS', '$(pkg-config --libs --static liburing)');
4344
}
4445

45-
$p->addExtension((new Extension('swoole'))
46+
$p->addExtension((new Extension('swoole_latest'))
47+
->withAliasName('swoole')
4648
->withHomePage('https://github.com/swoole/swoole-src')
4749
->withLicense('https://github.com/swoole/swoole-src/blob/master/LICENSE', Extension::LICENSE_APACHE2)
4850
->withManual('https://wiki.swoole.com/#/')
4951
->withFile($file)
5052
->withDownloadScript(
5153
'swoole-src',
5254
<<<EOF
53-
git clone -b master --depth=1 https://github.com/swoole/swoole-src.git
55+
git clone -b $swoole_tag --depth=1 https://github.com/swoole/swoole-src.git
5456
EOF
5557
)
5658
->withAutoUpdateFile()

sapi/src/builder/extension/swoole_v5.1.x.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
use SwooleCli\Extension;
66

77
return function (Preprocessor $p) {
8-
9-
$file = "swoole-v5.1.x.tar.gz";
108
$swoole_tag = '5.1.x';
9+
$file = "swoole-v${$swoole_tag}.tar.gz";
1110
$options = [];
1211

1312
if ($p->getBuildType() === 'debug') {

sapi/src/builder/extension/swow.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use SwooleCli\Library;
66

77
return function (Preprocessor $p) {
8+
$swow_tag = 'v1.6.1';
89
$options = ' --enable-swow ';
910
$options .= ' --enable-swow-ssl ';
1011
$options .= ' --enable-swow-curl ';
@@ -20,14 +21,12 @@
2021
->withHomePage('https://github.com/swow/swow')
2122
->withLicense('https://github.com/swow/swow/blob/develop/LICENSE', Extension::LICENSE_APACHE2)
2223
->withManual('https://docs.toast.run/swow/en/install.html')
23-
->withFile('swow-v1.5.3.tar.gz')
24+
->withFile("swow-{$swow_tag}.tar.gz")
2425
->withDownloadScript(
2526
"swow",
2627
<<<EOF
27-
git clone -b v1.5.3 https://github.com/swow/swow.git
28-
mv swow swow-t
29-
mv swow-t/ext swow
30-
rm -rf swow-t
28+
git clone -b {$swow_tag} https://github.com/swow/swow.git swow-code
29+
mv swow-code/ext swow
3130
EOF
3231
)
3332
->withBuildCached(false)

sapi/src/builder/extension/swow_latest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@
2626
->withDownloadScript(
2727
"swow",
2828
<<<EOF
29-
git clone -b develop https://github.com/swow/swow.git
30-
mv swow swow-t
31-
mv swow-t/ext swow
32-
rm -rf swow-t
29+
git clone -b develop https://github.com/swow/swow.git swow-code
30+
mv swow-code/ext swow
3331
EOF
3432
)
3533
->withDependentLibraries(...$dependentLibraries)

setup-php-runtime.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ done
9797

9898
case "$MIRROR" in
9999
china)
100-
APP_DOWNLOAD_URL="https://wenda-1252906962.file.myqcloud.com/dist/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.tar.xz"
100+
APP_DOWNLOAD_URL="https://storage.swoole.com/dist/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.tar.xz"
101101
COMPOSER_DOWNLOAD_URL="https://mirrors.tencent.com/composer/composer.phar"
102102
if [ $OS = 'windows' ]; then
103-
APP_DOWNLOAD_URL="https://wenda-1252906962.file.myqcloud.com/dist/${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}.zip"
103+
APP_DOWNLOAD_URL="https://storage.swoole.com/dist/${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}.zip"
104104
fi
105105
;;
106106

0 commit comments

Comments
 (0)