Merge pull request #285792 from ElvishJerricco/mongodb-cross

mongodb: Cleanups and fix cross compilation.
This commit is contained in:
Will Fancher 2024-02-10 21:30:08 -05:00 committed by GitHub
commit c898ce2283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 = buildPackages.scons;
python = scons.python.withPackages (ps: with ps; [
pyyaml
cheetah3
psutil
setuptools
] ++ lib.optionals (versionAtLeast version "6.0") [
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)";
};
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'"
'';