Skip to content

Commit

Permalink
merge code
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjingxyk committed Jul 8, 2024
2 parents b3a0d50 + 63291d7 commit 9b189cd
Show file tree
Hide file tree
Showing 58 changed files with 1,068 additions and 199 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linux-aarch64.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-php-cli-linux-aarch64
name: build-linux-aarch64

on: [ push, pull_request ]

Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
echo `expr $LIB_NUM - $CACHE_NUM`
if test $(ls -A /usr/local/swoole-cli/ | wc -l) -eq 0 ; then
TAG=all-dependencies-alpine-3.17-php8-v1.0.0-aarch64-20231113T121401Z
TAG=all-dependencies-alpine-3.18-php8-v1.0.0-aarch64-20240618T091126Z
IMAGE="docker.io/jingjingxyk/build-swoole-cli:${TAG}"
container_id=$(docker create $IMAGE) # returns container ID
docker cp $container_id:/usr/local/swoole-cli/ /usr/local/
Expand Down Expand Up @@ -121,7 +121,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
2 changes: 1 addition & 1 deletion .github/workflows/linux-mips64le.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-php-cli-linux-mips64le
name: build-linux-mips64le

on: [ push, pull_request ]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-riscv64.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-php-cli-linux-riscv64
name: build-linux-riscv64

on: [ push, pull_request ]

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/macos-aarch64.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build-php-cli-macos-aarch64
name: build-macos-aarch64

on: [ push, pull_request ]

Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
mkdir -p pool/ext
mkdir -p bin/runtime
if [ ! -f bin/runtime/php ] ; then
bash sapi/quickstart/setup-php-runtime.sh --mirror china
bash sapi/quickstart/setup-php-runtime.sh
fi
bash sapi/download-box/download-box-get-archive-from-server.sh
ls -A pool/lib/
Expand All @@ -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
5 changes: 2 additions & 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
# reconfigure #
# dpkg-reconfigure dash
Expand Down Expand Up @@ -214,6 +214,7 @@ if [ ${WITH_PHP_COMPOSER} -eq 1 ] ; then

# composer update --optimize-autoloader
# composer update --optimize-autoloader --no-dev
# composer update --profile --prefer-dist --no-dev --optimize-autoloader

# composer update --no-interaction --optimize-autoloader
# composer install --no-interaction --optimize-autoloader
Expand Down Expand Up @@ -247,8 +248,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
25 changes: 21 additions & 4 deletions diff.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
#!/usr/bin/env php
<?php
$list_swoole_cli = swoole_string(`./bin/swoole-cli -m | tail -n +2 | head -n -3`)->trim()->lower()->split(PHP_EOL)
$shell = "";
switch (PHP_OS) {
case 'Linux':
$shell = "./bin/swoole-cli -m | tail -n +2 | head -n -3 ";
break;
case 'Darwin':
$shell = "./bin/swoole-cli -m | tail -n +2 | ghead -n -3 ";
break;
case 'WINNT':
default:
echo "no support this OS ";
exit(0);

}
$list_swoole_cli = swoole_string(`$shell`)->trim()->lower()->split(PHP_EOL)
->remove('core');

$php_version_tag = trim(file_get_contents(__DIR__ . '/sapi/PHP-VERSION.conf'));
$php_source_folder = __DIR__ . '/var/php-' . $php_version_tag . '/ext/';
$list_php_src = swoole_string(`ls -1 {$php_source_folder}`)->trim()->lower()->split(PHP_EOL)
ob_start();
require_once __DIR__ . '/sapi/DownloadPHPSourceCode.php';
$php_source_folder = PHP_SRC_DIR;
ob_end_clean();

$list_php_src = swoole_string(`ls -1 {$php_source_folder}/ext/`)->trim()->lower()->split(PHP_EOL)
->remove('ext_skel.php')
->remove('zend_test');

Expand Down
56 changes: 56 additions & 0 deletions docs/extensions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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 |||||
| mailparse |||||
| mongodb |||||




12 changes: 12 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 Expand Up @@ -135,3 +139,11 @@ fix slow alpine apk installations
bash sapi/quickstart/linux/alpine-init.sh --mirror china

```

show file info
----

```bash
file ./bin/php-8.2.4/bin/php
readelf -h ./bin/php-8.2.4/bin/php
```
6 changes: 5 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 Expand Up @@ -178,7 +180,9 @@ export LIBSODIUM_LIBS=$(pkg-config --libs libsodium)
> 解压以后执行如下命令:
```bash
xattr ./swoole-cli

xattr -cr ./swoole-cli
sudo xattr -d com.apple.quarantine ./swoole-cli

file ./bin/swoole-cli
Expand Down
29 changes: 29 additions & 0 deletions sapi/DownloadPHPSourceCode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

$poject_dir = realpath(__DIR__ . '/../');
# $php_version_tag = trim(file_get_contents($poject_dir . '/sapi/PHP-VERSION.conf'));
$php_version_tag = "8.2.13";
define("PHP_SRC_DIR", $poject_dir . "/var/php-{$php_version_tag}");
$php_source_folder = PHP_SRC_DIR;
$php_file = $poject_dir . "/pool/lib/php-{$php_version_tag}.tar.gz";
$download_dir = dirname($php_file);


# 下载 PHP 源码
$DOWNLOAD_PHP_CMD = "curl -L https://github.com/php/php-src/archive/refs/tags/php-{$php_version_tag}.tar.gz -o {$php_file}";
echo $DOWNLOAD_PHP_CMD . PHP_EOL;
if (!file_exists($php_file)) {
`test -d {$download_dir} || mkdir -p {$download_dir}`;
`{$DOWNLOAD_PHP_CMD}`;
}

# 解压 PHP 源码
# tar -zxvf 文件名.tar.gz --strip-components=1 -C 指定解压目录
$UNTAR_PHP_SOURCE_CMD = <<<EOF
set -x
# test -d {$php_source_folder} && rm -rf {$php_source_folder}
mkdir -p {$php_source_folder}
test -f {$php_source_folder}/configure.ac || tar -zxf {$php_file} --strip-components=1 -C {$php_source_folder}
EOF;

`{$UNTAR_PHP_SOURCE_CMD}`;
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
42 changes: 39 additions & 3 deletions sapi/quickstart/clean-folder-for-extra-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ __PROJECT__=$(
cd ${__PROJECT__}

GIT_BRANCH=$(git branch | grep '* ' | awk '{print $2}')
echo "git branch : "$GIT_BRANCH
echo "current git branch : "$GIT_BRANCH

if [ $GIT_BRANCH = 'new_dev' ] ;then
echo ' Deleting folder is not allow in this branch : ' $GIT_BRANCH ;
exit 0
fi

echo '正在执行删除无关的文件或者文件建'

cd ${__DIR__}/linux/

test -d ceph && rm -rf ceph
test -d SDS && rm -rf SDS
test -d kubernetes && rm -rf kubernetes
test -d qemu && rm -rf qemu
test -d SDN && rm -rf SDN
Expand All @@ -42,11 +43,46 @@ test -d database && rm -rf database

test -d database-ui && rm -rf database-ui

test -d elasticsearch-neo4j && rm -rf elasticsearch-neo4j
test -d elasticsearch && rm -rf elasticsearch

test -d grafana && rm -rf grafana

test -d minio && rm -rf minio

test -d mysql && rm -rf mysql

test -d neo4j && rm -rf neo4j

test -d nginx && rm -rf nginx

test -d postgis && rm -rf postgis

test -d rabbitmq && rm -rf rabbitmq

test -d redis && rm -rf redis


cd ${__PROJECT__}/.github/workflows
test -f ceph.yml && rm -rf ceph.yml
test -f kubernetes.yml && rm -rf kubernetes.yml
test -f ovn.yml && rm -rf ovn.yml
test -f ovn.yml && rm -rf ovn.yml


cd ${__PROJECT__}
test -f setup-aria2-runtime.sh && rm -rf setup-aria2-runtime.sh
test -f setup-ffmpeg-runtime.sh && rm -rf setup-ffmpeg-runtime.sh
test -f setup-php-cli-runtime.sh && rm -rf setup-php-cli-runtime.sh
test -f setup-supervisord.sh && rm -rf setup-supervisord.sh
test -f setup-coturn-runtime.sh && rm -rf setup-coturn-runtime.sh
test -f setup-nginx-runtime.sh && rm -rf setup-nginx-runtime.sh
test -f setup-php-fpm-runtime.sh && rm -rf setup-php-fpm-runtime.sh
test -f setup-privoxy-runtime.sh && rm -rf setup-privoxy-runtime.sh
test -f setup-socat-runtime.sh && rm -rf setup-socat-runtime.sh
test -f setup-webBenchmark-runtime.sh && rm -rf setup-webBenchmark-runtime.sh
test -f setup-socat-runtime.sh && rm -rf setup-socat-runtime.sh
test -f setup-swoole-cli-pre-runtime.sh && rm -rf setup-swoole-cli-pre-runtime.sh

cd ${__PROJECT__}

echo '删除完毕'
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
Loading

0 comments on commit 9b189cd

Please sign in to comment.