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

Collapse All | Expand All

(-)b/databases/Makefile (+1 lines)
Lines 189-194 Link Here
189
    SUBDIR += mongodb60
189
    SUBDIR += mongodb60
190
    SUBDIR += mongodb70
190
    SUBDIR += mongodb70
191
    SUBDIR += mongodb80
191
    SUBDIR += mongodb80
192
    SUBDIR += mongosh
192
    SUBDIR += movine
193
    SUBDIR += movine
193
    SUBDIR += mroonga
194
    SUBDIR += mroonga
194
    SUBDIR += mtop
195
    SUBDIR += mtop
(-)b/databases/mongosh/Makefile (+146 lines)
Added Link Here
1
PORTNAME=	mongosh
2
DISTVERSIONPREFIX=	v
3
DISTVERSION=	2.2.5
4
CATEGORIES=	databases shells net
5
MASTER_SITES=	https://registry.npmjs.org/mongodb-client-encryption/-/:mongocrypt \
6
		https://registry.npmjs.org/kerberos/-/:kerberos \
7
		https://registry.npmjs.org/os-dns-native/-/:dns \
8
		https://github.com/${GH_ACCOUNT}/${PORTNAME}/releases/download/${DISTVERSIONFULL}/:modules
9
		# https://nodejs.org/dist/latest-v${NODEJS_VERSION}.x/:node
10
DISTFILES=	mongodb-client-encryption-${MONGO_CRYPT_VER}.tgz:mongocrypt \
11
		kerberos-${KERBEROS_VER}.tgz:kerberos \
12
		os-dns-native-${OSDNSNATIVE_VER}.tgz:dns \
13
		${NODE_MODULES_TARBALL}:modules \
14
		# ${NODEJS_TARBALL}:node \
15
		# SHASUMS256.txt:node
16
DIST_SUBDIR=	${PORTNAME}
17
EXTRACT_ONLY=	${DISTFILE_DEFAULT}
18
19
MAINTAINER=	fabien.amelinck+freebsd@advens.fr
20
COMMENT=	MongoDB Shell CLI REPL
21
WWW=		https://github.com/mongodb-js/mongosh/
22
23
LICENSE=	APACHE20
24
25
FETCH_DEPENDS=	npm${NODEJS_SUFFIX}>0:www/npm${NODEJS_SUFFIX}
26
BUILD_DEPENDS=	bash>0:shells/bash \
27
		brotli>=1.0.9,1:archivers/brotli \
28
		c-ares>=1.17.2:dns/c-ares \
29
		libnghttp2>=1.45.1:www/libnghttp2 \
30
		libuv>=1.42.0:devel/libuv \
31
		objdump:devel/binutils \
32
		git>0:devel/git \
33
		${PREFIX}/include/gssapi/gssapi_generic.h:security/krb5
34
RUN_DEPENDS=	ca_root_nss>=0:security/ca_root_nss
35
LIB_DEPENDS=	libmongocrypt.so:databases/libmongocrypt \
36
		libbrotlidec.so:archivers/brotli \
37
		libcares.so:dns/c-ares \
38
		libnghttp2.so:www/libnghttp2 \
39
		libuv.so:devel/libuv
40
41
USES=		compiler:c++11-lib gmake localbase pkgconfig nodejs:20,build python:build ssl
42
43
USE_GITHUB=	yes
44
GH_ACCOUNT=	VultureProject
45
GH_PROJECT=	mongosh
46
47
MPROTECT_DISABLE=	bin/mongosh
48
49
CXXFLAGS+=	-DNODE_API_EXPERIMENTAL \
50
		-DNODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT
51
52
CUSTOM_ENV=	SEGMENT_API_KEY=dummy BUILD_TYPE=dynamic
53
CONFIGURE_ENV=	${CUSTOM_ENV}
54
MAKE_ENV=	${CUSTOM_ENV} \
55
		NODE_JS_VERSION=file://${_DISTDIR}/${NODEJS_TARBALL} \
56
		BOXEDNODE_CONFIGURE_ARGS="--shared-brotli,--shared-cares,--shared-libuv,--shared-nghttp2,--shared-zlib,--shared-openssl,--openssl-use-def-ca-store,--without-npm"
57
REINPLACE_ARGS=	-i ''
58
59
MONGO_CRYPT_VER=6.0.0
60
KERBEROS_VER=	2.1.0
61
OSDNSNATIVE_VER=1.2.0
62
NODE_MODULES_DIR=	${WRKSRC}/node_modules
63
NODE_MODULES_TARBALL=	${PORTNAME}-node-modules.tar.xz
64
NPM_CACHE_DIR=	/tmp/.npm
65
NODEJS_TARBALL=	node-v${NODEJS_PORTVERSION}.tar.gz
66
67
post-fetch:
68
.if !exists(/tmp/checkpoint)
69
	${FETCH_CMD} -o ${_DISTDIR} https://nodejs.org/dist/v${NODEJS_PORTVERSION}/${NODEJS_TARBALL}
70
	${FETCH_CMD} -o ${_DISTDIR} https://nodejs.org/dist/v${NODEJS_PORTVERSION}/SHASUMS256.txt
71
	${TOUCH} /tmp/checkpoint
72
.endif
73
74
post-extract:
75
.if !exists(${NODE_MODULES_DIR})
76
	${TAR} -xzf /${_DISTDIR}/${NODE_MODULES_TARBALL} -C ${WRKSRC}
77
	${REINPLACE_CMD} -e "s/'make'/'gmake'/g" \
78
		-e "s/'V='/'V=0'/g" \
79
		-e 's/(await (0, nv_1.default)(range)).pop()/{"version": "${NODEJS_PORTVERSION}"}/g' \
80
		-e "s|\$${releaseBaseUrl}/\(SHASUMS256.txt\)|${_DISTDIR}/\1|g" \
81
		-e 's/await (0, node_fetch_1.default)(shaSumsUrl)/{"ok":1}/g' \
82
		-e "s/shaSums.text()/fs_1.promises.readFile(shaSumsUrl, 'utf8')/g" \
83
		-e "s/catch (_a) { }/catch (_a) { console.error(_a) }/g" \
84
		${NODE_MODULES_DIR}/boxednode/lib/index.js
85
	${GREP} -A20 "const shaSumsUrl" ${NODE_MODULES_DIR}/boxednode/lib/index.js
86
	${REINPLACE_CMD} -e "s|\('install',\) \('--ignore-scripts'\)|\1 '--offline', '--cache ${NPM_CACHE_DIR}', \2|g" \
87
		${NODE_MODULES_DIR}/boxednode/lib/native-addons.js
88
	${GREP} "ignore-scripts" ${NODE_MODULES_DIR}/boxednode/lib/native-addons.js
89
.endif
90
91
post-patch:
92
	${FIND} ${WRKSRC}/scripts -name "*.orig" -delete
93
	${CP} -v ${FILESDIR}/node-patches/* ${WRKSRC}/scripts/nodejs-patches
94
95
do-configure:
96
.for module in mongodb-client-encryption kerberos os-dns-native
97
	cd ${NODE_MODULES_DIR}/${module} && ${CONFIGURE_ENV} node-gyp configure --nodedir=${LOCALBASE}
98
.endfor
99
100
do-build:
101
.for module in mongodb-client-encryption kerberos os-dns-native
102
	cd ${NODE_MODULES_DIR}/${module} && ${MAKE_ENV} ${MAKE_CMD} BUILDTYPE=Release -C build -d
103
.endfor
104
	${REINPLACE_CMD} 's/"version": "0.0.0-dev.0"/"version": "${DISTVERSION}"/g' ${WRKSRC}/packages/cli-repl/package.json
105
	cd ${WRKSRC} && ${MAKE_ENV} /usr/local/bin/npm run compile-exec
106
107
do-install:
108
	${INSTALL_PROGRAM} ${WRKSRC}/dist/mongosh ${STAGEDIR}${PREFIX}/bin
109
110
npm-pkg-list: extract
111
	${GREP} registry.npmjs.org ${WRKSRC}/package-lock.json | \
112
		| ${SED} -E 's/^[[:space:]]+//g' \
113
		| ${SED} -E 's#^.*org/|.tgz",##g' \
114
		| ${SORT} \
115
		| /usr/bin/uniq \
116
		| ${SED} -E 's/(.*)-([^-])/\1@\2/g' \
117
		| ${SED} -E 's|/-/.*@|@|g' \
118
		> ${FILESDIR}/npm-pkg.list
119
120
.for module in mongodb-client-encryption kerberos os-dns-native mongodb-crypt-library-version glibc-version
121
	cd ${NODE_MODULES_DIR}/${module} && /usr/local/bin/npm list 2>/dev/null \
122
		| ${GREP} UNMET \
123
		| ${AWK} 'BEGIN{FS="UNMET DEPENDENCY "}{print $$2}' \
124
		> ${FILESDIR}/npm-pkg-${module}.list
125
.endfor
126
127
node-modules-archive: build
128
	${RM} -R ${NODE_MODULES_DIR}
129
.for module in mongodb-client-encryption kerberos os-dns-native
130
	${MKDIR} -v ${NODE_MODULES_DIR}/${module}
131
	${TAR} -xzf ${_DISTDIR}/${module}-*.tgz -C ${NODE_MODULES_DIR}/${module} --strip-components 1
132
.endfor
133
	for f in ${FILESDIR}/node-modules-patches/*; do patch -N -d ${WRKSRC} < $$f; done
134
135
	cd ${WRKSRC} && npx cross-env PUPPETEER_SKIP_DOWNLOAD=1 /usr/local/bin/npm install --cache ${NPM_CACHE_DIR}
136
137
.for module in mongodb-client-encryption kerberos os-dns-native mongodb-crypt-library-version glibc-version
138
	/usr/local/bin/npm cache add $$(cat ${FILESDIR}/npm-pkg-${module}.list) --cache ${NPM_CACHE_DIR} || true
139
	cd ${NODE_MODULES_DIR}/${module} && ${CONFIGURE_ENV} /usr/local/bin/npm install --ignore-scripts --cache ${NPM_CACHE_DIR}
140
.endfor
141
	${FIND} ${WRKSRC} -name "*.orig" -or -name "*.bak" -delete
142
143
	cd ${WRKSRC} && ${TAR} -cJf /tmp/${NODE_MODULES_TARBALL} node_modules
144
145
.include <bsd.port.mk>
146
.include "${PORTSDIR}/www/node${NODEJS_VERSION}/Makefile.version"
(-)b/databases/mongosh/distinfo (+11 lines)
Added Link Here
1
TIMESTAMP = 1731685667
2
SHA256 (mongosh/mongodb-client-encryption-6.0.0.tgz) = b72d6ad4e4c449ba4548f8f4f8708d37c1490c6615caefa8c56a02f22897b64a
3
SIZE (mongosh/mongodb-client-encryption-6.0.0.tgz) = 15734
4
SHA256 (mongosh/kerberos-2.1.0.tgz) = eeb1d33472dcf15be8ae46e30ffc76455a62356a91cee52bb8d48f97a35a58c7
5
SIZE (mongosh/kerberos-2.1.0.tgz) = 28988
6
SHA256 (mongosh/os-dns-native-1.2.0.tgz) = cfe145091dd469c4fe6923b61ef85621222526a0ed74b01b6b3739069d244f7d
7
SIZE (mongosh/os-dns-native-1.2.0.tgz) = 6525
8
SHA256 (mongosh/mongosh-node-modules.tar.xz) = fb8702b2e7846d320a6dafa77496be0adad9d248b4097b541bfaf84cd890a518
9
SIZE (mongosh/mongosh-node-modules.tar.xz) = 155538892
10
SHA256 (mongosh/VultureProject-mongosh-v2.2.5_GH0.tar.gz) = 38fd3c21433d2b8d371161941843a3c6a6652e41c4a9d3cfa3917164630f3928
11
SIZE (mongosh/VultureProject-mongosh-v2.2.5_GH0.tar.gz) = 8653615
(-)b/databases/mongosh/files/node-modules-patches/patch-node__modules_kerberos_binding.gyp (+32 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,14 +34,18 @@
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
               '-lkrb5',
24
@@ -58,7 +62,7 @@
25
             }]
26
           ]
27
         }],
28
-        ['(OS=="mac" or OS=="linux") and (kerberos_use_rtld=="true")', {
29
+        ['(OS=="mac" or OS=="linux" or OS=="freebsd") and (kerberos_use_rtld=="true")', {
30
           'defines': ['KERBEROS_USE_RTLD=1'],
31
           'link_settings': {
32
             'libraries': [
(-)b/databases/mongosh/files/node-modules-patches/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/node-modules-patches/patch-node__modules_mongodb-client-encryption_binding.gyp (+35 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
       }],
19
@@ -48,13 +53,12 @@
20
         'conditions': [
21
           ['OS!="win"', {
22
             'include_dirs': [
23
-              '<(module_root_dir)/deps/include'
24
+              '/usr/include',
25
+              '/usr/local/include'
26
             ],
27
             'link_settings': {
28
               'libraries': [
29
-                '<(module_root_dir)/deps/lib/libmongocrypt-static.a',
30
-                '<(module_root_dir)/deps/lib/libkms_message-static.a',
31
-                '<(module_root_dir)/deps/lib/libbson-static-for-libmongocrypt.a'
32
+                '-L/usr/local/lib -lmongocrypt'
33
               ]
34
             }
35
           }],
(-)b/databases/mongosh/files/node-modules-patches/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/node-modules-patches/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/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/patch-package.json (+36 lines)
Added Link Here
1
--- package.json.orig	2024-05-15 14:01:43 UTC
2
+++ package.json
3
@@ -9,7 +9,7 @@
4
   "author": "Compass Team <compass@mongodb.com>",
5
   "scripts": {
6
     "bootstrap-with-chromium": "npm install && npm run compile",
7
-    "bootstrap": "npx cross-env PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 npm install && npm run compile",
8
+    "bootstrap": "npx cross-env PUPPETEER_SKIP_DOWNLOAD=1 npm install && npm run compile",
9
     "clean": "lerna clean -y && rm -Rf node_modules",
10
     "check": "lerna run check --since HEAD --exclude-dependents",
11
     "check-ci": "npm run check --workspaces --if-present",
12
@@ -33,7 +33,7 @@
13
     "start-browser": "npm run start --workspace @mongosh/browser-repl",
14
     "start": "npm run start-cli",
15
     "precompile-exec": "npm run compile-cli",
16
-    "compile-exec": "npm run evergreen-release compile",
17
+    "compile-exec": "SEGMENT_API_KEY=dummy npm run evergreen-release compile",
18
     "compile-all": "npm run compile-compass && npm run compile-exec",
19
     "evergreen-release": "cd packages/build && npm run evergreen-release --",
20
     "release": "cd packages/build && npm run release --",
21
@@ -59,7 +59,6 @@
22
     "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",
23
     "where": "monorepo-where",
24
     "reformat": "npm run reformat --workspaces --if-present",
25
-    "prepare": "husky install",
26
     "precommit": "precommit",
27
     "preinstall": "node scripts/sort-workspaces.js"
28
   },
29
@@ -101,7 +100,6 @@
30
     "duplexpair": "^1.0.2",
31
     "find-up": "^5.0.0",
32
     "glob": "^10.3.12",
33
-    "husky": "^8.0.3",
34
     "mocha": "^10.2.0",
35
     "mongodb": "^6.5.0",
36
     "mongodb-runner": "^5.4.6",
(-)b/databases/mongosh/files/patch-scripts_nodejs-patches_002-workaround-node-bug-52229 (+17 lines)
Added Link Here
1
--- scripts/nodejs-patches/002-workaround-node-bug-52229.orig	2024-05-16 08:32:21 UTC
2
+++ scripts/nodejs-patches/002-workaround-node-bug-52229
3
@@ -2,13 +2,12 @@ diff --git a/common.gypi b/common.gypi
4
 index efcd8da84815..fe11453f09b5 100644
5
 --- a/common.gypi
6
 +++ b/common.gypi
7
-@@ -268,6 +268,9 @@
8
+@@ -268,6 +268,8 @@
9
      # Defines these mostly for node-gyp to pickup.
10
      'defines': [
11
        '_GLIBCXX_USE_CXX11_ABI=1',
12
 +      # Work around https://github.com/nodejs/node/issues/52229
13
 +      "NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT=1",
14
-+      "NAPI_EXPERIMENTAL=1",
15
      ],
16
 
17
      # Forcibly disable -Werror.  We support a wide range of compilers, it's
(-)b/databases/mongosh/files/patch-scripts_prep-fle-addon.sh (+20 lines)
Added Link Here
1
--- scripts/prep-fle-addon.sh.orig	2024-05-13 17:26:57 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 (+5 lines)
Added Link Here
1
Standalone MongoDB Shell replacing deprecated Mongo CLI.
2
NodeJS doesn't need to be installed.
3
4
This port is maintained by VultureOS Team.
5
Contact us if you experience any issue: https://discord.gg/E5Bs97J
(-)b/databases/mongosh/pkg-plist (-1 / +1 lines)
Added Link Here
0
- 
1
bin/mongosh

Return to bug 279519