at v206 2.1 kB view raw
1{ stdenv, fetchurl, openssl, python, zlib, libuv, v8, utillinux, http-parser 2, pkgconfig, runCommand, which, libtool 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 = "4.1.2"; 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 = "0j9ca1fjgljzh4m9l9d8g81510j0ljvaf031qij9psiz79qc7gpy"; 35 }; 36 37 configureFlags = concatMap sharedConfigureFlags (builtins.attrNames deps) ++ [ "--without-dtrace" ]; 38 dontDisableStatic = true; 39 prePatch = '' 40 patchShebangs . 41 sed -i 's/raise.*No Xcode or CLT version detected.*/version = "7.0.0"/' tools/gyp/pylib/gyp/xcode_emulation.py 42 ''; 43 44 patches = stdenv.lib.optionals stdenv.isDarwin [ ./no-xcode.patch ./pkg-libpath.patch ]; 45 46 buildInputs = [ python which zlib libuv openssl python ] 47 ++ optionals stdenv.isLinux [ utillinux http-parser ] 48 ++ optionals stdenv.isDarwin [ pkgconfig openssl libtool ]; 49 setupHook = ./setup-hook.sh; 50 51 enableParallelBuilding = true; 52 53 passthru.interpreterName = "nodejs"; 54 55 meta = { 56 description = "Event-driven I/O framework for the V8 JavaScript engine"; 57 homepage = http://nodejs.org; 58 license = licenses.mit; 59 maintainers = [ maintainers.goibhniu maintainers.havvy ]; 60 platforms = platforms.linux ++ platforms.darwin; 61 }; 62}