2015-02-22 11:41:33 +00:00
|
|
|
{ stdenv, fetchurl, openssl, python, zlib, libuv, v8, utillinux, http-parser
|
2015-02-23 12:24:18 +00:00
|
|
|
, pkgconfig, runCommand, which, unstableVersion ? false
|
2014-11-09 15:18:45 +00:00
|
|
|
}:
|
2012-08-22 22:54:47 +00:00
|
|
|
|
2015-05-03 16:02:55 +00:00
|
|
|
# nodejs 0.12 can't be built on armv5tel. Armv6 with FPU, minimum I think.
|
|
|
|
# Related post: http://zo0ok.com/techfindings/archives/1820
|
|
|
|
assert stdenv.system != "armv5tel-linux";
|
|
|
|
|
2013-05-23 21:46:07 +00:00
|
|
|
let
|
2013-05-28 22:38:16 +00:00
|
|
|
dtrace = runCommand "dtrace-native" {} ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
ln -sv /usr/sbin/dtrace $out/bin
|
|
|
|
'';
|
|
|
|
|
2015-07-06 16:58:50 +00:00
|
|
|
version = "0.12.6";
|
2013-05-23 21:46:07 +00:00
|
|
|
|
|
|
|
deps = {
|
2015-02-22 11:41:33 +00:00
|
|
|
inherit openssl zlib libuv;
|
2014-04-22 21:15:44 +00: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 15:51:24 +00:00
|
|
|
inherit http-parser;
|
2015-02-18 06:44:58 +00:00
|
|
|
});
|
2013-05-23 21:46:07 +00:00
|
|
|
|
|
|
|
sharedConfigureFlags = name: [
|
|
|
|
"--shared-${name}"
|
|
|
|
"--shared-${name}-includes=${builtins.getAttr name deps}/include"
|
|
|
|
"--shared-${name}-libpath=${builtins.getAttr name deps}/lib"
|
|
|
|
];
|
|
|
|
|
2013-05-28 22:38:16 +00:00
|
|
|
inherit (stdenv.lib) concatMap optional optionals maintainers licenses platforms;
|
2013-05-23 21:46:07 +00:00
|
|
|
in stdenv.mkDerivation {
|
2011-05-05 22:38:04 +00:00
|
|
|
name = "nodejs-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2011-07-31 08:56:09 +00:00
|
|
|
url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.gz";
|
2015-07-06 16:58:50 +00:00
|
|
|
sha256 = "1llsl7zl3080zd7jfhhy4d5s9pnhr15niw6vivp9sflpa71mlfvs";
|
2011-05-05 22:38:04 +00:00
|
|
|
};
|
|
|
|
|
2013-05-23 21:46:07 +00: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 21:46:07 +00:00
|
|
|
sed -e 's|^#!/usr/bin/env python$|#!${python}/bin/python|g' -i configure
|
2011-05-05 22:38:04 +00:00
|
|
|
'';
|
|
|
|
|
2013-05-28 22:38:16 +00:00
|
|
|
patches = if stdenv.isDarwin then [ ./no-xcode.patch ] else null;
|
|
|
|
|
|
|
|
|
2014-04-29 09:37:51 +00:00
|
|
|
buildInputs = [ python which ]
|
2013-05-28 22:38:16 +00: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 22:38:04 +00:00
|
|
|
|
2015-02-23 12:24:18 +00:00
|
|
|
passthru.interpreterName = "nodejs";
|
|
|
|
|
2013-05-23 21:46:07 +00:00
|
|
|
meta = {
|
2011-05-05 22:38:04 +00:00
|
|
|
description = "Event-driven I/O framework for the V8 JavaScript engine";
|
|
|
|
homepage = http://nodejs.org;
|
|
|
|
license = licenses.mit;
|
2015-07-01 12:11:05 +00:00
|
|
|
maintainers = [ maintainers.goibhniu maintainers.havvy ];
|
2013-12-17 10:13:55 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2011-05-05 22:38:04 +00:00
|
|
|
};
|
|
|
|
}
|