Merge pull request #87748 from Gaelan/nss-arm-fix

nss: fix building for aarch32 on aarch64
This commit is contained in:
Andreas Rammhold 2020-05-14 20:42:25 +02:00 committed by GitHub
commit bf60834d6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,7 +53,9 @@ in stdenv.mkDerivation rec {
preConfigure = "cd nss"; preConfigure = "cd nss";
makeFlags = let makeFlags = let
cpu = stdenv.hostPlatform.parsed.cpu.name; # NSS's build systems expects aarch32 to be called arm; if we pass in armv6l/armv7l, it
# fails with a linker error
cpu = if stdenv.hostPlatform.isAarch32 then "arm" else stdenv.hostPlatform.parsed.cpu.name;
in [ in [
"NSPR_INCLUDE_DIR=${nspr.dev}/include" "NSPR_INCLUDE_DIR=${nspr.dev}/include"
"NSPR_LIB_DIR=${nspr.out}/lib" "NSPR_LIB_DIR=${nspr.out}/lib"
@ -64,9 +66,11 @@ in stdenv.mkDerivation rec {
"USE_SYSTEM_ZLIB=1" "USE_SYSTEM_ZLIB=1"
"NSS_USE_SYSTEM_SQLITE=1" "NSS_USE_SYSTEM_SQLITE=1"
"NATIVE_CC=${buildPackages.stdenv.cc}/bin/cc" "NATIVE_CC=${buildPackages.stdenv.cc}/bin/cc"
] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ # Pass in CPU even if we're not cross compiling, because otherwise it tries to guess with
# uname, which can be wrong if e.g. we're compiling for aarch32 on aarch64
"OS_TEST=${cpu}" "OS_TEST=${cpu}"
"CPU_ARCH=${cpu}" "CPU_ARCH=${cpu}"
] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
"CROSS_COMPILE=1" "CROSS_COMPILE=1"
"NSS_DISABLE_GTESTS=1" # don't want to build tests when cross-compiling "NSS_DISABLE_GTESTS=1" # don't want to build tests when cross-compiling
] ++ stdenv.lib.optional stdenv.is64bit "USE_64=1" ] ++ stdenv.lib.optional stdenv.is64bit "USE_64=1"