Skip to content

Commit

Permalink
nodejs: cross compile runtime for ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
illegalprime authored and FRidh committed Nov 3, 2019
1 parent 6661154 commit 5b96d9c
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions pkgs/development/web/nodejs/nodejs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,30 @@ in
};

buildInputs = optionals stdenv.isDarwin [ CoreServices ApplicationServices ]
++ [ python2 zlib libuv openssl http-parser icu ];
++ [ zlib libuv openssl http-parser icu ];

nativeBuildInputs = [ which utillinux pkgconfig ]
nativeBuildInputs = [ which utillinux pkgconfig python2 ]
++ optionals stdenv.isDarwin [ xcbuild ];

configureFlags = sharedConfigureFlags ++ [ "--without-dtrace" ] ++ extraConfigFlags;
configureFlags = let
isCross = stdenv.hostPlatform != stdenv.buildPlatform;
host = stdenv.hostPlatform.platform;
isArm = stdenv.hostPlatform.isArm;
in sharedConfigureFlags ++ [
"--without-dtrace"
] ++ (optionals isCross [
"--cross-compiling"
"--without-intl"
"--without-snapshot"
]) ++ (optionals (isCross && isArm && hasAttr "fpu" host.gcc) [
"--with-arm-fpu=${host.gcc.fpu}"
]) ++ (optionals (isCross && isArm && hasAttr "float-abi" host.gcc) [
"--with-arm-float-abi=${host.gcc.float-abi}"
]) ++ (optionals (isCross && isArm) [
"--dest-cpu=arm"
]) ++ extraConfigFlags;

configurePlatforms = [];

dontDisableStatic = true;

Expand Down Expand Up @@ -96,7 +114,7 @@ in
postInstall = ''
PATH=$out/bin:$PATH patchShebangs $out
${optionalString enableNpm ''
${optionalString (enableNpm && stdenv.hostPlatform == stdenv.buildPlatform) ''
mkdir -p $out/share/bash-completion/completions/
$out/bin/npm completion > $out/share/bash-completion/completions/npm
for dir in "$out/lib/node_modules/npm/man/"*; do
Expand Down

0 comments on commit 5b96d9c

Please sign in to comment.