diff --git a/.github/workflows/artifact-hash.yml b/.github/workflows/artifact-hash.yml new file mode 100644 index 0000000000..73c537eb89 --- /dev/null +++ b/.github/workflows/artifact-hash.yml @@ -0,0 +1,32 @@ +name: artifact-hash + +on: + workflow_dispatch: + inputs: + version: + required: true + description: "发版 版本号 tag" + default: 'v1.6.0' + type: string + php-version: + required: true + description: "PHP 版本号 " + default: 'v8.1.30,v8.2.25,v8.3.13,v8.4.1' + type: string + +jobs: + generate-artifact-hash: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Show Release File Hash + run: | + bash sapi/scripts/generate-artifact-hash.sh --version ${{ inputs.version }} --php-version ${{ inputs.php-version }} + + - name: production artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.version }}-sha256sum + retention-days: 90 + path: | + ${{ inputs.version }}-sha256sum diff --git a/docs/Cygwin.md b/docs/Cygwin.md index fccdf87601..2c53dd0e44 100755 --- a/docs/Cygwin.md +++ b/docs/Cygwin.md @@ -116,6 +116,7 @@ libpq-devel (如果编译pgsql扩展) libpq5 (如果编译pgsql扩展) libicu-devel icu +libzstd-devel ``` diff --git a/docs/options.md b/docs/options.md index be38819a6f..456fdbd278 100644 --- a/docs/options.md +++ b/docs/options.md @@ -215,3 +215,12 @@ show-tarball-hash ---- 计算并显示已下载的源码包 HASH 值 + +with-libavif +---- +GD库支持 AVIF图片格式 + +with-iouring +---- +swoole 启用支持 iouring 特性 + diff --git a/sapi/quickstart/windows/install-cygwin.bat b/sapi/quickstart/windows/install-cygwin.bat index 0f5c641412..efc525ef24 100644 --- a/sapi/quickstart/windows/install-cygwin.bat +++ b/sapi/quickstart/windows/install-cygwin.bat @@ -3,8 +3,10 @@ setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel -setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages zip unzip +setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages zip unzip -setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages libpq5 libpq-devel +setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages libpq5 libpq-devel + +setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages libzstd-devel diff --git a/sapi/scripts/cygwin/cygwin-config.sh b/sapi/scripts/cygwin/cygwin-config.sh index e529b4b8e5..b5e074000b 100755 --- a/sapi/scripts/cygwin/cygwin-config.sh +++ b/sapi/scripts/cygwin/cygwin-config.sh @@ -48,7 +48,6 @@ fi ./buildconf --force test -f Makefile && make clean ./configure --prefix=/usr --disable-all \ - --enable-opcache \ --disable-fiber-asm \ --without-pcre-jit \ --with-openssl --enable-openssl \ @@ -83,6 +82,12 @@ test -f Makefile && make clean --enable-swoole --enable-sockets --enable-mysqlnd --enable-swoole-curl --enable-cares \ --enable-swoole-pgsql \ --enable-swoole-sqlite \ + --enable-swoole-thread \ + --enable-brotli \ + --enable-zstd \ + --enable-redis \ + --enable-opcache \ + --disable-opcache-jit \ --enable-redis \ --with-imagick \ --with-yaml \ diff --git a/sapi/scripts/cygwin/install-cygwin.sh b/sapi/scripts/cygwin/install-cygwin.sh index 910cefd94e..79d61128a9 100644 --- a/sapi/scripts/cygwin/install-cygwin.sh +++ b/sapi/scripts/cygwin/install-cygwin.sh @@ -15,7 +15,6 @@ ROOT=${__PROJECT__} # cp -f /cygdrive/c/setup-x86_64.exe /cygdrive/c/cygwin/bin/setup-x86_64.exe # cp -f /cygdrive/c/setup.exe /cygdrive/c/cygwin/bin/setup-x86_64.exe - # download cygwin # wget https://cygwin.com/setup-x86_64.exe @@ -28,12 +27,11 @@ ROOT=${__PROJECT__} ## https://mirrors.tuna.tsinghua.edu.cn/cygwin/ ## 多个包之间,用逗号分隔 - SITE='https://mirrors.kernel.org/sourceware/cygwin/' while [ $# -gt 0 ]; do case "$1" in --mirror) - if [ "$2" = 'china' ] ; then + if [ "$2" = 'china' ]; then SITE='https://mirrors.ustc.edu.cn/cygwin/' fi ;; @@ -47,8 +45,7 @@ done # setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site http://mirrors.ustc.edu.cn/cygwin/ --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel,zip,unzip #setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site http://mirrors.ustc.edu.cn/cygwin/ --packages - -setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site $SITE --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel,zip,unzip -setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site $SITE --packages zip unzip icu libicu-devel -setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site $SITE --packages libpq5 libpq-devel - +setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site $SITE --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel,zip,unzip +setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site $SITE --packages zip unzip icu libicu-devel +setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site $SITE --packages libpq5 libpq-devel +setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site $SITE --packages libzstd-devel diff --git a/sapi/scripts/generate-artifact-hash.sh b/sapi/scripts/generate-artifact-hash.sh new file mode 100644 index 0000000000..bc859cd57d --- /dev/null +++ b/sapi/scripts/generate-artifact-hash.sh @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +set -xu +__DIR__=$( + cd "$(dirname "$0")" + pwd +) +__PROJECT__=$( + cd ${__DIR__}/../../ + pwd +) + +cd ${__PROJECT__} + +OS=$(uname -s) +case $OS in +'Linux') + OS="linux" + ;; +'Darwin') + OS="macos" + ;; +*) + case $OS in + 'MSYS_NT'*) + OS="windows" + ;; + 'MINGW64_NT'*) + OS="windows" + ;; + *) + echo '暂未配置的 OS ' + exit 0 + ;; + esac + ;; +esac + +APP_VERSION='v8.3.13' +APP_NAME='php-cli' +VERSION='v1.6.0' + +while [ $# -gt 0 ]; do + case "$1" in + --proxy) + export HTTP_PROXY="$2" + export HTTPS_PROXY="$2" + NO_PROXY="127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16" + NO_PROXY="${NO_PROXY},::1/128,fe80::/10,fd00::/8,ff00::/8" + NO_PROXY="${NO_PROXY},localhost" + export NO_PROXY="${NO_PROXY},.myqcloud.com,.swoole.com" + ;; + --version) + # 指定发布 TAG + if [ $OS = "macos" ]; then + X_VERSION=$(echo "$2" | grep -E '^v\d\.\d{1,2}\.\d{1,2}$') + elif [ $OS = "linux" ]; then + X_VERSION=$(echo "$2" | grep -P '^v\d\.\d{1,2}\.\d{1,2}$') + else + X_VERSION='' + fi + + if [[ -n $X_VERSION ]]; then + { + VERSION=$X_VERSION + } + else + { + echo '--version vx.x.x error !' + exit 0 + } + fi + ;; + --php-version) + # 指定 PHP 版本 + if [ $OS = "macos" ]; then + X_APP_VERSION=$(echo "$2" | grep -Eo '^v\d\.\d{1,2}\.\d{1,2}') + elif [ $OS = "linux" ]; then + X_APP_VERSION=$(echo "$2" | grep -Po '^v\d\.\d{1,2}\.\d{1,2}') + else + X_VERSION='' + X_APP_VERSION='' + fi + + if [[ -n $X_APP_VERSION ]]; then + { + APP_VERSION=$X_APP_VERSION + } + else + { + echo '--php-version vx.x.x error !' + exit 0 + } + fi + ;; + --*) + echo "Illegal option $1" + exit 0 + ;; + esac + shift $(($# > 0 ? 1 : 0)) +done + +mkdir -p ${__PROJECT__}/var/artifact-hash/${VERSION} +cd ${__PROJECT__}/var/artifact-hash/${VERSION} + +UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME() { + OS="$1" + ARCH="$2" + APP_VERSION="$3" + APP_DOWNLOAD_URL="https://github.com/swoole/build-static-php/releases/download/${VERSION}/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.tar.xz" + APP_RUNTIME="${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}" + test -f ${APP_RUNTIME}.tar.xz || curl -LSo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL} + + APP_DOWNLOAD_URL="https://github.com/swoole/build-static-php/releases/download/${VERSION}/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}-debug.tar.xz" + APP_RUNTIME="${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}-debug" + test -f ${APP_RUNTIME}.tar.xz || curl -LSo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL} +} + +UNIX_DOWNLOAD() { + APP_VERSION="$1" + UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME "linux" "x64" "${APP_VERSION}" + UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME "linux" "arm64" "${APP_VERSION}" + UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME "macos" "x64" "${APP_VERSION}" + UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME "macos" "arm64" "${APP_VERSION}" +} + +WINDOWS_DOWNLOAD_SWOOLE_CLIE_RUNTIME() { + APP_VERSION="$1" + ARCH="x64" + APP_DOWNLOAD_URL="https://github.com/swoole/build-static-php/releases/download/${VERSION}/${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}.zip" + + APP_RUNTIME="${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}" + test -f ${APP_RUNTIME}.zip || curl -LSo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL} + test -f all-deps.zip || curl -LSo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/v5.1.5.1/all-deps.zip + +} +WINDOWS_DOWNLOAD() { + WINDOWS_DOWNLOAD_SWOOLE_CLIE_RUNTIME "$1" +} + +RUN_DOWNLOAD() { + UNIX_DOWNLOAD "$1" + WINDOWS_DOWNLOAD "$1" +} + +DOWNLOAD() { + declare -A PHP_VERSIONS + PHP_VERSIONS[0]="v8.2.25" + PHP_VERSIONS[1]="v8.1.30" + PHP_VERSIONS[2]="v8.3.13" + PHP_VERSIONS[3]="v8.4.1" + for i in "${!PHP_VERSIONS[@]}"; do + # echo ${PHP_VERSIONS[$i]} + RUN_DOWNLOAD "${PHP_VERSIONS[$i]}" + done + +} + +DOWNLOAD + +ls -p | grep -v '/$' | xargs sha256sum + +ls -p | grep -v '/$' | xargs sha256sum >${__PROJECT__}/${VERSION}-sha256sum diff --git a/sapi/src/builder/extension/swoole.php b/sapi/src/builder/extension/swoole.php index a3e39f8867..a509d5a345 100644 --- a/sapi/src/builder/extension/swoole.php +++ b/sapi/src/builder/extension/swoole.php @@ -4,16 +4,24 @@ use SwooleCli\Extension; return function (Preprocessor $p) { - $options = []; + + $dependentLibraries = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2', 'sqlite3', 'unix_odbc', 'pgsql']; + $dependentExtensions = ['curl', 'openssl', 'sockets', 'mysqlnd', 'pdo']; + $swoole_tag = 'v5.1.6'; if (BUILD_CUSTOM_PHP_VERSION_ID >= 8040) { // v5.1.x 不支持 PHP 8.4 // swoole 支持计划 https://wiki.swoole.com/zh-cn/#/version/supported?id=%e6%94%af%e6%8c%81%e8%ae%a1%e5%88%92 - $swoole_tag = 'v6.0.0-rc1'; + $swoole_tag = 'master'; $options[] = '--enable-swoole-thread'; $options[] = '--enable-zts'; $options[] = '--disable-opcache-jit'; + $options[] = '--enable-brotli'; + $options[] = '--enable-zstd'; + $dependentLibraries[] = 'libzstd'; + $p->withExportVariable('ZSTD_CFLAGS', '$(pkg-config --cflags --static libzstd)'); + $p->withExportVariable('ZSTD_LIBS', '$(pkg-config --libs --static libzstd)'); } $file = "swoole-{$swoole_tag}.tar.gz"; @@ -28,8 +36,6 @@ //call_user_func_array([$ext, 'withDependentLibraries'], $dependentLibraries); //call_user_func_array([$ext, 'withDependentExtensions'], $dependentExtensions); - $dependentLibraries = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2', 'sqlite3', 'unix_odbc', 'pgsql']; - $dependentExtensions = ['curl', 'openssl', 'sockets', 'mysqlnd', 'pdo']; $options[] = '--enable-swoole'; $options[] = '--enable-sockets'; @@ -42,6 +48,7 @@ $options[] = '--enable-swoole-sqlite'; $options[] = '--with-swoole-odbc=unixODBC,' . UNIX_ODBC_PREFIX; + $p->addExtension((new Extension('swoole')) ->withHomePage('https://github.com/swoole/swoole-src') ->withLicense('https://github.com/swoole/swoole-src/blob/master/LICENSE', Extension::LICENSE_APACHE2) diff --git a/sapi/src/builder/extension/swoole_latest.php b/sapi/src/builder/extension/swoole_latest.php index 86d40bf2b1..79ad44add7 100644 --- a/sapi/src/builder/extension/swoole_latest.php +++ b/sapi/src/builder/extension/swoole_latest.php @@ -13,7 +13,8 @@ $options[] = ' --enable-swoole-coro-time '; } - $dependentLibraries = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2', 'sqlite3', 'unix_odbc', 'pgsql']; + $dependentLibraries = ['curl', 'openssl', 'cares', 'zlib', 'brotli', 'nghttp2', 'sqlite3', 'unix_odbc', 'pgsql', 'libzstd']; + $dependentExtensions = ['curl', 'openssl', 'sockets', 'mysqlnd', 'pdo']; $options[] = '--enable-swoole'; @@ -28,6 +29,9 @@ $options[] = '--with-swoole-odbc=unixODBC,' . UNIX_ODBC_PREFIX; $options[] = '--enable-swoole-thread'; $options[] = '--enable-zts'; + $options[] = '--enable-brotli'; + $options[] = '--enable-zstd'; + $options[] = '--disable-opcache-jit'; if ($p->isLinux() && $p->getInputOption('with-iouring')) { @@ -37,7 +41,7 @@ $p->withExportVariable('URING_LIBS', '$(pkg-config --libs --static liburing)'); } - $ext = (new Extension('swoole')) + $p->addExtension((new Extension('swoole')) ->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/#/') @@ -53,13 +57,16 @@ ->withBuildCached(false) ->withAutoUpdateFile() ->withDependentLibraries(...$dependentLibraries) - ->withDependentExtensions(...$dependentExtensions); + ->withDependentExtensions(...$dependentExtensions) + ); //call_user_func_array([$ext, 'withDependentLibraries'], $dependentLibraries); //call_user_func_array([$ext, 'withDependentExtensions'], $dependentExtensions); - $p->addExtension($ext); $p->withVariable('LIBS', '$LIBS ' . ($p->isMacos() ? '-lc++' : '-lstdc++')); $p->withExportVariable('CARES_CFLAGS', '$(pkg-config --cflags --static libcares)'); $p->withExportVariable('CARES_LIBS', '$(pkg-config --libs --static libcares)'); + + $p->withExportVariable('ZSTD_CFLAGS', '$(pkg-config --cflags --static libzstd)'); + $p->withExportVariable('ZSTD_LIBS', '$(pkg-config --libs --static libzstd)'); }; diff --git a/setup-swoole-cli-runtime.sh b/setup-swoole-cli-runtime.sh index 3601f1ca41..8c3e378e27 100644 --- a/setup-swoole-cli-runtime.sh +++ b/setup-swoole-cli-runtime.sh @@ -80,6 +80,7 @@ while [ $# -gt 0 ]; do X_VERSION='' X_APP_VERSION='' fi + if [[ -n $X_VERSION ]] && [[ -n $X_APP_VERSION ]]; then { VERSION=$X_VERSION