diff --git a/pkgs/development/web/nodejs/default.nix b/pkgs/development/web/nodejs/default.nix index 9f48627e392..19785753b2d 100644 --- a/pkgs/development/web/nodejs/default.nix +++ b/pkgs/development/web/nodejs/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, openssl, python, zlib, v8 }: +{ stdenv, fetchurl, openssl, python, zlib, v8, darwinInstallNameToolUtility }: stdenv.mkDerivation rec { version = "0.6.10"; @@ -17,11 +17,17 @@ stdenv.mkDerivation rec { "--shared-v8-libpath=${v8}/lib" ]; - patchPhase = '' + patches = stdenv.lib.optional stdenv.isDarwin ./no-arch-flag.patch; + + prePatch = '' sed -e 's|^#!/usr/bin/env python$|#!${python}/bin/python|g' -i tools/{*.py,waf-light,node-waf} ''; - buildInputs = [ python openssl v8 zlib]; + postInstall = stdenv.lib.optionalString stdenv.isDarwin '' + install_name_tool -change libv8.dylib ${v8}/lib/libv8.dylib $out/bin/node + ''; + + buildInputs = [ python openssl v8 zlib ] ++ stdenv.lib.optional stdenv.isDarwin darwinInstallNameToolUtility; meta = with stdenv.lib; { description = "Event-driven I/O framework for the V8 JavaScript engine"; diff --git a/pkgs/development/web/nodejs/no-arch-flag.patch b/pkgs/development/web/nodejs/no-arch-flag.patch new file mode 100644 index 00000000000..bbe96c0c552 --- /dev/null +++ b/pkgs/development/web/nodejs/no-arch-flag.patch @@ -0,0 +1,21 @@ +diff -Naur node-v0.6.10-orig/wscript node-v0.6.10/wscript +--- node-v0.6.10-orig/wscript 2012-02-02 19:56:42.000000000 -0500 ++++ node-v0.6.10/wscript 2012-02-25 14:18:50.000000000 -0500 +@@ -443,17 +443,6 @@ + if sys.platform.startswith("darwin"): + # used by platform_darwin_*.cc + conf.env.append_value('LINKFLAGS', ['-framework','Carbon']) +- # cross compile for architecture specified by DEST_CPU +- if 'DEST_CPU' in conf.env: +- arch = conf.env['DEST_CPU'] +- # map supported_archs to GCC names: +- arch_mappings = {'ia32': 'i386', 'x64': 'x86_64'} +- if arch in arch_mappings: +- arch = arch_mappings[arch] +- flags = ['-arch', arch] +- conf.env.append_value('CCFLAGS', flags) +- conf.env.append_value('CXXFLAGS', flags) +- conf.env.append_value('LINKFLAGS', flags) + if 'DEST_CPU' in conf.env: + arch = conf.env['DEST_CPU'] + # TODO: -m32 is only available on 64 bit machines, so check host type