diff --git a/build-release-example.sh b/build-release-example.sh index 6d037a057b..19835ca0e4 100644 --- a/build-release-example.sh +++ b/build-release-example.sh @@ -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 diff --git a/diff.php b/diff.php index c884ae3aa2..29133a825c 100755 --- a/diff.php +++ b/diff.php @@ -1,11 +1,28 @@ #!/usr/bin/env php 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'); diff --git a/docs/extensions.md b/docs/extensions.md index fff8866ee7..ef7d55e87a 100644 --- a/docs/extensions.md +++ b/docs/extensions.md @@ -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 + +``` diff --git a/docs/macOS.md b/docs/macOS.md index dd621010e7..184c62b88f 100644 --- a/docs/macOS.md +++ b/docs/macOS.md @@ -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 ``` diff --git a/docs/upgrade.md b/docs/upgrade.md new file mode 100644 index 0000000000..12a359c29f --- /dev/null +++ b/docs/upgrade.md @@ -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 + + +``` diff --git a/sapi/DownloadPHPSourceCode.php b/sapi/DownloadPHPSourceCode.php new file mode 100644 index 0000000000..0d048f4b34 --- /dev/null +++ b/sapi/DownloadPHPSourceCode.php @@ -0,0 +1,28 @@ + 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/ @@ -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 @@ -44,29 +90,6 @@ 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" @@ -74,7 +97,9 @@ 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 diff --git a/sapi/quickstart/linux/run-alpine-container-full.sh b/sapi/quickstart/linux/run-alpine-container-full.sh index 1e7be927fc..af71f97df1 100644 --- a/sapi/quickstart/linux/run-alpine-container-full.sh +++ b/sapi/quickstart/linux/run-alpine-container-full.sh @@ -40,7 +40,7 @@ while [ $# -gt 0 ]; do --mirror) MIRROR="$2" ;; - --dev-shm) + --dev-shm) #使用 /dev/shm 目录加快构建速度 DEV_SHM=1 ;; esac diff --git a/sapi/quickstart/linux/run-alpine-container.sh b/sapi/quickstart/linux/run-alpine-container.sh index 96c36630ee..bcd371082f 100644 --- a/sapi/quickstart/linux/run-alpine-container.sh +++ b/sapi/quickstart/linux/run-alpine-container.sh @@ -18,7 +18,23 @@ cd ${__DIR__} echo $? } cd ${__DIR__} + IMAGE=alpine:3.18 +MIRROR='' +while [ $# -gt 0 ]; do + case "$1" in + --mirror) + MIRROR="$2" + case "$MIRROR" in + china | openatom) + IMAGE="hub.atomgit.com/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 $IMAGE tail -f /dev/null diff --git a/sapi/quickstart/linux/run-debian-container.sh b/sapi/quickstart/linux/run-debian-container.sh index e58417f499..13f09fd579 100644 --- a/sapi/quickstart/linux/run-debian-container.sh +++ b/sapi/quickstart/linux/run-debian-container.sh @@ -18,7 +18,24 @@ cd ${__DIR__} echo $? } cd ${__DIR__} + IMAGE=debian:12 +MIRROR='' +while [ $# -gt 0 ]; do + case "$1" in + --mirror) + MIRROR="$2" + case "$MIRROR" in + china | openatom) + IMAGE="hub.atomgit.com/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 $IMAGE tail -f /dev/null diff --git a/sapi/scripts/cygwin/cygwin-config.sh b/sapi/scripts/cygwin/cygwin-config.sh index 6b8cac3fee..ee34e3db76 100755 --- a/sapi/scripts/cygwin/cygwin-config.sh +++ b/sapi/scripts/cygwin/cygwin-config.sh @@ -14,47 +14,51 @@ cd ${__PROJECT__} ./buildconf --force test -f Makefile && make clean ./configure --prefix=/usr --disable-all \ - --disable-fiber-asm \ - --enable-opcache \ - --without-pcre-jit \ - --with-openssl --enable-openssl \ - --with-curl \ - --with-iconv \ - --enable-intl \ - --with-bz2 \ - --enable-bcmath \ - --enable-filter \ - --enable-session \ - --enable-tokenizer \ - --enable-mbstring \ - --enable-ctype \ - --with-zlib \ - --with-zip \ - --enable-posix \ - --enable-sockets \ - --enable-pdo \ - --with-sqlite3 \ - --enable-phar \ - --enable-pcntl \ - --enable-mysqlnd \ - --with-mysqli \ - --enable-fileinfo \ - --with-pdo_mysql \ - --enable-soap \ - --with-xsl \ - --with-gmp \ - --enable-exif \ - --with-sodium \ - --enable-xml --enable-simplexml --enable-xmlreader --enable-xmlwriter --enable-dom --with-libxml \ - --enable-gd --with-jpeg --with-freetype \ - --enable-swoole --enable-sockets --enable-mysqlnd --enable-swoole-curl --enable-cares \ - --enable-swoole-pgsql \ - --enable-swoole-sqlite \ - --enable-redis \ - --with-imagick \ - --with-yaml \ - --with-readline + --disable-fiber-asm \ + --without-pcre-jit \ + --with-openssl --enable-openssl \ + --with-curl \ + --with-iconv \ + --enable-intl \ + --with-bz2 \ + --enable-bcmath \ + --enable-filter \ + --enable-session \ + --enable-tokenizer \ + --enable-mbstring \ + --enable-ctype \ + --with-zlib \ + --with-zip \ + --enable-posix \ + --enable-sockets \ + --enable-pdo \ + --with-sqlite3 \ + --enable-phar \ + --enable-pcntl \ + --enable-mysqlnd \ + --with-mysqli \ + --enable-fileinfo \ + --with-pdo_mysql \ + --enable-soap \ + --with-xsl \ + --with-gmp \ + --enable-exif \ + --with-sodium \ + --enable-xml --enable-simplexml --enable-xmlreader --enable-xmlwriter --enable-dom --with-libxml \ + --enable-gd --with-jpeg --with-freetype \ + --enable-swoole --enable-sockets --enable-mysqlnd --enable-swoole-curl --enable-cares \ + --enable-swoole-pgsql \ + --enable-swoole-sqlite \ + --enable-swoole-thread \ + --enable-zts \ + --enable-redis \ + --with-imagick \ + --with-yaml \ + --with-readline + # --with-pdo-pgsql \ # --with-pgsql # --with-pdo-sqlite \ +# --enable-opcache \ + diff --git a/sapi/src/UnitTest/MainTest.php b/sapi/src/UnitTest/MainTest.php index ee864fc094..51b166023e 100644 --- a/sapi/src/UnitTest/MainTest.php +++ b/sapi/src/UnitTest/MainTest.php @@ -21,7 +21,7 @@ public function testExtesnions(): void $this->assertContains('swoole', $exts); $this->assertContains('gd', $exts); $this->assertContains('imagick', $exts); - $this->assertContains('opcache', $exts); + # $this->assertContains('opcache', $exts); $this->assertContains('redis', $exts); $this->assertContains('mongodb', $exts); } diff --git a/sapi/src/builder/extension/apcu.php b/sapi/src/builder/extension/apcu.php index 4b2400acb0..2e55edd44a 100644 --- a/sapi/src/builder/extension/apcu.php +++ b/sapi/src/builder/extension/apcu.php @@ -8,7 +8,7 @@ (new Extension('apcu')) ->withOptions('--enable-apcu') ->withPeclVersion('5.1.22') - ->withFileHash('md5','2e1fb1f09725ada616e873c4e4012ff6') + ->withFileHash('md5', '2e1fb1f09725ada616e873c4e4012ff6') ->withHomePage('https://github.com/krakjoe/apcu.git') ->withManual('https://www.php.net/apcu') ->withLicense('https://github.com/krakjoe/apcu/blob/master/LICENSE', Extension::LICENSE_PHP) diff --git a/sapi/src/builder/extension/ds.php b/sapi/src/builder/extension/ds.php index 1640f9dccd..0c935b7055 100644 --- a/sapi/src/builder/extension/ds.php +++ b/sapi/src/builder/extension/ds.php @@ -8,7 +8,7 @@ (new Extension('ds')) ->withOptions(' --enable-ds') ->withPeclVersion('1.4.0') - ->withFileHash('md5','d7e64fbb53b567908d63155ec2a8f548') + ->withFileHash('md5', 'd7e64fbb53b567908d63155ec2a8f548') ->withHomePage('https://github.com/php-ds/ext-ds') ->withManual('https://www.php.net/ds') ->withLicense('https://github.com/php-ds/ext-ds/blob/master/LICENSE', Extension::LICENSE_MIT) diff --git a/sapi/src/builder/extension/imagick.php b/sapi/src/builder/extension/imagick.php index d47901b33c..f10652abe1 100644 --- a/sapi/src/builder/extension/imagick.php +++ b/sapi/src/builder/extension/imagick.php @@ -9,7 +9,7 @@ (new Extension('imagick')) ->withOptions('--with-imagick=' . IMAGEMAGICK_PREFIX) ->withPeclVersion('3.6.0') - ->withFileHash('md5','f7b5e9b23fb844e5eb035203d316bc63') + ->withFileHash('md5', 'f7b5e9b23fb844e5eb035203d316bc63') ->withHomePage('https://github.com/Imagick/imagick') ->withLicense('https://github.com/Imagick/imagick/blob/master/LICENSE', Extension::LICENSE_PHP) ->withMd5sum('f7b5e9b23fb844e5eb035203d316bc63') @@ -17,3 +17,7 @@ ->withDependentExtensions('tokenizer') ); }; + + +//构建的过程中,会自动 下载 PHP-Parser +//https://github.com/nikic/PHP-Parser/ diff --git a/sapi/src/builder/extension/inotify.php b/sapi/src/builder/extension/inotify.php index 8b6b9d1808..356b5f249a 100644 --- a/sapi/src/builder/extension/inotify.php +++ b/sapi/src/builder/extension/inotify.php @@ -12,6 +12,6 @@ ->withHomePage('https://www.php.net/inotify') ->withOptions('--enable-inotify') ->withPeclVersion('3.0.0') - ->withFileHash('md5','084a5a5af53a5eb85dae7c7d2c95048f') + ->withFileHash('md5', '084a5a5af53a5eb85dae7c7d2c95048f') ); }; diff --git a/sapi/src/builder/extension/mongodb.php b/sapi/src/builder/extension/mongodb.php index 4395c46148..31939eeb74 100644 --- a/sapi/src/builder/extension/mongodb.php +++ b/sapi/src/builder/extension/mongodb.php @@ -33,7 +33,7 @@ ->withHomePage('https://www.mongodb.com/docs/drivers/php/') ->withOptions($options) ->withPeclVersion('1.14.2') - ->withFileHash('md5','b6de193d467f77d8fd7b27845c19e476') + ->withFileHash('md5', 'b6de193d467f77d8fd7b27845c19e476') ; $depends = ['icu', 'openssl', 'zlib', 'libzstd']; diff --git a/sapi/src/builder/extension/protobuf.php b/sapi/src/builder/extension/protobuf.php index 2a05e7f1b1..8c06b5121f 100644 --- a/sapi/src/builder/extension/protobuf.php +++ b/sapi/src/builder/extension/protobuf.php @@ -8,7 +8,7 @@ (new Extension('protobuf')) ->withOptions('--enable-protobuf') ->withPeclVersion('3.21.6') - ->withFileHash('md5','30fd6011881fa67878805c394e425577') + ->withFileHash('md5', '30fd6011881fa67878805c394e425577') ->withHomePage('https://developers.google.com/protocol-buffers') ->withManual('https://protobuf.dev/reference/php/php-generated/') ->withDependentExtensions('sockets') @@ -16,7 +16,7 @@ $p->withBeforeConfigureScript('protobuf', function (Preprocessor $p) { // compatible with redis - $workdir= $p->getWorkDir(); + $workdir = $p->getWorkDir(); if ($p->isMacos()) { $cmd = <<withOptions('--enable-redis') ->withPeclVersion('5.3.7') - ->withFileHash('md5','1ed6793902214cc02467666ba69dd2be') + ->withFileHash('md5', '1ed6793902214cc02467666ba69dd2be') ->withHomePage('https://github.com/phpredis/phpredis') ->withLicense('https://github.com/phpredis/phpredis/blob/develop/COPYING', Extension::LICENSE_PHP) ->withDependentExtensions('session') diff --git a/sapi/src/builder/extension/ssh2.php b/sapi/src/builder/extension/ssh2.php index 9f75754e57..32dcc9291f 100644 --- a/sapi/src/builder/extension/ssh2.php +++ b/sapi/src/builder/extension/ssh2.php @@ -8,7 +8,7 @@ (new Extension('ssh2')) ->withOptions('--with-ssh2=' . LIBSSH2_PREFIX) ->withPeclVersion('1.4') - ->withFileHash('md5','d4ff155a741fcc33c4439a6e20323afd') + ->withFileHash('md5', 'd4ff155a741fcc33c4439a6e20323afd') ->withHomePage('https://github.com/php/pecl-networking-ssh2') ->withManual('https://www.php.net/ssh2') ->withLicense('https://www.php.net/license/', Extension::LICENSE_PHP) diff --git a/sapi/src/builder/extension/swoole.php b/sapi/src/builder/extension/swoole.php index 5c2e082070..152ed806b9 100644 --- a/sapi/src/builder/extension/swoole.php +++ b/sapi/src/builder/extension/swoole.php @@ -21,6 +21,11 @@ $options .= ' --enable-swoole-sqlite '; $options .= ' --with-swoole-odbc=unixODBC,' . UNIX_ODBC_PREFIX . ' '; + if (in_array($p->getBuildType(), ['dev', 'debug'])) { + $options .= ' --enable-debug '; + $options .= ' --enable-debug-log '; + $options .= ' --enable-trace-log '; + } $ext = (new Extension('swoole')) ->withHomePage('https://github.com/swoole/swoole-src') diff --git a/sapi/src/builder/extension/swoole_latest.php b/sapi/src/builder/extension/swoole_latest.php index 177316b849..71111e9155 100644 --- a/sapi/src/builder/extension/swoole_latest.php +++ b/sapi/src/builder/extension/swoole_latest.php @@ -17,6 +17,12 @@ $options .= ' --enable-swoole-pgsql '; $options .= ' --with-swoole-odbc=unixODBC,' . UNIX_ODBC_PREFIX . ' '; + if (in_array($p->getBuildType(), ['dev', 'debug'])) { + $options .= ' --enable-debug '; + $options .= ' --enable-debug-log '; + $options .= ' --enable-trace-log '; + } + $ext = (new Extension('swoole_latest')) ->withAliasName('swoole') ->withHomePage('https://github.com/swoole/swoole-src') diff --git a/sapi/src/builder/extension/swoole_v4080.php b/sapi/src/builder/extension/swoole_v4080.php index 8cb8a1eee7..72125e7062 100644 --- a/sapi/src/builder/extension/swoole_v4080.php +++ b/sapi/src/builder/extension/swoole_v4080.php @@ -13,6 +13,13 @@ $options .= ' --enable-http2 --enable-brotli '; $options .= ' --with-openssl-dir=' . OPENSSL_PREFIX; $options .= ' --with-brotli-dir=' . BROTLI_PREFIX; + $options .= ' --enable-swoole-json ' ; + + if (in_array($p->getBuildType(), ['dev', 'debug'])) { + $options .= ' --enable-debug '; + $options .= ' --enable-debug-log '; + $options .= ' --enable-trace-log '; + } $ext = (new Extension('swoole_v4080')) ->withAliasName('swoole') diff --git a/sapi/src/builder/extension/swoole_v5.1.x.php b/sapi/src/builder/extension/swoole_v5.1.x.php index ab208827e9..8299630d29 100644 --- a/sapi/src/builder/extension/swoole_v5.1.x.php +++ b/sapi/src/builder/extension/swoole_v5.1.x.php @@ -13,6 +13,12 @@ $options .= ' --with-swoole-odbc=unixODBC,' . UNIX_ODBC_PREFIX . ' '; $options .= ' --enable-swoole-sqlite '; + if (in_array($p->getBuildType(), ['dev', 'debug'])) { + $options .= ' --enable-debug '; + $options .= ' --enable-debug-log '; + $options .= ' --enable-trace-log '; + } + $ext = (new Extension('swoole_v5.1.x')) ->withOptions($options) ->withLicense('https://github.com/swoole/swoole-src/blob/master/LICENSE', Extension::LICENSE_APACHE2) @@ -25,7 +31,7 @@ git clone -b 5.1.x --depth=1 https://github.com/swoole/swoole-src.git EOF ) - ->withDependentExtensions('curl', 'openssl', 'sockets', 'mysqlnd', 'pdo' ); + ->withDependentExtensions('curl', 'openssl', 'sockets', 'mysqlnd', 'pdo'); $ext->withDependentLibraries(...$depends); $p->addExtension($ext); diff --git a/sapi/src/builder/extension/swoole_v5000.php b/sapi/src/builder/extension/swoole_v5000.php index 7f6434ba72..0bd5433458 100644 --- a/sapi/src/builder/extension/swoole_v5000.php +++ b/sapi/src/builder/extension/swoole_v5000.php @@ -19,6 +19,12 @@ $dependentLibraries[] = 'pgsql'; } + if (in_array($p->getBuildType(), ['dev', 'debug'])) { + $options .= ' --enable-debug '; + $options .= ' --enable-debug-log '; + $options .= ' --enable-trace-log '; + } + $ext = (new Extension('swoole_v5000')) ->withAliasName('swoole') ->withHomePage('https://github.com/swoole/swoole-src') diff --git a/sapi/src/builder/extension/swoole_v6000.php b/sapi/src/builder/extension/swoole_v6.php similarity index 69% rename from sapi/src/builder/extension/swoole_v6000.php rename to sapi/src/builder/extension/swoole_v6.php index 91e881a5e0..6d756e336c 100644 --- a/sapi/src/builder/extension/swoole_v6000.php +++ b/sapi/src/builder/extension/swoole_v6.php @@ -6,6 +6,7 @@ return function (Preprocessor $p) { $swoole_tag = 'v6.0'; + $swoole_tag = 'master'; $file = "swoole-{$swoole_tag}.tar.gz"; $url = "https://github.com/swoole/swoole-src/archive/refs/tags/{$swoole_tag}.tar.gz"; @@ -21,16 +22,26 @@ $options .= ' --enable-swoole-sqlite '; $options .= ' --with-swoole-odbc=unixODBC,' . UNIX_ODBC_PREFIX . ' '; $options .= ' --enable-swoole-thread '; - if ($p->isLinux()) { + $options .= ' --enable-zts '; + + if (in_array($p->getBuildType(), ['dev', 'debug'])) { + $options .= ' --enable-debug '; + $options .= ' --enable-debug-log '; + $options .= ' --enable-trace-log '; + } + + //linux 环境下 启用 opcache 扩展时构建报错,需要禁用 opcache + + if ($p->isLinux() && 0) { + // 构建报错 $options .= ' --enable-iouring '; $dependentLibraries[] = 'liburing'; + $p->withExportVariable('URING_CFLAGS', '$(pkg-config --cflags --static liburing)'); + $p->withExportVariable('URING_LIBS', '$(pkg-config --libs --static liburing)'); } - $options .= ' --enable-zts '; - - $ext = (new Extension('swoole_v6000')) - ->withAliasName('swoole') + $ext = (new Extension('swoole_v6')) ->withHomePage('https://github.com/swoole/swoole-src') ->withLicense('https://github.com/swoole/swoole-src/blob/master/LICENSE', Extension::LICENSE_APACHE2) ->withManual('https://wiki.swoole.com/#/') @@ -39,8 +50,7 @@ ->withDownloadScript( 'swoole-src', <<withBuildCached(false) @@ -48,28 +58,11 @@ ->withDependentLibraries(...$dependentLibraries) ->withDependentExtensions(...$dependentExtensions); - //call_user_func_array([$ext, 'withDependentLibraries'], $dependentLibraries); - //call_user_func_array([$ext, 'withDependentExtensions'], $dependentExtensions); - $p->addExtension($ext); $libs = $p->isMacos() ? '-lc++' : ' -lstdc++ '; $p->withVariable('LIBS', '$LIBS ' . $libs); - // 扩展钩子 写法 (下载 swoole v6 源码) - $p->withBeforeConfigureScript('swoole_v6', function (Preprocessor $p) { - $workdir = $p->getWorkDir(); - $cmd = <<withExportVariable('CARES_CFLAGS', '$(pkg-config --cflags --static libcares)'); $p->withExportVariable('CARES_LIBS', '$(pkg-config --libs --static libcares)'); - }; diff --git a/sapi/src/builder/extension/xlswriter.php b/sapi/src/builder/extension/xlswriter.php index b2161686ad..2e5239f6dc 100644 --- a/sapi/src/builder/extension/xlswriter.php +++ b/sapi/src/builder/extension/xlswriter.php @@ -10,7 +10,7 @@ ->withHomePage('https://github.com/viest/php-ext-xlswriter') ->withLicense('https://github.com/viest/php-ext-xlswriter/blob/master/LICENSE', Extension::LICENSE_BSD) ->withPeclVersion('1.5.5') - ->withFileHash('md5','924847f19c20a6d071e91b7d2488021d') + ->withFileHash('md5', '924847f19c20a6d071e91b7d2488021d') ->withOptions(' --with-xlswriter --enable-reader --with-openssl=' . OPENSSL_PREFIX) ->withDependentLibraries('openssl', 'zlib') ); diff --git a/sapi/src/builder/extension/yaml.php b/sapi/src/builder/extension/yaml.php index e25ac522ae..d710094f49 100644 --- a/sapi/src/builder/extension/yaml.php +++ b/sapi/src/builder/extension/yaml.php @@ -9,7 +9,7 @@ (new Extension('yaml')) ->withOptions('--with-yaml=' . LIBYAML_PREFIX) ->withPeclVersion('2.2.2') - ->withFileHash('md5','22678c1238f2c6848ff7d74b780a8307') + ->withFileHash('md5', '22678c1238f2c6848ff7d74b780a8307') ->withHomePage('https://github.com/php/pecl-file_formats-yaml') ->withLicense('https://github.com/php/pecl-file_formats-yaml/blob/php7/LICENSE', Extension::LICENSE_MIT) ->withDependentLibraries('libyaml') diff --git a/sapi/src/builder/library/bison.php b/sapi/src/builder/library/bison.php index 9e74898732..41c518741f 100644 --- a/sapi/src/builder/library/bison.php +++ b/sapi/src/builder/library/bison.php @@ -9,7 +9,7 @@ (new Library('bison')) ->withHomePage('https://www.gnu.org/software/bison/') ->withUrl('https://ftpmirror.gnu.org/gnu/bison/bison-3.8.tar.gz') - ->withFileHash('md5','b9971f4f58690b7737ab7592d5a0a4e0') + ->withFileHash('md5', 'b9971f4f58690b7737ab7592d5a0a4e0') ->withLicense('https://www.gnu.org/licenses/gpl-3.0.html', Library::LICENSE_GPL) ->withConfigure( " diff --git a/sapi/src/builder/library/brotli.php b/sapi/src/builder/library/brotli.php index c87330706d..ac8c00b684 100644 --- a/sapi/src/builder/library/brotli.php +++ b/sapi/src/builder/library/brotli.php @@ -11,7 +11,7 @@ ->withManual('https://github.com/google/brotli')//有多种构建方式,选择cmake 构建 ->withLicense('https://github.com/google/brotli/blob/master/LICENSE', Library::LICENSE_MIT) ->withUrl('https://github.com/google/brotli/archive/refs/tags/v1.0.9.tar.gz') - ->withFileHash('md5','c2274f0c7af8470ad514637c35bcee7d') + ->withFileHash('md5', 'c2274f0c7af8470ad514637c35bcee7d') ->withFile('brotli-1.0.9.tar.gz') ->withPrefix($brotli_prefix) ->withBuildScript( diff --git a/sapi/src/builder/library/bzip2.php b/sapi/src/builder/library/bzip2.php index 39e648db7c..f461187a09 100644 --- a/sapi/src/builder/library/bzip2.php +++ b/sapi/src/builder/library/bzip2.php @@ -10,7 +10,7 @@ ->withHomePage('https://www.sourceware.org/bzip2/') ->withManual('https://www.sourceware.org/bzip2/docs.html') ->withUrl('https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz') - ->withFileHash('md5','67e051268d0c475ea773822f7500d0e5') + ->withFileHash('md5', '67e051268d0c475ea773822f7500d0e5') ->withPrefix($bzip2_prefix) ->withMakeOptions('PREFIX=' . $bzip2_prefix) ->withMakeInstallOptions('PREFIX=' . $bzip2_prefix) diff --git a/sapi/src/builder/library/cares.php b/sapi/src/builder/library/cares.php index 64b6a6aae3..b21657b187 100644 --- a/sapi/src/builder/library/cares.php +++ b/sapi/src/builder/library/cares.php @@ -10,7 +10,7 @@ ->withManual('https://c-ares.org/') ->withLicense('https://c-ares.org/license.html', Library::LICENSE_MIT) ->withUrl('https://github.com/c-ares/c-ares/releases/download/cares-1_24_0/c-ares-1.24.0.tar.gz') - ->withFileHash('md5','25b872ee1c3bee8ff5f49b5f31307002') + ->withFileHash('md5', '25b872ee1c3bee8ff5f49b5f31307002') ->withPrefix(CARES_PREFIX) ->withConfigure('./configure --prefix=' . CARES_PREFIX . ' --enable-static --disable-shared --disable-tests') ->withPkgName('libcares') diff --git a/sapi/src/builder/library/curl.php b/sapi/src/builder/library/curl.php index 89a978c8b2..cfad4cc937 100644 --- a/sapi/src/builder/library/curl.php +++ b/sapi/src/builder/library/curl.php @@ -14,7 +14,7 @@ ->withManual('https://curl.se/docs/install.html') ->withLicense('https://github.com/curl/curl/blob/master/COPYING', Library::LICENSE_SPEC) ->withUrl('https://curl.se/download/curl-8.4.0.tar.gz') - ->withFileHash('md5','533e8a3b1228d5945a6a512537bea4c7') + ->withFileHash('md5', '533e8a3b1228d5945a6a512537bea4c7') ->withPrefix($curl_prefix) ->withConfigure( <<withUrl('https://sourceforge.net/projects/freetype/files/freetype2/2.13.2/freetype-2.13.2.tar.gz') ->withMd5sum('d99447cf00c5f2679918f66f2b5771f6') - ->withFileHash('md5','d99447cf00c5f2679918f66f2b5771f6') + ->withFileHash('md5', 'd99447cf00c5f2679918f66f2b5771f6') ->withPrefix($freetype_prefix) ->withConfigure( <<withManual('https://gmplib.org/') ->withLicense('https://www.gnu.org/licenses/old-licenses/gpl-2.0.html', Library::LICENSE_GPL) ->withUrl('https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.lz') - ->withFileHash('md5','db3f4050677df3ff2bd23422c0d3caa1') + ->withFileHash('md5', 'db3f4050677df3ff2bd23422c0d3caa1') ->withPrefix($gmp_prefix) ->withConfigure( <<withUrl('https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz') - ->withFileHash('md5','b8a4b8cf77f2e2f6e1341eac0aab2fc4') + ->withFileHash('md5', 'b8a4b8cf77f2e2f6e1341eac0aab2fc4') ->withManual('https://unicode-org.github.io/icu/userguide/icu_data/#overview') ->withPrefix($icu_prefix) ->withConfigure( diff --git a/sapi/src/builder/library/imagemagick.php b/sapi/src/builder/library/imagemagick.php index 12850068af..d47c033a55 100644 --- a/sapi/src/builder/library/imagemagick.php +++ b/sapi/src/builder/library/imagemagick.php @@ -13,7 +13,7 @@ ->withLicense('https://imagemagick.org/script/license.php', Library::LICENSE_APACHE2) ->withUrl('https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.1.1-20.tar.gz') ->withFile('ImageMagick-v7.1.1-20.tar.gz') - ->withFileHash('md5','90eb1a9263b47b7e844eb817fe08932c') + ->withFileHash('md5', '90eb1a9263b47b7e844eb817fe08932c') ->withPrefix($imagemagick_prefix) ->withConfigure( <<withHomePage('https://thrysoee.dk/editline/') ->withLicense('http://www.netbsd.org/Goals/redistribution.html', Library::LICENSE_BSD) ->withUrl('https://thrysoee.dk/editline/libedit-20230828-3.1.tar.gz') - ->withFileHash('md5','16bb2ab0d33bce3467f5cd4ec7d8f3ee') + ->withFileHash('md5', '16bb2ab0d33bce3467f5cd4ec7d8f3ee') ->withPrefix($libedit_prefix) ->withConfigure( <<withLicense('https://giflib.sourceforge.net/intro.html', Library::LICENSE_SPEC) ->withUrl('https://sourceforge.net/projects/giflib/files/giflib-5.2.1.tar.gz') ->withMd5sum('6f03aee4ebe54ac2cc1ab3e4b0a049e5') - ->withFileHash('md5','6f03aee4ebe54ac2cc1ab3e4b0a049e5') + ->withFileHash('md5', '6f03aee4ebe54ac2cc1ab3e4b0a049e5') ->withPrefix($libgif_prefix) ->withMakeOptions('libgif.a') ->withMakeInstallCommand('') diff --git a/sapi/src/builder/library/libiconv.php b/sapi/src/builder/library/libiconv.php index 5ae0479ef7..7f74986a23 100644 --- a/sapi/src/builder/library/libiconv.php +++ b/sapi/src/builder/library/libiconv.php @@ -10,9 +10,11 @@ ->withHomePage('https://www.gnu.org/software/libiconv/') ->withManual('https://www.gnu.org/software/libiconv/') ->withLicense('https://www.gnu.org/licenses/old-licenses/gpl-2.0.html', Library::LICENSE_GPL) - ->withUrl('https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz') + //->withUrl('https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz') + ->withUrl('https://ftpmirror.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz') ->withMirrorUrl('https://mirrors.tuna.tsinghua.edu.cn/gnu/libiconv/libiconv-1.17.tar.gz') ->withMirrorUrl('https://mirrors.ustc.edu.cn/gnu/libiconv/libiconv-1.17.tar.gz') + ->withFileHash('md5', 'd718cd5a59438be666d1575855be72c3') ->withPrefix($libiconv_prefix) ->withConfigure('./configure --prefix=' . $libiconv_prefix . ' enable_static=yes enable_shared=no') diff --git a/sapi/src/builder/library/libjpeg.php b/sapi/src/builder/library/libjpeg.php index a008e0d2d1..5d5986bda6 100644 --- a/sapi/src/builder/library/libjpeg.php +++ b/sapi/src/builder/library/libjpeg.php @@ -11,7 +11,7 @@ ->withLicense('https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/LICENSE.md', Library::LICENSE_BSD) ->withUrl('https://codeload.github.com/libjpeg-turbo/libjpeg-turbo/tar.gz/refs/tags/2.1.2') ->withFile('libjpeg-turbo-2.1.2.tar.gz') - ->withFileHash('md5','f02d78311298468c5c1d278507ad42f2') + ->withFileHash('md5', 'f02d78311298468c5c1d278507ad42f2') ->withPrefix($libjpeg_prefix) ->withConfigure( <<addLibrary( @@ -13,7 +12,7 @@ ->withLicense('https://github.com/lz4/lz4/blob/dev/LICENSE', Library::LICENSE_BSD) ->withUrl('https://github.com/lz4/lz4/archive/refs/tags/v1.9.4.tar.gz') ->withFile('lz4-v1.9.4.tar.gz') - ->withFileHash('md5','e9286adb64040071c5e23498bf753261') + ->withFileHash('md5', 'e9286adb64040071c5e23498bf753261') ->withPkgName('liblz4') ->withPrefix($liblz4_prefix) ->withConfigure( diff --git a/sapi/src/builder/library/libpng.php b/sapi/src/builder/library/libpng.php index 65232956bb..64470b3881 100644 --- a/sapi/src/builder/library/libpng.php +++ b/sapi/src/builder/library/libpng.php @@ -29,7 +29,8 @@ EOF ) */ - ->withBuildScript(<<withBuildScript( + <<withLicense('https://en.wikipedia.org/wiki/ISC_license', Library::LICENSE_SPEC) ->withHomePage('https://doc.libsodium.org/') ->withUrl('https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz') - ->withFileHash('md5','3ca9ebc13b6b4735acae0a6a4c4f9a95') + ->withFileHash('md5', '3ca9ebc13b6b4735acae0a6a4c4f9a95') ->withPrefix(LIBSODIUM_PREFIX) ->withConfigure('./configure --prefix=' . LIBSODIUM_PREFIX . ' --enable-static --disable-shared') ->withPkgName('libsodium') diff --git a/sapi/src/builder/library/libssh2.php b/sapi/src/builder/library/libssh2.php index ec89dec5eb..817b210d70 100644 --- a/sapi/src/builder/library/libssh2.php +++ b/sapi/src/builder/library/libssh2.php @@ -14,7 +14,7 @@ ->withManual('https://github.com/libssh2/libssh2.git') ->withManual('https://github.com/libssh2/libssh2/blob/master/docs/INSTALL_CMAKE.md') ->withUrl('https://libssh2.org/download/libssh2-1.11.0.tar.gz') - ->withFileHash('md5','a01d543fd891ca48fe47726540d50b17') + ->withFileHash('md5', 'a01d543fd891ca48fe47726540d50b17') ->withPrefix($libssh2_prefix) ->withBuildScript( <<withLicense('https://github.com/webmproject/libwebp/blob/main/COPYING', Library::LICENSE_SPEC) ->withUrl('https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.2.tar.gz') ->withFile('libwebp-v1.3.2.tar.gz') - ->withFileHash('md5','827d510b73c73fca3343140556dd2943') + ->withFileHash('md5', '827d510b73c73fca3343140556dd2943') ->withPrefix($libwebp_prefix) ->withConfigure( <<withManual('https://gitlab.gnome.org/GNOME/libxml2/-/wikis') ->withLicense('https://www.opensource.org/licenses/mit-license.html', Library::LICENSE_MIT) ->withUrl('https://gitlab.gnome.org/GNOME/libxml2/-/archive/v2.9.10/libxml2-v2.9.10.tar.gz') - ->withFileHash('md5','b18faee9173c3378c910f6d7d1493115') + ->withFileHash('md5', 'b18faee9173c3378c910f6d7d1493115') ->withPrefix($libxml2_prefix) ->withConfigure( <<withManual('https://gitlab.gnome.org/GNOME/libxslt/-/wikis/home') ->withLicense('http://www.opensource.org/licenses/mit-license.html', Library::LICENSE_MIT) ->withUrl('https://gitlab.gnome.org/GNOME/libxslt/-/archive/v1.1.34/libxslt-v1.1.34.tar.gz') - ->withFileHash('md5','0b89ee955fd13326d40e762242da7f84') + ->withFileHash('md5', '0b89ee955fd13326d40e762242da7f84') ->withPrefix($libxslt_prefix) ->withConfigure( <<withManual('https://pyyaml.org/wiki/LibYAML') ->withLicense('https://pyyaml.org/wiki/LibYAML', Library::LICENSE_MIT) ->withUrl('https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz') - ->withFileHash('md5','bb15429d8fb787e7d3f1c83ae129a999') + ->withFileHash('md5', 'bb15429d8fb787e7d3f1c83ae129a999') ->withPrefix(LIBYAML_PREFIX) ->withConfigure('./configure --prefix=' . LIBYAML_PREFIX . ' --enable-static --disable-shared') ->withPkgName('yaml-0.1') - ); }; diff --git a/sapi/src/builder/library/libzip.php b/sapi/src/builder/library/libzip.php index bf69b38a5d..61cb3b3dd6 100644 --- a/sapi/src/builder/library/libzip.php +++ b/sapi/src/builder/library/libzip.php @@ -15,7 +15,7 @@ ->withHomePage('https://libzip.org/') ->withLicense('https://libzip.org/license/', Library::LICENSE_BSD) ->withUrl('https://libzip.org/download/libzip-1.9.2.tar.gz') - ->withFileHash('md5','345a88add7e9dd58aa029ac5b5b361ad') + ->withFileHash('md5', '345a88add7e9dd58aa029ac5b5b361ad') ->withManual('https://libzip.org') ->withPrefix($libzip_prefix) ->withConfigure( diff --git a/sapi/src/builder/library/libzstd.php b/sapi/src/builder/library/libzstd.php index 0b74634b2a..3974e4ca0c 100644 --- a/sapi/src/builder/library/libzstd.php +++ b/sapi/src/builder/library/libzstd.php @@ -14,7 +14,7 @@ ->withLicense('https://github.com/facebook/zstd/blob/dev/COPYING', Library::LICENSE_GPL) ->withUrl('https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz') ->withFile('zstd-1.5.2.tar.gz') - ->withFileHash('md5','072b10f71f5820c24761a65f31f43e73') + ->withFileHash('md5', '072b10f71f5820c24761a65f31f43e73') ->withPrefix($libzstd_prefix) ->withConfigure( <<withUrl('https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.3.tar.gz') ->withMirrorUrl('https://mirrors.tuna.tsinghua.edu.cn/gnu/ncurses/ncurses-6.3.tar.gz') ->withMirrorUrl('https://mirrors.ustc.edu.cn/gnu/ncurses/ncurses-6.3.tar.gz') - ->withFileHash('md5','a2736befde5fee7d2b7eb45eb281cdbe') + ->withFileHash('md5', 'a2736befde5fee7d2b7eb45eb281cdbe') ->withPrefix($ncurses_prefix) ->withConfigure( <<withManual('https://nghttp2.org/') ->withLicense('https://github.com/nghttp2/nghttp2/blob/master/COPYING', Library::LICENSE_MIT) ->withUrl('https://github.com/nghttp2/nghttp2/releases/download/v1.57.0/nghttp2-1.57.0.tar.gz') - ->withFileHash('md5','d4c92d9a85e551bb084964d2be05929c') + ->withFileHash('md5', 'd4c92d9a85e551bb084964d2be05929c') ->withPrefix($nghttp2_prefix) ->withConfigure( <<withManual('https://nghttp2.org/nghttp3/') ->withUrl('https://github.com/ngtcp2/nghttp3/archive/refs/tags/v1.0.0.tar.gz') ->withFile('nghttp3-v1.0.0.tar.gz') - ->withFileHash('md5','0446cce05f003bace3ac51277181ae51') + ->withFileHash('md5', '0446cce05f003bace3ac51277181ae51') ->withPrefix($nghttp3_prefix) ->withConfigure( <<withManual('https://curl.se/docs/http3.html') ->withUrl('https://github.com/ngtcp2/ngtcp2/releases/download/v1.1.0/ngtcp2-1.1.0.tar.gz') ->withFile('ngtcp2-1.1.0.tar.gz') - ->withFileHash('md5','e05c501244a2af34b492753763c74e04') + ->withFileHash('md5', 'e05c501244a2af34b492753763c74e04') ->withPrefix($ngtcp2_prefix) ->withConfigure( <<withLicense('https://github.com/kkos/oniguruma/blob/master/COPYING', Library::LICENSE_SPEC) ->withUrl('https://github.com/kkos/oniguruma/archive/refs/tags/v6.9.9.tar.gz') ->withFile('oniguruma-v6.9.9.tar.gz') - ->withFileHash('md5','6a3defb3d5e57c2fa4b6f3b4ec6de28b') + ->withFileHash('md5', '6a3defb3d5e57c2fa4b6f3b4ec6de28b') ->withPrefix($oniguruma_prefix) ->withConfigure( './autogen.sh && ./configure --prefix=' . $oniguruma_prefix . ' --enable-static --disable-shared' diff --git a/sapi/src/builder/library/openssl.php b/sapi/src/builder/library/openssl.php index 2c68e394ec..1c71e9449d 100644 --- a/sapi/src/builder/library/openssl.php +++ b/sapi/src/builder/library/openssl.php @@ -13,7 +13,7 @@ ->withLicense('https://github.com/openssl/openssl/blob/master/LICENSE.txt', Library::LICENSE_APACHE2) ->withManual('https://www.openssl.org/docs/') ->withUrl('https://github.com/quictls/openssl/archive/refs/tags/openssl-3.1.4-quic1.tar.gz') - ->withFileHash('md5','ba2d8774a51a38f2481aad43d05aea57') + ->withFileHash('md5', 'ba2d8774a51a38f2481aad43d05aea57') ->withPrefix($openssl_prefix) ->withConfigure( <<withUrl('https://ftp.gnu.org/gnu/readline/readline-8.2.tar.gz') ->withMirrorUrl('https://mirrors.tuna.tsinghua.edu.cn/gnu/readline/readline-8.2.tar.gz') ->withMirrorUrl('https://mirrors.ustc.edu.cn/gnu/readline/readline-8.2.tar.gz') - ->withFileHash('md5','4aa1b31be779e6b84f9a96cb66bc50f6') + ->withFileHash('md5', '4aa1b31be779e6b84f9a96cb66bc50f6') ->withPrefix(READLINE_PREFIX) ->withConfigure( <<withLicense('https://www.sqlite.org/copyright.html', Library::LICENSE_SPEC) ->withManual('https://www.sqlite.org/docs.html') ->withUrl('https://www.sqlite.org/2023/sqlite-autoconf-3430200.tar.gz') - ->withFileHash('sha256','6d422b6f62c4de2ca80d61860e3a3fb693554d2f75bb1aaca743ccc4d6f609f0') + ->withFileHash('sha256', '6d422b6f62c4de2ca80d61860e3a3fb693554d2f75bb1aaca743ccc4d6f609f0') ->withPrefix($sqlite3_prefix) ->withConfigure( <<withHomePage('https://github.com/lurcher/unixODBC') ->withLicense('https://github.com/lurcher/unixODBC/blob/master/LICENSE', Library::LICENSE_LGPL) ->withUrl('https://github.com/lurcher/unixODBC/releases/download/2.3.11/unixODBC-2.3.11.tar.gz') - ->withFileHash('md5','0ff1fdbcb4c3c7dc2357f3fd6ba09169') + ->withFileHash('md5', '0ff1fdbcb4c3c7dc2357f3fd6ba09169') ->withPrefix($unix_odbc_prefix) ->withPreInstallCommand( 'alpine', diff --git a/sapi/src/builder/library/zlib.php b/sapi/src/builder/library/zlib.php index b007d6a8b5..4166d46ddd 100644 --- a/sapi/src/builder/library/zlib.php +++ b/sapi/src/builder/library/zlib.php @@ -10,7 +10,7 @@ ->withLicense('https://zlib.net/zlib_license.html', Library::LICENSE_SPEC) ->withUrl('https://github.com/madler/zlib/archive/refs/tags/v1.3.1.tar.gz') ->withFile('zlib-v1.3.1.tar.gz') - ->withFileHash('md5','ddb17dbbf2178807384e57ba0d81e6a1') + ->withFileHash('md5', 'ddb17dbbf2178807384e57ba0d81e6a1') ->withPrefix(ZLIB_PREFIX) ->withConfigure('./configure --prefix=' . ZLIB_PREFIX . ' --static') ->withPkgName('zlib') diff --git a/sapi/src/constants.php b/sapi/src/constants.php index 5fb7eb78d8..242a476737 100644 --- a/sapi/src/constants.php +++ b/sapi/src/constants.php @@ -83,4 +83,3 @@ define("EXAMPLE_PREFIX", $p->getGlobalPrefix() . '/example'); - diff --git a/sapi/src/template/make.php b/sapi/src/template/make.php index f19594a755..25a7505e98 100755 --- a/sapi/src/template/make.php +++ b/sapi/src/template/make.php @@ -365,7 +365,7 @@ help() { set +x - echo "./make.sh docker-build [china|ustc|tuna]" + echo "./make.sh docker-build [ china | ustc | tuna ]" echo "./make.sh docker-bash" echo "./make.sh docker-commit" echo "./make.sh docker-push" @@ -394,11 +394,19 @@ 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 | ustc | tuna) + CONTAINER_BASE_IMAGE="hub.atomgit.com/library/alpine:3.18" + ;; + esac fi cd ${__PROJECT_DIR__}/sapi/docker - docker build -t :getBaseImageTag() ?> -f getBaseImageDockerFile() ?> . --build-arg="MIRROR=${MIRROR}" + echo "MIRROR=${MIRROR}" + echo "BASE_IMAGE=${CONTAINER_BASE_IMAGE}" + docker build --no-cache -t :getBaseImageTag() ?> -f Dockerfile . --build-arg="MIRROR=${MIRROR}" --build-arg="BASE_IMAGE=${CONTAINER_BASE_IMAGE}" exit 0 elif [ "$1" = "docker-bash" ] ;then container=$(docker ps -a -f name= | tail -n +2 2> /dev/null) @@ -525,7 +533,7 @@ echo $LIBS elif [ "$1" = "sync" ] ;then PHP_CLI=$(which php) - test -f ${__PROJECT_DIR__}/bin/runtime/php && PHP_CLI="${__PROJECT_DIR__}/bin/runtime/php -d curl.cainfo=${__PROJECT_DIR__}/bin/runtime/cacert.pem -d openssl.cafile=${__PROJECT_DIR__}/bin/runtime/cacert.pem" + test -f ${__PROJECT_DIR__}/bin/runtime/php && PHP_CLI="${__PROJECT_DIR__}/bin/runtime/php -c ${__PROJECT_DIR__}/bin/runtime/php.ini -d curl.cainfo=${__PROJECT_DIR__}/bin/runtime/cacert.pem -d openssl.cafile=${__PROJECT_DIR__}/bin/runtime/cacert.pem" $PHP_CLI -v $PHP_CLI sync-source-code.php --action run exit 0 diff --git a/setup-php-runtime.sh b/setup-php-runtime.sh index 3cb838eeae..c63dc79e6d 100644 --- a/setup-php-runtime.sh +++ b/setup-php-runtime.sh @@ -48,7 +48,8 @@ case $ARCH in ;; esac -SWOOLE_VERSION='v5.1.3' +APP_VERSION='v5.1.3' +APP_NAME='swoole-cli' VERSION='v5.1.3.0' mkdir -p bin/runtime @@ -56,12 +57,12 @@ mkdir -p var/runtime cd ${__PROJECT__}/var/runtime -SWOOLE_CLI_DOWNLOAD_URL="https://github.com/swoole/swoole-cli/releases/download/${VERSION}/swoole-cli-${SWOOLE_VERSION}-${OS}-${ARCH}.tar.xz" +APP_DOWNLOAD_URL="https://github.com/swoole/swoole-cli/releases/download/${VERSION}/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.tar.xz" COMPOSER_DOWNLOAD_URL="https://getcomposer.org/download/latest-stable/composer.phar" CACERT_DOWNLOAD_URL="https://curl.se/ca/cacert.pem" if [ $OS = 'windows' ]; then - SWOOLE_CLI_DOWNLOAD_URL="https://github.com/swoole/swoole-cli/releases/download/${VERSION}/swoole-cli-${SWOOLE_VERSION}-cygwin-${ARCH}.zip" + APP_DOWNLOAD_URL="https://github.com/swoole/swoole-cli/releases/download/${VERSION}/${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}.zip" fi MIRROR='' @@ -89,10 +90,10 @@ done case "$MIRROR" in china) - SWOOLE_CLI_DOWNLOAD_URL="https://wenda-1252906962.file.myqcloud.com/dist/swoole-cli-${SWOOLE_VERSION}-${OS}-${ARCH}.tar.xz" + APP_DOWNLOAD_URL="https://wenda-1252906962.file.myqcloud.com/dist/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.tar.xz" COMPOSER_DOWNLOAD_URL="https://mirrors.tencent.com/composer/composer.phar" if [ $OS = 'windows' ]; then - SWOOLE_CLI_DOWNLOAD_URL="https://wenda-1252906962.file.myqcloud.com/dist/swoole-cli-${SWOOLE_VERSION}-cygwin-${ARCH}.zip" + APP_DOWNLOAD_URL="https://wenda-1252906962.file.myqcloud.com/dist/${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}.zip" fi ;; @@ -103,25 +104,20 @@ chmod a+x composer.phar test -f cacert.pem || curl -LSo cacert.pem ${CACERT_DOWNLOAD_URL} -SWOOLE_CLI_RUNTIME="swoole-cli-${SWOOLE_VERSION}-${OS}-${ARCH}" +APP_RUNTIME="${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}" if [ $OS = 'windows' ]; then { - SWOOLE_CLI_RUNTIME="swoole-cli-${SWOOLE_VERSION}-cygwin-${ARCH}" - test -f ${SWOOLE_CLI_RUNTIME}.zip || curl -LSo ${SWOOLE_CLI_RUNTIME}.zip ${SWOOLE_CLI_DOWNLOAD_URL} - test -d ${SWOOLE_CLI_RUNTIME} && rm -rf ${SWOOLE_CLI_RUNTIME} - unzip "${SWOOLE_CLI_RUNTIME}.zip" - test -d ${__PROJECT__}/${SWOOLE_CLI_RUNTIME} && rm -rf ${__PROJECT__}/${SWOOLE_CLI_RUNTIME} - cp -f composer.phar ${SWOOLE_CLI_RUNTIME}/bin/ - #cp -f ${SWOOLE_CLI_RUNTIME}/bin/swoole-cli.exe ${SWOOLE_CLI_RUNTIME}/bin/php.exe - mv ${SWOOLE_CLI_RUNTIME} ${__PROJECT__} - echo + APP_RUNTIME="${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}" + test -f ${APP_RUNTIME}.zip || curl -LSo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL} + test -d ${APP_RUNTIME} && rm -rf ${APP_RUNTIME} + unzip "${APP_RUNTIME}.zip" exit 0 } else - test -f ${SWOOLE_CLI_RUNTIME}.tar.xz || curl -LSo ${SWOOLE_CLI_RUNTIME}.tar.xz ${SWOOLE_CLI_DOWNLOAD_URL} - test -f ${SWOOLE_CLI_RUNTIME}.tar || xz -d -k ${SWOOLE_CLI_RUNTIME}.tar.xz - test -f swoole-cli || tar -xvf ${SWOOLE_CLI_RUNTIME}.tar + test -f ${APP_RUNTIME}.tar.xz || curl -LSo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL} + test -f ${APP_RUNTIME}.tar || xz -d -k ${APP_RUNTIME}.tar.xz + test -f swoole-cli || tar -xvf ${APP_RUNTIME}.tar chmod a+x swoole-cli cp -f ${__PROJECT__}/var/runtime/swoole-cli ${__PROJECT__}/bin/runtime/php fi @@ -135,6 +131,19 @@ cat >${__PROJECT__}/bin/runtime/php.ini < ext/opcache/php_opcache.h - cp -r $SRC/ext/openssl/ ./ext - cp -r $SRC/ext/pcntl/ ./ext - cp -r $SRC/ext/pcre/ ./ext - cp -r $SRC/ext/pdo/ ./ext - cp -r $SRC/ext/pdo_mysql/ ./ext - cp -r $SRC/ext/phar/ ./ext + cp -rf $SRC/ext/bcmath/ ./ext/bcmath + cp -rf $SRC/ext/bz2/ ./ext/bz2 + cp -rf $SRC/ext/calendar/ ./ext/calendar + cp -rf $SRC/ext/ctype/ ./ext/ctype + cp -rf $SRC/ext/curl/ ./ext/curl + cp -rf $SRC/ext/date/ ./ext/date + cp -rf $SRC/ext/dom/ ./ext/dom + cp -rf $SRC/ext/exif/ ./ext/exif + cp -rf $SRC/ext/fileinfo/ ./ext/fileinfo + cp -rf $SRC/ext/filter/ ./ext/filter + cp -rf $SRC/ext/gd/ ./ext/gd + cp -rf $SRC/ext/gettext/ ./ext/gettext + cp -rf $SRC/ext/gmp/ ./ext/gmp + cp -rf $SRC/ext/hash/ ./ext/hash + cp -rf $SRC/ext/iconv/ ./ext/iconv + cp -rf $SRC/ext/intl/ ./ext/intl + cp -rf $SRC/ext/json/ ./ext/json + cp -rf $SRC/ext/libxml/ ./ext/libxml + cp -rf $SRC/ext/mbstring/ ./ext/mbstring + cp -rf $SRC/ext/mysqli/ ./ext/mysqli + cp -rf $SRC/ext/mysqlnd/ ./ext/mysqlnd + cp -rf $SRC/ext/opcache/ ./ext/opcache + + sed -i.backup 's/ext_shared=yes/ext_shared=no/g' ext/opcache/config.m4 + sed -i.backup 's/shared,,/$ext_shared,,/g' ext/opcache/config.m4 + # echo '#include "php.h"\n\nextern zend_module_entry opcache_module_entry;\n#define phpext_opcache_ptr &opcache_module_entry\n' > ext/opcache/php_opcache.h + cat > ext/opcache/php_opcache.h <> ext/phar/phar_internal.h - cp -r $SRC/ext/posix/ ./ext - cp -r $SRC/ext/readline/ ./ext - cp -r $SRC/ext/reflection/ ./ext - cp -r $SRC/ext/session/ ./ext - cp -r $SRC/ext/simplexml/ ./ext - cp -r $SRC/ext/soap/ ./ext - cp -r $SRC/ext/sockets/ ./ext - cp -r $SRC/ext/sodium/ ./ext - cp -r $SRC/ext/spl/ ./ext - cp -r $SRC/ext/sqlite3/ ./ext - cp -r $SRC/ext/standard/ ./ext - cp -r $SRC/ext/sysvshm/ ./ext - cp -r $SRC/ext/tokenizer/ ./ext - cp -r $SRC/ext/xml/ ./ext - cp -r $SRC/ext/xmlreader/ ./ext - cp -r $SRC/ext/xmlwriter/ ./ext - cp -r $SRC/ext/xsl/ ./ext - cp -r $SRC/ext/zip/ ./ext - cp -r $SRC/ext/zlib/ ./ext + + cp -rf $SRC/ext/posix/ ./ext/posix + cp -rf $SRC/ext/readline/ ./ext/readline + cp -rf $SRC/ext/reflection/ ./ext/reflection + cp -rf $SRC/ext/session/ ./ext/session + cp -rf $SRC/ext/simplexml/ ./ext/simplexml + cp -rf $SRC/ext/soap/ ./ext/soap + cp -rf $SRC/ext/sockets/ ./ext/sockets + cp -rf $SRC/ext/sodium/ ./ext/sodium + cp -rf $SRC/ext/spl/ ./ext/spl + cp -rf $SRC/ext/sqlite3/ ./ext/sqlite3 + cp -rf $SRC/ext/standard/ ./ext/standard + cp -rf $SRC/ext/sysvshm/ ./ext/sysvshm + cp -rf $SRC/ext/tokenizer/ ./ext/tokenizer + cp -rf $SRC/ext/xml/ ./ext/xml + cp -rf $SRC/ext/xmlreader/ ./ext/xmlreader + cp -rf $SRC/ext/xmlwriter/ ./ext/xmlwriter + cp -rf $SRC/ext/xsl/ ./ext/xsl + cp -rf $SRC/ext/zip/ ./ext/zip + cp -rf $SRC/ext/zlib/ ./ext/zlib # main - cp -r $SRC/main ./ + cp -rf $SRC/main/ ./main sed -i.backup 's/\/\* start Zend extensions \*\//\/\* start Zend extensions \*\/\n#ifdef PHP_ENABLE_OPCACHE\n\textern zend_extension zend_extension_entry;\n\tzend_register_extension(\&zend_extension_entry, NULL);\n#endif/g' main/main.c # build - cp -r $SRC/build ./ + cp -rf $SRC/build/ ./build + # TSRM - cp -r ./TSRM/TSRM.h main/TSRM.h - cp -r $SRC/configure.ac ./ + cp -rf $SRC/TSRM/ ./TSRM + cp -rf $SRC/TSRM/TSRM.h main/TSRM.h - # fpm - cp -r $SRC/sapi/fpm/fpm ./sapi/cli - sed 's/int main(int argc, char *argv[])/int fpm_main(int argc, char *argv[])/g' ./sapi/cli/fpm/main.c - sed 's/{'-', 0, NULL}/{'P', 0, "fpm"},\n {'-', 0, NULL}/g' ./sapi/cli/fpm/main.c + cp -f $SRC/configure.ac ./configure.ac + cp -f $SRC/buildconf ./buildconf + cp -f $SRC/run-tests.php ./run-tests.php + + # scripts + cp -rf $SRC/scripts/ ./scripts + + # 在sed命令中,常见的需要转义的字符有:\、/、$、&、.、*、[、]等 + # 反斜杠、正斜杠、美元符号、引用符号、点号、星号、方括号等 + + test -f main/main.c.backup && rm -f main/main.c.backup + test -f ext/opcache/config.m4.backup && rm -f ext/opcache/config.m4.backup exit 0 + # fpm + cp -rf $SRC/sapi/fpm/fpm ./sapi/cli/ + sed -i.backup 's/int main(int argc, char \*argv\[\])/int fpm_main(int argc, char \*argv\[\])/g' ./sapi/cli/fpm/fpm_main.c + sed -i.backup 's/{'-', 0, NULL}/{'P', 0, "fpm"},\n {'-', 0, NULL}/g' ./sapi/cli/fpm/fpm_main.c + + + # exit 0 + # cli - cp -r $SRC/sapi/cli/ps_title.c ./sapi/cli - cp -r $SRC/sapi/cli/generate_mime_type_map.php ./sapi/cli - cp -r $SRC/sapi/cli/php.1.in ./sapi/cli + cp -rf $SRC/sapi/cli/ps_title.c ./sapi/cli + cp -rf $SRC/sapi/cli/generate_mime_type_map.php ./sapi/cli + cp -rf $SRC/sapi/cli/php.1.in ./sapi/cli EOF; - -echo $cmd . PHP_EOL; -`$cmd`; echo PHP_EOL; -echo "action : " . $action . ' done !' . PHP_EOL; +# 显示将要执行的同步命令 +echo $SYNC_SOURCE_CODE_SHELL; +echo PHP_EOL; +echo PHP_EOL; +# 执行同步 +echo "synchronizing .... "; +echo PHP_EOL; +echo PHP_EOL; +echo `$SYNC_SOURCE_CODE_SHELL`; +echo PHP_EOL; +echo PHP_EOL; +echo "synchronizing end "; +echo PHP_EOL; +echo PHP_EOL; +echo "action: " . $action . ' done !' . PHP_EOL;