Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8cb9f27
移除无效的代码
jingjingxyk Jul 21, 2025
dd2a8fc
Merge branch 'optimize-setup-php-runtime' into experiment-feature
jingjingxyk Jul 21, 2025
9721ac6
Merge branch 'experiment-feature' into build_native_php
jingjingxyk Jul 21, 2025
9d48641
change windows msys2 build name
jingjingxyk Jul 21, 2025
2a198ec
当swoole版本设置为开发版本时,同时在 github action runner 环境下 保持拉取最新 swoole 版本
jingjingxyk Jul 25, 2025
faf9d60
在 github action runner 环境下,当swoole版本设置为开发版本时, 保持拉取最新 swoole 版本
jingjingxyk Jul 25, 2025
acd06ee
修复cygwin 构建环境链接 libiconv 错误
jingjingxyk Jul 25, 2025
1e1382d
Merge branch 'fix-cygwin-build-iconv-error' into feature-with-latest-…
jingjingxyk Jul 25, 2025
853db75
fix libiconv-devel no found
jingjingxyk Jul 25, 2025
9d5dcba
Merge branch 'fix-cygwin-build-iconv-error' into feature-with-latest-…
jingjingxyk Jul 25, 2025
6b4937e
LIBS add -liconv
jingjingxyk Jul 25, 2025
77a5de4
cygwin-config add LIBS config
jingjingxyk Jul 25, 2025
75f08ed
格式化 upgrade.md (#985)
jingjingxyk Aug 4, 2025
ae9c8f0
更新 默认php 运行时所在目录 (#976)
jingjingxyk Aug 4, 2025
060f5d0
Merge branch 'main' into feature-with-latest-swoole
jingjingxyk Aug 6, 2025
bbef596
swoole 引入面向对象风格的语法扩展
jingjingxyk Aug 8, 2025
ee5b330
update README.md
jingjingxyk Aug 8, 2025
7a64f13
update README.md
jingjingxyk Aug 8, 2025
b39f9af
修复 cygwin 环境下 iconv 链接错误
jingjingxyk Aug 22, 2025
7a18137
Merge branch 'main' into fix-cygwin-build-iconv-error
jingjingxyk Aug 22, 2025
23611c4
Merge branch 'fix-cygwin-build-iconv-error' into feature-with-latest-…
jingjingxyk Aug 22, 2025
e14d8d0
Merge branch 'fix-cygwin-build-iconv-error' into feature-swoole-stdext
jingjingxyk Aug 22, 2025
162c77f
add test single extension build
jingjingxyk Aug 22, 2025
399be37
merge main
jingjingxyk Aug 22, 2025
5f9a8ef
Merge branch 'fix-cygwin-build-iconv-error' into experiment-feature
jingjingxyk Aug 22, 2025
714d9a9
merge code
jingjingxyk Aug 22, 2025
339167e
merge code
jingjingxyk Aug 22, 2025
4c73683
merge code
jingjingxyk Aug 22, 2025
e52035b
优化 msys2 打包
jingjingxyk Aug 22, 2025
475d687
Merge branch 'optimize-cywing-msys2' into experiment-feature
jingjingxyk Aug 22, 2025
7878168
merge code
jingjingxyk Aug 22, 2025
d6826ca
优化 msys2 环境下 php-cli 构建配置
jingjingxyk Aug 22, 2025
cb98123
优化 msys2 环境下 构建配置
jingjingxyk Aug 22, 2025
a38dc6f
merge code
jingjingxyk Aug 22, 2025
0714a6e
Merge branch 'experiment-feature' into build_native_php
jingjingxyk Aug 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/auto-cache-pool-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
php prepare.php --show-tarball-hash=1 --with-php-version=8.3.23
php prepare.php --show-tarball-hash=1 --with-php-version=8.4.10

echo 'cygwin: https://www.cygwin.com/COPYING' > bin/LICENSE
cd ${{ github.workspace }}/pool/
zip -9 -r ${WORK_DIR}/all-deps.zip ext lib php-tar
HASH=$(sha256sum ${WORK_DIR}/all-deps.zip | awk '{print $1}')
Expand All @@ -105,6 +106,7 @@ jobs:
ls -A pool/lib/
ls -A pool/ext/
ls -A pool/php-tar/
cat bin/LICENSE

- name: production artifacts
uses: actions/upload-artifact@v4
Expand All @@ -114,6 +116,7 @@ jobs:
path: |
all-deps.zip
all-deps.zip.sha256sum
bin/LICENSE

- name: gh release
uses: softprops/action-gh-release@v2
Expand All @@ -122,3 +125,4 @@ jobs:
files: |
all-deps.zip
all-deps.zip.sha256sum
bin/LICENSE
4 changes: 0 additions & 4 deletions .github/workflows/linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ jobs:
export PATH=/work/runtime/php/:$PATH # 容器已经内置 php 和 composer
alias php="php -d curl.cainfo=/work/runtime/php/cacert.pem -d openssl.cafile=/work/runtime/php/cacert.pem"

# sed -i 's/mirrors.tuna.tsinghua.edu.cn/dl-cdn.alpinelinux.org/g' /etc/apk/repositories
# sed -i 's/mirrors.ustc.edu.cn/dl-cdn.alpinelinux.org/g' /etc/apk/repositories
# bash sapi/quickstart/mark-install-library-cached.sh

sh sapi/quickstart/linux/alpine-init.sh
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ jobs:
export PATH=/work/runtime/php:$PATH # 容器已经内置 php 和 composer
alias php="php -d curl.cainfo=/work/runtime/php/cacert.pem -d openssl.cafile=/work/runtime/php/cacert.pem"

# bash sapi/quickstart/mark-install-library-cached.sh

sh sapi/quickstart/linux/alpine-init.sh
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-msys2.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-swoole-cli-windows-msys2
name: build-php-cli-windows-msys2

on:
push:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

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


> 本项目 派生于 [swoole-cli](https://github.com/swoole/swoole-cli/)


> 代码与 swoole-cli 项目的 build_native_php 分支的代码 保持一致

> 构建流程 与 swoole-cli 构建流程一致
Expand Down
5 changes: 3 additions & 2 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ php sync-source-code.php --action run

## 目录说明

pool :持久化目录,存放扩展、 PHP 、依赖库等文件,此目录下的文件不会被主动删除
var :运行时目录,临时存在一些文件,在完成配置或构建后将被主动清空删除
- `pool`: 持久化目录,存放扩展、 `PHP` 、依赖库等文件,此目录下的文件不会被主动删除
- `var`: 运行时目录,临时存在一些文件,在完成配置或构建后将被主动清空删除

6 changes: 0 additions & 6 deletions sapi/docker/build-export-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ while [ $# -gt 0 ]; do
shift $(($# > 0 ? 1 : 0))
done

case "$MIRROR" in
china | openatom)
CONTAINER_BASE_IMAGE="docker.io/library/alpine:3.18"
;;
esac

mkdir -p var/build-export-container/
cd ${__PROJECT__}/var/build-export-container/

Expand Down
15 changes: 0 additions & 15 deletions sapi/quickstart/linux/run-alpine-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,5 @@ cd ${__DIR__}

IMAGE=alpine:3.18

MIRROR=''
while [ $# -gt 0 ]; do
case "$1" in
--mirror)
MIRROR="$2"
case "$MIRROR" in
china | openatom)
IMAGE="docker.io/library/alpine:3.18"
;;
esac
;;
esac
shift $(($# > 0 ? 1 : 0))
done

cd ${__DIR__}
docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
15 changes: 0 additions & 15 deletions sapi/quickstart/linux/run-debian-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,5 @@ cd ${__DIR__}

IMAGE=debian:12

MIRROR=''
while [ $# -gt 0 ]; do
case "$1" in
--mirror)
MIRROR="$2"
case "$MIRROR" in
china | openatom)
IMAGE="docker.io/library/debian:12"
;;
esac
;;
esac
shift $(($# > 0 ? 1 : 0))
done

cd ${__DIR__}
docker run --rm --name swoole-cli-debian-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null
1 change: 1 addition & 0 deletions sapi/quickstart/windows/cygwin-build/install-cygwin.bat
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ set "PACKAGES=%PACKAGES%,cmake,openssl,binutils"
set "PACKAGES=%PACKAGES%,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel"
set "PACKAGES=%PACKAGES%,libssh2-devel,libidn2-devel"
set "PACKAGES=%PACKAGES%,libgmp-devel,libsqlite3-devel,libpcre-devel,libpcre2-devel"
set "PACKAGES=%PACKAGES%,libiconv-devel"
set "PACKAGES=%PACKAGES%,libMagick-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel"
set "PACKAGES=%PACKAGES%,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel"
set "PACKAGES=%PACKAGES%,libzstd-devel,libbrotli-devel"
Expand Down
1 change: 1 addition & 0 deletions sapi/scripts/cygwin/cygwin-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ __PROJECT__=$(
pwd
)
cd ${__PROJECT__}

WORK_TEMP_DIR=${__PROJECT__}/var/cygwin-build/
cd ${WORK_TEMP_DIR}/php-src/

Expand Down
3 changes: 3 additions & 0 deletions sapi/scripts/cygwin/cygwin-config-ext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ download_and_extract "imagick" ${IMAGICK_VERSION}

cd ${__PROJECT__}/pool/ext
# with git clone swoole source code
if [ -n "${GITHUB_ACTION}" ]; then
test -f ${__PROJECT__}/pool/ext/swoole-${SWOOLE_VERSION}.tgz && rm -f ${__PROJECT__}/pool/ext/swoole-${SWOOLE_VERSION}.tgz
fi
if [ ! -f swoole-${SWOOLE_VERSION}.tgz ]; then
test -d ${WORK_TEMP_DIR}/swoole && rm -rf ${WORK_TEMP_DIR}/swoole
git clone -b ${SWOOLE_VERSION} https://github.com/swoole/swoole-src.git ${WORK_TEMP_DIR}/swoole
Expand Down
11 changes: 8 additions & 3 deletions sapi/scripts/cygwin/cygwin-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ __PROJECT__=$(
cd ${__PROJECT__}

OPTIONS=''
OPTIONS+=' --enable-swoole-thread '
OPTIONS+=' --enable-brotli '
OPTIONS+=' --enable-zstd '

OPTIONS+=' --enable-zts '
OPTIONS+=' --disable-opcache-jit '

Expand All @@ -41,6 +39,9 @@ cd ${WORK_TEMP_DIR}/php-src/
# export CFLAGS=""
# export LDFLAGS="-L/usr/lib"

sed -i.bak 's/ICONV_ALIASED_LIBICONV/HAVE_ICONV/' ext/iconv/iconv.c
export PATH=/usr/bin:$PATH

export ICU_CXXFLAGS=" -std=gnu++17 "
./buildconf --force
test -f Makefile && make clean
Expand Down Expand Up @@ -80,6 +81,10 @@ test -f Makefile && make clean
--enable-swoole --enable-sockets --enable-mysqlnd --enable-swoole-curl --enable-cares \
--enable-swoole-pgsql \
--enable-swoole-sqlite \
--enable-swoole-thread \
--enable-brotli \
--enable-zstd \
--enable-swoole-stdext \
--enable-redis \
--enable-opcache \
--disable-opcache-jit \
Expand Down
1 change: 1 addition & 0 deletions sapi/scripts/cygwin/install-cygwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ PACKAGES="${PACKAGES},cmake,openssl,binutils"
PACKAGES="${PACKAGES},libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel"
PACKAGES="${PACKAGES},libssh2-devel,libidn2-devel"
PACKAGES="${PACKAGES},libgmp-devel,libsqlite3-devel,libpcre-devel,libpcre2-devel"
PACKAGES="${PACKAGES},libiconv-devel"
PACKAGES="${PACKAGES},libMagick-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel"
PACKAGES="${PACKAGES},zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel"
PACKAGES="${PACKAGES},libzstd-devel,libbrotli-devel"
Expand Down
46 changes: 46 additions & 0 deletions sapi/scripts/cygwin/test-single-extension.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)
__PROJECT__=$(
cd ${__DIR__}/../../../
pwd
)
cd ${__PROJECT__}


export PATH=/usr/bin/:$PATH

bash ./sapi/scripts/cygwin/cygwin-config-ext.sh --php-version 8.2.29
PHP_SRC_EXT_DIR=${__PROJECT__}/var/cygwin-build/php-src/ext

test -d /tmp/php-src-ext && rm -rf /tmp/php-src-ext
mv $PHP_SRC_EXT_DIR /tmp/php-src-ext
mkdir -p $PHP_SRC_EXT_DIR
cd /tmp/php-src-ext
test -d date && cp -rf date $PHP_SRC_EXT_DIR
test -d hash && cp -rf hash $PHP_SRC_EXT_DIR
test -d json && cp -rf json $PHP_SRC_EXT_DIR
test -d pcre && cp -rf pcre $PHP_SRC_EXT_DIR
test -d standard && cp -rf standard $PHP_SRC_EXT_DIR
test -d reflection && cp -rf reflection $PHP_SRC_EXT_DIR
test -d spl && cp -rf spl $PHP_SRC_EXT_DIR
test -d tokenizer && cp -rf tokenizer $PHP_SRC_EXT_DIR
test -d session && cp -rf session $PHP_SRC_EXT_DIR
test -d random && cp -rf random $PHP_SRC_EXT_DIR
test -d phar && cp -rf phar $PHP_SRC_EXT_DIR
test -d iconv && cp -rf iconv $PHP_SRC_EXT_DIR
cd ${__PROJECT__}

bash ./sapi/scripts/cygwin/cygwin-config.sh
bash ./sapi/scripts/cygwin/cygwin-build.sh

exit 0
cat ${__PROJECT__}/var/cygwin-build//php-src/config.log
cat var/cygwin-build//php-src/Makefile | grep 'link'
cat var/cygwin-build//php-src/Makefile | grep '\-\-mode=link'


2 changes: 1 addition & 1 deletion sapi/scripts/msys2/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mkdir -p /tmp/${NAME}/bin/

cd ${__PROJECT__}/
ldd ${__PROJECT__}/bin/php.exe | grep -v '/c/Windows/' | awk '{print $3}'
ldd ${__PROJECT__}/bin/php.exe | grep -v '/c/Windows/' | awk '{print $3}' | xargs -I {} cp {} /tmp/${NAME}/
ldd ${__PROJECT__}/bin/php.exe | grep -v '/c/Windows/' | awk '{print $3}' | xargs -I {} cp {} /tmp/${NAME}/bin/

ls -lh /tmp/${NAME}/

Expand Down
3 changes: 3 additions & 0 deletions sapi/scripts/msys2/config-ext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ download_and_extract "yaml" ${YAML_VERSION}
download_and_extract "imagick" ${IMAGICK_VERSION}

cd ${__PROJECT__}/pool/ext
if [ -n "${GITHUB_ACTION}" ]; then
test -f ${__PROJECT__}/pool/ext/swoole-${SWOOLE_VERSION}.tgz && rm -f ${__PROJECT__}/pool/ext/swoole-${SWOOLE_VERSION}.tgz
fi
if [ ! -f swoole-${SWOOLE_VERSION}.tgz ]; then
test -d ${WORK_TEMP_DIR}/swoole && rm -rf ${WORK_TEMP_DIR}/swoole
git clone -b ${SWOOLE_VERSION} https://github.com/swoole/swoole-src.git ${WORK_TEMP_DIR}/swoole
Expand Down
7 changes: 4 additions & 3 deletions sapi/scripts/msys2/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ __PROJECT__=$(
cd ${__PROJECT__}

OPTIONS=''
OPTIONS+=' --enable-swoole-thread '
OPTIONS+=' --enable-brotli '
OPTIONS+=' --enable-zstd '
OPTIONS+=' --enable-zts '
OPTIONS+=' --disable-opcache-jit '

Expand Down Expand Up @@ -80,6 +77,10 @@ test -f Makefile && make clean
--enable-swoole --enable-sockets --enable-mysqlnd --enable-swoole-curl --enable-cares \
--enable-swoole-sqlite \
--enable-swoole-pgsql \
--enable-swoole-thread \
--enable-brotli \
--enable-zstd \
--enable-swoole-stdext \
--enable-redis \
--enable-opcache \
--disable-opcache-jit \
Expand Down
13 changes: 9 additions & 4 deletions sapi/src/builder/extension/swoole.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
$options[] = '--enable-swoole-thread';
$options[] = '--enable-brotli';
$options[] = '--enable-zstd';
$options[] = '--enable-swoole-stdext';

$options[] = '--enable-zts';
$options[] = '--disable-opcache-jit';

Expand Down Expand Up @@ -112,10 +114,13 @@
SWOOLE_VERSION=$(awk 'NR==1{ print $1 }' "sapi/SWOOLE-VERSION.conf")
CURRENT_SWOOLE_VERSION=''

if [ -f "ext/swoole/CMakeLists.txt" ] ;then
CURRENT_SWOOLE_VERSION=$(grep 'set(SWOOLE_VERSION' ext/swoole/CMakeLists.txt | awk '{ print $2 }' | sed 's/)//')
if [[ "${CURRENT_SWOOLE_VERSION}" =~ "-dev" ]]; then
echo 'swoole version master'
if [ -f "ext/swoole/CMakeLists.txt" ] ;then
CURRENT_SWOOLE_VERSION=$(grep 'set(SWOOLE_VERSION' ext/swoole/CMakeLists.txt | awk '{ print $2 }' | sed 's/)//')
if [[ "${CURRENT_SWOOLE_VERSION}" =~ "-dev" ]]; then
echo 'swoole version master'
if [ -n "${GITHUB_ACTION}" ]; then
test -f ${WORKDIR}/pool/ext/swoole-${SWOOLE_VERSION}.tgz && rm -f ${WORKDIR}/pool/ext/swoole-${SWOOLE_VERSION}.tgz
CURRENT_SWOOLE_VERSION=''
fi
fi

Expand Down
3 changes: 2 additions & 1 deletion sapi/src/builder/extension/swoole_latest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
$options[] = '--enable-swoole-thread';
$options[] = '--enable-brotli';
$options[] = '--enable-zstd';
$options[] = '--enable-zts';
$options[] = '--enable-swoole-stdext';

$options[] = '--enable-zts';
$options[] = '--disable-opcache-jit';

if ($p->isLinux() && $p->getInputOption('with-iouring')) {
Expand Down
8 changes: 0 additions & 8 deletions sapi/src/template/make.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,6 @@
if [ "$1" = "docker-build" ] ;then
MIRROR=""
CONTAINER_BASE_IMAGE='docker.io/library/alpine:3.18'
if [ -n "$2" ]; then
MIRROR=$2
case "$MIRROR" in
china | openatom)
CONTAINER_BASE_IMAGE="docker.io/library/alpine:3.18"
;;
esac
fi
PLATFORM=''
ARCH=$(uname -m)
case $ARCH in
Expand Down
Loading