Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment feature 同步功能代码 #683

Merged
merged 42 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
89e0951
验证 swoole v6
jingjingxyk Jul 6, 2024
70a5882
update swoole version
jingjingxyk Jul 6, 2024
f56b217
update extension.smd
jingjingxyk Jul 6, 2024
deb87ef
update build-release-example.sh
jingjingxyk Jul 6, 2024
0a6c9cf
update cygwin-config.sh
jingjingxyk Jul 6, 2024
5f34feb
swoole v6 disable opcache on linux x86_64
jingjingxyk Jul 6, 2024
98f7dea
cygwin disalble opcache
jingjingxyk Jul 6, 2024
76ce669
更新同步代码脚本
jingjingxyk Jul 7, 2024
f2df8b7
fix
jingjingxyk Jul 7, 2024
e5077b5
update diff.php
jingjingxyk Jul 7, 2024
4baa038
update sync-source-code.php diff.php
jingjingxyk Jul 7, 2024
7303f45
update sync-source-code.php
jingjingxyk Jul 7, 2024
a6ed6b3
Merge branch 'feature-update-sync-source-code' into experiment
jingjingxyk Jul 7, 2024
08211b6
update sync-source-code.php
jingjingxyk Jul 7, 2024
50e3eec
update sync-source-code.php
jingjingxyk Jul 7, 2024
5497393
update sync-source-code.php
jingjingxyk Jul 7, 2024
45bc317
update sync-source-code.php
jingjingxyk Jul 7, 2024
e642a83
update sync-source-code.php
jingjingxyk Jul 7, 2024
8e6cbfc
update sync-source-code.php
jingjingxyk Jul 7, 2024
8cd2d1c
Merge branch 'feature-update-sync-source-code' into experiment-feature
jingjingxyk Jul 7, 2024
5ea0835
update docs
jingjingxyk Jul 7, 2024
825fafa
update setup-php-runtime.sh
jingjingxyk Jul 8, 2024
e931d8f
update setup-php-runtime.sh
jingjingxyk Jul 8, 2024
b3fd2d1
Merge branch 'feature-php-ini-example' into experiment-feature
jingjingxyk Jul 9, 2024
b10fafc
merge code
jingjingxyk Jul 9, 2024
ff1bf75
dev debug 模式下启用 swoole debug
jingjingxyk Jul 9, 2024
88332d1
Merge branch 'feature-php-ini-example' into experiment-feature
jingjingxyk Jul 9, 2024
4a3a7dd
enable swoole debug config
jingjingxyk Jul 9, 2024
93f09dd
update swoole_v4080
jingjingxyk Jul 9, 2024
54bee6a
format code
jingjingxyk Jul 9, 2024
4400f6d
merge code
jingjingxyk Jul 9, 2024
be70bd1
update swoole_v6
jingjingxyk Jul 9, 2024
cbaf0a2
format code
jingjingxyk Jul 9, 2024
7d48c8f
merge code
jingjingxyk Jul 9, 2024
12ec67c
添加开放原子容器镜像 AtomHub
jingjingxyk Jul 10, 2024
2d274a1
update run-alpine-container-full.sh
jingjingxyk Jul 10, 2024
822ba86
fix dockerfile BUG
jingjingxyk Jul 10, 2024
86fc38b
fix dockerfile BUG
jingjingxyk Jul 10, 2024
6f34c5e
update make.php
jingjingxyk Jul 10, 2024
5610fa0
update make.php
jingjingxyk Jul 10, 2024
fae3e9b
update
jingjingxyk Jul 10, 2024
b72118c
merge code
jingjingxyk Jul 10, 2024
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
2 changes: 1 addition & 1 deletion build-release-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ php -v
if [ ${WITH_PHP_COMPOSER} -eq 1 ] ; then
export COMPOSER_ALLOW_SUPERUSER=1
if [ "$MIRROR" = 'china' ]; then
composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/
composer config -g repos.packagist composer https://mirrors.tencent.com/composer/
# composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
else
composer config -g repos.packagist composer https://packagist.org
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
105 changes: 55 additions & 50 deletions docs/extensions.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,60 @@
# 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 | ✅ | ✅ | ❌ | |
| extension name | linux | 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 | ✅ | ✅ | ✅ | ✅ |
| mongodb | ✅ | ✅ | ❌ | |
| ssh2 | ✅ | ✅ | ❌ | ❌ |
| apcu | ✅ | ✅ | | ❌ |
| ds | ✅ | ✅ | | ❌ |
| inotify | ✅ | ❌ | ❌ | ❌ |
| protobuf | ❌ | ❌ | ❌ | ❌ |
| uuid | ✅ | ✅ | ❌ | ❌ |
| mailparse | ✅ | ✅ | ❌ | |

## 查看 新增的扩展 和 移除的扩展

```bash

./bin/swoole-cli diff.php

```
13 changes: 8 additions & 5 deletions docs/macOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,17 @@ export LIBSODIUM_LIBS=$(pkg-config --libs libsodium)

## Mac安装应用“提示文件已损坏”或“来自身份不明开发者”解决方法

> 解压以后执行如下命令:
> note: macos clearing the com.apple.quarantine extended attribute
> macos环境下 首次运行提示无权限 ,通过清除扩展属性 解决

```bash
# 查看扩展属性
xattr ./bin/swoole-cli
# 移除扩展属性
sudo xattr -d com.apple.quarantine ./bin/swoole-cli

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

file ./bin/swoole-cli
otool -L ./bin/swoole-cli
file ./bin/swoole-cli
otool -L ./bin/swoole-cli

```

Expand Down
15 changes: 15 additions & 0 deletions docs/upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## 升级 PHP 版本 步骤

> 1、修改 sapi/PHP-VERSION.conf 文件里版本号即可
> 2、执行同步源码脚本, 拉取 PHP 官方源码 到本项目

```shell

# 测试同步源码
php sync-source-code.php

# 正式同步源码
php sync-source-code.php --action run


```
28 changes: 28 additions & 0 deletions sapi/DownloadPHPSourceCode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

$poject_dir = realpath(__DIR__ . '/../');
$php_version_tag = trim(file_get_contents($poject_dir . '/sapi/PHP-VERSION.conf'));
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}`;
5 changes: 4 additions & 1 deletion sapi/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM alpine:3.18
ARG BASE_IMAGE="alpine:3.18"
FROM ${BASE_IMAGE}
# FROM alpine:3.18


ARG MIRROR=""

Expand Down
30 changes: 0 additions & 30 deletions sapi/docker/Dockerfile-arm64

This file was deleted.

77 changes: 51 additions & 26 deletions sapi/docker/build-export-container.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

:<<'COMMENT'
从运行中的容器 将 /usr/local/swoole-cli/ 文件夹 拷贝出来 并生成新容器镜像 和 导出镜像到磁盘

COMMENT

set -exu
__DIR__=$(
cd "$(dirname "$0")"
Expand All @@ -12,6 +17,42 @@ __PROJECT__=$(
cd ${__DIR__}
cd ${__PROJECT__}


CONTAINER_BASE_IMAGE='docker.io/library/alpine:3.18'
MIRROR=''
PLATFORM=''
ARCH=$(uname -m)
case $ARCH in
'x86_64')
PLATFORM='linux/amd64'
;;
'aarch64')
PLATFORM='linux/arm64'
;;
esac

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

case "$MIRROR" in
china | openatom)
CONTAINER_BASE_IMAGE="hub.atomgit.com/library/alpine:3.18"
;;
esac


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

Expand All @@ -22,13 +63,18 @@ docker cp $container_id:/usr/local/swoole-cli/ .


cat > Dockerfile <<'EOF'
FROM alpine:3.18
ARG BASE_IMAGE="alpine:3.18"
FROM ${BASE_IMAGE}
# FROM alpine:3.18

ARG MIRROR=""

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV TZ=Etc/UTC

RUN test -f /etc/apk/repositories.save || cp /etc/apk/repositories /etc/apk/repositories.save
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN if [ "${MIRROR}" = "ustc" -o "${MIRROR}" = "china" ]; then { sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories ; } fi
RUN if [ "${MIRROR}" = "tuna" ]; then { sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories ; } fi

RUN apk add ca-certificates tini
ADD ./swoole-cli /usr/local/swoole-cli
Expand All @@ -44,37 +90,16 @@ EOF



PLATFORM=''
ARCH=$(uname -m)
case $ARCH in
'x86_64')
PLATFORM='linux/amd64'
;;
'aarch64')
PLATFORM='linux/arm64'
;;
esac

while [ $# -gt 0 ]; do
case "$1" in
--platform)
PLATFORM="$2"
;;
--*)
echo "Illegal option $1"
;;
esac
shift $(($# > 0 ? 1 : 0))
done

ARCH=$(uname -m)
TIME=$(date -u '+%Y%m%dT%H%M%SZ')
VERSION="1.6"
TAG="v${VERSION}-${ARCH}-${TIME}"

IMAGE="docker.io/phpswoole/swoole-cli-builder:${TAG}"

docker build -t ${IMAGE} -f ./Dockerfile . --progress=plain --platform ${PLATFORM}
echo "MIRROR=${MIRROR}"
echo "BASE_IMAGE=${CONTAINER_BASE_IMAGE}"
docker build -t ${IMAGE} -f ./Dockerfile . --progress=plain --platform ${PLATFORM} --build-arg="MIRROR=${MIRROR}" --build-arg="BASE_IMAGE=${CONTAINER_BASE_IMAGE}"

echo ${IMAGE}
echo ${IMAGE} > container-image.txt
Expand Down
2 changes: 1 addition & 1 deletion sapi/quickstart/linux/run-alpine-container-full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ while [ $# -gt 0 ]; do
--mirror)
MIRROR="$2"
;;
--dev-shm)
--dev-shm) #使用 /dev/shm 目录加快构建速度
DEV_SHM=1
;;
esac
Expand Down
Loading
Loading