Skip to content

Commit

Permalink
Merge pull request #662 from jingjingxyk/build_native_php
Browse files Browse the repository at this point in the history
Build native php merge code
  • Loading branch information
jingjingxyk committed Jun 22, 2024
2 parents 508f649 + 20cac85 commit 3664955
Show file tree
Hide file tree
Showing 20 changed files with 547 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
- name: prepare pre-built library
uses: addnab/docker-run-action@v3
with:
image: docker.io/jingjingxyk/build-swoole-cli:all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240106T114724Z
image: docker.io/jingjingxyk/build-swoole-cli:all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240618T091126Z
options: -v ${{ github.workspace }}:/work -w /work -v /usr/local/swoole-cli/:/usr/local/tmp/
run: |
for i in `ls /usr/local/swoole-cli/`
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +mongodb --with-build-type=release --with-libavif=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +uuid +mongodb --with-build-type=release --with-libavif=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
bash make-install-deps.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ jobs:
composer dump-autoload --optimize --profile --no-dev
# php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +mongodb --with-libavif=1 ${{ inputs.build_type }} ${{ inputs.build_options }} --with-php-version=${{ env.BUILD_PHP_VERSION }}
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +mongodb --with-libavif=1 --with-build-type=release --with-php-version=${{ env.BUILD_PHP_VERSION }}
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +mongodb +uuid --with-libavif=1 --with-build-type=release --with-php-version=${{ env.BUILD_PHP_VERSION }}
bash make-install-deps.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql --with-build-type=release --with-libavif=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql +uuid -mongodb --with-build-type=release --with-libavif=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql -mongodb --with-build-type=release --with-libavif=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql +uuid -mongodb --with-build-type=release --with-libavif=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
- name: Build
run: |
Expand Down
4 changes: 1 addition & 3 deletions build-release-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ if [ "$OS" = 'linux' ] ; then
if [ ! "$BASH_VERSION" ] ; then
echo "Please use bash to run this script ($0) " 1>&2
echo "fix : " 1>&2
echo "apk add bash' or sh sapi/quickstart/linux/alpine-init.sh " 1>&2
echo "apk add bash OR sh sapi/quickstart/linux/alpine-init-minimal.sh " 1>&2
exit 1
fi
fi
Expand Down Expand Up @@ -244,8 +244,6 @@ fi

# 定制构建选项
OPTIONS="${OPTIONS} +apcu +ds +xlswriter +ssh2 +uuid "
OPTIONS="${OPTIONS} "
OPTIONS="${OPTIONS} --with-libavif=1"
OPTIONS="${OPTIONS} --with-global-prefix=${LIBRARY_INSTALL_PREFIX}"
# OPTIONS="${OPTIONS} @macos"

Expand Down
54 changes: 54 additions & 0 deletions docs/extensions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# support extensions (x64)

| extension name | linux6 | macos | windows(cygwin) | default enabled |
|----------------|--------|-------|-----------------|-----------------|
| curl |||||
| iconv |||||
| bcmath |||||
| pcntl |||||
| filter |||||
| session |||||
| tokenizer |||||
| mbstring |||||
| ctype |||||
| zlib |||||
| zip |||||
| posix |||||
| sockets |||||
| pdo |||||
| sqlite3 |||||
| phar |||||
| mysqlnd |||||
| mysqli |||||
| intl |||||
| fileinfo |||||
| pdo_mysql |||||
| soap |||||
| xsl |||||
| gmp |||||
| exif |||||
| sodium |||||
| openssl |||||
| readline |||||
| libxml |||||
| xml |||||
| xmlreader |||||
| xmlwriter |||||
| dom |||||
| simplexml |||||
| redis |||||
| yaml |||||
| imagick |||||
| gd |||||
| opcache |||||
| swoole |||||
| ssh2 |||||
| apcu |||||
| ds |||||
| inotify |||||
| protobuf |||||
| uuid |||||
| mongodb |||||



4 changes: 4 additions & 0 deletions docs/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +uuid
bash ./make.sh docker-build
bash ./make.sh docker-bash

# 准备bash 命令
sh sapi/quickstart/linux/alpine-init-minimal.sh

bash sapi/quickstart/linux/alpine-init.sh

# 进入容器后需要再一次执行此命令
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +uuid

bash make-install-deps.sh

bash ./make.sh all-library
bash ./make.sh config
bash ./make.sh build
Expand Down
4 changes: 3 additions & 1 deletion docs/macOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ bash setup-php-runtime.sh
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile

php prepare.php --without-docker=1 +inotify +apcu +ds +xlswriter +ssh2 +uuid
php prepare.php --without-docker=1 +apcu +ds +xlswriter +ssh2 +uuid

bash sapi/quickstart/macos/macos-init.sh

bash make-install-deps.sh

bash ./make.sh all-library
bash ./make.sh config
bash ./make.sh build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ RUN composer update --optimize-autoloader
RUN composer config -g --unset repos.packagist


RUN php prepare.php --with-swoole-pgsql=1 --with-libavif=1
RUN php prepare.php +apcu +ds +xlswriter +ssh2 +uuid

RUN bash make-install-deps.sh

Expand Down
7 changes: 5 additions & 2 deletions sapi/quickstart/linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ bash sapi/quickstart/linux/run-alpine-container.sh
# 进入容器
bash sapi/quickstart/linux/connection-swoole-cli-alpine.sh

# 准备构建基础软件 bash git
sh sapi/quickstart/linux/alpine-init-minimal.sh

# 准备构建基础软件
sh sapi/quickstart/linux/alpine-init.sh
bash sapi/quickstart/linux/alpine-init.sh

# 准备构建基础软件 使用中科大镜像源
sh sapi/quickstart/linux/alpine-init.sh --mirror china
bash sapi/quickstart/linux/alpine-init.sh --mirror china

```

Expand Down
44 changes: 44 additions & 0 deletions sapi/quickstart/linux/alpine-init-minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

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

# use china mirror
# sh sapi/quickstart/linux/alpine-init-mini.sh --mirror [ china | ustc | tuna | tencentyun | huaweicloud ]


MIRROR=''
while [ $# -gt 0 ]; do
case "$1" in
--mirror)
MIRROR="$2"
;;
--*)
echo "no found mirror option $1"
;;
esac
shift $(($# > 0 ? 1 : 0))
done

case "$MIRROR" in
china | tuna | ustc)
test -f /etc/apk/repositories.save || cp /etc/apk/repositories /etc/apk/repositories.save
test "$MIRROR" = "china" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
test "$MIRROR" = "tuna" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
test "$MIRROR" = "ustc" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
;;
tencentyun | huaweicloud) # 云服务的内网镜像源
test -f /etc/apk/repositories.save || cp /etc/apk/repositories /etc/apk/repositories.save
test "$MIRROR" = "tencentyun" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.tencentyun.com/g' /etc/apk/repositories
test "$MIRROR" = "huaweicloud" && sed -i 's/dl-cdn.alpinelinux.org/repo.huaweicloud.com/g' /etc/apk/repositories
;;

esac

apk update

apk add bash git curl wget xz zip unzip ca-certificates
94 changes: 94 additions & 0 deletions sapi/quickstart/linux/debian-init-minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash

set -exu
__DIR__=$(
cd "$(dirname "$0")"
pwd
)

# use china mirror
# bash sapi/quickstart/linux/debian-init-mini.sh --mirror [ china | ustc | tuna | aliyuncs | tencentyun | huaweicloud ]

MIRROR=''
while [ $# -gt 0 ]; do
case "$1" in
--mirror)
case "$2" in
china | ustc | tuna | aliyuncs | tencentyun | huaweicloud )
MIRROR="$2"
;;
esac
;;
--*)
echo "Illegal option $1"
;;
esac
shift $(($# > 0 ? 1 : 0))
done



if test -n "$MIRROR" ; then
{
OS_ID=$(cat /etc/os-release | grep '^ID=' | awk -F '=' '{print $2}')
VERSION_ID=$(cat /etc/os-release | grep '^VERSION_ID=' | awk -F '=' '{print $2}' | sed "s/\"//g")
case $OS_ID in
debian)
case $VERSION_ID in
11 | 12 )
# debian 容器内和容器外 镜像源配置不一样
if [ -f /.dockerenv ] && [ "$VERSION_ID" = 12 ]; then
test -f /etc/apt/sources.list.d/debian.sources.save || cp -f /etc/apt/sources.list.d/debian.sources /etc/apt/sources.list.d/debian.sources.save
sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources
test "$MIRROR" = "tuna" && sed -i "[email protected]@mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list.d/debian.sources
# 云服务内网镜像源
test "$MIRROR" = "aliyuncs" && sed -i "[email protected]@mirrors.cloud.aliyuncs.com@g" /etc/apt/sources.list.d/debian.sources
test "$MIRROR" = "tencentyun" && sed -i "[email protected]@mirrors.tencentyun.com@g" /etc/apt/sources.list.d/debian.sources
test "$MIRROR" = "huaweicloud" && sed -i "[email protected]@repo.huaweicloud.com@g" /etc/apt/sources.list.d/debian.sources
else
test -f /etc/apt/sources.list.save || cp /etc/apt/sources.list /etc/apt/sources.list.save
sed -i "[email protected]@mirrors.ustc.edu.cn@g" /etc/apt/sources.list
sed -i "[email protected]@mirrors.ustc.edu.cn@g" /etc/apt/sources.list
test "$MIRROR" = "tuna" && sed -i "[email protected]@mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
test "$MIRROR" = "aliyuncs" && sed -i "[email protected]@mirrors.cloud.aliyuncs.com@g" /etc/apt/sources.list
test "$MIRROR" = "tencentyun" && sed -i "[email protected]@mirrors.tencentyun.com@g" /etc/apt/sources.list
test "$MIRROR" = "huaweicloud" && sed -i "[email protected]@repo.huaweicloud.com@g" /etc/apt/sources.list
fi
;;
*)
echo 'no match debian OS version' . $VERSION_ID
;;
esac
;;
ubuntu)
case $VERSION_ID in
20.04 | 22.04 | 22.10 | 23.04 | 23.10)
test -f /etc/apt/sources.list.save || cp /etc/apt/sources.list /etc/apt/sources.list.save
sed -i "[email protected]@mirrors.ustc.edu.cn@g" /etc/apt/sources.list
sed -i "[email protected]@mirrors.ustc.edu.cn@g" /etc/apt/sources.list
test "$MIRROR" = "tuna" && sed -i "[email protected]@mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list
test "$MIRROR" = "aliyuncs" && sed -i "[email protected]@mirrors.cloud.aliyuncs.com@g" /etc/apt/sources.list
test "$MIRROR" = "tencentyun" && sed -i "[email protected]@mirrors.tencentyun.com@g" /etc/apt/sources.list
test "$MIRROR" = "huaweicloud" && sed -i "[email protected]@repo.huaweicloud.com@g" /etc/apt/sources.list
;;
*)
echo 'no match ubuntu OS version' . $VERSION_ID
;;
esac
;;
*)
echo 'NO SUPPORT LINUX OS'
exit 0
;;
esac
}
fi

test -f /etc/apt/apt.conf.d/proxy.conf && rm -rf /etc/apt/apt.conf.d/proxy.conf

export DEBIAN_FRONTEND=noninteractive

apt update -y

apt install -y git curl wget ca-certificates xz-utils bzip2 p7zip lzip zip unzip
2 changes: 1 addition & 1 deletion sapi/quickstart/linux/debian-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ __DIR__=$(
)

# use china mirror
# bash sapi/quickstart/linux/debian-init.sh --mirror [china | ustc | tuna | aliyuncs | tencentyun | huaweicloud]
# bash sapi/quickstart/linux/debian-init.sh --mirror [ china | ustc | tuna | aliyuncs | tencentyun | huaweicloud ]

MIRROR=''
while [ $# -gt 0 ]; do
Expand Down
14 changes: 12 additions & 2 deletions sapi/quickstart/linux/install-docker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -exu
set -ex
__DIR__=$(
cd "$(dirname "$0")"
pwd
Expand All @@ -15,7 +15,17 @@ mkdir -p ${__PROJECT__}/var

cd ${__PROJECT__}/var

curl -fsSL https://get.docker.com -o get-docker.sh
# https://github.com/docker/docker-install.git


# test -f get-docker.sh || curl -fsSL https://get.docker.com -o get-docker.sh
test -f get-docker.sh || curl -fsSL https://github.com/docker/docker-install/blob/master/install.sh?raw=true -o get-docker.sh

if [ -n "$http_proxy" ] || [ -n "$https_proxy" ] || [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then
echo 'Please delete proxy settings !'
echo 'Execute this script again !'
exit 0
fi

MIRROR=''
while [ $# -gt 0 ]; do
Expand Down
5 changes: 3 additions & 2 deletions sapi/quickstart/linux/run-alpine-container-full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ while [ $# -gt 0 ]; do
shift $(($# > 0 ? 1 : 0))
done


case $ARCH in
'x86_64')
TAG=all-dependencies-alpine-3.17-php8-v1.0.0-x86_64-20231113T125520Z
Expand All @@ -56,10 +57,10 @@ case $ARCH in
fi
;;
'aarch64')
TAG=all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240106T114724Z
TAG=all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240618T091126Z
IMAGE=docker.io/jingjingxyk/build-swoole-cli:${TAG}
if [ "$MIRROR" = 'china' ] ; then
IMAGE=registry.cn-shanghai.aliyuncs.com/jingjingxyk-public/app:${TAG}
IMAGE=registry.cn-hangzhou.aliyuncs.com/jingjingxyk-public/app:${TAG}
fi
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion sapi/scripts/cygwin/cygwin-config-ext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cd ${__PROJECT__}
ROOT=${__PROJECT__}

PHP_VERSION='8.2.13'
SWOOLE_VERSION=v5.1.2
SWOOLE_VERSION=v5.1.3

while [ $# -gt 0 ]; do
case "$1" in
Expand Down
Loading

0 comments on commit 3664955

Please sign in to comment.