Author: shlevy
Date: Sat Feb 25 19:36:24 2012
New Revision: 32563
URL: https://nixos.org/websvn/nix/?rev=32563&sc=1

Log:
node.js: Get building on darwin

Added:
   nixpkgs/trunk/pkgs/development/web/nodejs/no-arch-flag.patch
Modified:
   nixpkgs/trunk/pkgs/development/web/nodejs/default.nix

Modified: nixpkgs/trunk/pkgs/development/web/nodejs/default.nix
==============================================================================
--- nixpkgs/trunk/pkgs/development/web/nodejs/default.nix       Sat Feb 25 
19:22:06 2012        (r32562)
+++ nixpkgs/trunk/pkgs/development/web/nodejs/default.nix       Sat Feb 25 
19:36:24 2012        (r32563)
@@ -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 @@
     "--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";

Added: nixpkgs/trunk/pkgs/development/web/nodejs/no-arch-flag.patch
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixpkgs/trunk/pkgs/development/web/nodejs/no-arch-flag.patch        Sat Feb 
25 19:36:24 2012        (r32563)
@@ -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
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to