about summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2024-02-10 21:30:08 -0500
committerGitHub <noreply@github.com>2024-02-10 21:30:08 -0500
commitc898ce22834cf40ea69adf6093755532df412102 (patch)
tree94e51d9ff42eed8e0675ee80cd15dcdf3f754977 /pkgs/servers
parente72d6a1d3facbcbbc771ca53f8f31c07838825b3 (diff)
parent9bfa405ab4494e6e23e8645ff98156132d3f6629 (diff)
downloadnixlib-c898ce22834cf40ea69adf6093755532df412102.tar
nixlib-c898ce22834cf40ea69adf6093755532df412102.tar.gz
nixlib-c898ce22834cf40ea69adf6093755532df412102.tar.bz2
nixlib-c898ce22834cf40ea69adf6093755532df412102.tar.lz
nixlib-c898ce22834cf40ea69adf6093755532df412102.tar.xz
nixlib-c898ce22834cf40ea69adf6093755532df412102.tar.zst
nixlib-c898ce22834cf40ea69adf6093755532df412102.zip
Merge pull request #285792 from ElvishJerricco/mongodb-cross
mongodb: Cleanups and fix cross compilation.
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/nosql/mongodb/mongodb.nix61
1 files changed, 22 insertions, 39 deletions
diff --git a/pkgs/servers/nosql/mongodb/mongodb.nix b/pkgs/servers/nosql/mongodb/mongodb.nix
index c37f06d5e8bd..928e50a0ae8c 100644
--- a/pkgs/servers/nosql/mongodb/mongodb.nix
+++ b/pkgs/servers/nosql/mongodb/mongodb.nix
@@ -1,7 +1,7 @@
 { lib
 , stdenv
 , fetchurl
-, scons_3_1_2
+, buildPackages
 , boost
 , gperftools
 , pcre-cpp
@@ -32,38 +32,19 @@ with lib;
 }:
 
 let
-  variants =
-    if versionAtLeast version "6.0"
-    then rec {
-      python = scons.python.withPackages (ps: with ps; [
-        pyyaml
-        cheetah3
-        psutil
-        setuptools
-        packaging
-        pymongo
-      ]);
-
-      scons = scons_3_1_2;
-
-      mozjsVersion = "60";
-      mozjsReplace = "defined(HAVE___SINCOS)";
-
-    }
-    else rec {
-      python = scons.python.withPackages (ps: with ps; [
-        pyyaml
-        cheetah3
-        psutil
-        setuptools
-      ]);
-
-      scons = scons_3_1_2;
-
-      mozjsVersion = "60";
-      mozjsReplace = "defined(HAVE___SINCOS)";
-
-    };
+  scons = buildPackages.scons;
+  python = scons.python.withPackages (ps: with ps; [
+    pyyaml
+    cheetah3
+    psutil
+    setuptools
+  ] ++ lib.optionals (versionAtLeast version "6.0") [
+    packaging
+    pymongo
+  ]);
+
+  mozjsVersion = "60";
+  mozjsReplace = "defined(HAVE___SINCOS)";
 
   system-libraries = [
     "boost"
@@ -87,8 +68,10 @@ in stdenv.mkDerivation rec {
     inherit sha256;
   };
 
-  nativeBuildInputs = [ variants.scons ]
-                      ++ lib.optionals (versionAtLeast version "4.4") [ xz ];
+  nativeBuildInputs = [
+    scons
+    python
+  ] ++ lib.optional stdenv.isLinux net-snmp;
 
   buildInputs = [
     boost
@@ -99,13 +82,12 @@ in stdenv.mkDerivation rec {
     openssl
     openldap
     pcre-cpp
-    variants.python
     sasl
     snappy
     zlib
   ] ++ lib.optionals stdenv.isDarwin [ Security CoreFoundation cctools ]
-  ++ lib.optionals stdenv.isLinux [ net-snmp ];
-
+  ++ lib.optional stdenv.isLinux net-snmp
+  ++ lib.optionals (versionAtLeast version "4.4") [ xz ];
 
   # MongoDB keeps track of its build parameters, which tricks nix into
   # keeping dependencies to build inputs in the final output.
@@ -127,7 +109,7 @@ in stdenv.mkDerivation rec {
     # remove -march overriding, we know better.
     sed -i 's/env.Append.*-march=.*$/pass/' SConstruct
   '' + lib.optionalString (stdenv.isDarwin && versionOlder version "6.0") ''
-    substituteInPlace src/third_party/mozjs-${variants.mozjsVersion}/extract/js/src/jsmath.cpp --replace '${variants.mozjsReplace}' 0
+    substituteInPlace src/third_party/mozjs-${mozjsVersion}/extract/js/src/jsmath.cpp --replace '${mozjsReplace}' 0
   '' + lib.optionalString (stdenv.isDarwin && versionOlder version "3.6") ''
     substituteInPlace src/third_party/s2/s1angle.cc --replace drem remainder
     substituteInPlace src/third_party/s2/s1interval.cc --replace drem remainder
@@ -162,6 +144,7 @@ in stdenv.mkDerivation rec {
   preBuild = ''
     sconsFlags+=" CC=$CC"
     sconsFlags+=" CXX=$CXX"
+    sconsFlags+=" AR=$AR"
   '' + optionalString stdenv.isAarch64 ''
     sconsFlags+=" CCFLAGS='-march=armv8-a+crc'"
   '';