diff --git a/.github/workflows/artifact-hash.yml b/.github/workflows/artifact-hash.yml index fb9e4d13e4..c1cb921d9a 100644 --- a/.github/workflows/artifact-hash.yml +++ b/.github/workflows/artifact-hash.yml @@ -38,8 +38,10 @@ jobs: - name: upload artifacts to cloud object storage if: ${{ 0 && (github.repository == 'swoole/swoole-cli') && (inputs.enable_upload_cloud_object_storage == true) }} env: - SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} - SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} + OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }} + OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }} run: | bash sapi/scripts/tencent-cloud-object-storage.sh --upload-all --swoole-cli-version ${{ inputs.version }} diff --git a/.github/workflows/linux-aarch64.yml b/.github/workflows/linux-aarch64.yml index 844c7cb223..00b1721e39 100644 --- a/.github/workflows/linux-aarch64.yml +++ b/.github/workflows/linux-aarch64.yml @@ -206,7 +206,9 @@ jobs: - name: upload artifacts to cloud object storage if: ${{ 0 && (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }} env: - SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} - SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} + OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }} + OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }} run: | bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-linux-arm64.tar.xz diff --git a/.github/workflows/linux-x86_64.yml b/.github/workflows/linux-x86_64.yml index c5426a6c51..d2bc485677 100644 --- a/.github/workflows/linux-x86_64.yml +++ b/.github/workflows/linux-x86_64.yml @@ -241,8 +241,10 @@ jobs: - name: upload artifacts to cloud object storage if: ${{ 0 && (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }} env: - SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} - SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} + OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }} + OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }} run: | bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-linux-x64.tar.xz diff --git a/.github/workflows/macos-aarch64.yml b/.github/workflows/macos-aarch64.yml index b4e02bd69f..9312c321c7 100644 --- a/.github/workflows/macos-aarch64.yml +++ b/.github/workflows/macos-aarch64.yml @@ -173,7 +173,9 @@ jobs: - name: upload artifacts to cloud object storage if: ${{ 0 && (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }} env: - SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} - SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} + OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }} + OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }} run: | bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-macos-arm64.tar.xz diff --git a/.github/workflows/macos-x86_64.yml b/.github/workflows/macos-x86_64.yml index 424364a89d..a2b85d6ba7 100644 --- a/.github/workflows/macos-x86_64.yml +++ b/.github/workflows/macos-x86_64.yml @@ -184,7 +184,9 @@ jobs: - name: upload artifacts to cloud object storage if: ${{ 0 && (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }} env: - SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} - SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} + OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }} + OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }} run: | bash sapi/scripts/tencent-cloud-object-storage.sh --upload-file ${{ github.workspace }}/swoole-cli-v${{ env.APP_VERSION }}-macos-x64.tar.xz diff --git a/.github/workflows/windows-cygwin.yml b/.github/workflows/windows-cygwin.yml index 37f9538504..3c604ea8b2 100644 --- a/.github/workflows/windows-cygwin.yml +++ b/.github/workflows/windows-cygwin.yml @@ -38,6 +38,8 @@ jobs: git config --global core.autocrlf false git config --global core.eol lf git config --global core.ignorecase false + git config --global --add safe.directory ${{ github.workspace }} + ipconfig - uses: actions/checkout@v4 - name: set php version @@ -180,8 +182,10 @@ jobs: - name: upload artifacts to cloud object storage if: ${{ 0 && (github.repository == 'swoole/swoole-cli') && (startsWith(github.ref, 'refs/tags/')) }} env: - SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} - SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_SECRET_ID: ${{ secrets.QCLOUD_OSS_SECRET_ID }} + OSS_SECRET_KEY: ${{ secrets.QCLOUD_OSS_SECRET_KEY }} + OSS_BUCKET: ${{ vars.QCLOUD_OSS_BUCKET }} + OSS_REGION: ${{ vars.QCLOUD_OSS_REGION }} run: | FILE_NAME=$(ls -d swoole-cli-v*-cygwin-x64) FILE="${{ github.workspace }}/${FILE_NAME}/${FILE_NAME}.zip" diff --git a/sapi/musl-cross-make/config.mak b/sapi/musl-cross-make/config.mak deleted file mode 100644 index ac9d59a8c0..0000000000 --- a/sapi/musl-cross-make/config.mak +++ /dev/null @@ -1,91 +0,0 @@ -# -# config.mak.dist - sample musl-cross-make configuration -# -# Copy to config.mak and edit as desired. -# - -# There is no default TARGET; you must select one here or on the make -# command line. Some examples: - -# TARGET = i486-linux-musl -TARGET = x86_64-linux-musl -# TARGET = arm-linux-musleabi -# TARGET = arm-linux-musleabihf -# TARGET = sh2eb-linux-muslfdpic -# ... - -# By default, cross compilers are installed to ./output under the top-level -# musl-cross-make directory and can later be moved wherever you want them. -# To install directly to a specific location, set it here. Multiple targets -# can safely be installed in the same location. Some examples: - -# OUTPUT = /opt/cross - OUTPUT = /usr/local/swoole-cli/musl_cross_make/ - -# By default, latest supported release versions of musl and the toolchain -# components are used. You can override those here, but the version selected -# must be supported (under hashes/ and patches/) to work. For musl, you -# can use "git-refname" (e.g. git-master) instead of a release. Setting a -# blank version for gmp, mpc, mpfr and isl will suppress download and -# in-tree build of these libraries and instead depend on pre-installed -# libraries when available (isl is optional and not set by default). -# Setting a blank version for linux will suppress installation of kernel -# headers, which are not needed unless compiling programs that use them. - -# BINUTILS_VER = 2.25.1 -GCC_VER = 11.2.0 -# MUSL_VER = git-master -# GMP_VER = -# MPC_VER = -# MPFR_VER = -# ISL_VER = -# LINUX_VER = - -# By default source archives are downloaded with wget. curl is also an option. - -# DL_CMD = wget -c -O -DL_CMD = curl -C - -L -o - -# Check sha-1 hashes of downloaded source archives. On gnu systems this is -# usually done with sha1sum. - -# SHA1_CMD = sha1sum -c -# SHA1_CMD = sha1 -c -# SHA1_CMD = shasum -a 1 -c - -# Something like the following can be used to produce a static-linked -# toolchain that's deployable to any system with matching arch, using -# an existing musl-targeted cross compiler. This only works if the -# system you build on can natively (or via binfmt_misc and qemu) run -# binaries produced by the existing toolchain (in this example, i486). - -# COMMON_CONFIG += CC="i486-linux-musl-gcc -static --static" CXX="i486-linux-musl-g++ -static --static" -# COMMON_CONFIG += CC="x86_64-linux-musl-gcc -static --static" CXX="x86_64-linux-musl-g++ -static --static" -COMMON_CONFIG += CC="gcc -static --static" CXX="g++ -static --static" - -# Recommended options for smaller build for deploying binaries: - -# COMMON_CONFIG += CFLAGS="-g0 -Os" CXXFLAGS="-g0 -Os" LDFLAGS="-s" -COMMON_CONFIG += CFLAGS="-g0 -O3" CXXFLAGS="-g0 -O3" LDFLAGS="-s" - -# Options you can add for faster/simpler build at the expense of features: - -COMMON_CONFIG += --disable-nls -GCC_CONFIG += --disable-libquadmath --disable-decimal-float -GCC_CONFIG += --disable-libitm -GCC_CONFIG += --disable-fixed-point -GCC_CONFIG += --disable-lto -GCC_CONFIG += --enable-default-pie --enable-static-pie - -# By default C and C++ are the only languages enabled, and these are -# the only ones tested and known to be supported. You can uncomment the -# following and add other languages if you want to try getting them to -# work too. - -GCC_CONFIG += --enable-languages=c,c++ - -# You can keep the local build path out of your toolchain binaries and -# target libraries with the following, but then gdb needs to be told -# where to look for source files. - -# COMMON_CONFIG += --with-debug-prefix-map=$(CURDIR)= diff --git a/sapi/quickstart/build-native-php-example.sh b/sapi/quickstart/build-native-php-example.sh index a1cad4aa9a..63454ab2f1 100644 --- a/sapi/quickstart/build-native-php-example.sh +++ b/sapi/quickstart/build-native-php-example.sh @@ -1,18 +1,16 @@ #!/bin/env bash set -uex - OS=$(uname -s) ARCH=$(uname -m) - export CC=clang export CXX=clang++ export LD=ld.lld -if [ "$OS" = 'Linux' ] ;then +if [ "$OS" = 'Linux' ]; then -: <<'EOF' + : <<'EOF' # setup container environment docker run --rm -ti --init -v .:/work -w /work debian:11 @@ -24,15 +22,12 @@ EOF fi +if [ "$OS" = 'Darwin' ]; then -if [ "$OS" = 'Darwin' ] ;then - -export PATH=/usr/local/opt/bison/bin/:/usr/local/opt/llvm/bin/:$PATH + export PATH=/usr/local/opt/bison/bin/:/usr/local/opt/llvm/bin/:$PATH fi - - mkdir -p /tmp/t cd /tmp/t @@ -53,10 +48,6 @@ tar --strip-components=1 -C mongodb -xf mongodb-${MONGODB_VERSION}.tgz test -d php-src/ext/mongodb && rm -rf php-src/ext/mongodb mv mongodb php-src/ext/ - - - - cd php-src ./buildconf --force @@ -83,13 +74,11 @@ cd php-src make -j $(nproc) - -if [ "$OS" = 'Linux' ] ;then +if [ "$OS" = 'Linux' ]; then file sapi/cli/php readelf -h sapi/cli/php else - otool -L sapi/cli/php + otool -L sapi/cli/php fi - diff --git a/sapi/quickstart/linux/arm64/README.md b/sapi/quickstart/linux/arm64/README.md index d22e0344b3..8c4031d9a9 100644 --- a/sapi/quickstart/linux/arm64/README.md +++ b/sapi/quickstart/linux/arm64/README.md @@ -1,18 +1,13 @@ -# x86_64 运行 arm64 -> 使用 qemu-user-static 实现 +# 在 `x86_64` 平台模拟 `arm64` -## 参考文档 -qemu - https://www.qemu.org/ - https://github.com/qemu/qemu.git - -qemu-user-static - https://github.com/multiarch/qemu-user-static.git +使用 `qemu-user-static` 实现 -x86 平台利用 qemu-user-static 实现 arm64 平台 docker 镜像的运行和构建 - https://www.cnblogs.com/chen2ha/p/17180287.html +## 参考文档 -Docker在x86架构的物理机上跑Qemu-arm 容器 - https://blog.csdn.net/sunSHINEEzy/article/details/80015638 +- [qemu 官网](https://www.qemu.org/) +- [qemu GitHub](https://github.com/qemu/qemu.git) +- [qemu-user-static](https://github.com/multiarch/qemu-user-static.git) +- [x86 平台利用 qemu-user-static 实现 arm64 平台 docker 镜像的运行和构建](https://www.cnblogs.com/chen2ha/p/17180287.html) +- [Docker在x86架构的物理机上跑Qemu-arm 容器](https://blog.csdn.net/sunSHINEEzy/article/details/80015638) diff --git a/sapi/quickstart/linux/extra/README.md b/sapi/quickstart/linux/extra/README.md index 4f223c5ddc..6d91c5a293 100644 --- a/sapi/quickstart/linux/extra/README.md +++ b/sapi/quickstart/linux/extra/README.md @@ -1,22 +1,23 @@ -# +# 常见问题 -## 当环境中没有 PHP 解释器时 可以快速安装 PHP 解释器 +## 快速安装 `PHP` 解释器 -```bash - -# alpine +### Alpine -sh sapi/quickstart/linux/extra/alpine-php-init.sh +```bash +sh sapi/quickstart/linux/extra/alpine-php-init.sh +``` -## debian +### Debian/Ubuntu +```bash bash sapi/quickstart/linux/extra/debian-php-init.sh - ``` -## download composer +## 安装 `Composer` ```bash + curl -Lo /usr/local/bin/composer.phar https://getcomposer.org/download/latest-stable/composer.phar ln -sf /usr/local/bin/composer.phar /usr/local/bin/composer @@ -24,8 +25,8 @@ chmod a+x /usr/local/bin/composer ``` -## c c++编译器 组合 +## `C/C++` 编译器组合 -- 组合一 clang clang++ -- 组合二 gcc g++ +- `clang` + `clang++` +- `gcc` + `g++` diff --git a/sapi/quickstart/linux/install-docker-compose.sh b/sapi/quickstart/linux/install-docker-compose.sh index 68d5623866..830ed50268 100644 --- a/sapi/quickstart/linux/install-docker-compose.sh +++ b/sapi/quickstart/linux/install-docker-compose.sh @@ -24,7 +24,7 @@ if [ ! -f /usr/libexec/docker/cli-plugins/docker-compose ]; then # show more version info # https://github.com/docker/compose/releases - VERSION="v2.29.1" + VERSION="v2.32.1" curl -fsSL "https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose diff --git a/sapi/quickstart/linux/install-docker.sh b/sapi/quickstart/linux/install-docker.sh index ebdcf2a8ef..860c6f21a6 100644 --- a/sapi/quickstart/linux/install-docker.sh +++ b/sapi/quickstart/linux/install-docker.sh @@ -28,7 +28,6 @@ while [ $# -gt 0 ]; do shift $(($# > 0 ? 1 : 0)) done - # https://github.com/docker/docker-install.git # test -f get-docker.sh || curl -fsSL https://get.docker.com -o get-docker.sh @@ -41,14 +40,15 @@ china | ustc | tuna) ;; esac - if [ -n "$http_proxy" ] || [ -n "$https_proxy" ] || [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then - echo 'Please delete proxy settings !' - echo 'Execute this script again !' - exit 0 + set +u + unset http_proxy + unset https_proxy + unset HTTP_PROXY + unset HTTPS_PROXY + set -u fi - case "$MIRROR" in china | ustc) sed -i "s@https://mirrors.aliyun.com/docker-ce@https://mirrors.ustc.edu.cn/docker-ce@g" get-docker.sh diff --git a/sapi/quickstart/linux/run-alpine-container-full.sh b/sapi/quickstart/linux/run-alpine-container-full.sh index 9de4659031..7a2ca6750c 100644 --- a/sapi/quickstart/linux/run-alpine-container-full.sh +++ b/sapi/quickstart/linux/run-alpine-container-full.sh @@ -13,7 +13,6 @@ cd ${__DIR__} { docker stop swoole-cli-alpine-dev - docker stop swoole-cli-builder sleep 5 } || { echo $? @@ -75,7 +74,7 @@ cd ${__DIR__} if [ $DEV_SHM -eq 1 ]; then mkdir -p /dev/shm/swoole-cli/thirdparty/ mkdir -p /dev/shm/swoole-cli/ext/ - docker run --rm --name swoole-cli-builder -d -v ${__PROJECT__}:/work -v /dev/shm/swoole-cli/thirdparty/:/work/thirdparty/ -v /dev/shm/swoole-cli/ext/:/work/ext/ -w /work --init $IMAGE tail -f /dev/null + docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -v /dev/shm/swoole-cli/thirdparty/:/work/thirdparty/ -v /dev/shm/swoole-cli/ext/:/work/ext/ -w /work --init $IMAGE tail -f /dev/null else - docker run --rm --name swoole-cli-builder -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null + docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null fi diff --git a/sapi/quickstart/linux/run-alpine-container.sh b/sapi/quickstart/linux/run-alpine-container.sh index be9ad82e56..b2c8f09b27 100644 --- a/sapi/quickstart/linux/run-alpine-container.sh +++ b/sapi/quickstart/linux/run-alpine-container.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu __DIR__=$( @@ -13,7 +13,6 @@ cd ${__DIR__} { docker stop swoole-cli-alpine-dev - docker stop swoole-cli-builder sleep 5 } || { echo $? @@ -28,9 +27,9 @@ while [ $# -gt 0 ]; do --mirror) MIRROR="$2" case "$MIRROR" in - china | openatom) - IMAGE="hub.atomgit.com/library/alpine:3.18" - ;; + china | openatom) + IMAGE="hub.atomgit.com/library/alpine:3.18" + ;; esac ;; esac @@ -38,4 +37,4 @@ while [ $# -gt 0 ]; do done cd ${__DIR__} -docker run --rm --name swoole-cli-builder -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null +docker run --rm --name swoole-cli-alpine-dev -d -v ${__PROJECT__}:/work -w /work --init $IMAGE tail -f /dev/null diff --git a/sapi/quickstart/linux/run-debian-container.sh b/sapi/quickstart/linux/run-debian-container.sh index 1e3768a605..c2fe991bcb 100644 --- a/sapi/quickstart/linux/run-debian-container.sh +++ b/sapi/quickstart/linux/run-debian-container.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu __DIR__=$( @@ -27,15 +27,14 @@ while [ $# -gt 0 ]; do --mirror) MIRROR="$2" case "$MIRROR" in - china | openatom) - IMAGE="hub.atomgit.com/library/debian:12" - ;; + 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 --init $IMAGE tail -f /dev/null diff --git a/sapi/quickstart/linux/run-swoole-cli-builder-container.sh b/sapi/quickstart/linux/run-swoole-cli-builder-container.sh new file mode 100644 index 0000000000..a91021e404 --- /dev/null +++ b/sapi/quickstart/linux/run-swoole-cli-builder-container.sh @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +set -exu +__DIR__=$( + cd "$(dirname "$0")" + pwd +) +__PROJECT__=$( + cd ${__DIR__}/../../../ + pwd +) +cd ${__PROJECT__} + +MIRROR='' +OPTIONS='' +while [ $# -gt 0 ]; do + case "$1" in + --mirror) + MIRROR="$2" + case "$MIRROR" in + china) + OPTIONS=" --mirror china " + ;; + *) + echo "$0 parameter error" + exit 0 + ;; + esac + + ;; + esac + shift $(($# > 0 ? 1 : 0)) +done + +bash setup-php-runtime.sh ${OPTIONS} +export PATH=${__PROJECT__}/bin/runtime:$PATH +alias php="php -d curl.cainfo=${__PROJECT__}/bin/runtime/cacert.pem -d openssl.cafile=${__PROJECT__}/bin/runtime/cacert.pem " + +export COMPOSER_ALLOW_SUPERUSER=1 + +if [ "$MIRROR" = 'china' ]; then + composer config -g repos.packagist composer https://mirrors.tencent.com/composer/ +fi + +composer install --no-interaction --no-autoloader --no-scripts --prefer-dist -vv --profile # --no-dev +composer dump-autoload --optimize --profile + +if [ "$MIRROR" = 'china' ]; then + composer config -g --unset repos.packagist +fi + +php ./prepare.php --skip-download=yes --without-docker=yes + +bash make.sh docker-build ${MIRROR} + +{ + docker exec -it swoole-cli-builder which bash +} || { + docker exec -it swoole-cli-builder sh /work/sapi/quickstart/linux/alpine-init.sh ${OPTIONS} +} + +bash make.sh docker-bash diff --git a/sapi/quickstart/windows/cygwin-build/README.md b/sapi/quickstart/windows/cygwin-build/README.md index b66e60f7f2..e999b615e9 100644 --- a/sapi/quickstart/windows/cygwin-build/README.md +++ b/sapi/quickstart/windows/cygwin-build/README.md @@ -14,21 +14,3 @@ sapi\quickstart\windows\cygwin-build\install-cygwin.bat ``` -# windows 软连接例子 - -```bash - -mklink composer composer.phar - -``` - -## 其他 - -1. [windows build native php](./windows-native.md) -1. [install msys2 ](./install-msys2.md) - - - - - - diff --git a/sapi/quickstart/windows/cygwin-build/install-cygwin.bat b/sapi/quickstart/windows/cygwin-build/install-cygwin.bat index 77a9548927..947c6fa2d4 100644 --- a/sapi/quickstart/windows/cygwin-build/install-cygwin.bat +++ b/sapi/quickstart/windows/cygwin-build/install-cygwin.bat @@ -1,18 +1,20 @@ @echo off + :: cygwin site: https://cygwin.com/ :: start https://cygwin.com/setup-x86_64.exe setlocal enableextensions enabledelayedexpansion - echo %~dp0 cd /d %~dp0 cd /d ..\..\..\..\ set "__PROJECT__=%cd%" +cd /d %__PROJECT__%\ echo %cd% :: package separate with commas + set SITE="https://mirrors.kernel.org/sourceware/cygwin/" :getopt @@ -29,7 +31,6 @@ if "%GITHUB_ACTIONS%"=="" ( setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site %SITE% ) - 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 setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site %SITE% --packages zip unzip @@ -38,6 +39,4 @@ setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disa setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site %SITE% --packages libzstd-devel - - endlocal diff --git a/sapi/quickstart/windows/download-msys2.bat b/sapi/quickstart/windows/msys2-build/download-msys2.bat similarity index 100% rename from sapi/quickstart/windows/download-msys2.bat rename to sapi/quickstart/windows/msys2-build/download-msys2.bat diff --git a/sapi/quickstart/windows/install-msys2.md b/sapi/quickstart/windows/msys2-build/install-msys2.md similarity index 68% rename from sapi/quickstart/windows/install-msys2.md rename to sapi/quickstart/windows/msys2-build/install-msys2.md index 229f54fe44..9c58998b40 100644 --- a/sapi/quickstart/windows/install-msys2.md +++ b/sapi/quickstart/windows/msys2-build/install-msys2.md @@ -33,27 +33,8 @@ pacman -Syy --noconfirm git curl wget openssl zip unzip xz gcc gcc-g++ cmake ma pacman -Syy --noconfirm openssl-devel libreadline - # msys2 环境下 拉取 swoole-cli 源码 git clone --recursive https://github.com:swoole/swoole-cli.git -# msys2 环境下下载 cygwin (也可以用浏览器下载) 安装包 -wget https://cygwin.com/setup-x86_64.exe - -# 将 cygwin 安装包 移动到 window 指定盘符根目 (这里以 C盘为例) -mv setup-x86_64.exe C:/setup-x86_64.exe - - ``` -### windows 自带默认终端 - -```shell - -# windows 开始菜单,打开 新的 windows 自带终端,执行安装 cygwin -cd c:\ - -# 添加 pgsql -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-deve - -``` diff --git a/sapi/scripts/cygwin/install-msys2.sh b/sapi/quickstart/windows/msys2-build/install-msys2.sh similarity index 100% rename from sapi/scripts/cygwin/install-msys2.sh rename to sapi/quickstart/windows/msys2-build/install-msys2.sh diff --git a/sapi/quickstart/windows/open-msys2-cygwin-website.bat b/sapi/quickstart/windows/msys2-build/open-msys2-cygwin-website.bat similarity index 100% rename from sapi/quickstart/windows/open-msys2-cygwin-website.bat rename to sapi/quickstart/windows/msys2-build/open-msys2-cygwin-website.bat diff --git a/sapi/quickstart/windows/windows-native.md b/sapi/quickstart/windows/windows-native.md deleted file mode 100644 index 718f8acb53..0000000000 --- a/sapi/quickstart/windows/windows-native.md +++ /dev/null @@ -1,31 +0,0 @@ -# 构建window PHP 工具 和 参考 - -[ download windows PHP ](https://windows.php.net/download#php-8.2) - -[windows build php 步骤](https://wiki.php.net/internals/windows/stepbystepbuild) - -```shell -git config core.ignorecase false # 设置 Git 在 Windows 上也区分大小写 -``` - -Latest VC++ -https://learn.microsoft.com/en-AU/cpp/windows/latest-supported-vc-redist - -7zip -https://7-zip.org/ - -visualstudio -https://visualstudio.microsoft.com/zh-hans/downloads/ - -windows-sdk -https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ - -Windows PowerShell ISE 文本编辑器 - -## 使用命令行快速安装 VisualStudio 组件 - -```shell - -VisualStudioSetup.exe --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATLMFC --includeRecommended - -``` diff --git a/sapi/quickstart/windows/windows.md b/sapi/quickstart/windows/windows.md new file mode 100644 index 0000000000..7911036e98 --- /dev/null +++ b/sapi/quickstart/windows/windows.md @@ -0,0 +1,27 @@ +# 构建window PHP 工具 和 参考 + +[download windows PHP ](https://windows.php.net/download#php-8.2) + +[windows build php 步骤](https://wiki.php.net/internals/windows/stepbystepbuild) + +## windows 环境下 git 配置 + +```shell +git config --global core.autocrlf false +git config --global core.eol lf +git config --global core.ignorecase false +git config core.ignorecase false # 设置 Git 在 Windows 上也区分大小写 +``` + +[Latest VC++](https://learn.microsoft.com/en-AU/cpp/windows/latest-supported-vc-redist) +[7zip](https://7-zip.org/) +[visualstudio](https://visualstudio.microsoft.com/zh-hans/downloads/) +[windows-sdk](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/) + +## windows 软连接例子 + +```bash + +mklink composer composer.phar + +``` diff --git a/sapi/scripts/cygwin/cygwin-build.sh b/sapi/scripts/cygwin/cygwin-build.sh index f8eb5ef99c..5b296d8b23 100755 --- a/sapi/scripts/cygwin/cygwin-build.sh +++ b/sapi/scripts/cygwin/cygwin-build.sh @@ -13,19 +13,22 @@ cd ${__PROJECT__} cd ${__PROJECT__}/php-src mkdir -p bin/.libs +# export LDFLAGS="-all-static" LOGICAL_PROCESSORS=$(nproc) set +u if [ -n "${GITHUB_ACTION}" ]; then - if test $LOGICAL_PROCESSORS -gt 2; then - LOGICAL_PROCESSORS=$((LOGICAL_PROCESSORS - 1)) + if test $LOGICAL_PROCESSORS -ge 4; then + LOGICAL_PROCESSORS=$((LOGICAL_PROCESSORS - 2)) fi + make cli + # make -j $LOGICAL_PROCESSORS +else + make -j $LOGICAL_PROCESSORS cli fi set -u -make -j $LOGICAL_PROCESSORS cli - ${__PROJECT__}/php-src/sapi/cli/php.exe -v cp -f ${__PROJECT__}/php-src/sapi/cli/php.exe ${__PROJECT__}/bin/ diff --git a/sapi/scripts/cygwin/install-cygwin.sh b/sapi/scripts/cygwin/install-cygwin.sh index 6971f19e5a..cd6d321a0e 100644 --- a/sapi/scripts/cygwin/install-cygwin.sh +++ b/sapi/scripts/cygwin/install-cygwin.sh @@ -42,10 +42,14 @@ while [ $# -gt 0 ]; do shift $(($# > 0 ? 1 : 0)) 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,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 +set +u +if [ -z "${GITHUB_ACTION}" ]; then + # 非 github 构建环境下创建启动图标 + setup-x86_64.exe --quiet-mode --disable-buggy-antivirus --site $SITE +fi +set -u 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,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 +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 libzstd-devel diff --git a/sapi/scripts/generate-artifact-hash.sh b/sapi/scripts/generate-artifact-hash.sh index 1116bb2f65..9df5c8766b 100644 --- a/sapi/scripts/generate-artifact-hash.sh +++ b/sapi/scripts/generate-artifact-hash.sh @@ -36,9 +36,9 @@ case $OS in ;; esac -APP_VERSION='v8.3.13' +APP_VERSION='v8.3.15' APP_NAME='php-cli' -VERSION='v1.6.0' +VERSION='v1.7.1' while [ $# -gt 0 ]; do case "$1" in diff --git a/sapi/scripts/tencent-cloud-object-storage.sh b/sapi/scripts/tencent-cloud-object-storage.sh index 00aa875982..ad3522bc03 100644 --- a/sapi/scripts/tencent-cloud-object-storage.sh +++ b/sapi/scripts/tencent-cloud-object-storage.sh @@ -85,7 +85,7 @@ while [ $# -gt 0 ]; do export NO_PROXY="${NO_PROXY},.myqcloud.com,.swoole.com" PROXY_OPTION="--proxy $2" ;; - --show-uploaded-file-list) + --show) UPLOAD_TYPE="show" ;; esac @@ -99,9 +99,11 @@ CLOUD_OBJECT_STORAGE_CONFIG=${__PROJECT__}/var/tencent-cloud-object-storage/.ten if [ ! -f ${CLOUD_OBJECT_STORAGE_CONFIG} ]; then cp -f ${__PROJECT__}/sapi/scripts/tencent-cloud-object-storage.yaml ${CLOUD_OBJECT_STORAGE_CONFIG} set +u - if [ -n "${SECRET_ID}" ] && [ -n "${SECRET_KEY}" ]; then - sed -i.bak "s/\${{ secrets.QCLOUD_OSS_SECRET_ID }}/${SECRET_ID}/" ${CLOUD_OBJECT_STORAGE_CONFIG} - sed -i.bak "s/\${{ secrets.QCLOUD_OSS_SECRET_KEY }}/${SECRET_KEY}/" ${CLOUD_OBJECT_STORAGE_CONFIG} + if [ -n "${OSS_SECRET_ID}" ] && [ -n "${OSS_SECRET_KEY}" ]; then + sed -i.bak "s/\${{ secrets.QCLOUD_OSS_SECRET_ID }}/${OSS_SECRET_ID}/" ${CLOUD_OBJECT_STORAGE_CONFIG} + sed -i.bak "s/\${{ secrets.QCLOUD_OSS_SECRET_KEY }}/${OSS_SECRET_KEY}/" ${CLOUD_OBJECT_STORAGE_CONFIG} + sed -i.bak "s/\${{ vars.QCLOUD_OSS_BUCKET }}/${OSS_BUCKET}/" ${CLOUD_OBJECT_STORAGE_CONFIG} + sed -i.bak "s/\${{ vars.QCLOUD_OSS_REGION }}/${OSS_REGION}/" ${CLOUD_OBJECT_STORAGE_CONFIG} fi set -u fi @@ -113,8 +115,9 @@ fi test -f ${APP_RUNTIME} || curl -fSLo ${APP_RUNTIME} https://github.com/tencentyun/coscli/releases/download/${APP_VERSION}/${APP_RUNTIME} chmod a+x ${APP_RUNTIME} +BUCKET_NAME=$(grep "\- name: " ${CLOUD_OBJECT_STORAGE_CONFIG} | sed 's/\- name: //g' | sed 's/^ *//;s/ *$//' | tr -d '"') COSCLI="${__PROJECT__}/var/tencent-cloud-object-storage/${APP_RUNTIME} --config-path ${CLOUD_OBJECT_STORAGE_CONFIG} --log-path ${__PROJECT__}/var/tencent-cloud-object-storage/coscli.log " -COS_BUCKET_FOLDER="cos://wenda-1252906962/dist/" +COS_BUCKET_FOLDER="cos://${BUCKET_NAME}/dist/" if [ "${UPLOAD_TYPE}" == 'all' ]; then if [ ! -d ${__PROJECT__}/var/artifact-hash/${SWOOLE_CLI_VERSION} ]; then @@ -147,8 +150,8 @@ if [ "${UPLOAD_TYPE}" == 'single' ]; then fi if [ "${UPLOAD_TYPE}" == 'show' ]; then - cat ${CLOUD_OBJECT_STORAGE_CONFIG} - ${COSCLI} --help + # cat ${CLOUD_OBJECT_STORAGE_CONFIG} + # ${COSCLI} --help ${COSCLI} ls ${COS_BUCKET_FOLDER} exit 0 fi diff --git a/sapi/scripts/tencent-cloud-object-storage.yaml b/sapi/scripts/tencent-cloud-object-storage.yaml index e7acfed053..dc7e963fb0 100644 --- a/sapi/scripts/tencent-cloud-object-storage.yaml +++ b/sapi/scripts/tencent-cloud-object-storage.yaml @@ -8,9 +8,9 @@ cos: cvmrolename: "" closeautoswitchhost: "true" buckets: - - name: "wenda-1252906962" - alias: "wenda-1252906962" - region: "ap-shanghai" + - name: "${{ vars.QCLOUD_OSS_BUCKET }}" + alias: "${{ vars.QCLOUD_OSS_BUCKET }}" + region: "${{ vars.QCLOUD_OSS_REGION }}" # endpoint: cos.ap-shanghai.myqcloud.com # endpoint: wenda-1252906962.cos.accelerate.myqcloud.com endpoint: "cos.accelerate.myqcloud.com" diff --git a/sapi/src/template/make.php b/sapi/src/template/make.php index 5198f5eb94..0f483affb2 100755 --- a/sapi/src/template/make.php +++ b/sapi/src/template/make.php @@ -1,4 +1,3 @@ -#!/usr/bin/env bash