nodejs: fix cross compilation

main
Nick Cao 3 years ago
parent ffbe82639b
commit 13d37eab6c
No known key found for this signature in database
GPG Key ID: 068A56CEF48FA2C1
  1. 21
      pkgs/development/web/nodejs/nodejs.nix

@ -1,5 +1,5 @@
{ lib, stdenv, fetchurl, openssl, python, zlib, libuv, util-linux, http-parser
, pkg-config, which
, pkg-config, which, buildPackages
# for `.pkgs` attribute
, callPackage
# Updater dependencies
@ -50,6 +50,10 @@ let
inherit sha256;
};
CC_host = "cc";
CXX_host = "c++";
depsBuildBuild = [ buildPackages.stdenv.cc openssl libuv zlib ];
buildInputs = optionals stdenv.isDarwin [ CoreServices ApplicationServices ]
++ [ zlib libuv openssl http-parser icu ];
@ -69,12 +73,23 @@ let
"--cross-compiling"
"--without-intl"
"--without-snapshot"
"--dest-cpu=${let platform = stdenv.hostPlatform; in
if platform.isAarch32 then "arm"
else if platform.isAarch64 then "arm64"
else if platform.isMips32 && platform.isLittleEndian then "mipsel"
else if platform.isMips32 && !platform.isLittleEndian then "mips"
else if platform.isMips64 && platform.isLittleEndian then "mips64el"
else if platform.isPower && platform.is32bit then "ppc"
else if platform.isPower && platform.is64bit then "ppc64"
else if platform.isx86_64 then "x86_64"
else if platform.isx86_32 then "x86"
else if platform.isS390 && platform.is64bit then "s390x"
else if platform.isRiscV && platform.is64bit then "riscv64"
else throw "unsupported cpu ${stdenv.hostPlatform.uname.processor}"}"
]) ++ (optionals (isCross && isAarch32 && hasAttr "fpu" gcc) [
"--with-arm-fpu=${gcc.fpu}"
]) ++ (optionals (isCross && isAarch32 && hasAttr "float-abi" gcc) [
"--with-arm-float-abi=${gcc.float-abi}"
]) ++ (optionals (isCross && isAarch32) [
"--dest-cpu=arm"
]) ++ extraConfigFlags;
configurePlatforms = [];

Loading…
Cancel
Save