Hello ports@,

The attached diff updates mongodb from the current 3.2 to 4.4.10 so it
builds with scons 4.

I couldn't fully test the port because:

 - I don't own any Ubiquiti stuff
 - `make test' filled my poor SSD with ~90GB of WRKDIR and no signs of
   finishing anytime soon

so help testing the update is greatly appreciated.  (I did some basic
runtime testing thought.)

I'm kinda confused about the versioning.  net/unifi/Makefile.inc
explicitly set mongodb < 3.6.0, and that's probably why freebsd and nix
still have mongo 3.x packaged.  But if I read repology correctly, gentoo
ships mongodb 5, 4.4 and 4.2 and some unifi stuff too, so I think it's
worth to give this update at least try.  If it fails, the plan B is to
update mongo to 3.6.23 and patch the hell out of site_scons/mongo/*.py
to run under python 3.

Random notes:

 - patch-src_mongo_util_net_ssl_manager_openssl_cpp is a desperate
   tentative to build mongo with base libressl.  The other options are
   to either use openssl from ports or disable TLS.  FWIW I ran
   (locally) mongodb with a self-signed certificate and it worked fine.

 - some tools are not bundled anymore.  If there is interest in those, I
   can try porting mongo-tools (https://github.com/mongodb/mongo-tools)

 - the license changed to a custom one.  mongodb is still packaged on
   various other systems so I guess it's not a problem.

 - make port-lib-depends-check complains regarding libbind, but does so
   also in the other ports that depends on libbind, so I guess it's OK.

 - I've added the port in the config file even if it's the default
   because 1) it's what upstream does and 2) I think it's handy to have
   a remainder of which port mongo operates on without digging through
   the doc.

Remember to apply with -E because the diff removes some files and to
apply the scons patch that I just posted.

Thanks,

Omar Polo


Index: Makefile
===================================================================
RCS file: /home/cvs/ports/databases/mongodb/Makefile,v
retrieving revision 1.43
diff -u -p -r1.43 Makefile
--- Makefile    9 Jun 2021 19:50:06 -0000       1.43
+++ Makefile    25 Oct 2021 10:46:10 -0000
@@ -9,76 +9,104 @@ DPB_PROPERTIES = parallel
 
 COMMENT =      scalable, high-performance document-oriented database
 
-DISTNAME =     mongodb-src-r3.2.22
+DISTNAME =     mongodb-src-r4.4.10
 PKGNAME =      ${DISTNAME:S/src-r//}
 CATEGORIES =   databases
-REVISION =     4
 
 HOMEPAGE =     https://www.mongodb.com/
 
-# mongodb itself: AGPLv3
-# client/utils:   Apache 2.0
+# mongodb itself: SSPLv1
+# abseil-cpp: Apache
+# asio: Boost
+# fmt: MIT
+# mozjs-60: MPL
+# wiredtiger: GPLv2 or v3
 PERMIT_PACKAGE =       Yes
 
-WANTLIB += boost_chrono-mt boost_filesystem-mt boost_program_options-mt
-WANTLIB += boost_regex-mt boost_system-mt boost_thread-mt c crypto
-WANTLIB += execinfo kvm m pcap pcre pcrecpp pthread ssl yaml-cpp
-WANTLIB += z ${COMPILER_LIBCXX}
+WANTLIB += ${COMPILER_LIBCXX} boost_filesystem-mt boost_iostreams-mt
+WANTLIB += boost_log-mt boost_program_options-mt boost_system-mt
+WANTLIB += boost_thread-mt c crypto curl execinfo icudata icui18n
+WANTLIB += icuuc kvm lib/libbind/bind m pcre pcrecpp snappy ssl
+WANTLIB += stemmer yaml-cpp z zstd
 
 MASTER_SITES = https://fastdl.mongodb.org/src/
 
 MODULES =      devel/scons \
                lang/python
-MODPY_VERSION =        ${MODPY_DEFAULT_VERSION_2}
 
 # XXX should come from scons module, but broken when gcc module also used:
 NO_CCACHE =    Yes
 
+# C++17
 COMPILER =     base-clang ports-gcc
-MODPY_VERSION =        ${MODPY_DEFAULT_VERSION_2}
 MODPY_RUNDEP = No
+
 MODSCONS_ENV = CC="${CC}" \
                CXX="${CXX}" \
                CCFLAGS="${CFLAGS} -DBOOST_NO_USER_CONFIG" \
-               CXXFLAGS="${CXXFLAGS}" \
-               LINKFLAGS="${LDFLAGS}" \
-               CPPPATH="${LOCALBASE}/include" \
-               LIBPATH="${LOCALBASE}/lib" \
-               VERBOSE=true
-MODSCONS_FLAGS += --prefix="${PREFIX}" \
+               CXXFLAGS="${CXXFLAGS} -DBOOST_LOG_DYN_LINK" \
+               CPPPATH="${LOCALBASE}/include ${LOCALBASE}/include/bind" \
+               LIBPATH="${LOCALBASE}/lib ${LOCALBASE}/lib/libbind" \
+               LIBS="-lbind" \
+               LINKFLAGS="${LDFLAGS} -Wl,-rpath,${LOCALBASE}/lib/libbind" \
+               VERBOSE=true \
+               PREFIX="${PREFIX}"
+
+# XXX --use-system-fmt fails at linking because mongo reaches into fmt
+# internals; see src/mongo/logv2/log_attr.h
+MODSCONS_FLAGS += \
                  --opt=on \
-                 --ssl=SSL \
+                 --ssl=on \
                  --allocator=system \
                  --use-system-boost \
+                 --use-system-icu \
                  --use-system-pcre \
+                 --use-system-snappy \
+                 --use-system-stemmer \
                  --use-system-yaml \
                  --use-system-zlib \
-                 -j${MAKE_JOBS}
+                 --use-system-zstd \
+                 --disable-warnings-as-errors
 
-ALL_TARGET =   core tools
-LIB_DEPENDS =  devel/boost \
+ALL_TARGET =   install-core
+LIB_DEPENDS =  archivers/snappy \
+               archivers/zstd \
+               devel/boost \
                devel/pcre \
-               devel/yaml-cpp
-TEST_DEPENDS = textproc/py-yaml \
-               databases/py-mongo
-# icu4c support is not actually compiled in, but scons picks up the
-# headers and patching this away is intrusive
-BUILD_DEPENDS =        textproc/icu4c
+               devel/yaml-cpp \
+               net/curl \
+               net/libbind \
+               textproc/icu4c \
+               textproc/libstemmer
+BUILD_DEPENDS =        devel/py-cheetah${MODPY_FLAVOR} \
+               textproc/py-yaml${MODPY_FLAVOR} \
+               sysutils/py-psutil${MODPY_FLAVOR}
+TEST_DEPENDS = databases/py-mongo${MODPY_FLAVOR} \
+               ${BUILD_DEPENDS}
+
+# to build the bundled mozjs we need some config files: steal the
+# FreeBSD ones
+post-extract:
+       cd ${WRKSRC}/src/third_party/mozjs-60/platform/x86_64/ && \
+               cp -R freebsd openbsd
 
 do-install:
-.for bin in mongo mongod mongos mongosniff mongobridge mongoperf
-       ${INSTALL_PROGRAM} ${WRKSRC}/${bin} ${PREFIX}/bin/
+.for bin in mongo mongod mongos
+       ${INSTALL_PROGRAM} ${WRKSRC}/build/opt/mongo/${bin} \
+               ${PREFIX}/bin/
        if [ -f ${WRKSRC}/debian/${bin}.1 ]; then \
          ${INSTALL_MAN} ${WRKSRC}/debian/${bin}.1 ${PREFIX}/man/man1; \
        fi
 .endfor
+       ${INSTALL_MAN} ${WRKSRC}/debian/mongodb-parameters.5 ${PREFIX}/man/man5
        ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/mongodb
        ${INSTALL_DATA} ${FILESDIR}/mongodb.conf \
            ${PREFIX}/share/examples/mongodb
 
 do-test:
        @${SETENV} ${MAKE_ENV} ${MODSCONS_BIN} -C ${WRKSRC} \
-           ${MODSCONS_ENV} ${MODSCONS_FLAGS} unittests
-       cd ${WRKSRC} && ${MODPY_BIN} buildscripts/resmoke.py --suites=unittests
+           ${MODSCONS_ENV} ${MODSCONS_FLAGS} install-unittests
+       cd ${WRKSRC} && ${MODPY_BIN} buildscripts/resmoke.py run \
+           --suites=unittests
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /home/cvs/ports/databases/mongodb/distinfo,v
retrieving revision 1.13
diff -u -p -r1.13 distinfo
--- distinfo    20 Feb 2019 17:58:04 -0000      1.13
+++ distinfo    16 Oct 2021 20:03:00 -0000
@@ -1,2 +1,2 @@
-SHA256 (mongodb-src-r3.2.22.tar.gz) = 
JvNEPXO7Bo2qBwqUxiYalB9ZHNdhRIPHyRXOHP3mElI=
-SIZE (mongodb-src-r3.2.22.tar.gz) = 29350747
+SHA256 (mongodb-src-r4.4.10.tar.gz) = 
3SLK/UoO6LzjotCnduCSuPD/GTvrp9Fxj2uKxfngyeY=
+SIZE (mongodb-src-r4.4.10.tar.gz) = 50636024
Index: files/mongodb.conf
===================================================================
RCS file: /home/cvs/ports/databases/mongodb/files/mongodb.conf,v
retrieving revision 1.2
diff -u -p -r1.2 mongodb.conf
--- files/mongodb.conf  6 May 2016 15:33:37 -0000       1.2
+++ files/mongodb.conf  18 Oct 2021 10:21:49 -0000
@@ -10,6 +10,7 @@ net:
   # Only listen on the local network interface. Change this only if you
   # need a public-facing instance and have turned on authorization.
   bindIp: 127.0.0.1
+  port: 27017
 storage:
   dbPath: /var/mongodb/data
   journal:
Index: patches/patch-SConstruct
===================================================================
RCS file: /home/cvs/ports/databases/mongodb/patches/patch-SConstruct,v
retrieving revision 1.9
diff -u -p -r1.9 patch-SConstruct
--- patches/patch-SConstruct    18 Mar 2021 15:51:13 -0000      1.9
+++ patches/patch-SConstruct    19 Oct 2021 11:56:59 -0000
@@ -3,11 +3,29 @@ $OpenBSD: patch-SConstruct,v 1.9 2021/03
 Index: SConstruct
 --- SConstruct.orig
 +++ SConstruct
-@@ -846,6 +846,7 @@ envDict = dict(BUILD_ROOT=buildDir,
-                INSTALL_DIR=installDir,
+@@ -91,7 +91,7 @@ def make_variant_dir_generator():
+ 
+ # Always randomize the build order to shake out missing edges, and to help 
the cache:
+ # http://scons.org/doc/production/HTML/scons-user/ch24s06.html
+-SetOption('random', 1)
++#SetOption('random', 1)
+ 
+ # Options TODOs:
+ #
+@@ -1131,6 +1131,7 @@ envDict = dict(BUILD_ROOT=buildDir,
+                CONFIGURELOG='$BUILD_ROOT/scons/config.log',
                 CONFIG_HEADER_DEFINES={},
                 LIBDEPS_TAG_EXPANSIONS=[],
 +               ENV = {'PATH': os.environ['PATH']},
                 )
  
- env = Environment(variables=env_vars, **envDict)
+ # TODO: Remove these when hygienic builds are default.
+@@ -3338,7 +3339,7 @@ def doConfigure(myenv):
+         sslLibName = "ssl"
+         cryptoLibName = "crypto"
+         sslLinkDependencies = ["crypto", "dl"]
+-        if conf.env.TargetOSIs('freebsd'):
++        if conf.env.TargetOSIs('freebsd') or conf.env.TargetOSIs('openbsd'):
+             sslLinkDependencies = ["crypto"]
+ 
+         if conf.env.TargetOSIs('windows'):
Index: patches/patch-src_SConscript
===================================================================
RCS file: patches/patch-src_SConscript
diff -N patches/patch-src_SConscript
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_SConscript        19 Oct 2021 10:11:14 -0000
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Index: src/SConscript
+--- src/SConscript.orig
++++ src/SConscript
+@@ -17,9 +17,7 @@ env.SConscript('third_party/SConscript', exports=['env
+ env = env.Clone()
+ env.InjectThirdParty(libraries=[
+     'abseil-cpp',
+-    'boost',
+     'fmt',
+-    'pcre',
+     'safeint',
+ ])
+ 
Index: patches/patch-src_mongo_db_concurrency_lock_manager_h
===================================================================
RCS file: patches/patch-src_mongo_db_concurrency_lock_manager_h
diff -N patches/patch-src_mongo_db_concurrency_lock_manager_h
--- patches/patch-src_mongo_db_concurrency_lock_manager_h       18 Mar 2021 
15:51:13 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-$OpenBSD: patch-src_mongo_db_concurrency_lock_manager_h,v 1.1 2021/03/18 
15:51:13 sthen Exp $
-
-Fix build with Boost > 1.72.0
-
-Index: src/mongo/db/concurrency/lock_manager.h
---- src/mongo/db/concurrency/lock_manager.h.orig
-+++ src/mongo/db/concurrency/lock_manager.h
-@@ -30,6 +30,7 @@
- 
- #include <cstdint>
- #include <deque>
-+#include <map>
- 
- #include "mongo/config.h"
- #include "mongo/db/concurrency/lock_manager_defs.h"
Index: patches/patch-src_mongo_db_ftdc_compressor_cpp
===================================================================
RCS file: patches/patch-src_mongo_db_ftdc_compressor_cpp
diff -N patches/patch-src_mongo_db_ftdc_compressor_cpp
--- patches/patch-src_mongo_db_ftdc_compressor_cpp      18 Mar 2021 15:51:13 
-0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-$OpenBSD: patch-src_mongo_db_ftdc_compressor_cpp,v 1.2 2021/03/18 15:51:13 
sthen Exp $
-
-Index: src/mongo/db/ftdc/compressor.cpp
---- src/mongo/db/ftdc/compressor.cpp.orig
-+++ src/mongo/db/ftdc/compressor.cpp
-@@ -47,7 +47,7 @@ FTDCCompressor::addSample(const BSONObj& sample, Date_
-     if (_referenceDoc.isEmpty()) {
-         FTDCBSONUtil::extractMetricsFromDocument(sample, sample, &_metrics);
-         _reset(sample, date);
--        return {boost::none_t()};
-+        return {boost::none};
-     }
- 
-     _metrics.resize(0);
-@@ -107,7 +107,7 @@ FTDCCompressor::addSample(const BSONObj& sample, Date_
-     }
- 
-     // The buffer is not full, inform the caller
--    return {boost::none_t()};
-+    return {boost::none};
- }
- 
- StatusWith<std::tuple<ConstDataRange, Date_t>> 
FTDCCompressor::getCompressedSamples() {
Index: patches/patch-src_mongo_db_ftdc_compressor_test_cpp
===================================================================
RCS file: patches/patch-src_mongo_db_ftdc_compressor_test_cpp
diff -N patches/patch-src_mongo_db_ftdc_compressor_test_cpp
--- patches/patch-src_mongo_db_ftdc_compressor_test_cpp 26 Dec 2017 19:18:57 
-0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-$OpenBSD: patch-src_mongo_db_ftdc_compressor_test_cpp,v 1.1 2017/12/26 
19:18:57 rsadowski Exp $
-
-Index: src/mongo/db/ftdc/compressor_test.cpp
---- src/mongo/db/ftdc/compressor_test.cpp.orig
-+++ src/mongo/db/ftdc/compressor_test.cpp
-@@ -122,7 +122,7 @@ class TestTie { (public)
-     TestTie() : _compressor(&_config) {}
- 
-     ~TestTie() {
--        validate(boost::none_t());
-+        validate(boost::none);
-     }
- 
-     StatusWith<boost::optional<std::tuple<ConstDataRange, 
FTDCCompressor::CompressorState, Date_t>>>
Index: patches/patch-src_mongo_db_ftdc_file_writer_cpp
===================================================================
RCS file: patches/patch-src_mongo_db_ftdc_file_writer_cpp
diff -N patches/patch-src_mongo_db_ftdc_file_writer_cpp
--- patches/patch-src_mongo_db_ftdc_file_writer_cpp     26 Dec 2017 19:18:57 
-0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-$OpenBSD: patch-src_mongo_db_ftdc_file_writer_cpp,v 1.1 2017/12/26 19:18:57 
rsadowski Exp $
-
-Index: src/mongo/db/ftdc/file_writer.cpp
---- src/mongo/db/ftdc/file_writer.cpp.orig
-+++ src/mongo/db/ftdc/file_writer.cpp
-@@ -211,7 +211,7 @@ Status FTDCFileWriter::flush(const boost::optional<Con
- 
- Status FTDCFileWriter::close() {
-     if (_archiveStream.is_open()) {
--        Status s = flush(boost::none_t(), Date_t());
-+        Status s = flush(boost::none, Date_t());
- 
-         _archiveStream.close();
- 
Index: patches/patch-src_mongo_db_fts_unicode_string_cpp
===================================================================
RCS file: patches/patch-src_mongo_db_fts_unicode_string_cpp
diff -N patches/patch-src_mongo_db_fts_unicode_string_cpp
--- patches/patch-src_mongo_db_fts_unicode_string_cpp   26 Dec 2017 19:18:57 
-0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-src_mongo_db_fts_unicode_string_cpp,v 1.1 2017/12/26 19:18:57 
rsadowski Exp $
-
-fix boost > 1.58.0 build
-
-Index: src/mongo/db/fts/unicode/string.cpp
---- src/mongo/db/fts/unicode/string.cpp.orig
-+++ src/mongo/db/fts/unicode/string.cpp
-@@ -274,7 +274,7 @@ bool String::substrMatch(const std::string& str,
- 
-     // Case sensitive and diacritic sensitive.
-     return boost::algorithm::boyer_moore_search(
--               haystack.begin(), haystack.end(), needle.begin(), 
needle.end()) != haystack.end();
-+               haystack.begin(), haystack.end(), needle.begin(), 
needle.end()) != std::make_pair(haystack.end(), haystack.end());
- }
- 
- }  // namespace unicode
Index: patches/patch-src_mongo_db_matcher_expression_leaf_cpp
===================================================================
RCS file: patches/patch-src_mongo_db_matcher_expression_leaf_cpp
diff -N patches/patch-src_mongo_db_matcher_expression_leaf_cpp
--- patches/patch-src_mongo_db_matcher_expression_leaf_cpp      23 Oct 2017 
07:44:22 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-$OpenBSD: patch-src_mongo_db_matcher_expression_leaf_cpp,v 1.1 2017/10/23 
07:44:22 kili Exp $
-
-pcrecpp.h used to expose std::string, which is no longer the case
-starting with pcre-8.41.
-
-Index: src/mongo/db/matcher/expression_leaf.cpp
---- src/mongo/db/matcher/expression_leaf.cpp.orig
-+++ src/mongo/db/matcher/expression_leaf.cpp
-@@ -45,6 +45,8 @@
- 
- namespace mongo {
- 
-+using std::string;
-+
- Status LeafMatchExpression::initPath(StringData path) {
-     _path = path;
-     return _elementPath.init(_path);
Index: patches/patch-src_mongo_db_repl_master_slave_cpp
===================================================================
RCS file: patches/patch-src_mongo_db_repl_master_slave_cpp
diff -N patches/patch-src_mongo_db_repl_master_slave_cpp
--- patches/patch-src_mongo_db_repl_master_slave_cpp    23 Oct 2017 07:44:22 
-0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-src_mongo_db_repl_master_slave_cpp,v 1.1 2017/10/23 07:44:22 
kili Exp $
-
-pcrecpp.h used to expose std::string, which is no longer the case
-starting with pcre-8.41.
-
-Index: src/mongo/db/repl/master_slave.cpp
---- src/mongo/db/repl/master_slave.cpp.orig
-+++ src/mongo/db/repl/master_slave.cpp
-@@ -77,6 +77,7 @@ using std::endl;
- using std::max;
- using std::min;
- using std::set;
-+using std::string;
- using std::stringstream;
- using std::unique_ptr;
- using std::vector;
Index: patches/patch-src_mongo_db_service_context_d_h
===================================================================
RCS file: patches/patch-src_mongo_db_service_context_d_h
diff -N patches/patch-src_mongo_db_service_context_d_h
--- patches/patch-src_mongo_db_service_context_d_h      18 Mar 2021 15:51:13 
-0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-$OpenBSD: patch-src_mongo_db_service_context_d_h,v 1.1 2021/03/18 15:51:13 
sthen Exp $
-
-Fix build with Boost > 1.72.0
-
-Index: src/mongo/db/service_context_d.h
---- src/mongo/db/service_context_d.h.orig
-+++ src/mongo/db/service_context_d.h
-@@ -28,6 +28,7 @@
- 
- #pragma once
- 
-+#include <map>
- #include <vector>
- 
- #include "mongo/db/service_context.h"
Index: patches/patch-src_mongo_db_storage_mmap_v1_file_allocator_h
===================================================================
RCS file: patches/patch-src_mongo_db_storage_mmap_v1_file_allocator_h
diff -N patches/patch-src_mongo_db_storage_mmap_v1_file_allocator_h
--- patches/patch-src_mongo_db_storage_mmap_v1_file_allocator_h 4 Sep 2021 
20:27:53 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-$OpenBSD: patch-src_mongo_db_storage_mmap_v1_file_allocator_h,v 1.1 2021/09/04 
20:27:53 sthen Exp $
-
-Fix build with Boost > 1.72.0
-
-Index: src/mongo/db/storage/mmap_v1/file_allocator.h
---- src/mongo/db/storage/mmap_v1/file_allocator.h.orig
-+++ src/mongo/db/storage/mmap_v1/file_allocator.h
-@@ -30,6 +30,7 @@
- #include "mongo/platform/basic.h"
- 
- #include <list>
-+#include <map>
- #include <boost/filesystem/path.hpp>
- 
- #include "mongo/stdx/condition_variable.h"
Index: patches/patch-src_mongo_s_chunk_diff_h
===================================================================
RCS file: patches/patch-src_mongo_s_chunk_diff_h
diff -N patches/patch-src_mongo_s_chunk_diff_h
--- patches/patch-src_mongo_s_chunk_diff_h      18 Mar 2021 15:51:13 -0000      
1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-$OpenBSD: patch-src_mongo_s_chunk_diff_h,v 1.1 2021/03/18 15:51:13 sthen Exp $
-
-Fix build with Boost > 1.72.0
-
-Index: src/mongo/s/chunk_diff.h
---- src/mongo/s/chunk_diff.h.orig
-+++ src/mongo/s/chunk_diff.h
-@@ -28,6 +28,7 @@
- 
- #pragma once
- 
-+#include <map>
- #include <string>
- 
- #include "mongo/bson/bsonmisc.h"
Index: patches/patch-src_mongo_shell_bench_cpp
===================================================================
RCS file: patches/patch-src_mongo_shell_bench_cpp
diff -N patches/patch-src_mongo_shell_bench_cpp
--- patches/patch-src_mongo_shell_bench_cpp     23 Oct 2017 07:44:22 -0000      
1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-src_mongo_shell_bench_cpp,v 1.1 2017/10/23 07:44:22 kili Exp $
-
-pcrecpp.h used to expose std::string, which is no longer the case
-starting with pcre-8.41.
-
-Index: src/mongo/shell/bench.cpp
---- src/mongo/shell/bench.cpp.orig
-+++ src/mongo/shell/bench.cpp
-@@ -79,6 +79,7 @@ using std::unique_ptr;
- using std::cout;
- using std::endl;
- using std::map;
-+using std::string;
- 
- const std::map<OpType, std::string> opTypeName{{OpType::NONE, "none"},
-                                                {OpType::NOP, "nop"},
Index: patches/patch-src_mongo_util_dns_query_posix-impl_h
===================================================================
RCS file: patches/patch-src_mongo_util_dns_query_posix-impl_h
diff -N patches/patch-src_mongo_util_dns_query_posix-impl_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_mongo_util_dns_query_posix-impl_h 16 Oct 2021 22:07:11 
-0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+use libbind (sigh...)
+
+Index: src/mongo/util/dns_query_posix-impl.h
+--- src/mongo/util/dns_query_posix-impl.h.orig
++++ src/mongo/util/dns_query_posix-impl.h
+@@ -36,7 +36,8 @@
+ #include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+-#include <resolv.h>
++#include <bind/arpa/nameser.h>
++#include <bind/resolv.h>
+ // clang-format on
+ 
+ #include <stdio.h>
Index: patches/patch-src_mongo_util_net_sock_h
===================================================================
RCS file: 
/home/cvs/ports/databases/mongodb/patches/patch-src_mongo_util_net_sock_h,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_mongo_util_net_sock_h
--- patches/patch-src_mongo_util_net_sock_h     18 Mar 2021 15:51:13 -0000      
1.2
+++ patches/patch-src_mongo_util_net_sock_h     16 Oct 2021 20:05:02 -0000
@@ -4,9 +4,9 @@ Index: src/mongo/util/net/sock.h
 --- src/mongo/util/net/sock.h.orig
 +++ src/mongo/util/net/sock.h
 @@ -37,6 +37,7 @@
+ #include <sys/socket.h>
  #include <sys/types.h>
  #include <sys/un.h>
- #include <errno.h>
 +#include <unistd.h>
  
  #ifdef __OpenBSD__
Index: patches/patch-src_mongo_util_net_ssl_manager_openssl_cpp
===================================================================
RCS file: patches/patch-src_mongo_util_net_ssl_manager_openssl_cpp
diff -N patches/patch-src_mongo_util_net_ssl_manager_openssl_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_mongo_util_net_ssl_manager_openssl_cpp    25 Oct 2021 
10:43:16 -0000
@@ -0,0 +1,86 @@
+$OpenBSD$
+
+mongodb bundles some "shims" to support both OpenSSL (including old
+versions) and LibreSSL.  It doesn't work well, because to build we
+need some of those shims, but not all.
+
+Index: src/mongo/util/net/ssl_manager_openssl.cpp
+--- src/mongo/util/net/ssl_manager_openssl.cpp.orig
++++ src/mongo/util/net/ssl_manager_openssl.cpp
+@@ -276,15 +276,21 @@ inline int X509_NAME_ENTRY_set(const X509_NAME_ENTRY* 
+     return ne->set;
+ }
+ 
++#endif
++
+ inline void X509_OBJECT_free(X509_OBJECT* a) {
+     X509_OBJECT_free_contents(a);
+     OPENSSL_free(a);
+ }
+ 
++#if 0
++
+ void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX* ctx, STACK_OF(X509) * sk) {
+     X509_STORE_CTX_set_chain(ctx, sk);
+ }
+ 
++#endif
++
+ X509_OBJECT* X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX* vs, int type, 
X509_NAME* name) {
+     X509_OBJECT* ret;
+     ret = (X509_OBJECT*)OPENSSL_malloc(sizeof(X509_OBJECT));
+@@ -299,6 +305,8 @@ X509_OBJECT* X509_STORE_CTX_get_obj_by_subject(X509_ST
+     return ret;
+ }
+ 
++#if 0
++
+ X509* X509_OBJECT_get0_X509(const X509_OBJECT* a) {
+     if (a == NULL || a->type != X509_LU_X509) {
+         return NULL;
+@@ -307,6 +315,8 @@ X509* X509_OBJECT_get0_X509(const X509_OBJECT* a) {
+     return a->data.x509;
+ }
+ 
++#endif
++
+ using UniqueVerifiedChainPolyfill = std::unique_ptr<STACK_OF(X509), 
X509StackDeleter>;
+ 
+ STACK_OF(X509) * SSL_get0_verified_chain(SSL* s) {
+@@ -326,15 +336,17 @@ STACK_OF(X509) * SSL_get0_verified_chain(SSL* s) {
+     return X509_STORE_CTX_get1_chain(ctx.get());
+ }
+ 
++#if 0
++
+ const OCSP_CERTID* OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP* single) {
+     return single->certId;
+ }
+ 
+-#if OPENSSL_VERSION_NUMBER < 0x10002000L
++#endif
+ inline bool ASN1_TIME_diff(int*, int*, const ASN1_TIME*, const ASN1_TIME*) {
+     return false;
+ }
+-#endif
++#if 0
+ 
+ int DH_set0_pqg(DH* dh, BIGNUM* p, BIGNUM* q, BIGNUM* g) {
+     dh->p = p;
+@@ -353,13 +365,15 @@ void DH_get0_pqg(const DH* dh, const BIGNUM** p, const
+     }
+ }
+ 
++#endif
++
+ // TLS versions before 1.1.0 did not define the TLS Feature extension
+ static ASN1OID tlsFeatureOID("1.3.6.1.5.5.7.1.24", "tlsfeature", "TLS 
Feature");
+ static int const NID_tlsfeature = OBJ_create(tlsFeatureOID.identifier.c_str(),
+                                              
tlsFeatureOID.shortDescription.c_str(),
+                                              
tlsFeatureOID.longDescription.c_str());
+ 
+-#else
++#if 0
+ using UniqueVerifiedChainPolyfill = std::unique_ptr<STACK_OF(X509), 
X509StackDeleterNoOp>;
+ 
+ #endif
Index: patches/patch-src_mongo_util_processinfo_openbsd_cpp
===================================================================
RCS file: 
/home/cvs/ports/databases/mongodb/patches/patch-src_mongo_util_processinfo_openbsd_cpp,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_mongo_util_processinfo_openbsd_cpp
--- patches/patch-src_mongo_util_processinfo_openbsd_cpp        13 Jan 2019 
23:18:42 -0000      1.2
+++ patches/patch-src_mongo_util_processinfo_openbsd_cpp        16 Oct 2021 
22:18:35 -0000
@@ -1,36 +1,20 @@
-$OpenBSD: patch-src_mongo_util_processinfo_openbsd_cpp,v 1.2 2019/01/13 
23:18:42 jca Exp $
+$OpenBSD$
 
-- avoid use after free
 - mincore(2) has been removed
 
 Index: src/mongo/util/processinfo_openbsd.cpp
 --- src/mongo/util/processinfo_openbsd.cpp.orig
 +++ src/mongo/util/processinfo_openbsd.cpp
-@@ -110,9 +110,10 @@ int ProcessInfo::getVirtualMemorySize() {
-     }
- 
-     kinfo_proc* task = kvm_getprocs(kd, KERN_PROC_PID, _pid.toNative(), 
sizeof(kinfo_proc), &cnt);
--    kvm_close(kd);
--    return ((task->p_vm_dsize + task->p_vm_ssize + task->p_vm_tsize) * 
sysconf(_SC_PAGESIZE)) /
-+    int rss = ((task->p_vm_dsize + task->p_vm_ssize + task->p_vm_tsize) * 
sysconf(_SC_PAGESIZE)) /
-         1048576;
-+    kvm_close(kd);
-+    return rss;
- }
- 
- int ProcessInfo::getResidentSize() {
-@@ -124,8 +125,9 @@ int ProcessInfo::getResidentSize() {
-         return -1;
-     }
-     kinfo_proc* task = kvm_getprocs(kd, KERN_PROC_PID, _pid.toNative(), 
sizeof(kinfo_proc), &cnt);
-+    int rss = (task->p_vm_rssize * sysconf(_SC_PAGESIZE)) / 1048576;  // 
convert from pages to MB
-     kvm_close(kd);
--    return (task->p_vm_rssize * sysconf(_SC_PAGESIZE)) / 1048576;  // convert 
from pages to MB
-+    return rss;
- }
- 
- double ProcessInfo::getSystemMemoryPressurePercentage() {
-@@ -182,28 +184,14 @@ bool ProcessInfo::supported() {
+@@ -85,7 +85,7 @@ template <>
+ int getSysctlByIDWithDefault<std::string>(const int* sysctlID,
+                                           const int idLen,
+                                           const std::string& defaultValue,
+-                                          string* result) {
++                                          std::string* result) {
+     char value[256] = {0};
+     size_t len = sizeof(value);
+     if (sysctl(sysctlID, idLen, &value, &len, NULL, 0) == -1) {
+@@ -195,33 +195,15 @@ bool ProcessInfo::supported() {
  }
  
  bool ProcessInfo::blockCheckSupported() {
@@ -41,18 +25,22 @@ Index: src/mongo/util/processinfo_openbs
  bool ProcessInfo::blockInMemory(const void* start) {
 -    char x = 0;
 -    if (mincore((void*)alignToStartOfPage(start), getPageSize(), &x)) {
--        log() << "mincore failed: " << errnoWithDescription() << endl;
+-        LOGV2(23349,
+-              "mincore failed: {errnoWithDescription}",
+-              "errnoWithDescription"_attr = errnoWithDescription());
 -        return 1;
 -    }
 -    return x & 0x1;
 +    return false;
  }
  
- bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, 
vector<char>* out) {
+ bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, 
std::vector<char>* out) {
 -    out->resize(numPages);
 -    // int mincore(const void *addr, size_t len, char *vec);
 -    if (mincore((void*)alignToStartOfPage(start), numPages * getPageSize(), 
&(out->front()))) {
--        log() << "mincore failed: " << errnoWithDescription() << endl;
+-        LOGV2(23350,
+-              "mincore failed: {errnoWithDescription}",
+-              "errnoWithDescription"_attr = errnoWithDescription());
 -        return false;
 -    }
 -    for (size_t i = 0; i < numPages; ++i) {
@@ -61,4 +49,5 @@ Index: src/mongo/util/processinfo_openbs
 -    return true;
 +    return false;
  }
- }
+ 
+ // get the number of CPUs available to the scheduler
Index: patches/patch-src_mongo_util_time_support_cpp
===================================================================
RCS file: patches/patch-src_mongo_util_time_support_cpp
diff -N patches/patch-src_mongo_util_time_support_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_mongo_util_time_support_cpp       16 Oct 2021 20:29:06 
-0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: src/mongo/util/time_support.cpp
+--- src/mongo/util/time_support.cpp.orig
++++ src/mongo/util/time_support.cpp
+@@ -846,7 +846,7 @@ class MachPort { (private)
+ // Find minimum timer resolution of OS
+ Nanoseconds getMinimumTimerResolution() {
+     Nanoseconds minTimerResolution;
+-#if defined(__linux__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__)
++#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || 
defined(__EMSCRIPTEN__)
+     struct timespec tp;
+     clock_getres(CLOCK_REALTIME, &tp);
+     minTimerResolution = Nanoseconds{tp.tv_nsec};
Index: 
patches/patch-src_third_party_asio-asio-1-11-0_asio_include_asio_ssl_detail_impl_engine_ipp
===================================================================
RCS file: 
patches/patch-src_third_party_asio-asio-1-11-0_asio_include_asio_ssl_detail_impl_engine_ipp
diff -N 
patches/patch-src_third_party_asio-asio-1-11-0_asio_include_asio_ssl_detail_impl_engine_ipp
--- 
patches/patch-src_third_party_asio-asio-1-11-0_asio_include_asio_ssl_detail_impl_engine_ipp
 23 May 2021 07:22:37 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: 
patch-src_third_party_asio-asio-1-11-0_asio_include_asio_ssl_detail_impl_engine_ipp,v
 1.1 2021/05/23 07:22:37 tb Exp $
-
-Use accessor instead of reaching inside the SSL.
-
-Index: 
src/third_party/asio-asio-1-11-0/asio/include/asio/ssl/detail/impl/engine.ipp
---- 
src/third_party/asio-asio-1-11-0/asio/include/asio/ssl/detail/impl/engine.ipp.orig
-+++ 
src/third_party/asio-asio-1-11-0/asio/include/asio/ssl/detail/impl/engine.ipp
-@@ -206,7 +206,7 @@ const asio::error_code& engine::map_error_code(
- 
-   // SSL v2 doesn't provide a protocol-level shutdown, so an eof on the
-   // underlying transport is passed through.
--  if (ssl_ && ssl_->version == SSL2_VERSION)
-+  if (ssl_ && SSL_version(ssl_) == SSL2_VERSION)
-     return ec;
- 
-   // Otherwise, the peer should have negotiated a proper shutdown.
Index: 
patches/patch-src_third_party_asio-asio-1-11-0_asio_include_asio_ssl_impl_context_ipp
===================================================================
RCS file: 
patches/patch-src_third_party_asio-asio-1-11-0_asio_include_asio_ssl_impl_context_ipp
diff -N 
patches/patch-src_third_party_asio-asio-1-11-0_asio_include_asio_ssl_impl_context_ipp
--- 
patches/patch-src_third_party_asio-asio-1-11-0_asio_include_asio_ssl_impl_context_ipp
       10 May 2021 15:10:11 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,116 +0,0 @@
-$OpenBSD: 
patch-src_third_party_asio-asio-1-11-0_asio_include_asio_ssl_impl_context_ipp,v 
1.1 2021/05/10 15:10:11 tb Exp $
-
-Index: src/third_party/asio-asio-1-11-0/asio/include/asio/ssl/impl/context.ipp
---- 
src/third_party/asio-asio-1-11-0/asio/include/asio/ssl/impl/context.ipp.orig
-+++ src/third_party/asio-asio-1-11-0/asio/include/asio/ssl/impl/context.ipp
-@@ -192,13 +192,14 @@ context::~context()
- {
-   if (handle_)
-   {
--    if (handle_->default_passwd_callback_userdata)
-+    void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
-+    if (cb_userdata)
-     {
-       detail::password_callback_base* callback =
-         static_cast<detail::password_callback_base*>(
--            handle_->default_passwd_callback_userdata);
-+            cb_userdata);
-       delete callback;
--      handle_->default_passwd_callback_userdata = 0;
-+      ::SSL_CTX_set_default_passwd_cb_userdata(handle_, 0);
-     }
- 
-     if (SSL_CTX_get_app_data(handle_))
-@@ -528,10 +529,12 @@ asio::error_code context::use_certificate_chain(
-   bio_cleanup bio = { make_buffer_bio(chain) };
-   if (bio.p)
-   {
-+    pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_);
-+    void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
-     x509_cleanup cert = {
-       ::PEM_read_bio_X509_AUX(bio.p, 0,
--          handle_->default_passwd_callback,
--          handle_->default_passwd_callback_userdata) };
-+          callback,
-+          cb_userdata) };
-     if (!cert.p)
-     {
-       ec = asio::error_code(ERR_R_PEM_LIB,
-@@ -548,15 +551,11 @@ asio::error_code context::use_certificate_chain(
-       return ec;
-     }
- 
--    if (handle_->extra_certs)
--    {
--      ::sk_X509_pop_free(handle_->extra_certs, X509_free);
--      handle_->extra_certs = 0;
--    }
-+    ::SSL_CTX_clear_chain_certs(handle_);
- 
-     while (X509* cacert = ::PEM_read_bio_X509(bio.p, 0,
--          handle_->default_passwd_callback,
--          handle_->default_passwd_callback_userdata))
-+          callback,
-+          cb_userdata))
-     {
-       if (!::SSL_CTX_add_extra_chain_cert(handle_, cacert))
-       {
-@@ -621,6 +620,9 @@ asio::error_code context::use_private_key(
- {
-   ::ERR_clear_error();
- 
-+  pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_);
-+  void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
-+
-   bio_cleanup bio = { make_buffer_bio(private_key) };
-   if (bio.p)
-   {
-@@ -632,8 +634,8 @@ asio::error_code context::use_private_key(
-       break;
-     case context_base::pem:
-       evp_private_key.p = ::PEM_read_bio_PrivateKey(
--          bio.p, 0, handle_->default_passwd_callback,
--          handle_->default_passwd_callback_userdata);
-+          bio.p, 0, callback,
-+          cb_userdata);
-       break;
-     default:
-       {
-@@ -680,6 +682,9 @@ asio::error_code context::use_rsa_private_key(
- {
-   ::ERR_clear_error();
- 
-+  pem_password_cb* callback = ::SSL_CTX_get_default_passwd_cb(handle_);
-+  void* cb_userdata = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
-+
-   bio_cleanup bio = { make_buffer_bio(private_key) };
-   if (bio.p)
-   {
-@@ -691,8 +696,8 @@ asio::error_code context::use_rsa_private_key(
-       break;
-     case context_base::pem:
-       rsa_private_key.p = ::PEM_read_bio_RSAPrivateKey(
--          bio.p, 0, handle_->default_passwd_callback,
--          handle_->default_passwd_callback_userdata);
-+          bio.p, 0, callback,
-+          cb_userdata);
-       break;
-     default:
-       {
-@@ -911,11 +916,12 @@ int context::verify_callback_function(int preverified,
- asio::error_code context::do_set_password_callback(
-     detail::password_callback_base* callback, asio::error_code& ec)
- {
--  if (handle_->default_passwd_callback_userdata)
--    delete static_cast<detail::password_callback_base*>(
--        handle_->default_passwd_callback_userdata);
-+  void* old_callback = ::SSL_CTX_get_default_passwd_cb_userdata(handle_);
-+  ::SSL_CTX_set_default_passwd_cb_userdata(handle_, callback);
- 
--  handle_->default_passwd_callback_userdata = callback;
-+  if (old_callback)
-+    delete static_cast<detail::password_callback_base*>(
-+        old_callback);
- 
-   SSL_CTX_set_default_passwd_cb(handle_, 
&context::password_callback_function);
- 
Index: 
patches/patch-src_third_party_mozjs-60_platform_x86_64_openbsd_build_js-confdefs_h
===================================================================
RCS file: 
patches/patch-src_third_party_mozjs-60_platform_x86_64_openbsd_build_js-confdefs_h
diff -N 
patches/patch-src_third_party_mozjs-60_platform_x86_64_openbsd_build_js-confdefs_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-src_third_party_mozjs-60_platform_x86_64_openbsd_build_js-confdefs_h
  16 Oct 2021 22:10:35 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: src/third_party/mozjs-60/platform/x86_64/openbsd/build/js-confdefs.h
+--- src/third_party/mozjs-60/platform/x86_64/openbsd/build/js-confdefs.h.orig
++++ src/third_party/mozjs-60/platform/x86_64/openbsd/build/js-confdefs.h
+@@ -54,7 +54,7 @@
+ #define JS_POSIX_NSPR 1
+ #define JS_PUNBOX64 1
+ #define JS_STANDALONE 1
+-#define MALLOC_H <malloc_np.h>
++#define MALLOC_H <stdlib.h>
+ #define MALLOC_USABLE_SIZE_CONST_PTR const
+ #define MOZILLA_UAVERSION "60.0"
+ #define MOZILLA_VERSION "60.3.0"
Index: pkg/PLIST
===================================================================
RCS file: /home/cvs/ports/databases/mongodb/pkg/PLIST,v
retrieving revision 1.8
diff -u -p -r1.8 PLIST
--- pkg/PLIST   20 Feb 2019 17:58:04 -0000      1.8
+++ pkg/PLIST   18 Oct 2021 10:24:18 -0000
@@ -12,16 +12,12 @@
 @owner
 @group
 @bin bin/mongo
-@bin bin/mongobridge
 @bin bin/mongod
-@bin bin/mongoperf
 @bin bin/mongos
-@bin bin/mongosniff
 @man man/man1/mongo.1
 @man man/man1/mongod.1
-@man man/man1/mongoperf.1
 @man man/man1/mongos.1
-@man man/man1/mongosniff.1
+@man man/man5/mongodb-parameters.5
 share/examples/mongodb/
 share/examples/mongodb/mongodb.conf
 @sample ${SYSCONFDIR}/mongodb.conf

Reply via email to