Skip to content

Commit 3a1c70c

Browse files
committed
Merge branch 'build_native_php' into php-fpm
2 parents 34a7914 + 9d48641 commit 3a1c70c

File tree

11 files changed

+68
-62
lines changed

11 files changed

+68
-62
lines changed

.github/workflows/windows-msys2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build-swoole-cli-windows-msys2
1+
name: build-php-cli-windows-msys2
22

33
on:
44
push:

docs/upgrade.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# 升级 PHP 版本 步骤
22

3-
> 1、修改 sapi/PHP-VERSION.conf 文件里版本号即可
4-
5-
> 2、修改 sync-source-code.php 文件里 PHP 源码包的 sha256sum 配置
6-
7-
> 3、执行同步源码脚本, 拉取 PHP 官方源码 到本项目
8-
9-
> 4、sapi/cli/ 代码的升级,需要手动确认
3+
1. 修改 `sapi/PHP-VERSION.conf` 文件里版本号即可
4+
2. 修改 `sync-source-code.php` 文件里 PHP 源码包的 sha256sum 配置
5+
3. 执行同步源码脚本, 拉取 PHP 官方源码 到本项目
6+
4. sapi/cli 代码的升级,需要手动确认
107

118
```shell
129

@@ -17,8 +14,8 @@ php sync-source-code.php
1714
php sync-source-code.php --action run
1815

1916

20-
./bin/runtime/php -c ./bin/runtime/php.ini sync-source-code.php
21-
./bin/runtime/php -c ./bin/runtime/php.ini sync-source-code.php --action run
17+
./runtime/php/php -c ./runtime/php/php.ini sync-source-code.php
18+
./runtime/php/php -c ./runtime/php/php.ini sync-source-code.php --action run
2219

2320
```
2421

sapi/docker/build-export-container.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ while [ $# -gt 0 ]; do
4949
shift $(($# > 0 ? 1 : 0))
5050
done
5151

52-
case "$MIRROR" in
53-
china | openatom)
54-
CONTAINER_BASE_IMAGE="docker.io/library/alpine:3.18"
55-
;;
56-
esac
57-
5852
mkdir -p var/build-export-container/
5953
cd ${__PROJECT__}/var/build-export-container/
6054

sapi/download-box/Dockerfile-dowload-box

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nginx:1.23-alpine
1+
FROM nginx:1.27-alpine
22

33
RUN rm -rf /usr/share/nginx/html/*
44
ADD ./default.conf /etc/nginx/conf.d/default.conf
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
set -exu
4+
__DIR__=$(
5+
cd "$(dirname "$0")"
6+
pwd
7+
)
8+
__PROJECT__=$(
9+
cd ${__DIR__}/../../../
10+
pwd
11+
)
12+
cd ${__DIR__}
13+
14+
{
15+
docker stop swoole-cli-alpine-dev
16+
sleep 5
17+
} || {
18+
echo $?
19+
}
20+
cd ${__DIR__}
21+
22+
IMAGE=alpine:3.18
23+
24+
cd ${__DIR__}
25+
26+
mkdir -p /dev/shm/swoole-cli/thirdparty/
27+
mkdir -p /dev/shm/swoole-cli/ext/
28+
mkdir -p /dev/shm/swoole-cli/var/
29+
30+
docker run --rm --name swoole-cli-alpine-dev -d \
31+
-v ${__PROJECT__}:/work \
32+
-v /dev/shm/swoole-cli/thirdparty/:/work/thirdparty/ \
33+
-v /dev/shm/swoole-cli/ext/:/work/ext/ \
34+
-v /dev/shm/swoole-cli/var/:/work/var/ \
35+
-w /work --init $IMAGE tail -f /dev/null

sapi/quickstart/linux/run-alpine-container.sh

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,5 @@ cd ${__DIR__}
2121

2222
IMAGE=alpine:3.18
2323

24-
MIRROR=''
25-
while [ $# -gt 0 ]; do
26-
case "$1" in
27-
--mirror)
28-
MIRROR="$2"
29-
case "$MIRROR" in
30-
china | openatom)
31-
IMAGE="docker.io/library/alpine:3.18"
32-
;;
33-
esac
34-
;;
35-
esac
36-
shift $(($# > 0 ? 1 : 0))
37-
done
38-
3924
cd ${__DIR__}
4025
docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null

sapi/quickstart/linux/run-debian-container.sh

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,5 @@ cd ${__DIR__}
2121

2222
IMAGE=debian:12
2323

24-
MIRROR=''
25-
while [ $# -gt 0 ]; do
26-
case "$1" in
27-
--mirror)
28-
MIRROR="$2"
29-
case "$MIRROR" in
30-
china | openatom)
31-
IMAGE="docker.io/library/debian:12"
32-
;;
33-
esac
34-
;;
35-
esac
36-
shift $(($# > 0 ? 1 : 0))
37-
done
38-
3924
cd ${__DIR__}
4025
docker run --rm --name swoole-cli-debian-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null

sapi/quickstart/linux/run-swoole-cli-builder-container.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ while [ $# -gt 0 ]; do
3333
shift $(($# > 0 ? 1 : 0))
3434
done
3535

36-
if [ ! -f ${__PROJECT__}/runtime/php ]; then
36+
if [ ! -f ${__PROJECT__}/runtime/php/php ]; then
3737
{
3838
bash setup-php-runtime.sh $OPTIONS
3939
} || {
4040
echo $?
4141
}
4242
fi
43-
export PATH=${__PROJECT__}/runtime:$PATH
44-
alias php="php -d curl.cainfo=${__PROJECT__}/runtime/cacert.pem -d openssl.cafile=${__PROJECT__}/runtime/cacert.pem "
43+
export PATH=${__PROJECT__}/runtime/php/:$PATH
44+
alias php="php -d curl.cainfo=${__PROJECT__}/runtime/php/cacert.pem -d openssl.cafile=${__PROJECT__}/runtime/php/cacert.pem "
4545

4646
export COMPOSER_ALLOW_SUPERUSER=1
4747

sapi/src/template/make.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,6 @@
513513
if [ "$1" = "docker-build" ] ;then
514514
MIRROR=""
515515
CONTAINER_BASE_IMAGE='docker.io/library/alpine:3.18'
516-
if [ -n "$2" ]; then
517-
MIRROR=$2
518-
case "$MIRROR" in
519-
china | openatom)
520-
CONTAINER_BASE_IMAGE="docker.io/library/alpine:3.18"
521-
;;
522-
esac
523-
fi
524516
PLATFORM=''
525517
ARCH=$(uname -m)
526518
case $ARCH in

setup-php-runtime.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ if [ $OS = 'windows' ]; then
7171
fi
7272

7373
MIRROR=''
74+
CURL_OPTIONS=""
7475
while [ $# -gt 0 ]; do
7576
case "$1" in
7677
--mirror)
7778
MIRROR="$2"
79+
CURL_OPTIONS+="-H 'Referer: https://www.swoole.com/download' -H 'User-Agent: download swoole-cli runtime with setup-php-runtime.sh' -H 'X-Auth-Token: 6F0A7F038A69'"
7880
;;
7981
--proxy)
8082
export HTTP_PROXY="$2"
@@ -104,6 +106,13 @@ china)
104106

105107
esac
106108

109+
downloader() {
110+
local file=$1
111+
local url=$2
112+
local cmd=$(echo "curl $CURL_OPTIONS -fSLo $file $url ")
113+
eval $cmd
114+
}
115+
107116
test -f composer.phar || curl -fSLo composer.phar ${COMPOSER_DOWNLOAD_URL}
108117
chmod a+x composer.phar
109118

@@ -114,13 +123,13 @@ APP_RUNTIME="${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}"
114123
if [ $OS = 'windows' ]; then
115124
{
116125
APP_RUNTIME="${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}"
117-
test -f ${APP_RUNTIME}.zip || curl -fSLo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL}
126+
test -f ${APP_RUNTIME}.zip || downloader ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL}
118127
test -d ${APP_RUNTIME} && rm -rf ${APP_RUNTIME}
119128
unzip "${APP_RUNTIME}.zip"
120129
exit 0
121130
}
122131
else
123-
test -f ${APP_RUNTIME}.tar.xz || curl -fSLo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL}
132+
test -f ${APP_RUNTIME}.tar.xz || downloader ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL}
124133
test -f ${APP_RUNTIME}.tar || xz -d -k ${APP_RUNTIME}.tar.xz
125134
test -f swoole-cli && rm -f swoole-cli
126135
tar -xvf ${APP_RUNTIME}.tar

0 commit comments

Comments
 (0)