From 2767ac524fb81ce7b62ec47257c1ea0ebdfcb6cf Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Mon, 8 May 2023 11:44:44 +0800 Subject: [PATCH 1/7] =?UTF-8?q?mongodb=20=E6=B7=BB=E5=8A=A0=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/ext.json | 6 +++++- src/SPC/builder/extension/mongodb.php | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/config/ext.json b/config/ext.json index 7e4718e9..fab1d737 100644 --- a/config/ext.json +++ b/config/ext.json @@ -157,7 +157,11 @@ "mongodb": { "type": "external", "source": "mongodb", - "arg-type": "custom" + "arg-type": "custom", + "lib-suggests": [ + "icu", + "openssl" + ] }, "mysqli": { "type": "builtin", diff --git a/src/SPC/builder/extension/mongodb.php b/src/SPC/builder/extension/mongodb.php index 843ee39b..6214720d 100644 --- a/src/SPC/builder/extension/mongodb.php +++ b/src/SPC/builder/extension/mongodb.php @@ -12,6 +12,19 @@ class mongodb extends Extension { public function getUnixConfigureArg(): string { - return '--enable-mongodb --without-mongodb-sasl'; + $arg = '--enable-mongodb --without-mongodb-sasl'; + if ($this->builder->getLib('openssl')) { + $arg .= '--with-mongodb-system-libs=no --with-mongodb-ssl=openssl'; + } else { + // 禁用,否则链接的是系统库 + $arg .= ''; + } + if ($this->builder->getLib('icu')) { + $arg .= '--with-mongodb-system-libs=no --with-mongodb-ssl=openssl'; + } else { + // 禁用,否则链接的是系统库 + $arg .= ''; + } + return $arg; } } From 41aa129b97a56b7d7c0f0468e10d0a1c3508a1f6 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 24 May 2023 03:48:40 +0800 Subject: [PATCH 2/7] update --- src/SPC/builder/extension/mongodb.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/SPC/builder/extension/mongodb.php b/src/SPC/builder/extension/mongodb.php index 6214720d..f05b096a 100644 --- a/src/SPC/builder/extension/mongodb.php +++ b/src/SPC/builder/extension/mongodb.php @@ -12,18 +12,14 @@ class mongodb extends Extension { public function getUnixConfigureArg(): string { - $arg = '--enable-mongodb --without-mongodb-sasl'; + $arg = ' --enable-mongodb '; + $arg .= ' --with-mongodb-system-libs=no '; + $arg .= ' --with-mongodb-sasl=no '; if ($this->builder->getLib('openssl')) { - $arg .= '--with-mongodb-system-libs=no --with-mongodb-ssl=openssl'; - } else { - // 禁用,否则链接的是系统库 - $arg .= ''; + $arg .= '--with-mongodb-ssl=openssl'; } if ($this->builder->getLib('icu')) { - $arg .= '--with-mongodb-system-libs=no --with-mongodb-ssl=openssl'; - } else { - // 禁用,否则链接的是系统库 - $arg .= ''; + $arg .= ' --with-mongodb-icu=yes '; } return $arg; } From 1cca826e8a5928bdde5c80f5f6629720e3de4ecb Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 24 May 2023 12:29:57 +0800 Subject: [PATCH 3/7] update mongodb extension config --- src/SPC/builder/extension/mongodb.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SPC/builder/extension/mongodb.php b/src/SPC/builder/extension/mongodb.php index f05b096a..a33b1b9e 100644 --- a/src/SPC/builder/extension/mongodb.php +++ b/src/SPC/builder/extension/mongodb.php @@ -20,6 +20,8 @@ class mongodb extends Extension } if ($this->builder->getLib('icu')) { $arg .= ' --with-mongodb-icu=yes '; + } else { + $arg .= ' --with-mongodb-icu=no '; } return $arg; } From f831b4d61df106a1ffd9a4972e63cbb46794a3ff Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 24 May 2023 13:20:56 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quickstart/linux/x86_64/alpine-3.16-init.sh | 2 ++ quickstart/linux/x86_64/debian-11-init.sh | 3 +-- quickstart/linux/x86_64/prepare.sh | 23 +++++++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/quickstart/linux/x86_64/alpine-3.16-init.sh b/quickstart/linux/x86_64/alpine-3.16-init.sh index 2ad2d6e6..8aed86b6 100644 --- a/quickstart/linux/x86_64/alpine-3.16-init.sh +++ b/quickstart/linux/x86_64/alpine-3.16-init.sh @@ -36,3 +36,5 @@ esac apk update apk add vim alpine-sdk xz autoconf automake linux-headers clang-dev clang lld libtool cmake bison re2c gettext coreutils +apk add bash p7zip zip unzip flex pkgconf ca-certificates +apk add wget git curl \ No newline at end of file diff --git a/quickstart/linux/x86_64/debian-11-init.sh b/quickstart/linux/x86_64/debian-11-init.sh index 1ff044a9..dbd8478c 100644 --- a/quickstart/linux/x86_64/debian-11-init.sh +++ b/quickstart/linux/x86_64/debian-11-init.sh @@ -36,7 +36,6 @@ esac apt update -y apt install -y git curl wget ca-certificates apt install -y xz-utils autoconf automake lld libtool cmake bison re2c gettext coreutils lzip zip unzip -apt install -y pkg-config bzip2 flex +apt install -y pkg-config bzip2 flex p7zip apt install -y musl-tools g++ apt install -y clang - diff --git a/quickstart/linux/x86_64/prepare.sh b/quickstart/linux/x86_64/prepare.sh index bd278330..ef7c2f32 100644 --- a/quickstart/linux/x86_64/prepare.sh +++ b/quickstart/linux/x86_64/prepare.sh @@ -20,6 +20,25 @@ chmod +x bin/spc ./bin/spc list-ext -#./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo,pdo_sqlite,ftp,curl" --cc=gcc --cxx=g++ --debug +EXTENSION="calendar,ctype,exif,fileinfo,filter,ftp" +EXTENSION="${EXTENSION},session,tokenizer" +EXTENSION="${EXTENSION},phar,posix" +EXTENSION="${EXTENSION},iconv" +EXTENSION="${EXTENSION},xml,dom,simplexml,xmlwriter,xmlreader" +EXTENSION="${EXTENSION},phar,posix" +EXTENSION="${EXTENSION},soap" +EXTENSION="${EXTENSION},mbstring,mbregex" +EXTENSION="${EXTENSION},openssl" +EXTENSION="${EXTENSION},sockets,gmp,bcmath" +EXTENSION="${EXTENSION},pcntl" +EXTENSION="${EXTENSION},curl" +EXTENSION="${EXTENSION},zlib,zip,bz2" +EXTENSION="${EXTENSION},gd" +EXTENSION="${EXTENSION},redis" +EXTENSION="${EXTENSION},pdo,pdo_mysql,pdo_sqlite," +EXTENSION="${EXTENSION},mysqlnd,sqlite3" +EXTENSION="${EXTENSION},mongodb" -./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo,pdo_sqlite,ftp,curl" --cc=clang --cxx=clang++ --debug + +./bin/spc build "${EXTENSION}" --build-cli --cc=clang --cxx=clang++ --debug +# ./bin/spc build "${EXTENSION}" --build-cli --cc=gcc --cxx=g++ --debug From 7fb3d05b2ccd1f10117973703a052154fda0b5bd Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 24 May 2023 13:30:22 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E8=B0=83=E6=95=B4quickstart=20=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quickstart/linux/{x86_64 => }/README.md | 12 ++--- .../linux/{x86_64 => }/alpine-3.16-init.sh | 0 .../{x86_64 => }/connection-static-php-cli.sh | 0 .../linux/{x86_64 => }/debian-11-init.sh | 0 .../{x86_64 => }/run-alpine-3.16-container.sh | 2 +- .../{x86_64 => }/run-debian-11-container.sh | 2 +- quickstart/linux/x86_64/prepare.sh | 44 ------------------- quickstart/macOS/x86_64/prepare.sh | 24 ---------- quickstart/prepare.sh | 44 +++++++++++++++++++ 9 files changed, 52 insertions(+), 76 deletions(-) rename quickstart/linux/{x86_64 => }/README.md (51%) rename quickstart/linux/{x86_64 => }/alpine-3.16-init.sh (100%) rename quickstart/linux/{x86_64 => }/connection-static-php-cli.sh (100%) rename quickstart/linux/{x86_64 => }/debian-11-init.sh (100%) rename quickstart/linux/{x86_64 => }/run-alpine-3.16-container.sh (92%) rename quickstart/linux/{x86_64 => }/run-debian-11-container.sh (92%) delete mode 100644 quickstart/linux/x86_64/prepare.sh delete mode 100644 quickstart/macOS/x86_64/prepare.sh create mode 100644 quickstart/prepare.sh diff --git a/quickstart/linux/x86_64/README.md b/quickstart/linux/README.md similarity index 51% rename from quickstart/linux/x86_64/README.md rename to quickstart/linux/README.md index deb80a2b..c6090a30 100644 --- a/quickstart/linux/x86_64/README.md +++ b/quickstart/linux/README.md @@ -8,13 +8,13 @@ ```bash # 启动 debian 11 容器环境 -sh quickstart/linux/x86_64/run-debian-11-container.sh +sh quickstart/linux/run-debian-11-container.sh # 进入容器 -sh quickstart/linux/x86_64/connection-static-php-cli.sh +sh quickstart/linux/connection-static-php-cli.sh # 准备构建基础软件 -sh quickstart/linux/x86_64/debian-11-init.sh +sh quickstart/linux/debian-11-init.sh ``` @@ -23,12 +23,12 @@ sh quickstart/linux/x86_64/debian-11-init.sh ```bash # 启动 alpine 容器环境 -sh quickstart/linux/x86_64/run-alpine-3.16-container.sh +sh quickstart/linux/run-alpine-3.16-container.sh # 进入容器 -sh sh quickstart/linux/x86_64/connection-static-php-cli.sh +sh sh quickstart/linux/connection-static-php-cli.sh # 准备构建基础软件 -sh quickstart/linux/x86_64/alpine-3.16-init.sh +sh quickstart/linux/alpine-3.16-init.sh ``` \ No newline at end of file diff --git a/quickstart/linux/x86_64/alpine-3.16-init.sh b/quickstart/linux/alpine-3.16-init.sh similarity index 100% rename from quickstart/linux/x86_64/alpine-3.16-init.sh rename to quickstart/linux/alpine-3.16-init.sh diff --git a/quickstart/linux/x86_64/connection-static-php-cli.sh b/quickstart/linux/connection-static-php-cli.sh similarity index 100% rename from quickstart/linux/x86_64/connection-static-php-cli.sh rename to quickstart/linux/connection-static-php-cli.sh diff --git a/quickstart/linux/x86_64/debian-11-init.sh b/quickstart/linux/debian-11-init.sh similarity index 100% rename from quickstart/linux/x86_64/debian-11-init.sh rename to quickstart/linux/debian-11-init.sh diff --git a/quickstart/linux/x86_64/run-alpine-3.16-container.sh b/quickstart/linux/run-alpine-3.16-container.sh similarity index 92% rename from quickstart/linux/x86_64/run-alpine-3.16-container.sh rename to quickstart/linux/run-alpine-3.16-container.sh index b53d9cd4..fa3ea0e5 100644 --- a/quickstart/linux/x86_64/run-alpine-3.16-container.sh +++ b/quickstart/linux/run-alpine-3.16-container.sh @@ -6,7 +6,7 @@ __DIR__=$( pwd ) __PROJECT__=$( - cd ${__DIR__}/../../../ + cd ${__DIR__}/../../ pwd ) cd ${__DIR__} diff --git a/quickstart/linux/x86_64/run-debian-11-container.sh b/quickstart/linux/run-debian-11-container.sh similarity index 92% rename from quickstart/linux/x86_64/run-debian-11-container.sh rename to quickstart/linux/run-debian-11-container.sh index a9239727..c00ae1a6 100644 --- a/quickstart/linux/x86_64/run-debian-11-container.sh +++ b/quickstart/linux/run-debian-11-container.sh @@ -6,7 +6,7 @@ __DIR__=$( pwd ) __PROJECT__=$( - cd ${__DIR__}/../../../ + cd ${__DIR__}/../../ pwd ) cd ${__DIR__} diff --git a/quickstart/linux/x86_64/prepare.sh b/quickstart/linux/x86_64/prepare.sh deleted file mode 100644 index ef7c2f32..00000000 --- a/quickstart/linux/x86_64/prepare.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -set -exu -__DIR__=$( - cd "$(dirname "$0")" - pwd -) -__PROJECT__=$( - cd ${__DIR__}/../../../ - pwd -) -cd ${__PROJECT__} - -composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ - -chmod +x bin/spc - -./bin/spc fetch --all --debug - -./bin/spc list-ext - - -EXTENSION="calendar,ctype,exif,fileinfo,filter,ftp" -EXTENSION="${EXTENSION},session,tokenizer" -EXTENSION="${EXTENSION},phar,posix" -EXTENSION="${EXTENSION},iconv" -EXTENSION="${EXTENSION},xml,dom,simplexml,xmlwriter,xmlreader" -EXTENSION="${EXTENSION},phar,posix" -EXTENSION="${EXTENSION},soap" -EXTENSION="${EXTENSION},mbstring,mbregex" -EXTENSION="${EXTENSION},openssl" -EXTENSION="${EXTENSION},sockets,gmp,bcmath" -EXTENSION="${EXTENSION},pcntl" -EXTENSION="${EXTENSION},curl" -EXTENSION="${EXTENSION},zlib,zip,bz2" -EXTENSION="${EXTENSION},gd" -EXTENSION="${EXTENSION},redis" -EXTENSION="${EXTENSION},pdo,pdo_mysql,pdo_sqlite," -EXTENSION="${EXTENSION},mysqlnd,sqlite3" -EXTENSION="${EXTENSION},mongodb" - - -./bin/spc build "${EXTENSION}" --build-cli --cc=clang --cxx=clang++ --debug -# ./bin/spc build "${EXTENSION}" --build-cli --cc=gcc --cxx=g++ --debug diff --git a/quickstart/macOS/x86_64/prepare.sh b/quickstart/macOS/x86_64/prepare.sh deleted file mode 100644 index 93b83560..00000000 --- a/quickstart/macOS/x86_64/prepare.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -exu -__DIR__=$( - cd "$(dirname "$0")" - pwd -) -__PROJECT__=$( - cd ${__DIR__}/../../../ - pwd -) -cd ${__PROJECT__} - -export PATH=${__PROJECT__}/bin/runtime:$PATH - -composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ - -chmod +x bin/spc - -./bin/spc fetch --all --debug - -./bin/spc list-ext - -./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo,pdo_sqlite,ftp,curl" --cc=clang --cxx=clang++ --debug diff --git a/quickstart/prepare.sh b/quickstart/prepare.sh new file mode 100644 index 00000000..3cb98d5e --- /dev/null +++ b/quickstart/prepare.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -exu +__DIR__=$( + cd "$(dirname "$0")" + pwd +) +__PROJECT__=$( + cd ${__DIR__}/../ + pwd +) +cd ${__PROJECT__} + +composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ + +chmod +x bin/spc + +./bin/spc fetch --all --debug + +./bin/spc list-ext + + +EXTENSIONS="calendar,ctype,exif,fileinfo,filter,ftp" +EXTENSIONS="${EXTENSIONS},session,tokenizer" +EXTENSIONS="${EXTENSIONS},phar,posix" +EXTENSIONS="${EXTENSIONS},iconv" +EXTENSIONS="${EXTENSIONS},xml,dom,simplexml,xmlwriter,xmlreader" +EXTENSIONS="${EXTENSIONS},phar,posix" +EXTENSIONS="${EXTENSIONS},soap" +EXTENSIONS="${EXTENSIONS},mbstring,mbregex" +EXTENSIONS="${EXTENSIONS},openssl" +EXTENSIONS="${EXTENSIONS},sockets,gmp,bcmath" +EXTENSIONS="${EXTENSIONS},pcntl" +EXTENSIONS="${EXTENSIONS},curl" +EXTENSIONS="${EXTENSIONS},zlib,zip,bz2" +EXTENSIONS="${EXTENSIONS},gd" +EXTENSIONS="${EXTENSIONS},redis" +EXTENSIONS="${EXTENSIONS},pdo,pdo_mysql,pdo_sqlite" +EXTENSIONS="${EXTENSIONS},mysqlnd,sqlite3" +EXTENSIONS="${EXTENSIONS},mongodb" + + +./bin/spc build "${EXTENSIONS}" --build-cli --cc=clang --cxx=clang++ --debug +# ./bin/spc build "${EXTENSIONS}" --build-cli --cc=gcc --cxx=g++ --debug From 7c3826f4a42fc1b98ac45814439df071cd0313a9 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 24 May 2023 13:50:23 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quickstart/prepare.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/quickstart/prepare.sh b/quickstart/prepare.sh index 3cb98d5e..47c7d676 100644 --- a/quickstart/prepare.sh +++ b/quickstart/prepare.sh @@ -11,6 +11,14 @@ __PROJECT__=$( ) cd ${__PROJECT__} +OS=$(uname -s) +ARCH=$(uname -m) + +if [[ $OS = "Linux" && -f /etc/os-release ]]; then + OS_NAME=$(cat /etc/os-release | grep '^ID=' | awk -F '=' '{print $2}') + # debian ubuntu alpine +fi + composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ chmod +x bin/spc @@ -19,7 +27,6 @@ chmod +x bin/spc ./bin/spc list-ext - EXTENSIONS="calendar,ctype,exif,fileinfo,filter,ftp" EXTENSIONS="${EXTENSIONS},session,tokenizer" EXTENSIONS="${EXTENSIONS},phar,posix" @@ -38,7 +45,7 @@ EXTENSIONS="${EXTENSIONS},redis" EXTENSIONS="${EXTENSIONS},pdo,pdo_mysql,pdo_sqlite" EXTENSIONS="${EXTENSIONS},mysqlnd,sqlite3" EXTENSIONS="${EXTENSIONS},mongodb" +EXTENSIONS="${EXTENSIONS},swoole" - -./bin/spc build "${EXTENSIONS}" --build-cli --cc=clang --cxx=clang++ --debug +./bin/spc build "${EXTENSIONS}" --build-cli --cc=clang --cxx=clang++ --debug # ./bin/spc build "${EXTENSIONS}" --build-cli --cc=gcc --cxx=g++ --debug From 1fd70c9a9972c61776bb7e3459c7e6e75e1de71e Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 24 May 2023 14:40:09 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E9=AA=8C=E8=AF=81=20swow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quickstart/prepare.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quickstart/prepare.sh b/quickstart/prepare.sh index 47c7d676..9f4669d1 100644 --- a/quickstart/prepare.sh +++ b/quickstart/prepare.sh @@ -45,7 +45,8 @@ EXTENSIONS="${EXTENSIONS},redis" EXTENSIONS="${EXTENSIONS},pdo,pdo_mysql,pdo_sqlite" EXTENSIONS="${EXTENSIONS},mysqlnd,sqlite3" EXTENSIONS="${EXTENSIONS},mongodb" -EXTENSIONS="${EXTENSIONS},swoole" +# EXTENSIONS="${EXTENSIONS},swoole" +EXTENSIONS="${EXTENSIONS},swow" ./bin/spc build "${EXTENSIONS}" --build-cli --cc=clang --cxx=clang++ --debug # ./bin/spc build "${EXTENSIONS}" --build-cli --cc=gcc --cxx=g++ --debug