Skip to content

Commit cb86856

Browse files
committed
Merge branch 'build_native_php' into php-fpm
2 parents 6204558 + e378c84 commit cb86856

31 files changed

Lines changed: 892 additions & 24 deletions

.github/workflows/linux-aarch64.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ jobs:
126126
alias php="php -d curl.cainfo=/work/runtime/php/cacert.pem -d openssl.cafile=/work/runtime/php/cacert.pem"
127127
128128
sh sapi/quickstart/linux/alpine-init.sh
129+
git config --global --add safe.directory /work
129130
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
130131
composer dump-autoload --optimize --profile --no-dev
131132

.github/workflows/linux-glibc.yml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: build-swoole-cli-linux-glibc-x86_64
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
linux-glibc:
7+
if: ${{ 0 && !contains(github.event.head_commit.message, '--filter=') || contains(github.event.head_commit.message, '[linux-glibc]') }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [ ubuntu-22.04, ubuntu-22.04-arm ]
12+
name: linux-glibc-${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Show Environment Info
17+
run: |
18+
echo $PATH
19+
env
20+
docker info
21+
id -u
22+
id -g
23+
who
24+
cat /etc/os-release
25+
hostnamectl
26+
uname -s
27+
uname -m
28+
uname -r
29+
30+
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
31+
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
32+
cat /proc/cpuinfo | grep "cpu cores" | uniq
33+
cat /proc/cpuinfo| grep "processor"| wc -l
34+
lscpu
35+
36+
export IPV6=$(ip -6 address show | grep inet6 | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p')
37+
export IPV4=$(ip -4 address show | grep inet | grep -v 127.0.0 | awk '{print $2}' | cut -d'/' -f1 | sed -n '1p')
38+
echo $IPV4
39+
echo $IPV6
40+
echo "X_IPV6=${IPV6}" >> $GITHUB_ENV
41+
echo "X_IPV4=${IPV4}" >> $GITHUB_ENV
42+
43+
- name: Prepare Build Environment
44+
run: |
45+
git submodule update --init
46+
47+
sudo mkdir -p /usr/local/swoole-cli
48+
uid=$(id -u) && gid=$(id -g) && sudo chown -R ${uid}:${gid} /usr/local/swoole-cli
49+
50+
mkdir -p ${{ github.workspace }}/var/build-github-action-container/
51+
52+
- name: Cache PHP Runtime
53+
uses: actions/cache@v4
54+
id: php-runtime-cache-x86_64
55+
with:
56+
path: ${{ github.workspace }}/runtime
57+
key: ${{ runner.os }}-x86_64-php-runtime
58+
59+
- name: Cache PHP Vendor
60+
uses: actions/cache@v4
61+
id: php-vendor-cache-x86_64
62+
with:
63+
path: ${{ github.workspace }}/vendor
64+
key: ${{ runner.os }}-x86_64-php-vendor
65+
66+
- name: Cache Dependency Source Code Tarball
67+
uses: actions/cache@v4
68+
id: pool-cache
69+
with:
70+
path: ${{ github.workspace }}/pool/
71+
key: source-code-tarball-pool
72+
73+
- name: Cache all-library
74+
uses: actions/cache@v4
75+
id: all-library-cache-x86_64
76+
with:
77+
path: /usr/local/swoole-cli
78+
key: ${{ github.head_ref || github.ref_name }}-${{ runner.os }}-x86_64-all-library
79+
80+
- name: Prepare Runtime and Libraries and Extensions
81+
run: |
82+
set -x
83+
mkdir -p pool/lib
84+
mkdir -p pool/ext
85+
mkdir -p bin/
86+
mkdir -p runtime/
87+
test -f runtime/php && rm -f runtime/php
88+
if [ ! -f runtime/php/php ] ; then
89+
bash setup-php-runtime.sh
90+
fi
91+
bash sapi/download-box/download-box-get-archive-from-server.sh
92+
ls -A pool/lib/
93+
ls -A /usr/local/swoole-cli/
94+
95+
- name: Build
96+
run: |
97+
set -eux
98+
uname -m
99+
composer install --no-interaction --no-autoloader --no-scripts --profile
100+
composer dump-autoload --optimize --profile
101+
102+
php prepare.php --with-libavif
103+
104+
sudo apt update
105+
bash ./sapi/scripts/install-deps-on-ubuntu.sh
106+
bash ./ext/swoole/scripts/install-deps-on-ubuntu.sh
107+
bash ./sapi/scripts/build-swoole-cli-with-linux-gcc.sh
108+
109+
./bin/swoole-cli -v
110+
./bin/swoole-cli -m
111+
./bin/swoole-cli --ri curl
112+
./bin/swoole-cli --ri gd
113+
./bin/swoole-cli --ri imagick
114+
./bin/swoole-cli --ri swoole
115+
{ ldd ./bin/swoole-cli ; } || { echo $? ; } ;
116+
file ./bin/swoole-cli
117+
118+
- name: Make nfpm package
119+
run: |
120+
ARCH=$(uname -m)
121+
if [ "$ARCH" = "aarch64" ]; then
122+
NFPM_ARCH="arm64"
123+
else
124+
NFPM_ARCH="amd64"
125+
fi
126+
wget https://github.com/goreleaser/nfpm/releases/download/v2.43.4/nfpm_2.43.4_${NFPM_ARCH}.deb
127+
sudo dpkg -i nfpm_2.43.4_${NFPM_ARCH}.deb
128+
strip ./bin/swoole-cli
129+
./make.sh nfpm-pkg
130+
ls -ls ./*.deb
131+
ls -ls ./*.rpm
132+
133+
- name: upload artifacts to cloud object storage
134+
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
135+
env:
136+
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
137+
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
138+
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
139+
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
140+
run: |
141+
ARCH=$(uname -m)
142+
if [ "$ARCH" = "aarch64" ]; then
143+
FILE_ARCH="arm64"
144+
else
145+
FILE_ARCH="x64"
146+
fi
147+
SWOOLE_VERSION=$(awk 'NR==1{ print $1 }' "sapi/SWOOLE-VERSION.conf")
148+
OS="linux"
149+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-"${SWOOLE_VERSION}-${OS}-${FILE_ARCH}"-glibc.deb
150+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-"${SWOOLE_VERSION}-${OS}-${FILE_ARCH}"-glibc.rpm

.github/workflows/linux-x86_64.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ jobs:
179179
alias php="php -d curl.cainfo=/work/runtime/php/cacert.pem -d openssl.cafile=/work/runtime/php/cacert.pem"
180180
181181
sh sapi/quickstart/linux/alpine-init.sh
182+
git config --global --add safe.directory /work
182183
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
183184
composer dump-autoload --optimize --profile --no-dev
184185

.github/workflows/windows-cygwin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
- name: Prepare
9696
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}
9797
run: |
98-
bash ./sapi/scripts/cygwin/cygwin-config-ext.sh --php-version ${{ env.BUILD_PHP_VERSION }} --swoole-version master
98+
bash ./sapi/scripts/cygwin/cygwin-config-ext.sh --php-version ${{ env.BUILD_PHP_VERSION }}
9999
100100
- name: Configure
101101
shell: C:\cygwin\bin\bash.EXE --noprofile --norc -e -o pipefail -o igncr {0}

.github/workflows/windows-msys2.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ jobs:
6969
shell: msys2 {0}
7070
run: |
7171
bash ./sapi/scripts/msys2/install-deps-lib.sh
72+
bash sapi/download-box/download-box-get-archive-from-server.sh
7273
7374
- name: Prepare
7475
shell: msys2 {0}
7576
run: |
76-
bash ./sapi/scripts/msys2/config-ext.sh --php-version ${{ env.BUILD_PHP_VERSION }} --swoole-version master
77+
bash ./sapi/scripts/msys2/config-ext.sh --php-version ${{ env.BUILD_PHP_VERSION }}
7778
7879
- name: Configure
7980
shell: msys2 {0}
@@ -129,3 +130,26 @@ jobs:
129130
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130131
with:
131132
files: ${{ env.APP_NAME }}-${{ env.APP_VERSION }}-msys2-x64.zip
133+
134+
135+
upload-to-cloud-object-storage:
136+
if: 1
137+
runs-on: ubuntu-latest
138+
needs: windows-msys2
139+
steps:
140+
- name: Prepare Run Environment
141+
run:
142+
sudo apt install -y curl
143+
- uses: actions/checkout@v4
144+
- uses: actions/download-artifact@v4
145+
- name: upload artifacts to cloud object storage
146+
if: ${{ (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }}
147+
env:
148+
OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }}
149+
OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }}
150+
OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }}
151+
OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }}
152+
run: |
153+
FILE_NAME=$(ls -d swoole-cli-v*-msys2-x64)
154+
FILE="${{ github.workspace }}/${FILE_NAME}/${FILE_NAME}.zip"
155+
bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${FILE}

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,6 @@ php.ini
335335
sapi/webUI/deploy.sh
336336
sapi/webUI/public/data/
337337
Makefile.backup
338-
ldflags.log
339-
cppflags.log
340338
libs.log
341339
ext/apcu/
342340
ext/ssh2/
@@ -349,3 +347,7 @@ php-fpm-*
349347
!/runtime/.gitkeep
350348
/APP_NAME
351349
/APP_VERSION
350+
*.deb
351+
*.rpm
352+
nfpm-pkg.yaml
353+
!/var/.gitkeep

prepare.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
// Sync code from php-src
9191
$p->setPhpSrcDir($p->getWorkDir() . '/var/php-' . BUILD_PHP_VERSION);
9292

93+
9394
// Compile directly on the host machine, not in the docker container
9495
if ($p->getInputOption('without-docker') || ($p->isMacos())) {
9596
$p->setWorkDir(__DIR__);
@@ -108,12 +109,10 @@
108109
//设置PHP 安装目录
109110
define("BUILD_PHP_INSTALL_PREFIX", $p->getRootDir() . '/bin/php-' . BUILD_PHP_VERSION);
110111

111-
112112
if ($p->getInputOption('with-override-default-enabled-ext')) {
113113
$p->setExtEnabled([]);
114114
}
115115

116-
117116
if ($p->getInputOption('with-global-prefix')) {
118117
$p->setGlobalPrefix($p->getInputOption('with-global-prefix'));
119118
}

sapi/SWOOLE-VERSION.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v6.1.3
1+
v6.1.4

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ pacman -S --needed --noconfirm icu-devel
7171
pacman -S --needed --noconfirm gettext-devel
7272
pacman -S --needed --noconfirm libintl
7373
pacman -S --needed --noconfirm flex
74+
pacman -S --needed --noconfirm nasm yasm
7475

7576
: <<'COMMENT'
7677
# 不存在的包

sapi/scripts/build-swoole-cli-with-linux-gcc.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
./configure --prefix=/usr --disable-all \
1+
if [ ! -f ./configure ]; then
2+
./buildconf --force
3+
fi
4+
5+
./configure --prefix=/usr/local/swoole-cli \
6+
--disable-all \
27
--enable-zts \
38
--without-pcre-jit \
49
--with-openssl --enable-openssl \
@@ -31,17 +36,20 @@
3136
--with-sodium \
3237
--enable-xml --enable-simplexml --enable-xmlreader --enable-xmlwriter --enable-dom --with-libxml \
3338
--enable-gd --with-jpeg --with-freetype \
34-
--enable-swoole --enable-sockets --enable-mysqlnd --enable-swoole-curl --enable-cares \
39+
--enable-swoole \
40+
--enable-swoole-curl \
41+
--enable-cares \
3542
--enable-swoole-pgsql \
3643
--enable-swoole-sqlite \
44+
--with-swoole-odbc=unixODBC,/usr \
3745
--enable-swoole-thread \
46+
--enable-swoole-stdext \
3847
--enable-brotli \
3948
--enable-zstd \
40-
--enable-swoole-stdext \
4149
--enable-redis \
4250
--with-imagick \
4351
--with-yaml \
4452
--with-readline \
4553
--enable-opcache
4654

47-
make -j "$(nproc)"
55+
make -j "$(nproc)"

0 commit comments

Comments
 (0)