head 1.1; access; symbols; locks; strict; comment @# @; 1.1 date 2026.09.22.16.47.10; author abs; state Exp; branches; next ; commitid s8oGxWmvLnsKBDWG; desc @@ 1.1 log @Import mongodb-5.0.34 MongoDB 5.0 was released July 13, 2021, and the latest update (5.0.34) was released June 11, 2026 The main consumer of this version of mongodb in pkgsrc is net/unifi, and this will allow users to upgrade theit mongodb4 install (mongodb only allows version+1 upgrades, so 4.4 -> 5.0 then 5.0 -> 6.0 etc @ text @$NetBSD: patch-SConstruct,v 1.2 2025/04/26 13:53:10 tnn Exp $ Add support for NetBSD and Dragonfly. Fix locations. Don't compile with debug info. Don't mess with the linker. Respect LDFLAGS and CXXFLAGS. Fix compatibility issue with scons 4.9's CheckLibWithHeader --- SConstruct.orig 2026-06-16 02:58:57.000000000 +0000 +++ SConstruct @@@@ -16,10 +16,10 @@@@ import textwrap import uuid from glob import glob -from pkg_resources import parse_version - import SCons +from packaging.version import parse as parse_version + # This must be first, even before EnsureSConsVersion, if # we are to avoid bulk loading all tools in the DefaultEnvironment. DefaultEnvironment(tools=[]) @@@@ -1244,6 +1244,7 @@@@ envDict = dict(BUILD_ROOT=buildDir, CONFIGURELOG='$BUILD_ROOT/scons/config.log', CONFIG_HEADER_DEFINES={}, LIBDEPS_TAG_EXPANSIONS=[], + ENV=os.environ, ) # By default, we will get the normal SCons tool search. But if the @@@@ -1442,7 +1443,9 @@@@ def CheckForProcessor(context, which_arc os_macros = { "windows": "defined(_WIN32)", "solaris": "defined(__sun)", + "dragonfly": "defined(__DragonFly__)", "freebsd": "defined(__FreeBSD__)", + "netbsd": "defined(__NetBSD__)", "openbsd": "defined(__OpenBSD__)", "iOS": "defined(__APPLE__) && TARGET_OS_IOS && !TARGET_OS_SIMULATOR", "iOS-sim": "defined(__APPLE__) && TARGET_OS_IOS && TARGET_OS_SIMULATOR", @@@@ -1558,7 +1561,7 @@@@ if env.TargetOSIs('posix'): env.Append( CCFLAGS_WERROR=["-Werror"], CXXFLAGS_WERROR=['-Werror=unused-result'] if env.ToolchainIs('clang') else [], - LINKFLAGS_WERROR=['-Wl,-fatal_warnings' if env.TargetOSIs('darwin') else "-Wl,--fatal-warnings"], + ## LINKFLAGS_WERROR=['-Wl,-fatal_warnings' if env.TargetOSIs('darwin') else "-Wl,--fatal-warnings"], ) elif env.TargetOSIs('windows'): env.Append( @@@@ -1959,7 +1962,7 @@@@ if env['_LIBDEPS'] == '$_LIBDEPS_LIBS': if not env.TargetOSIs('solaris', 'darwin', 'windows', 'openbsd'): env.Tool('thin_archive') -if env.TargetOSIs('linux', 'freebsd', 'openbsd'): +if env.TargetOSIs('linux', 'freebsd', 'openbsd', 'netbsd', 'dragonfly'): env['LINK_WHOLE_ARCHIVE_LIB_START'] = '-Wl,--whole-archive' env['LINK_WHOLE_ARCHIVE_LIB_END'] = '-Wl,--no-whole-archive' env['LINK_AS_NEEDED_LIB_START'] = '-Wl,--as-needed' @@@@ -2136,14 +2139,14 @@@@ if env.TargetOSIs('linux'): elif env.TargetOSIs('solaris'): env.Append( LIBS=["socket","resolv","lgrp"] ) -elif env.TargetOSIs('freebsd'): +elif env.TargetOSIs('freebsd', 'dragonfly'): env.Append( LIBS=[ "kvm" ] ) env.Append( CCFLAGS=[ "-fno-omit-frame-pointer" ] ) elif env.TargetOSIs('darwin'): env.Append( LIBS=["resolv"] ) -elif env.TargetOSIs('openbsd'): +elif env.TargetOSIs('netbsd', 'openbsd'): env.Append( LIBS=[ "kvm" ] ) elif env.TargetOSIs('windows'): @@@@ -2434,7 +2437,6 @@@@ if env.TargetOSIs('posix'): # -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used. env.Append( CCFLAGS=["-fasynchronous-unwind-tables", - "-ggdb" if not env.TargetOSIs('emscripten') else "-g", "-Wall", "-Wsign-compare", "-Wno-unknown-pragmas", @@@@ -2909,7 +2911,7 @@@@ def doConfigure(myenv): def AddToSHLINKFLAGSIfSupported(env, flag): return AddFlagIfSupported(env, 'C', '.c', flag, True, SHLINKFLAGS=[flag]) - if myenv.ToolchainIs('gcc', 'clang'): + if myenv.ToolchainIs('gcc', 'clang') and get_option('runtime-hardening') == 'on': # This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker # because it is much faster. Don't use it if the user has already configured another linker # selection manually. @@@@ -3043,7 +3045,7 @@@@ def doConfigure(myenv): # This warning was added in clang-5 and incorrectly flags our implementation of # exceptionToStatus(). See https://bugs.llvm.org/show_bug.cgi?id=34804 - AddToCCFLAGSIfSupported(myenv, "-Wno-exceptions") + AddToCXXFLAGSIfSupported(myenv, "-Wno-exceptions") # Enable sized deallocation support. AddToCXXFLAGSIfSupported(myenv, '-fsized-deallocation') @@@@ -3276,9 +3278,9 @@@@ def doConfigure(myenv): if usingLibStdCxx: def CheckModernLibStdCxx(context): test_body = """ - #if !__has_include() - #error "libstdc++ from GCC 5.3.0 or newer is required" - #endif + //#if !__has_include() + //#error "libstdc++ from GCC 5.3.0 or newer is required" + //#endif """ context.Message('Checking for libstdc++ 5.3.0 or better... ') @@@@ -3897,8 +3899,9 @@@@ def doConfigure(myenv): def checkOpenSSL(conf): sslLibName = "ssl" cryptoLibName = "crypto" - sslLinkDependencies = ["crypto", "dl"] - if conf.env.TargetOSIs('freebsd'): + if conf.env.TargetOSIs('linux', 'solaris'): + sslLinkDependencies = ["crypto", "dl"] + else: sslLinkDependencies = ["crypto"] if conf.env.TargetOSIs('windows'): @@@@ -3947,7 +3950,7 @@@@ def doConfigure(myenv): cryptoLibName, ["openssl/crypto.h"], "C", - "SSLeay_version(0);", + call="SSLeay_version(0);", autoadd=True): maybeIssueDarwinSSLAdvice(conf.env) conf.env.ConfError("Couldn't find OpenSSL crypto.h header and library") @@@@ -4104,7 +4107,7 @@@@ def doConfigure(myenv): if conf.CheckLibWithHeader( "curl", ["curl/curl.h"], "C", - "curl_global_init(0);", + call="curl_global_init(0);", autoadd=False): return True @@@@ -4230,12 +4233,12 @@@@ def doConfigure(myenv): "sasl2", ["stddef.h","sasl/sasl.h"], "C", - "sasl_version_info(0, 0, 0, 0, 0, 0);", + call="sasl_version_info(0, 0, 0, 0, 0, 0);", autoadd=False ): 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'): if not conf.CheckLib("execinfo"): myenv.ConfError("Cannot find libexecinfo, please install devel/libexecinfo.") @@@@ -4373,7 +4376,7 @@@@ def doConfigure(myenv): ["mongoc-1.0"], ["mongoc/mongoc.h"], "C", - "mongoc_get_major_version();", + call="mongoc_get_major_version();", autoadd=False ): conf.env['MONGO_HAVE_LIBMONGOC'] = True if not conf.env['MONGO_HAVE_LIBMONGOC'] and mongoc_mode == 'on': @