From 8f9baa2e5a1a45394f1182db6bd074197a756361 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Wed, 11 Jun 2008 14:08:01 +0000
Subject: [PATCH] * Darwin compatibility.

svn path=/nixpkgs/branches/stdenv-updates/; revision=12038
---
 pkgs/stdenv/generic/setup.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index de22e64691c..b4e499a53bc 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -74,6 +74,7 @@ test -z $NIX_GCC && NIX_GCC=@gcc@
 # Set up the initial path.
 PATH=
 for i in $NIX_GCC @initialPath@; do
+    if test "$i" = /; then i=; fi
     PATH=$PATH${PATH:+:}$i/bin
 done
 
@@ -586,8 +587,7 @@ patchPhase() {
 
 
 fixLibtool() {
-    sed 's^eval sys_lib_.*search_path=.*^^' < $1 > $1.tmp
-    mv $1.tmp $1
+    sed -i -e 's^eval sys_lib_.*search_path=.*^^' "$1"
 }
 
 
@@ -702,7 +702,7 @@ patchShebangs() {
             local newPath=$(type -P $(basename $oldPath) || true)
             if test -n "$newPath" -a "$newPath" != "$oldPath"; then
                 echo "$f: interpreter changed from $oldPath to $newPath"
-                sed -i "1 s,$oldPath,$newPath," "$f"
+                sed -i -e "1 s,$oldPath,$newPath," "$f"
             fi
         fi
     done