2014-11-09 15:18:45 +00:00
|
|
|
{ stdenv, fetchurl, openssl, python, zlib, v8, utillinux, http-parser, c-ares
|
|
|
|
, pkgconfig, runCommand, which, unstableVersion ? false
|
|
|
|
}:
|
2012-08-22 23:54:47 +01:00
|
|
|
|
2013-05-23 22:46:07 +01:00
|
|
|
let
|
2013-05-28 23:38:16 +01:00
|
|
|
dtrace = runCommand "dtrace-native" {} ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
ln -sv /usr/sbin/dtrace $out/bin
|
|
|
|
'';
|
|
|
|
|
2014-12-17 14:48:51 +00:00
|
|
|
version = if unstableVersion then "0.11.13" else "0.10.33";
|
2013-05-23 22:46:07 +01:00
|
|
|
|
|
|
|
# !!! Should we also do shared libuv?
|
|
|
|
deps = {
|
2014-10-22 16:51:24 +01:00
|
|
|
inherit openssl zlib;
|
2014-04-22 22:15:44 +01:00
|
|
|
|
|
|
|
# disabled system v8 because v8 3.14 no longer receives security fixes
|
|
|
|
# we fall back to nodejs' internal v8 copy which receives backports for now
|
|
|
|
# inherit v8
|
2014-11-09 15:18:45 +00:00
|
|
|
} // (stdenv.lib.optionalAttrs (!stdenv.isDarwin) {
|
2014-10-22 16:51:24 +01:00
|
|
|
inherit http-parser;
|
2014-11-09 15:18:45 +00:00
|
|
|
})
|
|
|
|
# Node 0.11 has patched c-ares, won't compile with system's version
|
|
|
|
// (if unstableVersion then {} else { cares = c-ares; });
|
2013-05-23 22:46:07 +01:00
|
|
|
|
|
|
|
sharedConfigureFlags = name: [
|
|
|
|
"--shared-${name}"
|
|
|
|
"--shared-${name}-includes=${builtins.getAttr name deps}/include"
|
|
|
|
"--shared-${name}-libpath=${builtins.getAttr name deps}/lib"
|
|
|
|
];
|
|
|
|
|
2013-05-28 23:38:16 +01:00
|
|
|
inherit (stdenv.lib) concatMap optional optionals maintainers licenses platforms;
|
2013-05-23 22:46:07 +01:00
|
|
|
in stdenv.mkDerivation {
|
2011-05-05 23:38:04 +01:00
|
|
|
name = "nodejs-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2011-07-31 09:56:09 +01:00
|
|
|
url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.gz";
|
2014-11-09 15:18:45 +00:00
|
|
|
sha256 = if unstableVersion
|
|
|
|
then "1642zj3sajhqflfhb8fsvy84w9mm85wagm8w8300gydd2q6fkmhm"
|
2014-12-17 14:48:51 +00:00
|
|
|
else "07h8vl750svjg8x5zhxhwjkx03jpy2m6h3fbj7fd1rj4671jdp3m";
|
2011-05-05 23:38:04 +01:00
|
|
|
};
|
|
|
|
|
2013-05-23 22:46:07 +01:00
|
|
|
configureFlags = concatMap sharedConfigureFlags (builtins.attrNames deps);
|
2013-03-14 12:52:45 +00:00
|
|
|
|
2012-02-25 19:36:24 +00:00
|
|
|
prePatch = ''
|
2013-05-23 22:46:07 +01:00
|
|
|
sed -e 's|^#!/usr/bin/env python$|#!${python}/bin/python|g' -i configure
|
2011-05-05 23:38:04 +01:00
|
|
|
'';
|
|
|
|
|
2013-05-28 23:38:16 +01:00
|
|
|
patches = if stdenv.isDarwin then [ ./no-xcode.patch ] else null;
|
|
|
|
|
|
|
|
postPatch = if stdenv.isDarwin then ''
|
|
|
|
(cd tools/gyp; patch -Np1 -i ${../../python-modules/gyp/no-darwin-cflags.patch})
|
|
|
|
'' else null;
|
|
|
|
|
2014-04-29 10:37:51 +01:00
|
|
|
buildInputs = [ python which ]
|
2013-05-28 23:38:16 +01:00
|
|
|
++ (optional stdenv.isLinux utillinux)
|
|
|
|
++ optionals stdenv.isDarwin [ pkgconfig openssl dtrace ];
|
2013-02-04 14:21:33 +00:00
|
|
|
setupHook = ./setup-hook.sh;
|
2011-05-05 23:38:04 +01:00
|
|
|
|
2013-05-23 22:46:07 +01:00
|
|
|
meta = {
|
2011-05-05 23:38:04 +01:00
|
|
|
description = "Event-driven I/O framework for the V8 JavaScript engine";
|
|
|
|
homepage = http://nodejs.org;
|
|
|
|
license = licenses.mit;
|
2013-05-23 22:46:07 +01:00
|
|
|
maintainers = [ maintainers.goibhniu maintainers.shlevy ];
|
2013-12-17 10:13:55 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2011-05-05 23:38:04 +01:00
|
|
|
};
|
|
|
|
}
|