From 0dc6fd3204a859e5918820a153afae44d4b8be86 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Tue, 19 Aug 2003 10:40:54 +0000
Subject: [PATCH] * Added bash. * Separated stdenv.fix and
 stdenv-nativetools.fix.

svn path=/nixpkgs/trunk/; revision=324
---
 pkgs/bash/bash-build.sh                       | 10 ++++++
 pkgs/bash/bash.fix                            | 13 +++++++
 pkgs/stdenv-linux/setup.sh                    |  1 +
 pkgs/stdenv-linux/stdenv-build.sh             | 35 ++++++++-----------
 pkgs/stdenv-linux/stdenv-generic.fix          | 30 ----------------
 pkgs/stdenv-linux/stdenv-nativetools-build.sh | 22 ++++++++++++
 pkgs/stdenv-linux/stdenv-nativetools.fix      | 10 +++++-
 pkgs/stdenv-linux/stdenv.fix                  | 27 +++++++++++++-
 8 files changed, 96 insertions(+), 52 deletions(-)
 create mode 100755 pkgs/bash/bash-build.sh
 create mode 100644 pkgs/bash/bash.fix
 delete mode 100644 pkgs/stdenv-linux/stdenv-generic.fix
 create mode 100755 pkgs/stdenv-linux/stdenv-nativetools-build.sh

diff --git a/pkgs/bash/bash-build.sh b/pkgs/bash/bash-build.sh
new file mode 100755
index 000000000000..7b0d093c5760
--- /dev/null
+++ b/pkgs/bash/bash-build.sh
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+. $stdenv/setup || exit 1
+
+tar xvfz $src || exit 1
+cd bash-* || exit 1
+./configure --prefix=$out || exit 1
+make || exit 1
+make install || exit 1
+(cd $out/bin; ln -s bash sh) || exit 1
diff --git a/pkgs/bash/bash.fix b/pkgs/bash/bash.fix
new file mode 100644
index 000000000000..480f11b02127
--- /dev/null
+++ b/pkgs/bash/bash.fix
@@ -0,0 +1,13 @@
+Package(
+  [ ("name", "bash-2.05b")
+
+  , ("build", Relative("bash/bash-build.sh"))
+
+  , ("src", Call(IncludeFix("fetchurl/fetchurl.fix"),
+      [ ("url", "ftp://ftp.nluug.nl/pub/gnu/bash/bash-2.05b.tar.gz")
+      , ("md5", "5238251b4926d778dfe162f6ce729733")
+      ]))
+
+  , ("stdenv", IncludeFix("stdenv-linux/stdenv-nativetools.fix"))
+  ]
+)
diff --git a/pkgs/stdenv-linux/setup.sh b/pkgs/stdenv-linux/setup.sh
index 729ceb1592a6..3d37b2750c9c 100644
--- a/pkgs/stdenv-linux/setup.sh
+++ b/pkgs/stdenv-linux/setup.sh
@@ -6,3 +6,4 @@ export NIX_CC=@CC@
 export NIX_CXX=@CXX@
 
 export PATH=@PATH@
+export SHELL=@SHELL@
diff --git a/pkgs/stdenv-linux/stdenv-build.sh b/pkgs/stdenv-linux/stdenv-build.sh
index 015355218cea..6695cb058a9b 100755
--- a/pkgs/stdenv-linux/stdenv-build.sh
+++ b/pkgs/stdenv-linux/stdenv-build.sh
@@ -4,27 +4,21 @@ export PATH=/bin:/usr/bin
 
 mkdir $out || exit 1
 
-if test "$nativeTools" == 1; then
-    p='$PATH:/usr/local/bin:/usr/bin:/bin'
+p=
+first=1
+for i in $tools; do
+    if test "$first" == 1; then
+	first=
+    else
+	p=$p:
+    fi
+    p=$p$i/bin
+done
+p=$p':$PATH'
 
-    cc=/usr/bin/gcc
-    cxx=/usr/bin/g++
-else
-    p=
-    first=1
-    for i in $tools; do
-	if test "$first" == 1; then
-	    first=
-	else
-	    p=$p:
-	fi
-	p=$p$i/bin
-    done
-    p=$p':$PATH'
-
-    cc=$gcc/bin/gcc
-    cxx=$gcc/bin/g++
-fi
+cc=$gcc/bin/gcc
+cxx=$gcc/bin/g++
+shell=$shell/bin/sh
 
 echo "########## $p"
 
@@ -34,4 +28,5 @@ sed \
  -e s^@CXX\@^$cxx^g \
  -e s^@BASEENV\@^$baseenv^g \
  -e s^@PATH\@^$p^g \
+ -e s^@SHELL\@^$shell^g \
  < $setup > $out/setup || exit 1
diff --git a/pkgs/stdenv-linux/stdenv-generic.fix b/pkgs/stdenv-linux/stdenv-generic.fix
deleted file mode 100644
index 364b29dce68d..000000000000
--- a/pkgs/stdenv-linux/stdenv-generic.fix
+++ /dev/null
@@ -1,30 +0,0 @@
-Function(["nativeTools"],
-
-  Package(
-    [ ("name", "stdenv-linux")
-    , ("build", Relative("stdenv-linux/stdenv-build.sh"))
-
-    , ("nativeTools", Var("nativeTools"))
-
-    , ("setup", Relative("stdenv-linux/setup.sh"))
-    , ("baseenv", IncludeFix("baseenv/baseenv.fix"))
-    , ("glibc", IncludeFix("glibc/glibc.fix"))
-
-    , ("tools", If(Var("nativeTools"), 
-        [],
-        [ IncludeFix("coreutils/coreutils.fix")
-        , IncludeFix("gnused/gnused.fix")
-        , IncludeFix("gnugrep/gnugrep.fix")
-        , IncludeFix("gawk/gawk.fix")
-        , IncludeFix("gnutar/gnutar.fix")
-        , IncludeFix("diffutils/diffutils.fix")
-        , IncludeFix("gzip/gzip.fix")
-        , IncludeFix("bzip2/bzip2.fix")
-        , IncludeFix("gnumake/gnumake.fix")
-        , IncludeFix("binutils/binutils.fix")
-        ]))
-
-    , ("gcc", If(Var("nativeTools"), "", IncludeFix("gcc/gcc.fix")))
-    ]
-  )
-)
diff --git a/pkgs/stdenv-linux/stdenv-nativetools-build.sh b/pkgs/stdenv-linux/stdenv-nativetools-build.sh
new file mode 100755
index 000000000000..8d2094c9204c
--- /dev/null
+++ b/pkgs/stdenv-linux/stdenv-nativetools-build.sh
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+export PATH=/bin:/usr/bin
+
+mkdir $out || exit 1
+
+p='$PATH:/usr/local/bin:/usr/bin:/bin'
+
+cc=/usr/bin/gcc
+cxx=/usr/bin/g++
+shell=/bin/sh
+
+echo "########## $p"
+
+sed \
+ -e s^@GLIBC\@^$glibc^g \
+ -e s^@CC\@^$cc^g \
+ -e s^@CXX\@^$cxx^g \
+ -e s^@BASEENV\@^$baseenv^g \
+ -e s^@PATH\@^$p^g \
+ -e s^@SHELL\@^$shell^g \
+ < $setup > $out/setup || exit 1
diff --git a/pkgs/stdenv-linux/stdenv-nativetools.fix b/pkgs/stdenv-linux/stdenv-nativetools.fix
index a29278a38419..428d8cdebc4e 100644
--- a/pkgs/stdenv-linux/stdenv-nativetools.fix
+++ b/pkgs/stdenv-linux/stdenv-nativetools.fix
@@ -1 +1,9 @@
-Call(IncludeFix("stdenv-linux/stdenv-generic.fix"), [("nativeTools", True)])
\ No newline at end of file
+Package(
+  [ ("name", "stdenv-linux")
+  , ("build", Relative("stdenv-linux/stdenv-nativetools-build.sh"))
+
+  , ("setup", Relative("stdenv-linux/setup.sh"))
+  , ("baseenv", IncludeFix("baseenv/baseenv.fix"))
+  , ("glibc", IncludeFix("glibc/glibc.fix"))
+  ]
+)
diff --git a/pkgs/stdenv-linux/stdenv.fix b/pkgs/stdenv-linux/stdenv.fix
index ceef50c6eca6..1b2292efd405 100644
--- a/pkgs/stdenv-linux/stdenv.fix
+++ b/pkgs/stdenv-linux/stdenv.fix
@@ -1 +1,26 @@
-Call(IncludeFix("stdenv-linux/stdenv-generic.fix"), [("nativeTools", False)])
\ No newline at end of file
+Package(
+  [ ("name", "stdenv-linux")
+  , ("build", Relative("stdenv-linux/stdenv-build.sh"))
+
+  , ("setup", Relative("stdenv-linux/setup.sh"))
+  , ("baseenv", IncludeFix("baseenv/baseenv.fix"))
+  , ("glibc", IncludeFix("glibc/glibc.fix"))
+
+  , ("tools", 
+      [ IncludeFix("coreutils/coreutils.fix")
+      , IncludeFix("gnused/gnused.fix")
+      , IncludeFix("gnugrep/gnugrep.fix")
+      , IncludeFix("gawk/gawk.fix")
+      , IncludeFix("gnutar/gnutar.fix")
+      , IncludeFix("diffutils/diffutils.fix")
+      , IncludeFix("gzip/gzip.fix")
+      , IncludeFix("bzip2/bzip2.fix")
+      , IncludeFix("gnumake/gnumake.fix")
+      , IncludeFix("binutils/binutils.fix")
+      , IncludeFix("bash/bash.fix")
+      ])
+
+    , ("gcc", IncludeFix("gcc/gcc.fix"))
+    , ("shell", IncludeFix("bash/bash.fix"))
+  ]
+)