View | Details | Raw Unified | Return to bug 279519 | Differences between
and this patch

Collapse All | Expand All

(-)b/databases/Makefile (+1 lines)
Lines 187-192 Link Here
187
    SUBDIR += mongodb50
187
    SUBDIR += mongodb50
188
    SUBDIR += mongodb60
188
    SUBDIR += mongodb60
189
    SUBDIR += mongodb70
189
    SUBDIR += mongodb70
190
    SUBDIR += mongosh
190
    SUBDIR += movine
191
    SUBDIR += movine
191
    SUBDIR += mroonga
192
    SUBDIR += mroonga
192
    SUBDIR += mtop
193
    SUBDIR += mtop
(-)b/databases/mongosh/Makefile (+78 lines)
Added Link Here
1
PORTNAME=	mongosh
2
DISTVERSION=	2.2.5
3
CATEGORIES=	databases net
4
5
MAINTAINER=	fabien.amelinck@advens.fr
6
COMMENT=	MongoDB Shell CLI REPL
7
WWW=		https://github.com/mongodb-js/mongosh/
8
9
LICENSE=	APACHE20
10
11
PATCH_DEPENDS=	npm${NODEJS_SUFFIX}>0:www/npm${NODEJS_SUFFIX}
12
BUILD_DEPENDS=	bash>0:shells/bash \
13
		git>0:devel/git \
14
		brotli>=1.0.9,1:archivers/brotli \
15
		c-ares>=1.17.2:dns/c-ares \
16
		libnghttp2>=1.45.1:www/libnghttp2 \
17
		libuv>=1.42.0:devel/libuv \
18
		objdump:devel/binutils \
19
		${PREFIX}/include/gssapi/gssapi_generic.h:security/krb5
20
RUN_DEPENDS=	ca_root_nss>=0:security/ca_root_nss
21
LIB_DEPENDS=	libmongocrypt.so:databases/libmongocrypt \
22
		libbrotlidec.so:archivers/brotli \
23
		libcares.so:dns/c-ares \
24
		libnghttp2.so:www/libnghttp2 \
25
		libuv.so:devel/libuv
26
27
USES=		compiler:c++11-lib gmake localbase pkgconfig nodejs:20,build python:build ssl
28
29
USE_GITHUB=	yes
30
GH_ACCOUNT=	mongodb-js
31
GH_PROJECT=	mongosh
32
GH_TAGNAME=	v${DISTVERSION}
33
34
MPROTECT_DISABLE=	bin/mongosh
35
36
CUSTOM_ENV=	SEGMENT_API_KEY=dummy BUILD_TYPE=dynamic
37
CONFIGURE_ENV=	${CUSTOM_ENV}
38
MAKE_ENV=	${CUSTOM_ENV} BOXEDNODE_CONFIGURE_ARGS="--shared-brotli,--shared-cares,--shared-libuv,--shared-nghttp2,--shared-zlib,--shared-openssl,--openssl-use-def-ca-store,--without-npm"
39
40
post-fetch:
41
.if !exists(${DISTDIR}/mongodb-client-encryption-6.0.0.tgz)
42
	${FETCH_CMD} -o ${DISTDIR} https://registry.npmjs.org/mongodb-client-encryption/-/mongodb-client-encryption-6.0.0.tgz
43
	${FETCH_CMD} -o ${DISTDIR} https://registry.npmjs.org/kerberos/-/kerberos-2.1.0.tgz
44
	${FETCH_CMD} -o ${DISTDIR} https://registry.npmjs.org/os-dns-native/-/os-dns-native-1.2.0.tgz
45
	# ${MKDIR} -v /tmp/boxednode/${PORTNAME}
46
	# ${FETCH_CMD} -o /tmp/boxednode/${PORTNAME} https://nodejs.org/dist/v20.14.0/node-v20.14.0.tar.gz
47
.endif
48
49
post-extract:
50
	${MKDIR} -v ${WRKSRC}/node_modules/mongodb-client-encryption ${WRKSRC}/node_modules/kerberos ${WRKSRC}/node_modules/os-dns-native
51
	${TAR} -xzf ${DISTDIR}/mongodb-client-encryption-6.0.0.tgz -C ${WRKSRC}/node_modules/mongodb-client-encryption --strip-components 1
52
	${TAR} -xzf ${DISTDIR}/kerberos-2.1.0.tgz -C ${WRKSRC}/node_modules/kerberos --strip-components 1
53
	${TAR} -xzf ${DISTDIR}/os-dns-native-1.2.0.tgz -C ${WRKSRC}/node_modules/os-dns-native --strip-components 1
54
55
post-patch:
56
	cd ${WRKSRC} && npx cross-env PUPPETEER_SKIP_DOWNLOAD=1 npm install
57
58
	${PATCH} -d ${WRKSRC} < ${FILESDIR}/node-patches/node__modules_boxednode_lib_index.js
59
	${FIND} ${WRKSRC}/scripts/ -name "*.orig" -delete
60
	${CP} -vf ${FILESDIR}/node-patches/00* ${WRKSRC}/scripts/nodejs-patches
61
62
do-configure:
63
.for module in mongodb-client-encryption kerberos os-dns-native
64
	cd ${WRKSRC}/node_modules/${module} && ${CONFIGURE_ENV} node-gyp configure
65
.endfor
66
	${RM} -r ${WRKDIR}/.cache/node-gyp/20.12.2/include/node/openssl
67
68
do-build:
69
.for module in mongodb-client-encryption kerberos os-dns-native
70
	cd ${WRKSRC}/node_modules/${module} && ${MAKE_CMD} BUILDTYPE=Release -C build -d
71
.endfor
72
	${REINPLACE_CMD} 's/"version": "0.0.0-dev.0"/"version": "${DISTVERSION}"/g' ${WRKSRC}/packages/cli-repl/package.json
73
	cd ${WRKSRC} && ${MAKE_ENV} npm run compile-exec
74
75
do-install:
76
	${INSTALL_PROGRAM} ${WRKSRC}/dist/mongosh ${STAGEDIR}${PREFIX}/bin
77
78
.include <bsd.port.mk>
(-)b/databases/mongosh/distinfo (+3 lines)
Added Link Here
1
TIMESTAMP = 1715006095
2
SHA256 (mongodb-js-mongosh-2.2.5-v2.2.5_GH0.tar.gz) = 38fd3c21433d2b8d371161941843a3c6a6652e41c4a9d3cfa3917164630f3928
3
SIZE (mongodb-js-mongosh-2.2.5-v2.2.5_GH0.tar.gz) = 8653615
(-)b/databases/mongosh/files/node-patches/004-openssl3 (+15 lines)
Added Link Here
1
--- a/src/crypto/crypto_util.cc	2023-05-16 06:58:21 UTC
2
+++ b/src/crypto/crypto_util.cc
3
@@ -205,10 +205,12 @@ void InitCryptoOnce() {
4
   // No-op with OPENSSL_NO_COMP builds of OpenSSL.
5
   sk_SSL_COMP_zero(SSL_COMP_get_compression_methods());
6
 
7
+#if OPENSSL_VERSION_MAJOR < 3
8
 #ifndef OPENSSL_NO_ENGINE
9
   ERR_load_ENGINE_strings();
10
   ENGINE_load_builtin_engines();
11
 #endif  // !OPENSSL_NO_ENGINE
12
+#endif
13
 }
14
 
15
 void GetFipsCrypto(const FunctionCallbackInfo<Value>& args) {
(-)b/databases/mongosh/files/node-patches/005-src_cares__wrap.h (+11 lines)
Added Link Here
1
--- a/src/cares_wrap.h	2023-05-16 06:58:21 UTC
2
+++ b/src/cares_wrap.h
3
@@ -23,7 +23,7 @@
4
 # include <netdb.h>
5
 #endif  // __POSIX__
6
 
7
-# include <ares_nameser.h>
8
+# include <arpa/nameser.h>
9
 
10
 namespace node {
11
 namespace cares_wrap {
(-)b/databases/mongosh/files/node-patches/node__modules_boxednode_lib_index.js (+11 lines)
Added Link Here
1
--- node_modules/boxednode/lib/index.js.orig	2024-05-15 15:56:00 UTC
2
+++ node_modules/boxednode/lib/index.js
3
@@ -194,7 +196,7 @@ async function compileNode(sourcePath, linkedJSModules
4
                 await fs_1.promises.writeFile(target, 'utf8');
5
             }
6
         }
7
-        const make = ['make', ...makeArgs];
8
+        const make = ['gmake', ...makeArgs];
9
         if (!make.some((arg) => /^-j/.test(arg))) {
10
             make.push(`-j${cpus}`);
11
         }
(-)b/databases/mongosh/files/patch-node__modules_kerberos_binding.gyp (+35 lines)
Added Link Here
1
--- node_modules/kerberos/binding.gyp.orig	2024-05-13 15:16:38 UTC
2
+++ node_modules/kerberos/binding.gyp
3
@@ -34,16 +34,21 @@
4
               'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
5
             }
6
         }],
7
-        ['OS=="mac" or OS=="linux"', {
8
+        ['OS=="mac" or OS=="linux" or OS=="freebsd"', {
9
           'sources': [
10
             'src/unix/base64.cc',
11
             'src/unix/kerberos_gss.cc',
12
             'src/unix/kerberos_unix.cc'
13
           ]
14
         }],
15
-        ['(OS=="mac" or OS=="linux") and (kerberos_use_rtld!="true")', {
16
+        ['(OS=="mac" or OS=="linux" or OS=="freebsd") and (kerberos_use_rtld!="true")', {
17
+          'defines': ['NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT'],
18
+          'include_dirs': [
19
+            '/usr/local/include'
20
+          ],
21
           'link_settings': {
22
             'libraries': [
23
+              '-L/usr/lib',
24
               '-lkrb5',
25
               '-lgssapi_krb5'
26
             ]
27
@@ -58,7 +63,7 @@
28
             }]
29
           ]
30
         }],
31
-        ['(OS=="mac" or OS=="linux") and (kerberos_use_rtld=="true")', {
32
+        ['(OS=="mac" or OS=="linux" or OS=="freebsd") and (kerberos_use_rtld=="true")', {
33
           'defines': ['KERBEROS_USE_RTLD=1'],
34
           'link_settings': {
35
             'libraries': [
(-)b/databases/mongosh/files/patch-node__modules_kerberos_src_kerberos__common.h (+11 lines)
Added Link Here
1
--- node_modules/kerberos/src/kerberos_common.h.orig	2024-05-13 16:09:25 UTC
2
+++ node_modules/kerberos/src/kerberos_common.h
3
@@ -1,7 +1,7 @@
4
 #ifndef KERBEROS_COMMON_H
5
 #define KERBEROS_COMMON_H
6
 
7
-#if defined(__linux__) || defined(__APPLE__)
8
+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
9
 #include "unix/kerberos_gss.h"
10
 
11
 namespace node_kerberos {
(-)b/databases/mongosh/files/patch-node__modules_mongodb-client-encryption_binding.gyp (+18 lines)
Added Link Here
1
--- node_modules/mongodb-client-encryption/binding.gyp.orig	2024-05-13 14:10:24 UTC
2
+++ node_modules/mongodb-client-encryption/binding.gyp
3
@@ -38,9 +38,14 @@
4
           }
5
       }],
6
       ['build_type=="dynamic"', {
7
+        'defines': [ 'NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT' ],
8
+        'include_dirs': [
9
+          '/usr/include',
10
+          '/usr/local/include'
11
+        ],
12
         'link_settings': {
13
           'libraries': [
14
-            '-lmongocrypt'
15
+            '-L/usr/local/lib -lmongocrypt'
16
           ]
17
         }
18
       }],
(-)b/databases/mongosh/files/patch-node__modules_mongodb-client-encryption_package.json (+11 lines)
Added Link Here
1
--- node_modules/mongodb-client-encryption/package.json.orig	2024-05-13 13:50:11 UTC
2
+++ node_modules/mongodb-client-encryption/package.json
3
@@ -16,7 +16,7 @@
4
     "lib": "lib"
5
   },
6
   "scripts": {
7
-    "install": "prebuild-install --runtime napi --tag-prefix node-v || node-gyp rebuild",
8
+    "install": "prebuild-install --runtime napi --tag-prefix node-v || BUILD_TYPE=dynamic node-gyp rebuild",
9
     "build:ts": "tsc",
10
     "clang-format": "clang-format --style=file:.clang-format --Werror -i addon/*",
11
     "check:eslint": "eslint src test",
(-)b/databases/mongosh/files/patch-node__modules_os-dns-native_binding.gyp (+13 lines)
Added Link Here
1
--- node_modules/os-dns-native/binding.gyp.orig	2024-05-13 16:56:54 UTC
2
+++ node_modules/os-dns-native/binding.gyp
3
@@ -19,10 +19,6 @@
4
         "link_settings": {
5
           "libraries": ["-ldnsapi"]
6
         }
7
-      }, {
8
-        "link_settings": {
9
-          "libraries": ["-lresolv"]
10
-        }
11
       }]
12
     ]
13
   }]
(-)b/databases/mongosh/files/patch-package.json (+18 lines)
Added Link Here
1
--- package.json.orig	2024-05-15 14:01:43 UTC
2
+++ package.json
3
@@ -59,7 +59,6 @@
4
     "create-vulnerability-tickets": "mongodb-sbom-tools generate-vulnerability-report --snyk-reports=.sbom/snyk-test-result.json,.sbom/node-js-vuln.json --dependencies=.sbom/dependencies.json,.sbom/node-js-dep.json --create-jira-issues",
5
     "where": "monorepo-where",
6
     "reformat": "npm run reformat --workspaces --if-present",
7
-    "prepare": "husky install",
8
     "precommit": "precommit",
9
     "preinstall": "node scripts/sort-workspaces.js"
10
   },
11
@@ -101,7 +100,6 @@
12
     "duplexpair": "^1.0.2",
13
     "find-up": "^5.0.0",
14
     "glob": "^10.3.12",
15
-    "husky": "^8.0.3",
16
     "mocha": "^10.2.0",
17
     "mongodb": "^6.5.0",
18
     "mongodb-runner": "^5.4.6",
(-)b/databases/mongosh/files/patch-scripts_prep-fle-addon.sh (+20 lines)
Added Link Here
1
--- scripts/prep-fle-addon.sh.orig	2024-05-31 10:02:13 UTC
2
+++ scripts/prep-fle-addon.sh
3
@@ -62,7 +62,7 @@ if [ x"$PREBUILT_OSNAME" != x"" ]; then
4
   mv -v prebuilts/nocrypto/include include
5
   mv -v prebuilts/$LIB/*bson* lib
6
   rm -rf prebuilts
7
-else
8
+elif [ `uname` != FreeBSD ]; then
9
   if [ `uname` = Darwin ]; then
10
     export CFLAGS="-mmacosx-version-min=10.15";
11
   fi
12
@@ -86,7 +86,7 @@ else
13
   cd ../../
14
 fi
15
 
16
-if [ x"$FLE_NODE_SOURCE_PATH" != x"" ]; then
17
+if [ x"$FLE_NODE_SOURCE_PATH" != x"" -a `uname` != FreeBSD -a "$BUILD_TYPE" != dynamic ]; then
18
   mkdir -p "$FLE_NODE_SOURCE_PATH"/deps/lib
19
   mkdir -p "$FLE_NODE_SOURCE_PATH"/deps/include
20
   cp -rv "$BUILDROOT"/lib*/*-static* "$FLE_NODE_SOURCE_PATH"/deps/lib
(-)b/databases/mongosh/files/patch-scripts_sort-workspaces.js (+11 lines)
Added Link Here
1
--- scripts/sort-workspaces.js.orig	2024-05-03 16:42:16 UTC
2
+++ scripts/sort-workspaces.js
3
@@ -22,7 +22,7 @@ async function main() {
4
   ));
5
 
6
   // should use the scopes in lerna.json
7
-  const { stdout } = await exec('npx -y lerna ls --all --no-since --toposort --json');
8
+  const { stdout } = await exec('npx -y lerna ls --all --toposort --json');
9
   packageJSON.workspaces = JSON.parse(stdout).map(({ location }) => path.relative(monorepoRoot, location));
10
 
11
   await fs.writeFile(
(-)b/databases/mongosh/pkg-descr (+2 lines)
Added Link Here
1
Standalone MongoDB Shell replacing deprecated Mongo CLI
2
NodeJS doesn't need to be installed
(-)b/databases/mongosh/pkg-plist (-1 / +1 lines)
Added Link Here
0
- 
1
bin/mongosh

Return to bug 279519