1{ stdenv, fetchurl, openssl, python, zlib, libuv, v8, utillinux, http-parser
2, pkgconfig, runCommand, which, libtool, unstableVersion ? false
3}:
4
5# nodejs 0.12 can't be built on armv5tel. Armv6 with FPU, minimum I think.
6# Related post: http://zo0ok.com/techfindings/archives/1820
7assert stdenv.system != "armv5tel-linux";
8
9let
10 version = "0.12.7";
11
12 deps = {
13 inherit openssl zlib libuv;
14
15 # disabled system v8 because v8 3.14 no longer receives security fixes
16 # we fall back to nodejs' internal v8 copy which receives backports for now
17 # inherit v8
18 } // (stdenv.lib.optionalAttrs (!stdenv.isDarwin) {
19 inherit http-parser;
20 });
21
22 sharedConfigureFlags = name: [
23 "--shared-${name}"
24 "--shared-${name}-includes=${builtins.getAttr name deps}/include"
25 "--shared-${name}-libpath=${builtins.getAttr name deps}/lib"
26 ];
27
28 inherit (stdenv.lib) concatMap optional optionals maintainers licenses platforms;
29in stdenv.mkDerivation {
30 name = "nodejs-${version}";
31
32 src = fetchurl {
33 url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.gz";
34 sha256 = "17gk29zbw58l0sjjfw86acp39pkiblnq0gsq1jdrd70w0pgn8gdj";
35 };
36
37 configureFlags = concatMap sharedConfigureFlags (builtins.attrNames deps) ++ [ "--without-dtrace" ];
38
39 prePatch = ''
40 patchShebangs .
41 '';
42
43 patches = stdenv.lib.optional stdenv.isDarwin ./no-xcode.patch;
44
45 buildInputs = [ python which ]
46 ++ (optional stdenv.isLinux utillinux)
47 ++ optionals stdenv.isDarwin [ pkgconfig openssl libtool ];
48 setupHook = ./setup-hook.sh;
49
50 enableParallelBuilding = true;
51
52 passthru.interpreterName = "nodejs";
53
54 meta = {
55 description = "Event-driven I/O framework for the V8 JavaScript engine";
56 homepage = http://nodejs.org;
57 license = licenses.mit;
58 maintainers = [ maintainers.goibhniu maintainers.havvy ];
59 platforms = platforms.linux ++ platforms.darwin;
60 };
61}