node.js: copy v8 headers

most npm's that want to build binary stuff (bindings) look for the v8 headers at NODE_BINARY_PATH/../include
Ideally, we get something like npm2nix someday and fix these build scripts.

Until then, this little hack does the trick.
This commit is contained in:
Mathijs Kwik 2012-07-05 08:14:24 +02:00
parent b659b026c5
commit 2cedd7021b

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, openssl, python, zlib, v8 }: { stdenv, fetchurl, openssl, python, zlib, v8, linkV8Headers ? false }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "0.6.19"; version = "0.6.19";
@ -25,6 +25,8 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
sed -e 's|^#!/usr/bin/env node$|#!'$out'/bin/node|' -i $out/lib/node_modules/npm/bin/npm-cli.js sed -e 's|^#!/usr/bin/env node$|#!'$out'/bin/node|' -i $out/lib/node_modules/npm/bin/npm-cli.js
'' + stdenv.lib.optionalString linkV8Headers '' # helps binary npms
ln -s ${v8}/include/* $out/include
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''
install_name_tool -change libv8.dylib ${v8}/lib/libv8.dylib $out/bin/node install_name_tool -change libv8.dylib ${v8}/lib/libv8.dylib $out/bin/node
''; '';