From 8315dc67e269b6bbc9f9a6ccd219fea721d803e1 Mon Sep 17 00:00:00 2001 From: qubitnano <146656568+qubitnano@users.noreply.github.com> Date: Sun, 14 Jul 2024 16:16:23 -0400 Subject: [PATCH] mongodb-7_0: init at 7.0.14 --- pkgs/servers/nosql/mongodb/7.0.nix | 37 +++++++++++ pkgs/servers/nosql/mongodb/mongodb.nix | 11 +++- .../nosql/mongodb/mongodb7-SConstruct.patch | 63 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 13 ++++ 4 files changed, 122 insertions(+), 2 deletions(-) create mode 100644 pkgs/servers/nosql/mongodb/7.0.nix create mode 100644 pkgs/servers/nosql/mongodb/mongodb7-SConstruct.patch diff --git a/pkgs/servers/nosql/mongodb/7.0.nix b/pkgs/servers/nosql/mongodb/7.0.nix new file mode 100644 index 000000000000..ec7136119472 --- /dev/null +++ b/pkgs/servers/nosql/mongodb/7.0.nix @@ -0,0 +1,37 @@ +{ + stdenv, + callPackage, + sasl, + boost, + Security, + CoreFoundation, + cctools, + avxSupport ? stdenv.hostPlatform.avxSupport, +}: + +let + buildMongoDB = callPackage ./mongodb.nix { + inherit + sasl + boost + Security + CoreFoundation + cctools + stdenv + ; + }; +in +buildMongoDB { + inherit avxSupport; + version = "7.0.14"; + sha256 = "sha256-3NUv/Rr6V0rH6zHCXJwHZ7ZQOqMJvYGessNVemUF6g0="; + patches = [ + # ModuleNotFoundError: No module named 'mongo_tooling_metrics': + # NameError: name 'SConsToolingMetrics' is not defined: + # The recommended linker 'lld' is not supported with the current compiler configuration, you can try the 'gold' linker with '--linker=gold'. + ./mongodb7-SConstruct.patch + + # Fix building with python 3.12 since the imp module was removed + ./mongodb-python312.patch + ]; +} diff --git a/pkgs/servers/nosql/mongodb/mongodb.nix b/pkgs/servers/nosql/mongodb/mongodb.nix index f90695934121..5836a925498f 100644 --- a/pkgs/servers/nosql/mongodb/mongodb.nix +++ b/pkgs/servers/nosql/mongodb/mongodb.nix @@ -4,6 +4,7 @@ , buildPackages , boost , gperftools +, pcre2 , pcre-cpp , snappy , zlib @@ -48,7 +49,6 @@ let system-libraries = [ "boost" - "pcre" "snappy" "yaml" "zlib" @@ -56,7 +56,13 @@ let #"stemmer" -- not nice to package yet (no versioning, no makefile, no shared libs). #"valgrind" -- mongodb only requires valgrind.h, which is vendored in the source. #"wiredtiger" - ] ++ lib.optionals stdenv.hostPlatform.isLinux [ "tcmalloc" ]; + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ "tcmalloc" ] + ++ lib.optionals (lib.versionOlder version "7.0") [ + "pcre" + ] + ++ lib.optionals (lib.versionAtLeast version "7.0") [ + "pcre2" + ]; inherit (lib) systems subtractLists; in stdenv.mkDerivation rec { @@ -83,6 +89,7 @@ in stdenv.mkDerivation rec { yaml-cpp openssl openldap + pcre2 pcre-cpp sasl snappy diff --git a/pkgs/servers/nosql/mongodb/mongodb7-SConstruct.patch b/pkgs/servers/nosql/mongodb/mongodb7-SConstruct.patch new file mode 100644 index 000000000000..e5489ea38dfd --- /dev/null +++ b/pkgs/servers/nosql/mongodb/mongodb7-SConstruct.patch @@ -0,0 +1,63 @@ +diff --git a/SConstruct b/SConstruct +index 07579349b83..68a26f26a49 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -23,7 +23,6 @@ from pkg_resources import parse_version + + import SCons + import SCons.Script +-from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics + from site_scons.mongo import build_profiles + + # This must be first, even before EnsureSConsVersion, if +@@ -1653,16 +1652,6 @@ env = Environment(variables=env_vars, **envDict) + del envDict + env.AddMethod(lambda env, name, **kwargs: add_option(name, **kwargs), 'AddOption') + +-# The placement of this is intentional. Here we setup an atexit method to store tooling metrics. +-# We should only register this function after env, env_vars and the parser have been properly initialized. +-SConsToolingMetrics.register_metrics( +- utc_starttime=datetime.utcnow(), +- artifact_dir=env.Dir('$BUILD_DIR').get_abspath(), +- env_vars=env_vars, +- env=env, +- parser=_parser, +-) +- + if get_option('build-metrics'): + env['BUILD_METRICS_ARTIFACTS_DIR'] = '$BUILD_ROOT/$VARIANT_DIR' + env.Tool('build_metrics') +@@ -3549,33 +3538,6 @@ def doConfigure(myenv): + myenv.AddMethod( + functools.partial(var_func, var=var, func=CheckFlag), f"Check{var}Supported") + +- if myenv.ToolchainIs('gcc', 'clang'): +- # 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. +- if any(flag.startswith('-fuse-ld=') for flag in env['LINKFLAGS']): +- myenv.FatalError( +- f"Use the '--linker' option instead of modifying the LINKFLAGS directly.") +- +- linker_ld = get_option('linker') +- if linker_ld == 'auto': +- if not env.TargetOSIs('darwin', 'macOS'): +- if not myenv.AddToLINKFLAGSIfSupported('-fuse-ld=lld'): +- myenv.FatalError( +- f"The recommended linker 'lld' is not supported with the current compiler configuration, you can try the 'gold' linker with '--linker=gold'." +- ) +- elif link_model.startswith("dynamic") and linker_ld == 'bfd': +- # BFD is not supported due to issues with it causing warnings from some of +- # the third party libraries that mongodb is linked with: +- # https://jira.mongodb.org/browse/SERVER-49465 +- myenv.FatalError(f"Linker {linker_ld} is not supported with dynamic link model builds.") +- else: +- if not myenv.AddToLINKFLAGSIfSupported(f'-fuse-ld={linker_ld}'): +- myenv.FatalError(f"Linker {linker_ld} could not be configured.") +- +- if has_option('gcov') and myenv.AddToCCFLAGSIfSupported('-fprofile-update=single'): +- myenv.AppendUnique(LINKFLAGS=['-fprofile-update=single']) +- + detectCompiler = Configure( + myenv, + help=False, diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3d80d39bedd7..c6d23a02db4b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25034,6 +25034,19 @@ with pkgs; if stdenv.cc.isClang then llvmPackages.stdenv else stdenv; }; + mongodb-7_0 = darwin.apple_sdk_11_0.callPackage ../servers/nosql/mongodb/7.0.nix { + sasl = cyrus_sasl; + boost = boost179.override { enableShared = false; }; + inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; + stdenv = if stdenv.hostPlatform.isDarwin then + darwin.apple_sdk_11_0.stdenv.override (old: { + hostPlatform = old.hostPlatform // { darwinMinVersion = "10.14"; }; + buildPlatform = old.buildPlatform // { darwinMinVersion = "10.14"; }; + targetPlatform = old.targetPlatform // { darwinMinVersion = "10.14"; }; + }) else + if stdenv.cc.isClang then llvmPackages.stdenv else stdenv; + }; + immudb = callPackage ../servers/nosql/immudb { }; influxdb = callPackage ../servers/nosql/influxdb { };