Skip to content

Commit

Permalink
merge code
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjingxyk committed Oct 6, 2024
2 parents bf27403 + b812ffe commit cd502d3
Show file tree
Hide file tree
Showing 36 changed files with 347 additions and 415 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/auto-cache-pool-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +uuid +mongodb --show-tarball-hash=1
php prepare.php +apcu +ds +xlswriter +ssh2 +uuid @macos --show-tarball-hash=1
php prepare.php +inotify --show-tarball-hash=1
php prepare.php @macos --show-tarball-hash=1
cd ${{ github.workspace }}/pool/
zip -9 -r ${WORK_DIR}/all-deps.zip ext lib
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +uuid +mongodb --with-build-type=release --with-libavif=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
php prepare.php +inotify --with-php-version=${{ env.BUILD_PHP_VERSION }}
bash make-install-deps.sh
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
# php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +mongodb --with-libavif=1 ${{ inputs.build_type }} ${{ inputs.build_options }} --with-php-version=${{ env.BUILD_PHP_VERSION }}
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +mongodb +uuid --with-libavif=1 --with-build-type=release --with-php-version=${{ env.BUILD_PHP_VERSION }}
php prepare.php +inotify ${{ inputs.build_type }} ${{ inputs.build_options }} --with-php-version=${{ env.BUILD_PHP_VERSION }}
bash make-install-deps.sh
Expand Down
21 changes: 4 additions & 17 deletions .github/workflows/macos-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,11 @@ jobs:
sysctl -n hw.ncpu
env
echo $HOME
sw_vers
xcodebuild -version
brew config
# sudo rm -rf /Library/Developer/CommandLineTools
# xcode-select --install
# sudo xcode-select --reset
# sudo xcode-select -switch /Library/Developer/CommandLineTools
# softwareupdate --list --verbose
# softwareupdate --install -a
# xcode-select --install
# export SDKROOT=$(xcrun --show-sdk-path)
xcrun --show-sdk-path
ls -lh $(xcrun --show-sdk-path)
# sudo xcode-select --switch /Applications/Xcode.app
# export MACOSX_DEPLOYMENT_TARGET=12.6
ifconfig
export IPV6=$(ifconfig en0 | grep "inet6 " | grep -v "inet6 fe80:" | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p')
Expand All @@ -63,8 +52,6 @@ jobs:
run: |
bash sapi/quickstart/macos/macos-init.sh
export PATH="/opt/homebrew/opt/libtool/bin:$PATH"
export PATH="/opt/homebrew/opt/libtool/bin:$PATH"
ls -lha /opt/homebrew/opt/libtool/bin/
libtoolize --version
Expand Down Expand Up @@ -128,7 +115,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql +uuid -mongodb --with-build-type=release --with-libavif=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
php prepare.php --without-docker=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
- name: Build
run: |
Expand Down
30 changes: 14 additions & 16 deletions .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
jobs:
macos-x86_64:
if: 1
runs-on: macos-12
runs-on: macos-13
# macos-latest (macos-14) 变更了 CPU 架构,由 x86_64 变更为 arm64
# macos-14 CPU 架构 arm64
# macos-13 CPU 架构 x86_64
Expand All @@ -34,22 +34,22 @@ jobs:
sysctl -n hw.ncpu
env
echo $HOME
sw_vers
xcodebuild -version
brew config
# sudo rm -rf /Library/Developer/CommandLineTools
# xcode-select --install
xcrun --show-sdk-path
# sudo xcode-select --reset
# sudo xcode-select -switch /Library/Developer/CommandLineTools
# softwareupdate --list --verbose
# softwareupdate --install -a
# xcode-select --install
# export SDKROOT=$(xcrun --show-sdk-path)
ls -lh $(xcrun --show-sdk-path)
# sudo xcode-select --switch /Applications/Xcode.app
# export MACOSX_DEPLOYMENT_TARGET=12.6
# find /Applications/Xcode.app -name stdio.h
xcodebuild -find make
xcodebuild -find gcc
xcodebuild -find g++
xcodebuild -find clang
xcodebuild -find clang++
find /Applications/Xcode.app -path '*/usr/include/stdio.h'
find $(xcode-select --print-path) -name stdio.h
ifconfig
export IPV6=$(ifconfig en0 | grep "inet6 " | grep -v "inet6 fe80:" | awk '{print $2}' | cut -d'/' -f1 | sed -n '2p')
Expand All @@ -65,8 +65,6 @@ jobs:
run: |
bash sapi/quickstart/macos/macos-init.sh
export PATH=/usr/local/opt/libtool/bin:$PATH
export PATH=/usr/local/opt/libtool/bin:$PATH
ls -lha /usr/local/opt/libtool/bin/
Expand Down Expand Up @@ -130,7 +128,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql +uuid -mongodb --with-build-type=release --with-libavif=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
php prepare.php --without-docker=1 --with-php-version=${{ env.BUILD_PHP_VERSION }}
- name: Build
run: |
Expand Down
10 changes: 6 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,16 @@ var/
php-src/
ext/swoole/
sapi/webUI/.idea/
Dockerfile-all-dependencies-alpine
php.ini
sapi/webUI/deploy.sh
sapi/webUI/public/data/
Makefile.backup
ldflags.log
cppflags.log
libs.log

/php-src

ext/apcu/
ext/ssh2/
LICENSE
swool-cli-*
php-cli-*
php-fpm-*
35 changes: 7 additions & 28 deletions build-release-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ esac

IN_DOCKER=0
WITH_DOWNLOAD_BOX=0
WITH_BUILD_CONTAINER=0
WITH_WEB_UI=0
WITH_HTTP_PROXY=0
WITH_PHP_COMPOSER=1
Expand Down Expand Up @@ -79,10 +78,6 @@ while [ $# -gt 0 ]; do
WITH_DOWNLOAD_BOX=1
OPTIONS="${OPTIONS} --without-docker=1 --skip-download=1 --with-dependency-graph=1 "
;;
--build-contianer)
WITH_BUILD_CONTAINER=1
OPTIONS="${OPTIONS} --without-docker=1 "
;;
--webui)
WITH_WEB_UI=1
OPTIONS="${OPTIONS} --without-docker=1 --skip-download=1 --with-web-ui=1 "
Expand Down Expand Up @@ -220,9 +215,8 @@ if [ ${WITH_PHP_COMPOSER} -eq 1 ]; then
composer config -g --unset repos.packagist
fi


# 可用配置参数
# --with-swoole-pgsql=1
# --with-libavif=1
# --with-global-prefix=/usr/local/swoole-cli
# --with-dependency-graph=1
# --with-web-ui
Expand Down Expand Up @@ -265,16 +259,6 @@ if [ ${WITH_DOWNLOAD_BOX} -eq 1 ]; then
exit 0
fi

if [ ${WITH_BUILD_CONTAINER} -eq 1 ]; then
echo " please exec script: "
if [ "$MIRROR" = 'china' ]; then
echo " bash sapi/multistage-build-dependencies-container/all-dependencies-build-container.sh --composer_mirror tencent --mirror ustc "
else
echo " bash sapi/multistage-build-dependencies-container/all-dependencies-build-container.sh "
fi
exit 0
fi

if [ ${WITH_WEB_UI} -eq 1 ]; then
echo " please exec script: "
echo " bash sapi/webUI/webui-init-data.sh "
Expand All @@ -287,10 +271,9 @@ if [ "$OS" = 'linux' ] && [ ${IN_DOCKER} -eq 0 ]; then
exit 0
fi

bash make-install-deps.sh
set -ue

# 兼容上一版本已构建完毕的依赖库
# bash sapi/quickstart/mark-install-library-cached.sh
bash make-install-deps.sh

bash make.sh all-library

Expand All @@ -303,18 +286,14 @@ bash make.sh archive
exit 0

# 例子
# bash build-release.sh --mirror china
# bash build-release.sh --mirror china --debug
# bash build-release-php.sh --mirror china
# bash build-release-php.sh --mirror china --debug

# 例子 download-box
# bash build-release.sh --mirror china --download-box
# bash build-release-php.sh --mirror china --download-box
# bash sapi/download-box/download-box-init.sh --proxy http://192.168.3.26:8015

# 例子 build-contianer
# bash build-release.sh --mirror china --build-contianer
# bash sapi/multistage-build-dependencies-container/all-dependencies-build-container.sh --composer_mirror tencent --mirror ustc

# 例子 web ui
# bash build-release.sh --mirror china --webui
# bash build-release-php.sh --mirror china --webui
# bash sapi/webUI/webui-init-data.sh
# php sapi/webUI/bootstrap.php
39 changes: 15 additions & 24 deletions prepare.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require __DIR__ . '/vendor/autoload.php';

use SwooleCli\Exception;
use SwooleCli\Preprocessor;
use SwooleCli\Library;

Expand Down Expand Up @@ -159,28 +160,19 @@


if ($p->isMacos()) {
$p->setExtraLdflags('-undefined dynamic_lookup');
if (is_file('/usr/local/opt/llvm/bin/ld64.lld')) {
$p->withBinPath('/usr/local/opt/llvm/bin')
->withBinPath('/usr/local/opt/flex/bin')
->withBinPath('/usr/local/opt/bison/bin')
->withBinPath('/usr/local/opt/libtool/bin')
->withBinPath('/usr/local/opt/m4/bin')
->withBinPath('/usr/local/opt/automake/bin/')
->withBinPath('/usr/local/opt/autoconf/bin/')
->setLinker('ld64.lld');
} elseif (is_file('/opt/homebrew/opt/llvm/bin/ld64.lld')) { //兼容 macos arm64
$p->withBinPath('/opt/homebrew/opt/llvm/bin/')
->withBinPath('/opt/homebrew/opt/flex/bin')
->withBinPath('/opt/homebrew/opt/bison/bin')
->withBinPath('/opt/homebrew/opt/libtool/bin')
->withBinPath('/opt/homebrew/opt/m4/bin')
->withBinPath('/opt/homebrew/opt/automake/bin/')
->withBinPath('/opt/homebrew/opt/autoconf/bin/')
->setLinker('ld64.lld');
} else {
$p->setLinker('lld');
}
//$p->setExtraLdflags('-undefined dynamic_lookup');
$p->setExtraLdflags('');
$homebrew_prefix = trim(shell_exec('brew --prefix'));
$p->withBinPath($homebrew_prefix . '/opt/llvm/bin')
->withBinPath($homebrew_prefix . '/opt/flex/bin')
->withBinPath($homebrew_prefix . '/opt/bison/bin')
->withBinPath($homebrew_prefix . '/opt/libtool/bin')
->withBinPath($homebrew_prefix . '/opt/m4/bin')
->withBinPath($homebrew_prefix . '/opt/automake/bin/')
->withBinPath($homebrew_prefix . '/opt/autoconf/bin/')
->withBinPath($homebrew_prefix . '/opt/gettext/bin')
->setLinker('ld64.lld');

$p->setLogicalProcessors('$(sysctl -n hw.ncpu)');
} else {
$p->setLinker('ld.lld');
Expand All @@ -195,8 +187,7 @@
$p->setLinker('ld');
}


$p->setExtraCflags(' -Os');
$p->setExtraCflags(' -Os -fno-openmp');


// Generate make.sh
Expand Down
4 changes: 2 additions & 2 deletions sapi/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ RUN if [ "${MIRROR}" = "tuna" ]; then { sed -i 's/dl-cdn.alpinelinux.org/mirrors
RUN apk update
RUN apk upgrade

RUN apk add vim alpine-sdk xz autoconf automake linux-headers clang-dev clang lld libtool cmake bison re2c gettext coreutils
RUN apk add vim alpine-sdk xz autoconf automake linux-headers clang-dev clang lld libtool cmake bison re2c coreutils
RUN apk add bash tini
RUN apk add libc++-static libltdl-static
RUN apk add gettext-dev
RUN apk add gettext gettext-dev
RUN apk add pigz parallel
WORKDIR /work
8 changes: 3 additions & 5 deletions sapi/docker/build-export-container.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

: <<'COMMENT'
Expand All @@ -18,6 +18,8 @@ __PROJECT__=$(
cd ${__DIR__}
cd ${__PROJECT__}

# alpine 基础镜像 支持多架构

CONTAINER_BASE_IMAGE='docker.io/library/alpine:3.18'
CONTAIENR_NAME='swoole-cli-builder'
MIRROR=''
Expand All @@ -40,10 +42,6 @@ while [ $# -gt 0 ]; do
--mirror)
MIRROR="$2"
;;
--quickstart-container)
CONTAIENR_NAME='swoole-cli-alpine-dev'
# 从quickstart 生成的容器中拷贝 /usr/local/swoole-cli/ 文件夹,并生成新容器镜像
;;
--*)
echo "Illegal option $1"
;;
Expand Down
9 changes: 4 additions & 5 deletions sapi/quickstart/linux/alpine-init-minimal.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env sh

set -exu
__DIR__=$(
Expand All @@ -10,7 +10,6 @@ cd ${__DIR__}
# use china mirror
# sh sapi/quickstart/linux/alpine-init-mini.sh --mirror [ china | ustc | tuna | tencentyun | huaweicloud ]


MIRROR=''
while [ $# -gt 0 ]; do
case "$1" in
Expand All @@ -28,8 +27,8 @@ case "$MIRROR" in
china | tuna | ustc)
test -f /etc/apk/repositories.save || cp /etc/apk/repositories /etc/apk/repositories.save
test "$MIRROR" = "china" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
test "$MIRROR" = "tuna" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
test "$MIRROR" = "ustc" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
test "$MIRROR" = "tuna" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
test "$MIRROR" = "ustc" && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
;;
tencentyun | huaweicloud) # 云服务的内网镜像源
test -f /etc/apk/repositories.save || cp /etc/apk/repositories /etc/apk/repositories.save
Expand All @@ -41,4 +40,4 @@ esac

apk update

apk add bash git curl wget xz zip unzip ca-certificates
apk add bash git curl wget xz zip unzip ca-certificates
Loading

0 comments on commit cd502d3

Please sign in to comment.