diff options
| author | gdt <gdt@pkgsrc.org> | 2019-06-28 16:30:56 +0000 |
|---|---|---|
| committer | gdt <gdt@pkgsrc.org> | 2019-06-28 16:30:56 +0000 |
| commit | 4b6beb1e93544979c150bd7fa31c03d81d5d119a (patch) | |
| tree | 57e47acbeb9751af8a0744c6bf0cfe6e463323f5 /databases/mongodb3 | |
| parent | 57c6f51d4b07c34a0f5269a8e841c8a3d5c477f7 (diff) | |
| download | pkgsrc-4b6beb1e93544979c150bd7fa31c03d81d5d119a.tar.gz | |
databases/mongodb3: Add, to ameliorate problems with mongodb 4
This is a copy of mongodb before the update to 4, with annotations to
explain why it exists. Reasons include:
- mongodb 4 is licensed under the Server Side Public License, to
which some have objected
- mongodb 4 requires c++17 (and hence gcc 8)
(ok to add during freeze by wiz@)
Diffstat (limited to 'databases/mongodb3')
33 files changed, 1787 insertions, 0 deletions
diff --git a/databases/mongodb3/DESCR b/databases/mongodb3/DESCR new file mode 100644 index 00000000000..4555b7d5892 --- /dev/null +++ b/databases/mongodb3/DESCR @@ -0,0 +1,9 @@ +Mongo (from "humongous") is a high-performance, open source, schema-free, +document-oriented database. It features: document data model with dynamic +schemas; full, flexible index support and rich queries; auto-Sharding for +horizontal scalability; built-in replication for high availability; text +search; advanced security; aggregation Framework and MapReduce; large media +storage with GridFS. + +This is an older version of mongodb, chosen to avoid the Server Side +Public License and a need for a c++17 compiler.
\ No newline at end of file diff --git a/databases/mongodb3/Makefile b/databases/mongodb3/Makefile new file mode 100644 index 00000000000..832affe5eec --- /dev/null +++ b/databases/mongodb3/Makefile @@ -0,0 +1,147 @@ +# $NetBSD: Makefile,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +# This package is intentionally old to avoid: +# Server Side Public License +# c++17 (and c++14 if 3.4.4 does not already need it) +DISTNAME= mongodb-src-r3.4.4 +PKGNAME= ${DISTNAME:S/src-r//:S/-rc/rc/} +PKGREVISION= 6 +CATEGORIES= databases +MASTER_SITES= http://fastdl.mongodb.org/src/ + +MAINTAINER= gdt@NetBSD.org +HOMEPAGE= http://mongodb.org/ +COMMENT= NoSQL distributed document-oriented database +LICENSE= gnu-agpl-v3 # Client and tools licensed under apache-2.0 + +# MongoDB 3.4 onwards explicitly does not support 32-bit x86 platforms +NOT_FOR_PLATFORM+= *-*-i386 + +EXTRACT_USING= bsdtar + +NO_CONFIGURE= yes +USE_LANGUAGES= c c++ + +SCONS_ARGS= ${_MAKE_JOBS} +SCONS_ARGS+= --use-system-boost +SCONS_ARGS+= --use-system-pcre +SCONS_ARGS+= --use-system-snappy +SCONS_ARGS+= --use-system-tcmalloc +SCONS_ARGS+= --use-system-yaml +SCONS_ARGS+= --use-system-zlib +SCONS_ARGS+= --js-engine=mozjs +SCONS_ARGS+= --release + +PYTHON_VERSIONS_INCOMPATIBLE= 34 35 36 37 # not yet supported as of 3.0.4 + +.include "../../mk/bsd.prefs.mk" + +# XXX this doesn't work for some reason +#.if !empty(INSTALL_UNSTRIPPED:Uno:M[Yy][Ee][Ss]) +#SCONS_ARGS+= --nostrip +#.endif + +GCC_REQD+= 5.3.0 + +CPPFLAGS+= -fno-jump-tables + +.include "options.mk" + +SMF_METHODS+= mongodb + +BUILD_DEFS+= VARBASE +BUILD_DEFS+= MONGODB_USER MONGODB_GROUP MONGODB_DBPATH +BUILD_DEFS+= MONGODB_LOGPATH + +MONGODB_USER?= mongodb +MONGODB_GROUP?= mongodb +MONGODB_DBPATH?= ${VARBASE}/mongodb +MONGODB_LOGPATH?= ${VARBASE}/log/mongodb + +PKG_USERS_VARS+= MONGODB_USER +PKG_GROUPS_VARS+= MONGODB_GROUP + +PKG_GROUPS= ${MONGODB_GROUP} +PKG_USERS= ${MONGODB_USER}:${MONGODB_GROUP} + +PKG_GECOS.${MONGODB_USER}= MongoDB database administrator +PKG_HOME.${MONGODB_USER}= ${MONGODB_DBPATH} +PKG_SHELL.${MONGODB_USER}= ${SH} + +OWN_DIRS_PERMS+= ${MONGODB_DBPATH} ${MONGODB_USER} ${MONGODB_GROUP} 0755 +OWN_DIRS_PERMS+= ${MONGODB_DBPATH}/journal ${MONGODB_USER} ${MONGODB_GROUP} 0755 +OWN_DIRS_PERMS+= ${MONGODB_LOGPATH} ${MONGODB_USER} ${MONGODB_GROUP} 0755 + +FILES_SUBST+= MONGODB_USER=${MONGODB_USER} +FILES_SUBST+= MONGODB_GROUP=${MONGODB_GROUP} +FILES_SUBST+= MONGODB_DBPATH=${MONGODB_DBPATH} +FILES_SUBST+= MONGODB_LOGPATH=${MONGODB_LOGPATH} + +# XXX No better idea how to pass CXXFLAGS and LDFLAGS to scons +SUBST_CLASSES+= scons +SUBST_STAGE.scons= pre-build +SUBST_FILES.scons= SConstruct +SUBST_VARS.scons= PREFIX CXXFLAGS LDFLAGS + +SUBST_CLASSES+= path +SUBST_STAGE.path= pre-build +SUBST_FILES.path= src/mongo/db/flushtest.cpp debian/mongod.conf +SUBST_FILES.path+= debian/mongod.1 debian/mongo.1 src/mongo/shell/dbshell.cpp +SUBST_SED.path= -e 's|/data/db|${MONGODB_DBPATH}|g' +SUBST_SED.path+= -e 's|/etc|${PKG_SYSCONFDIR}|' +SUBST_VARS.path= MONGODB_DBPATH MONGODB_LOGPATH + +LDFLAGS+= ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.boost-libs}/lib + +MONGODB_MAN_FILES= bsondump.1 mongo.1 mongod.1 mongodump.1 mongoexport.1 \ + mongofiles.1 mongoimport.1 mongooplog.1 mongoperf.1 \ + mongorestore.1 mongos.1 mongosniff.1 mongostat.1 mongotop.1 + +NOT_PAX_MPROTECT_SAFE+= bin/mongo bin/mongod + +RCD_SCRIPTS= mongodb + +INSTALLATION_DIRS+= share/doc/mongodb share/examples/mongodb ${PKGMANDIR}/man1 + +CONF_FILES+= share/examples/mongodb/mongod.conf \ + ${PKG_SYSCONFDIR}/mongod.conf + +post-extract: + chmod -R g-w ${WRKSRC} + cp -r ${WRKSRC}/src/third_party/mozjs-45/platform/x86_64/freebsd \ + ${WRKSRC}/src/third_party/mozjs-45/platform/x86_64/dragonfly + cp -r ${WRKSRC}/src/third_party/mozjs-45/platform/x86_64/openbsd \ + ${WRKSRC}/src/third_party/mozjs-45/platform/x86_64/netbsd + cp ${WRKSRC}/src/mongo/db/ftdc/ftdc_system_stats_openbsd.cpp \ + ${WRKSRC}/src/mongo/db/ftdc/ftdc_system_stats_netbsd.cpp + +do-build: + cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${SCONSBIN} ${SCONS_ARGS} core + +do-install: + cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${SCONSBIN} ${SCONS_ARGS} \ + --prefix=${DESTDIR}${PREFIX} install + +do-test: + cd ${WRKSRC} && ./test + +post-install: + ${INSTALL_DATA} ${WRKSRC}/README ${DESTDIR}${PREFIX}/share/doc/mongodb +.for file in ${MONGODB_MAN_FILES} + ${INSTALL_MAN} ${WRKSRC}/debian/${file} \ + ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1 +.endfor + ${INSTALL_DATA} ${WRKSRC}/debian/mongod.conf \ + ${DESTDIR}${PREFIX}/share/examples/mongodb + +.include "../../devel/boost-headers/buildlink3.mk" +.include "../../devel/boost-libs/buildlink3.mk" +.include "../../devel/py-boost/buildlink3.mk" +.include "../../devel/libexecinfo/buildlink3.mk" +.include "../../devel/pcre/buildlink3.mk" +.include "../../devel/scons/buildlink3.mk" +.include "../../devel/snappy/buildlink3.mk" +.include "../../devel/zlib/buildlink3.mk" +.include "../../net/libpcap/buildlink3.mk" +.include "../../textproc/yaml-cpp/buildlink3.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/databases/mongodb3/PLIST b/databases/mongodb3/PLIST new file mode 100644 index 00000000000..d7afee1fc80 --- /dev/null +++ b/databases/mongodb3/PLIST @@ -0,0 +1,21 @@ +@comment $NetBSD: PLIST,v 1.1 2019/06/28 16:30:56 gdt Exp $ +bin/mongo +bin/mongod +bin/mongoperf +bin/mongos +man/man1/bsondump.1 +man/man1/mongo.1 +man/man1/mongod.1 +man/man1/mongodump.1 +man/man1/mongoexport.1 +man/man1/mongofiles.1 +man/man1/mongoimport.1 +man/man1/mongooplog.1 +man/man1/mongoperf.1 +man/man1/mongorestore.1 +man/man1/mongos.1 +man/man1/mongosniff.1 +man/man1/mongostat.1 +man/man1/mongotop.1 +share/doc/mongodb/README +share/examples/mongodb/mongod.conf diff --git a/databases/mongodb3/distinfo b/databases/mongodb3/distinfo new file mode 100644 index 00000000000..fedb5d5b294 --- /dev/null +++ b/databases/mongodb3/distinfo @@ -0,0 +1,34 @@ +$NetBSD: distinfo,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +SHA1 (mongodb-src-r3.4.4.tar.gz) = 6f9f2d8a3c1c2f4089fd03f8be0b86ff0431d955 +RMD160 (mongodb-src-r3.4.4.tar.gz) = 2a65f380204a92762ceea2be35dbe2c671e106f6 +SHA512 (mongodb-src-r3.4.4.tar.gz) = dbae89b49c363e7258021cd31385e4449bfdfdfd5adfcb1683e4431372731e58ec33bf8f7576d2d52659a52461bd6a32fbc67d5c6e36d52184ec1aabb345d940 +Size (mongodb-src-r3.4.4.tar.gz) = 39867133 bytes +SHA1 (patch-SConstruct) = 6ec188274fb25614494ec192be7809a6a01962de +SHA1 (patch-debian_mongod.conf) = e5074b5f7ad50560b99d652feab58da764ba542c +SHA1 (patch-src_mongo_base_initializer.h) = add32c5940c922a98122d0e6883eb3ad52dc25c5 +SHA1 (patch-src_mongo_db_dbwebserver.cpp) = 1e7bb9588930742839d2bc9e26b33751a64f98c7 +SHA1 (patch-src_mongo_db_fts_unicode_string.cpp) = 98c5b1b39c07190f08ec9f22ec3002b0a803f72f +SHA1 (patch-src_mongo_db_matcher_expression__leaf.cpp) = 52064034fabb5de63eccf87ddd140303c54f0312 +SHA1 (patch-src_mongo_db_repl_isself.c) = 82321c918b91ce1a68ce79c14589126aca6baf96 +SHA1 (patch-src_mongo_db_repl_master__slave.cpp) = 2f37f0819a2b2743df01f6b6ab0b3013b3b7d726 +SHA1 (patch-src_mongo_db_repl_oplog__fetcher.cpp) = e12dbfbd4e70ee210cdd4eb0582661666e8eb06a +SHA1 (patch-src_mongo_installer_msi_SConscript) = 78424fa10f90470dd941b900ef8fd131d28f6e65 +SHA1 (patch-src_mongo_platform_random.cpp) = 59c31e55fc2dc5a2b82b8f16dacf8736d8354cdb +SHA1 (patch-src_mongo_platform_stack__locator__dragonfly.cpp) = fb885c491e4de1cfbc2875620d854af726e5b45f +SHA1 (patch-src_mongo_platform_stack__locator__netbsd.cpp) = 3b09e86b2401555b6ab4c31d14c0693d766119c2 +SHA1 (patch-src_mongo_shell_bench.cpp) = c0fd15347d35e37daf87b642148215dee3ab7220 +SHA1 (patch-src_mongo_shell_linenoise__utf8.h) = f975925f56125d48b5124894fa1adf1382a634d2 +SHA1 (patch-src_mongo_util_intrusive__counter.h) = 9f1af59e1bc86e33bf183a6dda1737007afc7a18 +SHA1 (patch-src_mongo_util_net_miniwebserver.cpp) = 3715e826b8d03793066a84b2c1680c32c6ee6368 +SHA1 (patch-src_mongo_util_processinfo__dragonfly.cpp) = 62c236ce820dfe81f45625b15e022cca0f2c10ee +SHA1 (patch-src_mongo_util_processinfo__netbsd.cpp) = 6eabe5ffec4168bb9ba8a58b7d742772d38b4714 +SHA1 (patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_dpml__exception.c) = ef3b260e8a49227cbbabf427500b7c70bce15083 +SHA1 (patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_op__system.h) = 39f6fba82e2870ee4a5d99785033621225a72a16 +SHA1 (patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_src_bid__functions.h) = d3a85d3a3b33691466c65cdf51c56f221429aea9 +SHA1 (patch-src_third__party_mozjs-38_platform_x86__64_netbsd_build_js-confdefs.h) = c2ad1041b5c1ff9fac9085d2a8963781f51873a8 +SHA1 (patch-src_third__party_mozjs-38_platform_x86__64_netbsd_include_js-config.h) = 7ddbb4e3bf4126a1be2195acc82ff859e8130a01 +SHA1 (patch-src_third__party_s2_base_port.h) = 892ce91b5aaa432f34e1e7c169b7fd6eea2a3e94 +SHA1 (patch-src_third__party_wiredtiger_SConscript) = 71fd2326a4e95fec674326225bce5ccf5793aa5a +SHA1 (patch-src_third__party_wiredtiger_build__dragonfly_wiredtiger__config.h) = 0b00da401f832d985107dfa5dcc6447db4beec6d +SHA1 (patch-src_third__party_wiredtiger_build__netbsd_wiredtiger__config.h) = edd3c4e5784e52ad0078bcb7ef1e0902bc354285 diff --git a/databases/mongodb3/options.mk b/databases/mongodb3/options.mk new file mode 100644 index 00000000000..b1c7d5f8bc1 --- /dev/null +++ b/databases/mongodb3/options.mk @@ -0,0 +1,28 @@ +# $NetBSD: options.mk,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +PKG_OPTIONS_VAR= PKG_OPTIONS.mongodb +PKG_SUPPORTED_OPTIONS= ssl wiredtiger +PKG_SUGGESTED_OPTIONS= # + +.if !empty(MACHINE_ARCH:Mx86_64) +PKG_SUGGESTED_OPTIONS+= wiredtiger +.endif + +.include "../../mk/bsd.options.mk" + +.if !empty(PKG_OPTIONS:Mssl) +.include "../../security/openssl/buildlink3.mk" +SCONS_ARGS+= --ssl +.endif + +# The prospect of using databases/wiredtiger is unclear yet; +# MongoDB doesn't provide guarantees for non-bundled WiredTiger: +# https://groups.google.com/forum/#!msg/mongodb-dev/31FQSo4KVCI/Fx-WtJ9fzU4J +.if !empty(PKG_OPTIONS:Mwiredtiger) +. if empty(MACHINE_ARCH:Mx86_64) +PKG_FAIL_REASON+= "WiredTiger is not supported on 32-bit platforms" +. endif +SCONS_ARGS+= --wiredtiger=on +.else +SCONS_ARGS+= --wiredtiger=off +.endif diff --git a/databases/mongodb3/patches/patch-SConstruct b/databases/mongodb3/patches/patch-SConstruct new file mode 100644 index 00000000000..e9594d764cb --- /dev/null +++ b/databases/mongodb3/patches/patch-SConstruct @@ -0,0 +1,200 @@ +$NetBSD: patch-SConstruct,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +Add support for NetBSD/Dragonfly, fix locations. +Respect LDFLAGS and CXXFLAGS + +--- SConstruct.orig 2017-04-20 21:43:42.000000000 +0000 ++++ SConstruct +@@ -30,7 +30,7 @@ EnsureSConsVersion( 2, 3, 0 ) + def print_build_failures(): + from SCons.Script import GetBuildFailures + for bf in GetBuildFailures(): +- print "%s failed: %s" % (bf.node, bf.errstr) ++ print("%s failed: %s" % (bf.node, bf.errstr)) + atexit.register(print_build_failures) + + def versiontuple(v): +@@ -49,8 +49,12 @@ def get_running_os_name(): + running_os = os.sys.platform + if running_os.startswith('linux'): + running_os = 'linux' ++ elif running_os.startswith('dragonfly'): ++ running_os = 'dragonfly' + elif running_os.startswith('freebsd'): + running_os = 'freebsd' ++ elif running_os.startswith('netbsd'): ++ running_os = 'netbsd' + elif running_os.startswith('openbsd'): + running_os = 'openbsd' + elif running_os == 'sunos5': +@@ -68,7 +72,7 @@ def env_get_os_name_wrapper(self): + + def is_os_raw(target_os, os_list_to_check): + okay = False +- posix_os_list = [ 'linux', 'openbsd', 'freebsd', 'osx', 'solaris' ] ++ posix_os_list = [ 'linux', 'openbsd', 'freebsd', 'osx', 'solaris', 'dragonfly', 'netbsd' ] + + for p in os_list_to_check: + if p == 'posix' and target_os in posix_os_list: +@@ -511,7 +515,7 @@ try: + version_data = json.load(version_fp) + + if 'version' not in version_data: +- print "version.json does not contain a version string" ++ print("version.json does not contain a version string") + Exit(1) + if 'githash' not in version_data: + version_data['githash'] = utils.getGitVersion() +@@ -519,7 +523,7 @@ try: + except IOError as e: + # If the file error wasn't because the file is missing, error out + if e.errno != errno.ENOENT: +- print "Error opening version.json: {0}".format(e.strerror) ++ print("Error opening version.json: {0}".format(e.strerror)) + Exit(1) + + version_data = { +@@ -528,7 +532,7 @@ except IOError as e: + } + + except ValueError as e: +- print "Error decoding version.json: {0}".format(e) ++ print("Error decoding version.json: {0}".format(e)) + Exit(1) + + # Setup the command-line variables +@@ -598,7 +602,7 @@ def variable_distsrc_converter(val): + + variables_files = variable_shlex_converter(get_option('variables-files')) + for file in variables_files: +- print "Using variable customization file %s" % file ++ print("Using variable customization file %s" % file) + + env_vars = Variables( + files=variables_files, +@@ -892,6 +896,7 @@ envDict = dict(BUILD_ROOT=buildDir, + INSTALL_DIR=installDir, + CONFIG_HEADER_DEFINES={}, + LIBDEPS_TAG_EXPANSIONS=[], ++ ENV = os.environ, + ) + + env = Environment(variables=env_vars, **envDict) +@@ -901,12 +906,12 @@ env.AddMethod(env_os_is_wrapper, 'Target + env.AddMethod(env_get_os_name_wrapper, 'GetTargetOSName') + + def fatal_error(env, msg, *args): +- print msg.format(*args) ++ print(msg.format(*args)) + Exit(1) + + def conf_error(env, msg, *args): +- print msg.format(*args) +- print "See {0} for details".format(env['CONFIGURELOG'].abspath) ++ print(msg.format(*args)) ++ print("See {0} for details".format(env['CONFIGURELOG'].abspath)) + + Exit(1) + +@@ -926,7 +931,7 @@ else: + env.AddMethod(lambda env: env['VERBOSE'], 'Verbose') + + if has_option('variables-help'): +- print env_vars.GenerateHelpText(env) ++ print(env_vars.GenerateHelpText(env)) + Exit(0) + + unknown_vars = env_vars.UnknownVariables() +@@ -1029,7 +1034,9 @@ def CheckForProcessor(context, which_arc + os_macros = { + "windows": "_WIN32", + "solaris": "__sun", ++ "dragonfly": "__DragonFly__", + "freebsd": "__FreeBSD__", ++ "netbsd": "__NetBSD__", + "openbsd": "__OpenBSD__", + "osx": "__APPLE__", + "linux": "__linux__", +@@ -1124,7 +1131,7 @@ else: + env['TARGET_ARCH'] = detected_processor + + if env['TARGET_OS'] not in os_macros: +- print "No special config for [{0}] which probably means it won't work".format(env['TARGET_OS']) ++ print("No special config for [{0}] which probably means it won't work".format(env['TARGET_OS'])) + elif not detectConf.CheckForOS(env['TARGET_OS']): + env.ConfError("TARGET_OS ({0}) is not supported by compiler", env['TARGET_OS']) + +@@ -1360,7 +1367,7 @@ elif env['_LIBDEPS'] == '$_LIBDEPS_LIBS' + + libdeps.setup_environment(env, emitting_shared=(link_model.startswith("dynamic"))) + +-if env.TargetOSIs('linux', 'freebsd', 'openbsd'): ++if env.TargetOSIs('linux', 'dragonfly', 'freebsd', 'netbsd', 'openbsd'): + env['LINK_LIBGROUP_START'] = '-Wl,--start-group' + env['LINK_LIBGROUP_END'] = '-Wl,--end-group' + env['LINK_WHOLE_ARCHIVE_START'] = '-Wl,--whole-archive' +@@ -1388,10 +1395,24 @@ if env.TargetOSIs('linux'): + elif env.TargetOSIs('solaris'): + env.Append( LIBS=["socket","resolv","lgrp"] ) + ++elif os.sys.platform.startswith( "dragonfly" ): ++ env.Append( CPPPATH=[ "@PREFIX@/include" ] ) ++ env.Append( LIBPATH=[ "@PREFIX@/lib" ] ) ++ env.Append( LIBS=[ "m" ] ) ++ env.Append( LIBS=[ "kvm" ] ) ++ env.Append( CPPDEFINES=[ "__dragonfly__" ] ) ++ + elif env.TargetOSIs('freebsd'): + env.Append( LIBS=[ "kvm" ] ) + env.Append( CCFLAGS=[ "-fno-omit-frame-pointer" ] ) + ++elif os.sys.platform.startswith( "netbsd" ): ++ env.Append( CPPPATH=[ "@PREFIX@/include" ] ) ++ env.Append( LIBPATH=[ "@PREFIX@/lib" ] ) ++ env.Append( LIBS=[ "m" ] ) ++ env.Append( LIBS=[ "kvm" ] ) ++ env.Append( CPPDEFINES=[ "__netbsd__" ] ) ++ + elif env.TargetOSIs('openbsd'): + env.Append( LIBS=[ "kvm" ] ) + +@@ -1570,6 +1591,9 @@ if env.TargetOSIs('posix'): + + env.Append( CXXFLAGS=["-Woverloaded-virtual"] ) + env.Append( LINKFLAGS=["-pthread"] ) ++ env.Append( CPPDEFINES=["XP_UNIX=1"] ) ++ env.Append( CXXFLAGS=os.environ['CXXFLAGS'] ) ++ env.Append( LINKFLAGS=os.environ['LDFLAGS'] ) + + # SERVER-9761: Ensure early detection of missing symbols in dependent libraries at program + # startup. +@@ -2158,9 +2182,9 @@ def doConfigure(myenv): + if usingLibStdCxx: + def CheckModernLibStdCxx(context): + test_body = """ +- #if !__has_include(<experimental/filesystem>) +- #error "libstdc++ from GCC 5.3.0 or newer is required" +- #endif ++ //#if !__has_include(<experimental/filesystem>) ++ //#error "libstdc++ from GCC 5.3.0 or newer is required" ++ //#endif + """ + + context.Message('Checking for libstdc++ 5.3.0 or better... ') +@@ -2764,6 +2788,7 @@ def doConfigure(myenv): + # permit more than four parameters. + "BOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD", + "BOOST_SYSTEM_NO_DEPRECATED", ++ "BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE", + ] + ) + +@@ -2830,7 +2855,7 @@ def doConfigure(myenv): + myenv.ConfError("Couldn't find SASL header/libraries") + + # requires ports devel/libexecinfo to be installed +- if env.TargetOSIs('freebsd', 'openbsd'): ++ if env.TargetOSIs('dragonfly', 'freebsd', 'netbsd', 'openbsd'): + if not conf.CheckLib("execinfo"): + myenv.ConfError("Cannot find libexecinfo, please install devel/libexecinfo.") + diff --git a/databases/mongodb3/patches/patch-debian_mongod.conf b/databases/mongodb3/patches/patch-debian_mongod.conf new file mode 100644 index 00000000000..27f335f6914 --- /dev/null +++ b/databases/mongodb3/patches/patch-debian_mongod.conf @@ -0,0 +1,23 @@ +$NetBSD: patch-debian_mongod.conf,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +Use proper paths in default config file. +--- debian/mongod.conf.orig 2017-04-20 21:43:42.000000000 +0000 ++++ debian/mongod.conf +@@ -5,7 +5,7 @@ + + # Where and how to store data. + storage: +- dbPath: /var/lib/mongodb ++ dbPath: /var/mongodb + journal: + enabled: true + # engine: +@@ -16,7 +16,7 @@ storage: + systemLog: + destination: file + logAppend: true +- path: /var/log/mongodb/mongod.log ++ path: /var/mongodb/mongod.log + + # network interfaces + net: diff --git a/databases/mongodb3/patches/patch-src_mongo_base_initializer.h b/databases/mongodb3/patches/patch-src_mongo_base_initializer.h new file mode 100644 index 00000000000..895c36e23ba --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_base_initializer.h @@ -0,0 +1,13 @@ +$NetBSD: patch-src_mongo_base_initializer.h,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +Fixes at least SunOS. +--- src/mongo/base/initializer.h.orig 2014-04-07 00:36:57.000000000 +0000 ++++ src/mongo/base/initializer.h +@@ -17,6 +17,7 @@ + + #include <string> + #include <vector> ++#include <unistd.h> + + #include "mongo/base/disallow_copying.h" + #include "mongo/base/initializer_context.h" diff --git a/databases/mongodb3/patches/patch-src_mongo_db_dbwebserver.cpp b/databases/mongodb3/patches/patch-src_mongo_db_dbwebserver.cpp new file mode 100644 index 00000000000..da6581281ef --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_db_dbwebserver.cpp @@ -0,0 +1,20 @@ +$NetBSD: patch-src_mongo_db_dbwebserver.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/db/dbwebserver.cpp.orig 2017-07-11 17:07:27.098292902 +0000 ++++ src/mongo/db/dbwebserver.cpp +@@ -35,6 +35,7 @@ + + #include "mongo/db/dbwebserver.h" + ++#include <string> + #include <pcrecpp.h> + + #include "mongo/base/init.h" +@@ -67,6 +68,7 @@ namespace mongo { + using std::map; + using std::stringstream; + using std::vector; ++using std::string; + + using namespace html; + diff --git a/databases/mongodb3/patches/patch-src_mongo_db_fts_unicode_string.cpp b/databases/mongodb3/patches/patch-src_mongo_db_fts_unicode_string.cpp new file mode 100644 index 00000000000..20b36a5b0c8 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_db_fts_unicode_string.cpp @@ -0,0 +1,15 @@ +$NetBSD: patch-src_mongo_db_fts_unicode_string.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +* Fix build with boost 1.62.0 + +--- src/mongo/db/fts/unicode/string.cpp.orig 2016-09-26 12:10:04.000000000 +0000 ++++ src/mongo/db/fts/unicode/string.cpp +@@ -274,7 +274,7 @@ bool String::substrMatch(const std::stri + + // 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 diff --git a/databases/mongodb3/patches/patch-src_mongo_db_matcher_expression__leaf.cpp b/databases/mongodb3/patches/patch-src_mongo_db_matcher_expression__leaf.cpp new file mode 100644 index 00000000000..cbb121f080f --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_db_matcher_expression__leaf.cpp @@ -0,0 +1,20 @@ +$NetBSD: patch-src_mongo_db_matcher_expression__leaf.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/db/matcher/expression_leaf.cpp.orig 2017-07-11 17:17:17.311043545 +0000 ++++ src/mongo/db/matcher/expression_leaf.cpp +@@ -31,6 +31,7 @@ + #include "mongo/db/matcher/expression_leaf.h" + + #include <cmath> ++#include <string> + #include <pcrecpp.h> + + #include "mongo/bson/bsonelement_comparator.h" +@@ -45,6 +46,7 @@ + #include "mongo/util/mongoutils/str.h" + + namespace mongo { ++using std::string; + + Status LeafMatchExpression::setPath(StringData path) { + _path = path; diff --git a/databases/mongodb3/patches/patch-src_mongo_db_repl_isself.c b/databases/mongodb3/patches/patch-src_mongo_db_repl_isself.c new file mode 100644 index 00000000000..ebd4c955f83 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_db_repl_isself.c @@ -0,0 +1,24 @@ +$NetBSD: patch-src_mongo_db_repl_isself.c,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +* Add NetBSD support. + +--- src/mongo/db/repl/isself.cpp.orig 2017-04-20 21:43:42.000000000 +0000 ++++ src/mongo/db/repl/isself.cpp +@@ -50,7 +50,7 @@ + #include "mongo/util/scopeguard.h" + + #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) || \ +- defined(__OpenBSD__) ++ defined(__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__) + #define FASTPATH_UNIX 1 + #endif + +@@ -63,7 +63,7 @@ + #include <ifaddrs.h> + #include <netdb.h> + +-#ifdef __FreeBSD__ ++#if defined(__FreeBSD__) || defined(__NetBSD__) + #include <netinet/in.h> + #endif + diff --git a/databases/mongodb3/patches/patch-src_mongo_db_repl_master__slave.cpp b/databases/mongodb3/patches/patch-src_mongo_db_repl_master__slave.cpp new file mode 100644 index 00000000000..f2465f65d58 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_db_repl_master__slave.cpp @@ -0,0 +1,20 @@ +$NetBSD: patch-src_mongo_db_repl_master__slave.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/db/repl/master_slave.cpp.orig 2017-07-11 17:40:23.338075821 +0000 ++++ src/mongo/db/repl/master_slave.cpp +@@ -45,6 +45,7 @@ + #include "mongo/db/repl/master_slave.h" + + #include <pcrecpp.h> ++#include <string> + + #include "mongo/db/auth/authorization_manager.h" + #include "mongo/db/auth/authorization_session.h" +@@ -78,6 +79,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; diff --git a/databases/mongodb3/patches/patch-src_mongo_db_repl_oplog__fetcher.cpp b/databases/mongodb3/patches/patch-src_mongo_db_repl_oplog__fetcher.cpp new file mode 100644 index 00000000000..438db51ecdd --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_db_repl_oplog__fetcher.cpp @@ -0,0 +1,15 @@ +$NetBSD: patch-src_mongo_db_repl_oplog__fetcher.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +Fix build w/ boost >= 1.66 + +--- src/mongo/db/repl/oplog_fetcher.cpp.orig 2018-08-29 14:02:00.126096548 +0000 ++++ src/mongo/db/repl/oplog_fetcher.cpp +@@ -265,7 +265,7 @@ StatusWith<boost::optional<rpc::OplogQue + if (!metadataResult.isOK()) { + return metadataResult.getStatus(); + } +- oqMetadata = boost::make_optional<rpc::OplogQueryMetadata>(metadataResult.getValue()); ++ oqMetadata = boost::make_optional(metadataResult.getValue()); + } + return oqMetadata; + } diff --git a/databases/mongodb3/patches/patch-src_mongo_installer_msi_SConscript b/databases/mongodb3/patches/patch-src_mongo_installer_msi_SConscript new file mode 100644 index 00000000000..c53cf28414e --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_installer_msi_SConscript @@ -0,0 +1,15 @@ +$NetBSD: patch-src_mongo_installer_msi_SConscript,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/installer/msi/SConscript.orig 2017-04-20 21:43:42.000000000 +0000 ++++ src/mongo/installer/msi/SConscript +@@ -69,8 +69,8 @@ else: + upgrade_code = '9295A251-1B1F-45FB-96FF-35B57E490613' + + if 'msi' in BUILD_TARGETS and msi_edition == 'SSL' and msi_flavor != '2008R2Plus': +- print "Building the MongoDB SSL MSI is only supported on Windows 2008 R2+ or Windows 7+ platforms." +- print "You must add --win-version-min=ws08r2 to your scons flags" ++ print("Building the MongoDB SSL MSI is only supported on Windows 2008 R2+ or Windows 7+ platforms.") ++ print("You must add --win-version-min=ws08r2 to your scons flags") + exit(1) + + if msi_platform == 'x64': diff --git a/databases/mongodb3/patches/patch-src_mongo_platform_random.cpp b/databases/mongodb3/patches/patch-src_mongo_platform_random.cpp new file mode 100644 index 00000000000..8999bd66735 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_platform_random.cpp @@ -0,0 +1,14 @@ +$NetBSD: patch-src_mongo_platform_random.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +Add NetBSD support. +--- src/mongo/platform/random.cpp.orig 2016-01-05 18:31:44.000000000 +0000 ++++ src/mongo/platform/random.cpp +@@ -145,7 +145,7 @@ SecureRandom* SecureRandom::create() { + return new WinSecureRandom(); + } + +-#elif defined(__linux__) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__) ++#elif defined(__linux__) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) + + class InputStreamSecureRandom : public SecureRandom { + public: diff --git a/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__dragonfly.cpp b/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__dragonfly.cpp new file mode 100644 index 00000000000..80c5de97cfd --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__dragonfly.cpp @@ -0,0 +1,63 @@ +$NetBSD: patch-src_mongo_platform_stack__locator__dragonfly.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/platform/stack_locator_dragonfly.cpp.orig 2016-02-11 11:27:13.489023328 +0000 ++++ src/mongo/platform/stack_locator_dragonfly.cpp +@@ -0,0 +1,58 @@ ++/** ++ * Copyright (C) 2015 MongoDB Inc. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU Affero General Public License, version 3, ++ * as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Affero General Public License for more details. ++ * ++ * You should have received a copy of the GNU Affero General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ * ++ * As a special exception, the copyright holders give permission to link the ++ * code of portions of this program with the OpenSSL library under certain ++ * conditions as described in each individual source file and distribute ++ * linked combinations including the program with the OpenSSL library. You ++ * must comply with the GNU Affero General Public License in all respects for ++ * all of the code used other than as permitted herein. If you modify file(s) ++ * with this exception, you may extend this exception to your version of the ++ * file(s), but you are not obligated to do so. If you do not wish to do so, ++ * delete this exception statement from your version. If you delete this ++ * exception statement from all source files in the program, then also delete ++ * it in the license file. ++ */ ++ ++#include "mongo/platform/basic.h" ++ ++#include "mongo/platform/stack_locator.h" ++ ++#include <pthread.h> ++#include <pthread_np.h> ++ ++#include "mongo/util/assert_util.h" ++#include "mongo/util/scopeguard.h" ++ ++namespace mongo { ++ ++StackLocator::StackLocator() { ++ pthread_attr_t attr; ++ size_t size; ++ ++ pthread_t self = pthread_self(); ++ ++ invariant(pthread_attr_init(&attr) == 0); ++ ON_BLOCK_EXIT(pthread_attr_destroy, &attr); ++ ++ invariant(pthread_attr_get_np(self, &attr) == 0); ++ ++ invariant(pthread_attr_getstack(&attr, &_end, &size) == 0); ++ ++ // TODO: Assumes stack grows downward on FreeBSD ++ _begin = static_cast<char*>(_end) + size; ++} ++ ++} // namespace mongo diff --git a/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__netbsd.cpp b/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__netbsd.cpp new file mode 100644 index 00000000000..60511b89d4f --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_platform_stack__locator__netbsd.cpp @@ -0,0 +1,63 @@ +$NetBSD: patch-src_mongo_platform_stack__locator__netbsd.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/platform/stack_locator_netbsd.cpp.orig 2016-02-11 12:24:33.443209041 +0000 ++++ src/mongo/platform/stack_locator_netbsd.cpp +@@ -0,0 +1,58 @@ ++/** ++ * Copyright (C) 2015 MongoDB Inc. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU Affero General Public License, version 3, ++ * as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Affero General Public License for more details. ++ * ++ * You should have received a copy of the GNU Affero General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ * ++ * As a special exception, the copyright holders give permission to link the ++ * code of portions of this program with the OpenSSL library under certain ++ * conditions as described in each individual source file and distribute ++ * linked combinations including the program with the OpenSSL library. You ++ * must comply with the GNU Affero General Public License in all respects for ++ * all of the code used other than as permitted herein. If you modify file(s) ++ * with this exception, you may extend this exception to your version of the ++ * file(s), but you are not obligated to do so. If you do not wish to do so, ++ * delete this exception statement from your version. If you delete this ++ * exception statement from all source files in the program, then also delete ++ * it in the license file. ++ */ ++ ++#include "mongo/platform/basic.h" ++ ++#include "mongo/platform/stack_locator.h" ++ ++#include <pthread.h> ++ ++ ++#include "mongo/util/assert_util.h" ++#include "mongo/util/scopeguard.h" ++ ++namespace mongo { ++ ++StackLocator::StackLocator() { ++ pthread_attr_t attr; ++ size_t size; ++ ++ pthread_t self = pthread_self(); ++ ++ invariant(pthread_attr_init(&attr) == 0); ++ ON_BLOCK_EXIT(pthread_attr_destroy, &attr); ++ ++ invariant(pthread_attr_get_np(self, &attr) == 0); ++ ++ invariant(pthread_attr_getstack(&attr, &_end, &size) == 0); ++ ++ // TODO: Assumes stack grows downward on FreeBSD ++ _begin = static_cast<char*>(_end) + size; ++} ++ ++} // namespace mongo diff --git a/databases/mongodb3/patches/patch-src_mongo_shell_bench.cpp b/databases/mongodb3/patches/patch-src_mongo_shell_bench.cpp new file mode 100644 index 00000000000..0c02771aa7a --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_shell_bench.cpp @@ -0,0 +1,20 @@ +$NetBSD: patch-src_mongo_shell_bench.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/shell/bench.cpp.orig 2017-07-11 16:39:09.026014232 +0000 ++++ src/mongo/shell/bench.cpp +@@ -34,6 +34,7 @@ + + #include "mongo/shell/bench.h" + ++#include <string> + #include <iostream> + #include <pcrecpp.h> + +@@ -78,6 +79,7 @@ namespace mongo { + using std::unique_ptr; + using std::cout; + using std::map; ++using std::string; + + const std::map<OpType, std::string> opTypeName{{OpType::NONE, "none"}, + {OpType::NOP, "nop"}, diff --git a/databases/mongodb3/patches/patch-src_mongo_shell_linenoise__utf8.h b/databases/mongodb3/patches/patch-src_mongo_shell_linenoise__utf8.h new file mode 100644 index 00000000000..dbf472899b7 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_shell_linenoise__utf8.h @@ -0,0 +1,26 @@ +$NetBSD: patch-src_mongo_shell_linenoise__utf8.h,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +Use Boost swap instead of std. Fixes build on SunOS. +--- src/mongo/shell/linenoise_utf8.h.orig 2016-01-05 18:31:44.000000000 +0000 ++++ src/mongo/shell/linenoise_utf8.h +@@ -27,6 +27,7 @@ + * then also delete it in the license file. + */ + ++#include <boost/core/swap.hpp> + #include <algorithm> + #include <memory> + #include <string.h> +@@ -178,9 +179,9 @@ struct UtfStringMixin { + } + + void swap(UtfStringMixin& other) { +- std::swap(_len, other._len); +- std::swap(_cap, other._cap); +- std::swap(_chars, other._chars); ++ boost::swap(_len, other._len); ++ boost::swap(_cap, other._cap); ++ boost::swap(_chars, other._chars); + _str.swap(other._str); + } + diff --git a/databases/mongodb3/patches/patch-src_mongo_util_intrusive__counter.h b/databases/mongodb3/patches/patch-src_mongo_util_intrusive__counter.h new file mode 100644 index 00000000000..1d9bdf825a3 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_util_intrusive__counter.h @@ -0,0 +1,12 @@ +$NetBSD: patch-src_mongo_util_intrusive__counter.h,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/util/intrusive_counter.h.orig 2016-01-05 18:31:44.000000000 +0000 ++++ src/mongo/util/intrusive_counter.h +@@ -28,6 +28,7 @@ + + #pragma once + ++#include <cstdlib> + #include <boost/intrusive_ptr.hpp> + #include <stdlib.h> + diff --git a/databases/mongodb3/patches/patch-src_mongo_util_net_miniwebserver.cpp b/databases/mongodb3/patches/patch-src_mongo_util_net_miniwebserver.cpp new file mode 100644 index 00000000000..7cfdc692a34 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_util_net_miniwebserver.cpp @@ -0,0 +1,20 @@ +$NetBSD: patch-src_mongo_util_net_miniwebserver.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/util/net/miniwebserver.cpp.orig 2017-07-11 17:42:54.304511569 +0000 ++++ src/mongo/util/net/miniwebserver.cpp +@@ -33,6 +33,7 @@ + + #include "mongo/util/net/miniwebserver.h" + ++#include <string> + #include <pcrecpp.h> + + #include "mongo/config.h" +@@ -45,6 +46,7 @@ + namespace mongo { + + using std::shared_ptr; ++using std::string; + using std::stringstream; + using std::vector; + diff --git a/databases/mongodb3/patches/patch-src_mongo_util_processinfo__dragonfly.cpp b/databases/mongodb3/patches/patch-src_mongo_util_processinfo__dragonfly.cpp new file mode 100644 index 00000000000..d976103063a --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_util_processinfo__dragonfly.cpp @@ -0,0 +1,195 @@ +$NetBSD: patch-src_mongo_util_processinfo__dragonfly.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/util/processinfo_dragonfly.cpp.orig 2016-02-11 12:26:02.935580479 +0000 ++++ src/mongo/util/processinfo_dragonfly.cpp +@@ -0,0 +1,190 @@ ++/* Copyright 2012 10gen Inc. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU Affero General Public License, version 3, ++ * as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Affero General Public License for more details. ++ * ++ * You should have received a copy of the GNU Affero General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ * ++ * As a special exception, the copyright holders give permission to link the ++ * code of portions of this program with the OpenSSL library under certain ++ * conditions as described in each individual source file and distribute ++ * linked combinations including the program with the OpenSSL library. You ++ * must comply with the GNU Affero General Public License in all respects ++ * for all of the code used other than as permitted herein. If you modify ++ * file(s) with this exception, you may extend this exception to your ++ * version of the file(s), but you are not obligated to do so. If you do not ++ * wish to do so, delete this exception statement from your version. If you ++ * delete this exception statement from all source files in the program, ++ * then also delete it in the license file. ++ */ ++ ++#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kControl ++ ++#include <cstdlib> ++#include <string> ++ ++#include <kvm.h> ++#include <sys/file.h> ++#include <sys/mman.h> ++#include <sys/param.h> ++#include <sys/sysctl.h> ++#include <sys/types.h> ++#include <sys/user.h> ++#include <sys/vmmeter.h> ++#include <unistd.h> ++#include <vm/vm_param.h> ++ ++#include "mongo/util/scopeguard.h" ++#include "mongo/util/log.h" ++#include "processinfo.h" ++ ++using namespace std; ++ ++namespace mongo { ++ ++ProcessInfo::ProcessInfo(ProcessId pid) : _pid(pid) {} ++ ++ProcessInfo::~ProcessInfo() {} ++ ++/** ++ * Get a sysctl string value by name. Use string specialization by default. ++ */ ++template <typename T> ++int getSysctlByNameWithDefault(const char* sysctlName, const T& defaultValue, T* result); ++ ++template <> ++int getSysctlByNameWithDefault<uintptr_t>(const char* sysctlName, ++ const uintptr_t& defaultValue, ++ uintptr_t* result) { ++ uintptr_t value = 0; ++ size_t len = sizeof(value); ++ if (sysctlbyname(sysctlName, &value, &len, NULL, 0) == -1) { ++ *result = defaultValue; ++ return errno; ++ } ++ if (len > sizeof(value)) { ++ *result = defaultValue; ++ return EINVAL; ++ } ++ ++ *result = value; ++ return 0; ++} ++ ++template <> ++int getSysctlByNameWithDefault<string>(const char* sysctlName, ++ const string& defaultValue, ++ string* result) { ++ char value[256] = {0}; ++ size_t len = sizeof(value); ++ if (sysctlbyname(sysctlName, &value, &len, NULL, 0) == -1) { ++ *result = defaultValue; ++ return errno; ++ } ++ *result = value; ++ return 0; ++} ++ ++bool ProcessInfo::checkNumaEnabled() { ++ return false; ++} ++ ++int ProcessInfo::getVirtualMemorySize() { ++ kvm_t* kd = NULL; ++ int cnt = 0; ++ char err[_POSIX2_LINE_MAX] = {0}; ++ if ((kd = kvm_open(NULL, "/dev/null", "/dev/null", O_RDONLY, err)) == NULL) ++ return -1; ++ kinfo_proc* task = kvm_getprocs(kd, KERN_PROC_PID, _pid.toNative(), &cnt); ++ kvm_close(kd); ++ return task->ki_size / 1024 / 1024; // convert from bytes to MB ++} ++ ++int ProcessInfo::getResidentSize() { ++ kvm_t* kd = NULL; ++ int cnt = 0; ++ char err[_POSIX2_LINE_MAX] = {0}; ++ if ((kd = kvm_open(NULL, "/dev/null", "/dev/null", O_RDONLY, err)) == NULL) ++ return -1; ++ kinfo_proc* task = kvm_getprocs(kd, KERN_PROC_PID, _pid.toNative(), &cnt); ++ kvm_close(kd); ++ return task->ki_rssize * sysconf(_SC_PAGESIZE) / 1024 / 1024; // convert from pages to MB ++} ++ ++double ProcessInfo::getSystemMemoryPressurePercentage() { ++ return 0.0; ++} ++ ++void ProcessInfo::SystemInfo::collectSystemInfo() { ++ osType = "BSD"; ++ osName = "FreeBSD"; ++ ++ int status = getSysctlByNameWithDefault("kern.version", string("unknown"), &osVersion); ++ if (status != 0) ++ log() << "Unable to collect OS Version. (errno: " << status << " msg: " << strerror(status) ++ << ")" << endl; ++ ++ status = getSysctlByNameWithDefault("hw.machine_arch", string("unknown"), &cpuArch); ++ if (status != 0) ++ log() << "Unable to collect Machine Architecture. (errno: " << status ++ << " msg: " << strerror(status) << ")" << endl; ++ addrSize = cpuArch.find("64") != std::string::npos ? 64 : 32; ++ ++ uintptr_t numBuffer; ++ uintptr_t defaultNum = 1; ++ status = getSysctlByNameWithDefault("hw.physmem", defaultNum, &numBuffer); ++ memSize = numBuffer; ++ if (status != 0) ++ log() << "Unable to collect Physical Memory. (errno: " << status ++ << " msg: " << strerror(status) << ")" << endl; ++ ++ status = getSysctlByNameWithDefault("hw.ncpu", defaultNum, &numBuffer); ++ numCores = numBuffer; ++ if (status != 0) ++ log() << "Unable to collect Number of CPUs. (errno: " << status ++ << " msg: " << strerror(status) << ")" << endl; ++ ++ pageSize = static_cast<unsigned long long>(sysconf(_SC_PAGESIZE)); ++ ++ hasNuma = checkNumaEnabled(); ++} ++ ++void ProcessInfo::getExtraInfo(BSONObjBuilder& info) {} ++ ++bool ProcessInfo::supported() { ++ return true; ++} ++ ++bool ProcessInfo::blockCheckSupported() { ++ return true; ++} ++ ++bool ProcessInfo::blockInMemory(const void* start) { ++ char x = 0; ++ if (mincore(alignToStartOfPage(start), getPageSize(), &x)) { ++ log() << "mincore failed: " << errnoWithDescription() << endl; ++ return 1; ++ } ++ return x & 0x1; ++} ++ ++bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, vector<char>* out) { ++ out->resize(numPages); ++ // int mincore(const void *addr, size_t len, char *vec); ++ if (mincore(alignToStartOfPage(start), numPages * getPageSize(), &(out->front()))) { ++ log() << "mincore failed: " << errnoWithDescription() << endl; ++ return false; ++ } ++ for (size_t i = 0; i < numPages; ++i) { ++ (*out)[i] = 0x1; ++ } ++ return true; ++} ++} diff --git a/databases/mongodb3/patches/patch-src_mongo_util_processinfo__netbsd.cpp b/databases/mongodb3/patches/patch-src_mongo_util_processinfo__netbsd.cpp new file mode 100644 index 00000000000..2f835ae26c0 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_mongo_util_processinfo__netbsd.cpp @@ -0,0 +1,217 @@ +$NetBSD: patch-src_mongo_util_processinfo__netbsd.cpp,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/mongo/util/processinfo_netbsd.cpp.orig 2017-06-24 01:47:17.271883765 +0000 ++++ src/mongo/util/processinfo_netbsd.cpp +@@ -0,0 +1,212 @@ ++/* Copyright 2012 10gen Inc. ++ * ++ * This program is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU Affero General Public License, version 3, ++ * as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Affero General Public License for more details. ++ * ++ * You should have received a copy of the GNU Affero General Public License ++ * along with this program. If not, see <http://www.gnu.org/licenses/>. ++ * ++ * As a special exception, the copyright holders give permission to link the ++ * code of portions of this program with the OpenSSL library under certain ++ * conditions as described in each individual source file and distribute ++ * linked combinations including the program with the OpenSSL library. You ++ * must comply with the GNU Affero General Public License in all respects ++ * for all of the code used other than as permitted herein. If you modify ++ * file(s) with this exception, you may extend this exception to your ++ * version of the file(s), but you are not obligated to do so. If you do not ++ * wish to do so, delete this exception statement from your version. If you ++ * delete this exception statement from all source files in the program, ++ * then also delete it in the license file. ++ */ ++ ++#if defined(__NetBSD__) ++#define _KMEMUSER ++#endif ++ ++#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kControl ++ ++#include <cstdlib> ++#include <string> ++ ++#include <kvm.h> ++#include <sys/file.h> ++#include <sys/mman.h> ++#include <sys/param.h> ++#include <sys/sysctl.h> ++#include <sys/types.h> ++#include <sys/vmmeter.h> ++#include <unistd.h> ++ ++#include "mongo/util/scopeguard.h" ++#include "mongo/util/log.h" ++#include "processinfo.h" ++ ++using namespace std; ++ ++namespace mongo { ++ ++ProcessInfo::ProcessInfo(ProcessId pid) : _pid(pid) {} ++ ++ProcessInfo::~ProcessInfo() {} ++ ++/** ++ * Get a sysctl string value by name. Use string specialization by default. ++ */ ++template <typename T> ++int getSysctlByIDWithDefault(const int* sysctlID, ++ const int idLen, ++ const T& defaultValue, ++ T* result); ++ ++template <> ++int getSysctlByIDWithDefault<uintptr_t>(const int* sysctlID, ++ const int idLen, ++ const uintptr_t& defaultValue, ++ uintptr_t* result) { ++ uintptr_t value = 0; ++ size_t len = sizeof(value); ++ if (sysctl(sysctlID, idLen, &value, &len, NULL, 0) == -1) { ++ *result = defaultValue; ++ return errno; ++ } ++ if (len > sizeof(value)) { ++ *result = defaultValue; ++ return EINVAL; ++ } ++ ++ *result = value; ++ return 0; ++} ++ ++template <> ++int getSysctlByIDWithDefault<string>(const int* sysctlID, ++ const int idLen, ++ const string& defaultValue, ++ string* result) { ++ char value[256] = {0}; ++ size_t len = sizeof(value); ++ if (sysctl(sysctlID, idLen, &value, &len, NULL, 0) == -1) { ++ *result = defaultValue; ++ return errno; ++ } ++ *result = value; ++ return 0; ++} ++ ++bool ProcessInfo::checkNumaEnabled() { ++ return false; ++} ++ ++int ProcessInfo::getVirtualMemorySize() { ++ kvm_t* kd = NULL; ++ int cnt = 0; ++ char err[_POSIX2_LINE_MAX] = {0}; ++ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, err)) == NULL) { ++ log() << "Unable to get virt mem size: " << err << endl; ++ return -1; ++ } ++ ++ kinfo_proc2* task = kvm_getproc2(kd, KERN_PROC_PID, _pid.toNative(), sizeof(kinfo_proc2), &cnt); ++ kvm_close(kd); ++ return ((task->p_vm_dsize + task->p_vm_ssize + task->p_vm_tsize) * sysconf(_SC_PAGESIZE)) / ++ 1048576; ++} ++ ++int ProcessInfo::getResidentSize() { ++ kvm_t* kd = NULL; ++ int cnt = 0; ++ char err[_POSIX2_LINE_MAX] = {0}; ++ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, err)) == NULL) { ++ log() << "Unable to get res mem size: " << err << endl; ++ return -1; ++ } ++ kinfo_proc2* task = kvm_getproc2(kd, KERN_PROC_PID, _pid.toNative(), sizeof(kinfo_proc2), &cnt); ++ kvm_close(kd); ++ return (task->p_vm_rssize * sysconf(_SC_PAGESIZE)) / 1048576; // convert from pages to MB ++} ++ ++double ProcessInfo::getSystemMemoryPressurePercentage() { ++ return 0.0; ++} ++ ++void ProcessInfo::SystemInfo::collectSystemInfo() { ++ osType = "BSD"; ++ osName = "NetBSD"; ++ int mib[2]; ++ ++ mib[0] = CTL_KERN; ++ mib[1] = KERN_VERSION; ++ int status = getSysctlByIDWithDefault(mib, 2, string("unknown"), &osVersion); ++ if (status != 0) ++ log() << "Unable to collect OS Version. (errno: " << status << " msg: " << strerror(status) ++ << ")" << endl; ++ ++ mib[0] = CTL_HW; ++ mib[1] = HW_MACHINE; ++ status = getSysctlByIDWithDefault(mib, 2, string("unknown"), &cpuArch); ++ if (status != 0) ++ log() << "Unable to collect Machine Architecture. (errno: " << status ++ << " msg: " << strerror(status) << ")" << endl; ++ addrSize = cpuArch.find("64") != std::string::npos ? 64 : 32; ++ ++ uintptr_t numBuffer; ++ uintptr_t defaultNum = 1; ++ mib[0] = CTL_HW; ++ mib[1] = HW_PHYSMEM; ++ status = getSysctlByIDWithDefault(mib, 2, defaultNum, &numBuffer); ++ memSize = numBuffer; ++ if (status != 0) ++ log() << "Unable to collect Physical Memory. (errno: " << status ++ << " msg: " << strerror(status) << ")" << endl; ++ ++ mib[0] = CTL_HW; ++ mib[1] = HW_NCPU; ++ status = getSysctlByIDWithDefault(mib, 2, defaultNum, &numBuffer); ++ numCores = numBuffer; ++ if (status != 0) ++ log() << "Unable to collect Number of CPUs. (errno: " << status ++ << " msg: " << strerror(status) << ")" << endl; ++ ++ pageSize = static_cast<unsigned long long>(sysconf(_SC_PAGESIZE)); ++ ++ hasNuma = checkNumaEnabled(); ++} ++ ++void ProcessInfo::getExtraInfo(BSONObjBuilder& info) {} ++ ++bool ProcessInfo::supported() { ++ return true; ++} ++ ++bool ProcessInfo::blockCheckSupported() { ++ return true; ++} ++ ++bool ProcessInfo::blockInMemory(const void* start) { ++ char x = 0; ++ if (mincore((void*)alignToStartOfPage(start), getPageSize(), &x)) { ++ log() << "mincore failed: " << errnoWithDescription() << endl; ++ return 1; ++ } ++ return x & 0x1; ++} ++ ++bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, 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; ++ return false; ++ } ++ for (size_t i = 0; i < numPages; ++i) { ++ (*out)[i] = 0x1; ++ } ++ return true; ++} ++} diff --git a/databases/mongodb3/patches/patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_dpml__exception.c b/databases/mongodb3/patches/patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_dpml__exception.c new file mode 100644 index 00000000000..6608611989d --- /dev/null +++ b/databases/mongodb3/patches/patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_dpml__exception.c @@ -0,0 +1,12 @@ +$NetBSD: patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_dpml__exception.c,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/dpml_exception.c.orig 2017-04-20 21:43:42.000000000 +0000 ++++ src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/dpml_exception.c +@@ -131,6 +131,7 @@ + #if !defined(DPML_SIGNAL) && !defined(MINIMAL_SILENT_MODE_EXCEPTION_HANDLER) && \
+ !defined(wnt)
+
++# include <sys/types.h>
+ # include <sys/signal.h>
+ # define DPML_SIGNAL(p) raise(SIGFPE)
+
diff --git a/databases/mongodb3/patches/patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_op__system.h b/databases/mongodb3/patches/patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_op__system.h new file mode 100644 index 00000000000..60d6c970230 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_op__system.h @@ -0,0 +1,120 @@ +$NetBSD: patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_float128_op__system.h,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/op_system.h.orig 2017-04-20 21:43:42.000000000 +0000 ++++ src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/op_system.h +@@ -44,6 +44,7 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define dos 1
+ # define OP_SYSTEM dos
+@@ -62,6 +63,7 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define vms 2
+ # define OP_SYSTEM vms
+@@ -80,6 +82,7 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define wnt 3
+ # define OP_SYSTEM wnt
+@@ -98,6 +101,7 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define linux 8
+ # define OP_SYSTEM linux
+@@ -117,6 +121,7 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define osf 4
+ # define OP_SYSTEM osf
+@@ -135,6 +140,7 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define hp_ux 5
+ # define OP_SYSTEM hp_ux
+@@ -153,6 +159,7 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define unicos 6
+ # define OP_SYSTEM unicos
+@@ -171,6 +178,7 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define ultrix 7
+ # define OP_SYSTEM ultrix
+@@ -188,6 +196,7 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define win64 9
+ # define OP_SYSTEM win64
+@@ -205,6 +214,7 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define darwin 10
+ # define OP_SYSTEM darwin
+@@ -221,9 +231,27 @@ + # undef win64
+ # undef darwin
+ # undef interix
++# undef netbsd
+
+ # define interix 11
+ # define OP_SYSTEM interix
++
++#elif defined(__NetBSD__)
++# undef dos
++# undef vms
++# undef wnt
++# undef osf
++# undef hp_ux
++# undef linux
++# undef unicos
++# undef ultrix
++# undef win64
++# undef darwin
++# undef interix
++# undef netbsd
++
++# define netbsd 12
++# define OP_SYSTEM netbsd
+ #else
+
+ # error Operating system must be specified.
+@@ -235,6 +263,7 @@ + OP_SYSTEM == linux || \
+ OP_SYSTEM == osf || \
+ OP_SYSTEM == ultrix || \
++ OP_SYSTEM == netbsd || \
+ OP_SYSTEM == unicos \
+ )
+
diff --git a/databases/mongodb3/patches/patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_src_bid__functions.h b/databases/mongodb3/patches/patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_src_bid__functions.h new file mode 100644 index 00000000000..d106a9552f1 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_src_bid__functions.h @@ -0,0 +1,13 @@ +$NetBSD: patch-src_third__party_IntelRDFPMathLib20U1_LIBRARY_src_bid__functions.h,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_functions.h.orig 2017-04-20 21:43:42.000000000 +0000 ++++ src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_functions.h +@@ -159,7 +159,7 @@ typedef unsigned long fexcept_t;
+ typedef unsigned bid__int64 fexcept_t;
+ #endif
+ #else
+-#ifdef __QNX__
++#if defined(__QNX__) || defined(__NetBSD__)
+ #include <fenv.h>
+ #else
+ typedef unsigned short int fexcept_t;
diff --git a/databases/mongodb3/patches/patch-src_third__party_mozjs-38_platform_x86__64_netbsd_build_js-confdefs.h b/databases/mongodb3/patches/patch-src_third__party_mozjs-38_platform_x86__64_netbsd_build_js-confdefs.h new file mode 100644 index 00000000000..46f80e7738b --- /dev/null +++ b/databases/mongodb3/patches/patch-src_third__party_mozjs-38_platform_x86__64_netbsd_build_js-confdefs.h @@ -0,0 +1,20 @@ +$NetBSD: patch-src_third__party_mozjs-38_platform_x86__64_netbsd_build_js-confdefs.h,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/third_party/mozjs-45/platform/x86_64/netbsd/build/js-confdefs.h.orig 2016-02-11 12:42:39.272068631 +0000 ++++ src/third_party/mozjs-45/platform/x86_64/netbsd/build/js-confdefs.h +@@ -19,7 +19,6 @@ + #define HAVE_CPUID_H 1 + #define HAVE_DIRENT_H 1 + #define HAVE_DLOPEN 1 +-#define HAVE_ENDIAN_H 1 + #define HAVE_EXPM1 1 + #define HAVE_GETC_UNLOCKED 1 + #define HAVE_GETOPT_H 1 +@@ -54,7 +53,6 @@ + #define JS_CODEGEN_X64 1 + #define JS_CPU_X64 1 + #define JS_DEFAULT_JITREPORT_GRANULARITY 3 +-#define JS_HAVE_ENDIAN_H 1 + #define JS_HAVE_MACHINE_ENDIAN_H 1 + #define JS_POSIX_NSPR 1 + #define JS_PUNBOX64 1 diff --git a/databases/mongodb3/patches/patch-src_third__party_mozjs-38_platform_x86__64_netbsd_include_js-config.h b/databases/mongodb3/patches/patch-src_third__party_mozjs-38_platform_x86__64_netbsd_include_js-config.h new file mode 100644 index 00000000000..b2c6b41630a --- /dev/null +++ b/databases/mongodb3/patches/patch-src_third__party_mozjs-38_platform_x86__64_netbsd_include_js-config.h @@ -0,0 +1,13 @@ +$NetBSD: patch-src_third__party_mozjs-38_platform_x86__64_netbsd_include_js-config.h,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/third_party/mozjs-45/platform/x86_64/netbsd/include/js-config.h.orig 2016-02-11 12:24:33.328723425 +0000 ++++ src/third_party/mozjs-45/platform/x86_64/netbsd/include/js-config.h +@@ -36,7 +36,7 @@ + + /* Define to 1 if the <endian.h> header is present and + useable. See jscpucfg.h. */ +-#define JS_HAVE_ENDIAN_H 1 ++/* #undef JS_HAVE_ENDIAN_H */ + + /* Define to 1 if the <machine/endian.h> header is present and + useable. See jscpucfg.h. */ diff --git a/databases/mongodb3/patches/patch-src_third__party_s2_base_port.h b/databases/mongodb3/patches/patch-src_third__party_s2_base_port.h new file mode 100644 index 00000000000..efae5648422 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_third__party_s2_base_port.h @@ -0,0 +1,27 @@ +$NetBSD: patch-src_third__party_s2_base_port.h,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +* Add NetBSD support. + +--- src/third_party/s2/base/port.h.orig 2016-01-05 18:31:44.000000000 +0000 ++++ src/third_party/s2/base/port.h +@@ -102,7 +102,7 @@ typedef uint16_t u_int16_t; + + #endif + +-#if defined __sun || defined __FreeBSD__ || defined __OpenBSD__ ++#if defined __sun || defined __FreeBSD__ || defined __OpenBSD__ || defined __DragonFly__ || defined __NetBSD__ + #ifdef _LITTLE_ENDIAN + #define IS_LITTLE_ENDIAN + #elif defined _BIG_ENDIAN +@@ -139,6 +139,11 @@ typedef uint16_t u_int16_t; + #define bswap_16(x) swap16(x) + #define bswap_32(x) swap32(x) + #define bswap_64(x) swap64(x) ++#elif defined __NetBSD__ ++#include <machine/bswap.h> ++#define bswap_16(x) bswap16(x) ++#define bswap_32(x) bswap32(x) ++#define bswap_64(x) bswap64(x) + #else + #include <byteswap.h> + #endif diff --git a/databases/mongodb3/patches/patch-src_third__party_wiredtiger_SConscript b/databases/mongodb3/patches/patch-src_third__party_wiredtiger_SConscript new file mode 100644 index 00000000000..965ca1d9c86 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_third__party_wiredtiger_SConscript @@ -0,0 +1,28 @@ +$NetBSD: patch-src_third__party_wiredtiger_SConscript,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +* Add NetBSD case. + +--- src/third_party/wiredtiger/SConscript.orig 2017-04-20 21:43:42.000000000 +0000 ++++ src/third_party/wiredtiger/SConscript +@@ -62,8 +62,12 @@ elif env.TargetOSIs('solaris'): + # For an explanation of __EXTENSIONS__, + # see http://docs.oracle.com/cd/E19253-01/816-5175/standards-5/index.html + env.Append(CPPDEFINES=["__EXTENSIONS__"]) ++elif env.TargetOSIs('dragonfly'): ++ env.Append(CPPPATH=["build_dragonfly"]) + elif env.TargetOSIs('freebsd'): + env.Append(CPPPATH=["build_freebsd"]) ++elif env.TargetOSIs('netbsd'): ++ env.Append(CPPPATH=["build_netbsd"]) + elif env.TargetOSIs('openbsd'): + env.Append(CPPPATH=["build_openbsd"]) + elif env.TargetOSIs('linux'): +@@ -93,7 +97,7 @@ if (VERSION_MAJOR == None or + VERSION_MINOR == None or + VERSION_PATCH == None or + VERSION_STRING == None): +- print "Failed to find version variables in " + version_file ++ print("Failed to find version variables in " + version_file) + Exit(1) + + wiredtiger_includes = """ diff --git a/databases/mongodb3/patches/patch-src_third__party_wiredtiger_build__dragonfly_wiredtiger__config.h b/databases/mongodb3/patches/patch-src_third__party_wiredtiger_build__dragonfly_wiredtiger__config.h new file mode 100644 index 00000000000..cfc0f7acfa2 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_third__party_wiredtiger_build__dragonfly_wiredtiger__config.h @@ -0,0 +1,159 @@ +$NetBSD: patch-src_third__party_wiredtiger_build__dragonfly_wiredtiger__config.h,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +--- src/third_party/wiredtiger/build_dragonfly/wiredtiger_config.h.orig 2016-02-11 11:07:15.049932059 +0000 ++++ src/third_party/wiredtiger/build_dragonfly/wiredtiger_config.h +@@ -0,0 +1,154 @@ ++/* wiredtiger_config.h. Generated from config.hin by configure. */ ++/* build_posix/config.hin. Generated from configure.ac by autoheader. */ ++ ++/* Define if building universal (internal helper macro) */ ++/* #undef AC_APPLE_UNIVERSAL_BUILD */ ++ ++/* Define to 1 to pause for debugger attach on failure. */ ++/* #undef HAVE_ATTACH */ ++ ++/* Build the LevelDB API with Basho LevelDB support. */ ++/* #undef HAVE_BASHOLEVELDB */ ++ ++/* Snappy support automatically loaded. */ ++/* #undef HAVE_BUILTIN_EXTENSION_SNAPPY */ ++ ++/* Zlib support automatically loaded. */ ++/* #undef HAVE_BUILTIN_EXTENSION_ZLIB */ ++ ++/* Define to 1 if you have the `clock_gettime' function. */ ++#define HAVE_CLOCK_GETTIME 1 ++ ++/* Define to 1 for diagnostic tests. */ ++/* #undef HAVE_DIAGNOSTIC */ ++ ++/* Define to 1 if you have the <dlfcn.h> header file. */ ++#define HAVE_DLFCN_H 1 ++ ++/* Define to 1 if you have the `fallocate' function. */ ++/* #undef HAVE_FALLOCATE */ ++ ++/* Define to 1 if you have the `fcntl' function. */ ++#define HAVE_FCNTL 1 ++ ++/* Define to 1 if you have the `fdatasync' function. */ ++/* #undef HAVE_FDATASYNC */ ++ ++/* Define to 1 if you have the `fread_unlocked' function. */ ++/* #undef HAVE_FREAD_UNLOCKED */ ++ ++/* Define to 1 if you have the `ftruncate' function. */ ++#define HAVE_FTRUNCATE 1 ++ ++/* Define to 1 if you have the `gettimeofday' function. */ ++#define HAVE_GETTIMEOFDAY 1 ++ ++/* Build the LevelDB API with HyperLevelDB support. */ ++/* #undef HAVE_HYPERLEVELDB */ ++ ++/* Define to 1 if you have the <inttypes.h> header file. */ ++#define HAVE_INTTYPES_H 1 ++ ++/* Define to 1 if you have the `bz2' library (-lbz2). */ ++/* #undef HAVE_LIBBZ2 */ ++ ++/* Define to 1 if you have the `dl' library (-ldl). */ ++/* #undef HAVE_LIBDL */ ++ ++/* Define to 1 if you have the `pthread' library (-lpthread). */ ++#define HAVE_LIBPTHREAD 1 ++ ++/* Define to 1 if you have the `rt' library (-lrt). */ ++#define HAVE_LIBRT 1 ++ ++/* Define to 1 if you have the `snappy' library (-lsnappy). */ ++/* #undef HAVE_LIBSNAPPY */ ++ ++/* Define to 1 if you have the `z' library (-lz). */ ++/* #undef HAVE_LIBZ */ ++ ++/* Define to 1 if you have the <memory.h> header file. */ ++#define HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the `posix_fadvise' function. */ ++#define HAVE_POSIX_FADVISE 1 ++ ++/* Define to 1 if you have the `posix_fallocate' function. */ ++#define HAVE_POSIX_FALLOCATE 1 ++ ++/* Define to 1 if you have the `posix_madvise' function. */ ++#define HAVE_POSIX_MADVISE 1 ++ ++/* Define to 1 if you have the `posix_memalign' function. */ ++#define HAVE_POSIX_MEMALIGN 1 ++ ++/* Define to 1 if you have the <pthread_np.h> header file. */ ++#define HAVE_PTHREAD_NP_H 1 ++ ++/* Build the LevelDB API with RocksDB support. */ ++/* #undef HAVE_ROCKSDB */ ++ ++/* Define to 1 if you have the <stdint.h> header file. */ ++#define HAVE_STDINT_H 1 ++ ++/* Define to 1 if you have the <stdlib.h> header file. */ ++#define HAVE_STDLIB_H 1 ++ ++/* Define to 1 if you have the <strings.h> header file. */ ++#define HAVE_STRINGS_H 1 ++ ++/* Define to 1 if you have the <string.h> header file. */ ++#define HAVE_STRING_H 1 ++ ++/* Define to 1 if you have the `strtouq' function. */ ++#define HAVE_STRTOUQ 1 ++ ++/* Define to 1 if you have the `sync_file_range' function. */ ++/* #undef HAVE_SYNC_FILE_RANGE */ ++ ++/* Define to 1 if you have the <sys/stat.h> header file. */ ++#define HAVE_SYS_STAT_H 1 ++ ++/* Define to 1 if you have the <sys/types.h> header file. */ ++#define HAVE_SYS_TYPES_H 1 ++ ++/* Define to 1 if you have the <unistd.h> header file. */ ++#define HAVE_UNISTD_H 1 ++ ++/* Enable verbose message configuration. */ ++/* #undef HAVE_VERBOSE */ ++ ++/* Define to 1 if you have the <x86intrin.h> header file. */ ++/* #undef HAVE_X86INTRIN_H */ ++ ++/* Spinlock type from mutex.h. */ ++#define SPINLOCK_TYPE SPINLOCK_PTHREAD_MUTEX ++ ++/* Define to 1 if you have the ANSI C header files. */ ++#define STDC_HEADERS 1 ++ ++/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most ++ significant byte first (like Motorola and SPARC, unlike Intel). */ ++#if defined AC_APPLE_UNIVERSAL_BUILD ++# if defined __BIG_ENDIAN__ ++# define WORDS_BIGENDIAN 1 ++# endif ++#else ++# ifndef WORDS_BIGENDIAN ++/* # undef WORDS_BIGENDIAN */ ++# endif ++#endif ++ ++/* Default alignment of buffers used for I/O */ ++#define WT_BUFFER_ALIGNMENT_DEFAULT 0 ++ ++/* Enable large inode numbers on Mac OS X 10.5. */ ++#ifndef _DARWIN_USE_64_BIT_INODE ++# define _DARWIN_USE_64_BIT_INODE 1 ++#endif ++ ++/* Number of bits in a file offset, on hosts where this is settable. */ ++/* #undef _FILE_OFFSET_BITS */ ++ ++/* Define for large files, on AIX-style hosts. */ ++/* #undef _LARGE_FILES */ diff --git a/databases/mongodb3/patches/patch-src_third__party_wiredtiger_build__netbsd_wiredtiger__config.h b/databases/mongodb3/patches/patch-src_third__party_wiredtiger_build__netbsd_wiredtiger__config.h new file mode 100644 index 00000000000..e8631bdf863 --- /dev/null +++ b/databases/mongodb3/patches/patch-src_third__party_wiredtiger_build__netbsd_wiredtiger__config.h @@ -0,0 +1,161 @@ +$NetBSD: patch-src_third__party_wiredtiger_build__netbsd_wiredtiger__config.h,v 1.1 2019/06/28 16:30:56 gdt Exp $ + +* Copy from OpenBSD case. + +--- src/third_party/wiredtiger/build_netbsd/wiredtiger_config.h.orig 2016-02-11 11:07:20.607136772 +0000 ++++ src/third_party/wiredtiger/build_netbsd/wiredtiger_config.h +@@ -0,0 +1,154 @@ ++/* wiredtiger_config.h. Generated from config.hin by configure. */ ++/* build_posix/config.hin. Generated from configure.ac by autoheader. */ ++ ++/* Define if building universal (internal helper macro) */ ++/* #undef AC_APPLE_UNIVERSAL_BUILD */ ++ ++/* Define to 1 to pause for debugger attach on failure. */ ++/* #undef HAVE_ATTACH */ ++ ++/* Build the LevelDB API with Basho LevelDB support. */ ++/* #undef HAVE_BASHOLEVELDB */ ++ ++/* Snappy support automatically loaded. */ ++/* #undef HAVE_BUILTIN_EXTENSION_SNAPPY */ ++ ++/* Zlib support automatically loaded. */ ++/* #undef HAVE_BUILTIN_EXTENSION_ZLIB */ ++ ++/* Define to 1 if you have the `clock_gettime' function. */ ++#define HAVE_CLOCK_GETTIME 1 ++ ++/* Define to 1 for diagnostic tests. */ ++/* #undef HAVE_DIAGNOSTIC */ ++ ++/* Define to 1 if you have the <dlfcn.h> header file. */ ++#define HAVE_DLFCN_H 1 ++ ++/* Define to 1 if you have the `fallocate' function. */ ++/* #undef HAVE_FALLOCATE */ ++ ++/* Define to 1 if you have the `fcntl' function. */ ++#define HAVE_FCNTL 1 ++ ++/* Define to 1 if you have the `fdatasync' function. */ ++/* #undef HAVE_FDATASYNC */ ++ ++/* Define to 1 if you have the `fread_unlocked' function. */ ++/* #undef HAVE_FREAD_UNLOCKED */ ++ ++/* Define to 1 if you have the `ftruncate' function. */ ++#define HAVE_FTRUNCATE 1 ++ ++/* Define to 1 if you have the `gettimeofday' function. */ ++#define HAVE_GETTIMEOFDAY 1 ++ ++/* Build the LevelDB API with HyperLevelDB support. */ ++/* #undef HAVE_HYPERLEVELDB */ ++ ++/* Define to 1 if you have the <inttypes.h> header file. */ ++#define HAVE_INTTYPES_H 1 ++ ++/* Define to 1 if you have the `bz2' library (-lbz2). */ ++/* #undef HAVE_LIBBZ2 */ ++ ++/* Define to 1 if you have the `dl' library (-ldl). */ ++/* #undef HAVE_LIBDL */ ++ ++/* Define to 1 if you have the `pthread' library (-lpthread). */ ++#define HAVE_LIBPTHREAD 1 ++ ++/* Define to 1 if you have the `rt' library (-lrt). */ ++/* #undef HAVE_LIBRT */ ++ ++/* Define to 1 if you have the `snappy' library (-lsnappy). */ ++/* #undef HAVE_LIBSNAPPY */ ++ ++/* Define to 1 if you have the `z' library (-lz). */ ++/* #undef HAVE_LIBZ */ ++ ++/* Define to 1 if you have the <memory.h> header file. */ ++#define HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the `posix_fadvise' function. */ ++/* #undef HAVE_POSIX_FADVISE */ ++ ++/* Define to 1 if you have the `posix_fallocate' function. */ ++/* #undef HAVE_POSIX_FALLOCATE */ ++ ++/* Define to 1 if you have the `posix_madvise' function. */ ++#define HAVE_POSIX_MADVISE 1 ++ ++/* Define to 1 if you have the `posix_memalign' function. */ ++#define HAVE_POSIX_MEMALIGN 1 ++ ++/* Define to 1 if you have the <pthread_np.h> header file. */ ++/* #undef HAVE_PTHREAD_NP_H */ ++ ++/* Build the LevelDB API with RocksDB support. */ ++/* #undef HAVE_ROCKSDB */ ++ ++/* Define to 1 if you have the <stdint.h> header file. */ ++#define HAVE_STDINT_H 1 ++ ++/* Define to 1 if you have the <stdlib.h> header file. */ ++#define HAVE_STDLIB_H 1 ++ ++/* Define to 1 if you have the <strings.h> header file. */ ++#define HAVE_STRINGS_H 1 ++ ++/* Define to 1 if you have the <string.h> header file. */ ++#define HAVE_STRING_H 1 ++ ++/* Define to 1 if you have the `strtouq' function. */ ++#define HAVE_STRTOUQ 1 ++ ++/* Define to 1 if you have the `sync_file_range' function. */ ++/* #undef HAVE_SYNC_FILE_RANGE */ ++ ++/* Define to 1 if you have the <sys/stat.h> header file. */ ++#define HAVE_SYS_STAT_H 1 ++ ++/* Define to 1 if you have the <sys/types.h> header file. */ ++#define HAVE_SYS_TYPES_H 1 ++ ++/* Define to 1 if you have the <unistd.h> header file. */ ++#define HAVE_UNISTD_H 1 ++ ++/* Enable verbose message configuration. */ ++/* #undef HAVE_VERBOSE */ ++ ++/* Define to 1 if you have the <x86intrin.h> header file. */ ++/* #undef HAVE_X86INTRIN_H */ ++ ++/* Spinlock type from mutex.h. */ ++#define SPINLOCK_TYPE SPINLOCK_PTHREAD_MUTEX ++ ++/* Define to 1 if you have the ANSI C header files. */ ++#define STDC_HEADERS 1 ++ ++/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most ++ significant byte first (like Motorola and SPARC, unlike Intel). */ ++#if defined AC_APPLE_UNIVERSAL_BUILD ++# if defined __BIG_ENDIAN__ ++# define WORDS_BIGENDIAN 1 ++# endif ++#else ++# ifndef WORDS_BIGENDIAN ++/* # undef WORDS_BIGENDIAN */ ++# endif ++#endif ++ ++/* Default alignment of buffers used for I/O */ ++#define WT_BUFFER_ALIGNMENT_DEFAULT 0 ++ ++/* Enable large inode numbers on Mac OS X 10.5. */ ++#ifndef _DARWIN_USE_64_BIT_INODE ++# define _DARWIN_USE_64_BIT_INODE 1 ++#endif ++ ++/* Number of bits in a file offset, on hosts where this is settable. */ ++/* #undef _FILE_OFFSET_BITS */ ++ ++/* Define for large files, on AIX-style hosts. */ ++/* #undef _LARGE_FILES */ |
