nodejs: refactor generic build function
This removes some duplicated and dead code across the different versions of nodejs.
This commit is contained in:
parent
9ac793f860
commit
ccbcf15c8e
@ -1,16 +1,20 @@
|
|||||||
{ stdenv, fetchurl, openssl, python2, zlib, libuv, v8, utillinux, http-parser
|
{ stdenv, fetchurl, openssl, python2, zlib, libuv, utillinux, http-parser
|
||||||
, pkgconfig, runCommand, which, libtool, fetchpatch
|
, pkgconfig, which
|
||||||
, callPackage
|
|
||||||
, darwin ? null
|
, darwin ? null
|
||||||
, enableNpm ? true
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
|
|
||||||
|
{ enableNpm ? true, version, sha256, patches }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
|
inherit (darwin.apple_sdk.frameworks) CoreServices ApplicationServices;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
baseName = if enableNpm then "nodejs" else "nodejs-slim";
|
||||||
|
|
||||||
sharedLibDeps = { inherit openssl zlib libuv; } // (optionalAttrs (!stdenv.isDarwin) { inherit http-parser; });
|
sharedLibDeps = { inherit openssl zlib libuv; } // (optionalAttrs (!stdenv.isDarwin) { inherit http-parser; });
|
||||||
|
|
||||||
sharedConfigureFlags = concatMap (name: [
|
sharedConfigureFlags = concatMap (name: [
|
||||||
@ -25,12 +29,20 @@ let
|
|||||||
extraConfigFlags = optionals (!enableNpm) [ "--without-npm" ];
|
extraConfigFlags = optionals (!enableNpm) [ "--without-npm" ];
|
||||||
in
|
in
|
||||||
|
|
||||||
rec {
|
stdenv.mkDerivation {
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
name = "${baseName}-${version}";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.xz";
|
||||||
|
inherit sha256;
|
||||||
|
};
|
||||||
|
|
||||||
buildInputs = optionals stdenv.isDarwin [ CoreServices ApplicationServices ]
|
buildInputs = optionals stdenv.isDarwin [ CoreServices ApplicationServices ]
|
||||||
++ [ python2 which zlib libuv openssl ]
|
++ [ python2 which zlib libuv openssl ]
|
||||||
++ optionals stdenv.isLinux [ utillinux http-parser ]
|
++ optionals stdenv.isLinux [ utillinux http-parser ]
|
||||||
++ optionals stdenv.isDarwin [ pkgconfig libtool ];
|
++ optionals stdenv.isDarwin [ pkgconfig darwin.cctools ];
|
||||||
|
|
||||||
configureFlags = sharedConfigureFlags ++ [ "--without-dtrace" ] ++ extraConfigFlags;
|
configureFlags = sharedConfigureFlags ++ [ "--without-dtrace" ] ++ extraConfigFlags;
|
||||||
|
|
||||||
@ -40,10 +52,9 @@ in
|
|||||||
|
|
||||||
passthru.interpreterName = "nodejs";
|
passthru.interpreterName = "nodejs";
|
||||||
|
|
||||||
|
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
patches = optionals stdenv.isDarwin [ ./no-xcode.patch ];
|
inherit patches;
|
||||||
|
|
||||||
preBuild = optionalString stdenv.isDarwin ''
|
preBuild = optionalString stdenv.isDarwin ''
|
||||||
sed -i -e "s|tr1/type_traits|type_traits|g" \
|
sed -i -e "s|tr1/type_traits|type_traits|g" \
|
||||||
@ -59,7 +70,7 @@ in
|
|||||||
paxmark m $out/bin/node
|
paxmark m $out/bin/node
|
||||||
PATH=$out/bin:$PATH patchShebangs $out
|
PATH=$out/bin:$PATH patchShebangs $out
|
||||||
|
|
||||||
${optionalString enableNpm ''
|
${optionalString enableNpm ''
|
||||||
mkdir -p $out/share/bash-completion/completions/
|
mkdir -p $out/share/bash-completion/completions/
|
||||||
$out/bin/npm completion > $out/share/bash-completion/completions/npm
|
$out/bin/npm completion > $out/share/bash-completion/completions/npm
|
||||||
''}
|
''}
|
||||||
|
@ -1,20 +1,11 @@
|
|||||||
{ stdenv, fetchurl, openssl, python2, zlib, libuv, v8, utillinux, http-parser
|
{ stdenv, callPackage, lib, enableNpm ? true }:
|
||||||
, pkgconfig, runCommand, which, libtool, fetchpatch
|
|
||||||
, callPackage
|
|
||||||
, darwin ? null
|
|
||||||
, enableNpm ? true
|
|
||||||
}@args:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
nodejs = import ./nodejs.nix args;
|
buildNodejs = callPackage ./nodejs.nix {};
|
||||||
baseName = if enableNpm then "nodejs" else "nodejs-slim";
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (nodejs // rec {
|
buildNodejs {
|
||||||
|
inherit enableNpm;
|
||||||
version = "4.8.5";
|
version = "4.8.5";
|
||||||
name = "${baseName}-${version}";
|
sha256 = "0lqdnnihmc2wpl1v1shj60i49wka2354b00a86k0xbjg5gyfx2m4";
|
||||||
src = fetchurl {
|
patches = lib.optionals stdenv.isDarwin [ ./no-xcode.patch ];
|
||||||
url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.xz";
|
}
|
||||||
sha256 = "0lqdnnihmc2wpl1v1shj60i49wka2354b00a86k0xbjg5gyfx2m4";
|
|
||||||
};
|
|
||||||
|
|
||||||
})
|
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
{ stdenv, fetchurl, openssl, python2, zlib, libuv, v8, utillinux, http-parser
|
{ stdenv, callPackage, lib, enableNpm ? true }:
|
||||||
, pkgconfig, runCommand, which, libtool, fetchpatch
|
|
||||||
, callPackage
|
|
||||||
, darwin ? null
|
|
||||||
, enableNpm ? true
|
|
||||||
}@args:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
nodejs = import ./nodejs.nix args;
|
buildNodejs = callPackage ./nodejs.nix {};
|
||||||
baseName = if enableNpm then "nodejs" else "nodejs-slim";
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (nodejs // rec {
|
buildNodejs {
|
||||||
|
inherit enableNpm;
|
||||||
version = "6.11.5";
|
version = "6.11.5";
|
||||||
name = "${baseName}-${version}";
|
sha256 = "1bwakrvy0if5spbymwpb05qwrb47xwzlnc42rapgp6b744ay8v8w";
|
||||||
src = fetchurl {
|
patches = lib.optionals stdenv.isDarwin [ ./no-xcode.patch ];
|
||||||
url = "https://nodejs.org/download/release/v${version}/node-v${version}.tar.xz";
|
}
|
||||||
sha256 = "1bwakrvy0if5spbymwpb05qwrb47xwzlnc42rapgp6b744ay8v8w";
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
@ -1,21 +1,11 @@
|
|||||||
{ stdenv, fetchurl, openssl, python2, zlib, libuv, v8, utillinux, http-parser
|
{ stdenv, callPackage, lib, enableNpm ? true }:
|
||||||
, pkgconfig, runCommand, which, libtool, fetchpatch
|
|
||||||
, callPackage
|
|
||||||
, darwin ? null
|
|
||||||
, enableNpm ? true
|
|
||||||
}@args:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
nodejs = import ./nodejs.nix args;
|
buildNodejs = callPackage ./nodejs.nix {};
|
||||||
baseName = if enableNpm then "nodejs" else "nodejs-slim";
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (nodejs // rec {
|
buildNodejs {
|
||||||
|
inherit enableNpm;
|
||||||
version = "8.9.0";
|
version = "8.9.0";
|
||||||
name = "${baseName}-${version}";
|
sha256 = "128ir6rkdz1xj55hbflw0sh7snrrvjwgvxmgnka7cyhjkvw5i0mf";
|
||||||
src = fetchurl {
|
patches = lib.optionals stdenv.isDarwin [ ./no-xcode-v7.patch ];
|
||||||
url = "https://nodejs.org/download/release/v${version}/node-v${version}.tar.xz";
|
}
|
||||||
sha256 = "128ir6rkdz1xj55hbflw0sh7snrrvjwgvxmgnka7cyhjkvw5i0mf";
|
|
||||||
};
|
|
||||||
|
|
||||||
patches = stdenv.lib.optionals stdenv.isDarwin [ ./no-xcode-v7.patch ];
|
|
||||||
})
|
|
||||||
|
@ -1,21 +1,11 @@
|
|||||||
{ stdenv, fetchurl, openssl, python2, zlib, libuv, v8, utillinux, http-parser
|
{ stdenv, callPackage, lib, enableNpm ? true }:
|
||||||
, pkgconfig, runCommand, which, libtool, fetchpatch
|
|
||||||
, callPackage
|
|
||||||
, darwin ? null
|
|
||||||
, enableNpm ? true
|
|
||||||
}@args:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
nodejs = import ./nodejs.nix args;
|
buildNodejs = callPackage ./nodejs.nix {};
|
||||||
baseName = if enableNpm then "nodejs" else "nodejs-slim";
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (nodejs // rec {
|
buildNodejs {
|
||||||
|
inherit enableNpm;
|
||||||
version = "9.0.0";
|
version = "9.0.0";
|
||||||
name = "${baseName}-${version}";
|
sha256 = "19az7mxcb3d1aj0f7gvhriyyghn1rwn0425924pa84d6j1mbsljv";
|
||||||
src = fetchurl {
|
patches = lib.optionals stdenv.isDarwin [ ./no-xcode-v7.patch ];
|
||||||
url = "https://nodejs.org/download/release/v${version}/node-v${version}.tar.xz";
|
}
|
||||||
sha256 = "19az7mxcb3d1aj0f7gvhriyyghn1rwn0425924pa84d6j1mbsljv";
|
|
||||||
};
|
|
||||||
|
|
||||||
patches = stdenv.lib.optionals stdenv.isDarwin [ ./no-xcode-v7.patch ];
|
|
||||||
})
|
|
||||||
|
@ -3028,41 +3028,17 @@ with pkgs;
|
|||||||
|
|
||||||
nodejs-slim = nodejs-slim-6_x;
|
nodejs-slim = nodejs-slim-6_x;
|
||||||
|
|
||||||
nodejs-4_x = callPackage ../development/web/nodejs/v4.nix {
|
nodejs-4_x = callPackage ../development/web/nodejs/v4.nix {};
|
||||||
libtool = darwin.cctools;
|
nodejs-slim-4_x = callPackage ../development/web/nodejs/v4.nix { enableNpm = false; };
|
||||||
};
|
|
||||||
|
|
||||||
nodejs-slim-4_x = callPackage ../development/web/nodejs/v4.nix {
|
nodejs-6_x = callPackage ../development/web/nodejs/v6.nix {};
|
||||||
libtool = darwin.cctools;
|
nodejs-slim-6_x = callPackage ../development/web/nodejs/v6.nix { enableNpm = false; };
|
||||||
enableNpm = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
nodejs-6_x = callPackage ../development/web/nodejs/v6.nix {
|
nodejs-8_x = callPackage ../development/web/nodejs/v8.nix {};
|
||||||
libtool = darwin.cctools;
|
nodejs-slim-8_x = callPackage ../development/web/nodejs/v8.nix { enableNpm = false; };
|
||||||
};
|
|
||||||
|
|
||||||
nodejs-slim-6_x = callPackage ../development/web/nodejs/v6.nix {
|
nodejs-9_x = callPackage ../development/web/nodejs/v9.nix {};
|
||||||
libtool = darwin.cctools;
|
nodejs-slim-9_x = callPackage ../development/web/nodejs/v9.nix { enableNpm = false; };
|
||||||
enableNpm = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
nodejs-8_x = callPackage ../development/web/nodejs/v8.nix {
|
|
||||||
libtool = darwin.cctools;
|
|
||||||
};
|
|
||||||
|
|
||||||
nodejs-slim-8_x = callPackage ../development/web/nodejs/v8.nix {
|
|
||||||
libtool = darwin.cctools;
|
|
||||||
enableNpm = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
nodejs-9_x = callPackage ../development/web/nodejs/v9.nix {
|
|
||||||
libtool = darwin.cctools;
|
|
||||||
};
|
|
||||||
|
|
||||||
nodejs-slim-9_x = callPackage ../development/web/nodejs/v9.nix {
|
|
||||||
libtool = darwin.cctools;
|
|
||||||
enableNpm = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
nodePackages_6_x = callPackage ../development/node-packages/default-v6.nix {
|
nodePackages_6_x = callPackage ../development/node-packages/default-v6.nix {
|
||||||
nodejs = pkgs.nodejs-6_x;
|
nodejs = pkgs.nodejs-6_x;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user