From 2767ac524fb81ce7b62ec47257c1ea0ebdfcb6cf Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Mon, 8 May 2023 11:44:44 +0800 Subject: [PATCH] =?UTF-8?q?mongodb=20=E6=B7=BB=E5=8A=A0=E5=8F=82=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; } }