mongodb: Fix cross compilation

This commit is contained in:
Will Fancher 2024-02-02 07:34:06 -05:00
parent f6086df42f
commit 9bfa405ab4

View file

@ -1,7 +1,7 @@
{ lib { lib
, stdenv , stdenv
, fetchurl , fetchurl
, scons , buildPackages
, boost , boost
, gperftools , gperftools
, pcre-cpp , pcre-cpp
@ -32,6 +32,7 @@ with lib;
}: }:
let let
scons = buildPackages.scons;
python = scons.python.withPackages (ps: with ps; [ python = scons.python.withPackages (ps: with ps; [
pyyaml pyyaml
cheetah3 cheetah3
@ -67,8 +68,10 @@ in stdenv.mkDerivation rec {
inherit sha256; inherit sha256;
}; };
nativeBuildInputs = [ scons ] nativeBuildInputs = [
++ lib.optionals (versionAtLeast version "4.4") [ xz ]; scons
python
] ++ lib.optional stdenv.isLinux net-snmp;
buildInputs = [ buildInputs = [
boost boost
@ -79,13 +82,12 @@ in stdenv.mkDerivation rec {
openssl openssl
openldap openldap
pcre-cpp pcre-cpp
python
sasl sasl
snappy snappy
zlib zlib
] ++ lib.optionals stdenv.isDarwin [ Security CoreFoundation cctools ] ] ++ 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 # MongoDB keeps track of its build parameters, which tricks nix into
# keeping dependencies to build inputs in the final output. # keeping dependencies to build inputs in the final output.
@ -142,6 +144,7 @@ in stdenv.mkDerivation rec {
preBuild = '' preBuild = ''
sconsFlags+=" CC=$CC" sconsFlags+=" CC=$CC"
sconsFlags+=" CXX=$CXX" sconsFlags+=" CXX=$CXX"
sconsFlags+=" AR=$AR"
'' + optionalString stdenv.isAarch64 '' '' + optionalString stdenv.isAarch64 ''
sconsFlags+=" CCFLAGS='-march=armv8-a+crc'" sconsFlags+=" CCFLAGS='-march=armv8-a+crc'"
''; '';