summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2004-03-11 17:26:14 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2004-03-11 17:26:14 +0000
commitde13527000165c566e47d2146a1a6480fc67da59 (patch)
tree12f84ad99f15678dde1c6282ed78db37e776914a
parenta1b3ae0c8121b932beeceb46bef816bdb2a9f180 (diff)
downloadnixpkgs-de13527000165c566e47d2146a1a6480fc67da59.tar
nixpkgs-de13527000165c566e47d2146a1a6480fc67da59.tar.gz
nixpkgs-de13527000165c566e47d2146a1a6480fc67da59.tar.bz2
nixpkgs-de13527000165c566e47d2146a1a6480fc67da59.tar.lz
nixpkgs-de13527000165c566e47d2146a1a6480fc67da59.tar.xz
nixpkgs-de13527000165c566e47d2146a1a6480fc67da59.tar.zst
nixpkgs-de13527000165c566e47d2146a1a6480fc67da59.zip
* Finally got stdenv-nix-linux working again. Still not perfect,
  though.
* libxml2: upgrade to latest.
* octavefront/rna: keep debug info.

svn path=/nixpkgs/trunk/; revision=830
-rwxr-xr-xpkgs/build-support/gcc-wrapper/builder.sh11
-rw-r--r--pkgs/build-support/gcc-wrapper/default.nix19
-rw-r--r--pkgs/build-support/gcc-wrapper/gcc-wrapper.sh17
-rw-r--r--pkgs/build-support/gcc-wrapper/ld-wrapper.sh12
-rw-r--r--pkgs/build-support/gcc-wrapper/setup-hook.sh3
-rwxr-xr-xpkgs/development/compilers/gcc/builder.sh4
-rw-r--r--pkgs/development/compilers/gcc/default.nix4
-rwxr-xr-xpkgs/development/interpreters/perl/builder.sh7
-rwxr-xr-xpkgs/development/libraries/glibc/builder.sh1
-rw-r--r--pkgs/development/libraries/glibc/default.nix6
-rwxr-xr-xpkgs/development/libraries/libxml2/builder.sh2
-rw-r--r--pkgs/development/libraries/libxml2/default.nix6
-rw-r--r--pkgs/development/libraries/libxml2/libxml2-2.6.5.nix15
-rwxr-xr-xpkgs/development/libraries/rna/builder.sh3
-rwxr-xr-xpkgs/development/libraries/xft/builder.sh2
-rwxr-xr-xpkgs/development/tools/misc/binutils/builder.sh2
-rw-r--r--pkgs/development/tools/misc/binutils/default.nix4
-rwxr-xr-xpkgs/development/tools/misc/octavefront/builder.sh9
-rwxr-xr-xpkgs/stdenv/generic/builder.sh16
-rw-r--r--pkgs/stdenv/generic/setup.sh6
-rw-r--r--pkgs/stdenv/native/default.nix3
-rw-r--r--pkgs/stdenv/native/prehook.sh2
-rw-r--r--pkgs/stdenv/nix-linux/boot.nix13
-rw-r--r--pkgs/stdenv/nix-linux/default.nix8
-rw-r--r--pkgs/stdenv/nix-linux/prehook-boot.sh4
-rw-r--r--pkgs/stdenv/nix/default.nix24
-rw-r--r--pkgs/stdenv/nix/prehook.sh6
-rw-r--r--pkgs/system/all-packages-generic.nix22
-rw-r--r--pkgs/system/all-packages.nix2
-rw-r--r--pkgs/system/populate-cache.nix6
-rw-r--r--pkgs/system/stdenvs.nix25
-rwxr-xr-xpkgs/test/simple/builder.sh9
-rw-r--r--pkgs/test/simple/default.nix2
-rwxr-xr-xpkgs/tools/text/gnugrep/builder.sh18
34 files changed, 162 insertions, 131 deletions
diff --git a/pkgs/build-support/gcc-wrapper/builder.sh b/pkgs/build-support/gcc-wrapper/builder.sh
index e704c8b6794..352a5895135 100755
--- a/pkgs/build-support/gcc-wrapper/builder.sh
+++ b/pkgs/build-support/gcc-wrapper/builder.sh
@@ -6,7 +6,7 @@
 # Force gcc to use ld-wrapper.sh when calling ld.
 cflagsCompile="-B$out/bin"
 
-if test -n "$glibc"; then
+if test -z "$nativeGlibc"; then
     # The "-B$glibc/lib" flag is a quick hack to force gcc to link
     # against the crt1.o from our own glibc, rather than the one in
     # /usr/lib.  The real solution is of course to prevent those paths
@@ -15,14 +15,11 @@ if test -n "$glibc"; then
     ldflags="$ldflags -L$glibc/lib -rpath $glibc/lib -dynamic-linker $glibc/lib/ld-linux.so.2"
 fi
 
-if test -n "$gcc"; then
-    ldflags="$ldflags -L$gcc/lib -rpath $gcc/lib"
-fi
-
-if test -n "$isNative"; then
+if test -n "$nativeTools"; then
     gccPath="$nativePrefix/bin"
     ldPath="$nativePrefix/bin"
 else
+    ldflags="$ldflags -L$gcc/lib -rpath $gcc/lib"
     gccPath="$gcc/bin"
     ldPath="$binutils/bin"
 fi
@@ -76,8 +73,6 @@ NIX_LDFLAGS="$ldflags \$NIX_LDFLAGS"
 EOF
 
 sed \
-    -e "s^@isNative@^$isNative^g" \
-    -e "s^@enforcePurity@^$enforcePurity^g" \
     -e "s^@gcc@^$gcc^g" \
     -e "s^@binutils@^$binutils^g" \
     -e "s^@glibc@^$glibc^g" \
diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix
index 631212a9f22..a9c3f3382b8 100644
--- a/pkgs/build-support/gcc-wrapper/default.nix
+++ b/pkgs/build-support/gcc-wrapper/default.nix
@@ -5,11 +5,13 @@
 # derivation provides a wrapper that sets up the right environment
 # variables so that the compiler and the linker just "work".
 
-{ name, stdenv, isNative, nativePrefix ? ""
-, gcc ? null, glibc ? null, binutils ? null}:
+{ name, stdenv, nativeTools, nativeGlibc, nativePrefix ? ""
+, gcc ? null, glibc ? null, binutils ? null
+}:
 
-assert isNative -> nativePrefix != "";
-assert !isNative -> gcc != null && glibc != null && binutils != null;
+assert nativeTools -> nativePrefix != "";
+assert !nativeTools -> gcc != null && binutils != null;
+assert !nativeGlibc -> glibc != null;
 
 derivation {
   system = stdenv.system;
@@ -17,9 +19,8 @@ derivation {
   setupHook = ./setup-hook.sh;
   gccWrapper = ./gcc-wrapper.sh;
   ldWrapper = ./ld-wrapper.sh;
-  inherit name stdenv isNative nativePrefix gcc glibc binutils;
-  enforcePurity = if isNative then false else gcc.enforcePurity;
-  langC = if isNative then true else gcc.langC;
-  langCC = if isNative then true else gcc.langCC;
-  langF77 = if isNative then false else gcc.langF77;
+  inherit name stdenv nativeTools nativeGlibc nativePrefix gcc glibc binutils;
+  langC = if nativeTools then true else gcc.langC;
+  langCC = if nativeTools then true else gcc.langCC;
+  langF77 = if nativeTools then false else gcc.langF77;
 }
diff --git a/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh b/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh
index 7bc01eb035b..29d3ffb8e49 100644
--- a/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh
+++ b/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh
@@ -40,22 +40,27 @@ skip () {
     fi
 }
 
+badPath() {
+    p=$1
+    test "${p:0:${#NIX_STORE}}" = "$NIX_STORE" -o "${p:0:4}" = "/tmp"
+}
+
 params=("$@")
-if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
+if test "$NIX_ENFORCE_PURITY" = "1x" -a -n "$NIX_STORE"; then
     rest=()
     n=0
     while test $n -lt ${#params[*]}; do
         p=${params[n]}
         p2=${params[$((n+1))]}
-        if test "${p:0:3}" = "-L/" -a "${p:2:${#NIX_STORE}}" != "$NIX_STORE"; then
+        if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
             skip $p
-        elif test "$p" = "-L" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then
+        elif test "$p" = "-L" && badPath "$p2"; then
             n=$((n + 1)); skip $p2
-        elif test "${p:0:3}" = "-I/" -a "${p:2:${#NIX_STORE}}" != "$NIX_STORE"; then
+        elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
             skip $p
-        elif test "$p" = "-I" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then
+        elif test "$p" = "-I" && badPath "$p2"; then
             n=$((n + 1)); skip $p2
-        elif test "$p" = "-isystem" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then
+        elif test "$p" = "-isystem" && badPath "$p2"; then
             n=$((n + 1)); skip $p2
         else
             rest=("${rest[@]}" "$p")
diff --git a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
index c94f24833c7..bf59b2a8afb 100644
--- a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
+++ b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
@@ -12,7 +12,7 @@ skip () {
 }
 
 params=("$@")
-if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
+if test "$NIX_ENFORCE_PURITY" = "1x" -a -n "$NIX_STORE"; then
     rest=()
     n=0
     while test $n -lt ${#params[*]}; do
@@ -22,10 +22,12 @@ if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
             skip $p
         elif test "$p" = "-L" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then
             n=$((n + 1)); skip $p2
-        elif test "${p:0:1}" = "/" -a "${p:0:${#NIX_STORE}}" != "$NIX_STORE"; then
-            # We cannot skip this; barf.
-            echo "impure path \`$p' used in link"
-            exit 1
+        elif test "$p" = "-dynamic-linker" -a "${p2:0:${#NIX_STORE}}" != "$NIX_STORE"; then
+            n=$((n + 1)); skip $p2
+#        elif test "${p:0:1}" = "/" -a "${p:0:${#NIX_STORE}}" != "$NIX_STORE"; then
+#            # We cannot skip this; barf.
+#            echo "impure path \`$p' used in link"
+#            exit 1
         else
             rest=("${rest[@]}" "$p")
         fi
diff --git a/pkgs/build-support/gcc-wrapper/setup-hook.sh b/pkgs/build-support/gcc-wrapper/setup-hook.sh
index 4385ab0602b..a52ca43d9df 100644
--- a/pkgs/build-support/gcc-wrapper/setup-hook.sh
+++ b/pkgs/build-support/gcc-wrapper/setup-hook.sh
@@ -10,9 +10,6 @@ addCVars () {
 
 envHooks=(${envHooks[@]} addCVars)
 
-export NIX_IS_NATIVE=@isNative@
-export NIX_ENFORCE_PURITY=@enforcePurity@
-
 # Note: these come *after* $out in the PATH (see setup.sh).
 
 if test -n "@gcc@"; then
diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh
index ce772d07a78..c1438e6d0e8 100755
--- a/pkgs/development/compilers/gcc/builder.sh
+++ b/pkgs/development/compilers/gcc/builder.sh
@@ -5,7 +5,7 @@ buildinputs="$binutils"
 
 tar xvfj $src
 
-if test "$enforcePurity" = "1"; then
+if test "$noSysDirs" = "1"; then
     # Disable the standard include directories.
     cd gcc-*
     cat >> ./gcc/cppdefault.h <<EOF
@@ -29,7 +29,7 @@ mkdir build
 cd build
 ../gcc-*/configure --prefix=$out --enable-languages="$langs"
 
-if test "$enforcePurity" = "1"; then
+if test "$noSysDirs" = "1"; then
     # Patch some of the makefiles to force linking against our own glibc.
     . $NIX_GCC/nix-support/add-flags # add glibc/gcc flags
     extraflags="-Wl,-s $NIX_CFLAGS_COMPILE $NIX_CFLAGS_LINK"
diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix
index 9e79b21cd7a..dea31911048 100644
--- a/pkgs/development/compilers/gcc/default.nix
+++ b/pkgs/development/compilers/gcc/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, enforcePurity ? true
+{ stdenv, fetchurl, noSysDirs
 , langC ? true, langCC ? true, langF77 ? false
 }:
 
@@ -16,5 +16,5 @@ derivation {
 #    url = ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-3.3.3/gcc-3.3.3.tar.bz2;
 #    md5 = "3c6cfd9fcd180481063b4058cf6faff2";
 #  };
-  inherit stdenv enforcePurity langC langCC langF77;
+  inherit stdenv noSysDirs langC langCC langF77;
 }
diff --git a/pkgs/development/interpreters/perl/builder.sh b/pkgs/development/interpreters/perl/builder.sh
index 14c1d3146b8..e36e0738f50 100755
--- a/pkgs/development/interpreters/perl/builder.sh
+++ b/pkgs/development/interpreters/perl/builder.sh
@@ -23,6 +23,11 @@ fi
 
 patch -p1 < $srcPatch
 
-./Configure -de -Dcc=gcc -Dprefix=$out -Uinstallusrbinperl
+if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
+    GLIBC=$(cat $NIX_GCC/nix-support/orig-glibc)
+    extraflags="-Dlocincpth=$GLIBC/include -Dloclibpth=$GLIBC/lib"
+fi
+
+./Configure -de -Dcc=gcc -Dprefix=$out -Uinstallusrbinperl $extraflags
 make
 make install
diff --git a/pkgs/development/libraries/glibc/builder.sh b/pkgs/development/libraries/glibc/builder.sh
index b671d269cbf..e2423ad37c2 100755
--- a/pkgs/development/libraries/glibc/builder.sh
+++ b/pkgs/development/libraries/glibc/builder.sh
@@ -2,6 +2,7 @@
 
 # glibc cannot have itself in its rpath.
 export NIX_NO_SELF_RPATH=1
+buildinputs="$patch"
 . $stdenv/setup
 
 tar xvfj $glibcSrc
diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix
index 6af83b3f72e..6106e92812f 100644
--- a/pkgs/development/libraries/glibc/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl, kernelHeaders}:
+{stdenv, fetchurl, kernelHeaders, patch}:
+
+assert patch != null;
 
 derivation {
   name = "glibc-2.3.2";
@@ -18,5 +20,5 @@ derivation {
   # later releases of glibc won't need this.
   vaargsPatch = ./glibc-2.3.2-sscanf-1.patch;
 
-  inherit stdenv kernelHeaders;
+  inherit stdenv kernelHeaders patch;
 }
diff --git a/pkgs/development/libraries/libxml2/builder.sh b/pkgs/development/libraries/libxml2/builder.sh
index 7d597905327..d787dee7071 100755
--- a/pkgs/development/libraries/libxml2/builder.sh
+++ b/pkgs/development/libraries/libxml2/builder.sh
@@ -3,7 +3,7 @@
 buildinputs="$zlib"
 . $stdenv/setup
 
-tar xvfz $src
+tar xvfj $src
 cd libxml2-*
 ./configure --prefix=$out
 make
diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix
index 3e2fb8b13e5..4eb33f53d01 100644
--- a/pkgs/development/libraries/libxml2/default.nix
+++ b/pkgs/development/libraries/libxml2/default.nix
@@ -3,12 +3,12 @@
 assert !isNull zlib;
 
 derivation {
-  name = "libxml2-2.6.2";
+  name = "libxml2-2.6.7";
   system = stdenv.system;
   builder = ./builder.sh;
   src = fetchurl {
-    url = http://rpmfind.net/pub/libxml/libxml2-2.6.2.tar.gz;
-    md5 = "56e7f74d3d44cc16790ad08624faef64";
+    url = ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.7.tar.bz2;
+    md5 = "bdbef92cbdc5b4bd0365313ba22b75ce";
   };
   stdenv = stdenv;
   zlib = zlib;
diff --git a/pkgs/development/libraries/libxml2/libxml2-2.6.5.nix b/pkgs/development/libraries/libxml2/libxml2-2.6.5.nix
deleted file mode 100644
index a3a4e0df36d..00000000000
--- a/pkgs/development/libraries/libxml2/libxml2-2.6.5.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{stdenv, fetchurl, zlib}:
-
-assert !isNull zlib;
-
-derivation {
-  name = "libxml2-2.6.5";
-  system = stdenv.system;
-  builder = ./builder.sh;
-  src = fetchurl {
-    url = http://rpmfind.net/pub/libxml/libxml2-2.6.5.tar.gz;
-    md5 = "0ac5dd9902c9bf20f7bc50de1034d49f";
-  };
-  stdenv = stdenv;
-  zlib = zlib;
-}
diff --git a/pkgs/development/libraries/rna/builder.sh b/pkgs/development/libraries/rna/builder.sh
index a7ba75723fd..60ac15542e5 100755
--- a/pkgs/development/libraries/rna/builder.sh
+++ b/pkgs/development/libraries/rna/builder.sh
@@ -3,6 +3,9 @@
 buildinputs="$zlib"
 . $stdenv/setup
 
+export NIX_STRIP_DEBUG=
+export NIX_CFLAGS_COMPILE="-g $NIX_CFLAGS_COMPILE"
+
 tar xvfz $src
 cd rna-*
 ./configure --prefix=$out
diff --git a/pkgs/development/libraries/xft/builder.sh b/pkgs/development/libraries/xft/builder.sh
index 2a2850ee7a5..085974877de 100755
--- a/pkgs/development/libraries/xft/builder.sh
+++ b/pkgs/development/libraries/xft/builder.sh
@@ -1,5 +1,7 @@
 #! /bin/sh -e
 
+set -x
+
 buildinputs="$pkgconfig $fontconfig $x11"
 . $stdenv/setup
 
diff --git a/pkgs/development/tools/misc/binutils/builder.sh b/pkgs/development/tools/misc/binutils/builder.sh
index f76eb534c55..6de59a675d7 100755
--- a/pkgs/development/tools/misc/binutils/builder.sh
+++ b/pkgs/development/tools/misc/binutils/builder.sh
@@ -6,7 +6,7 @@ tar xvfj $src
 cd binutils-*
 
 # Clear the default library search path.
-if test "$enforcePurity" = "1"; then
+if test "$noSysDirs" = "1"; then
     echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
 fi
 
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index 3f027d90fcc..63039877d6f 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, enforcePurity ? true}:
+{stdenv, fetchurl, noSysDirs}:
 
 derivation {
   name = "binutils-2.14";
@@ -8,5 +8,5 @@ derivation {
     url = ftp://ftp.nluug.nl/pub/gnu/binutils/binutils-2.14.tar.bz2;
     md5 = "2da8def15d28af3ec6af0982709ae90a";
   };
-  inherit stdenv enforcePurity;
+  inherit stdenv noSysDirs;
 }
diff --git a/pkgs/development/tools/misc/octavefront/builder.sh b/pkgs/development/tools/misc/octavefront/builder.sh
index ccdd540cf45..c24c9d1b123 100755
--- a/pkgs/development/tools/misc/octavefront/builder.sh
+++ b/pkgs/development/tools/misc/octavefront/builder.sh
@@ -1,15 +1,20 @@
 #! /bin/sh -e
 
+set -x
+
 buildinputs="$autoconf $g77 $texinfo $bison $flex $gperf $rna $aterm"
 . $stdenv/setup
 
-g77orig=$(cat $g77/orig-gcc)
+g77orig=$(cat $g77/nix-support/orig-gcc)
 export NIX_LDFLAGS="-rpath $g77orig/lib $NIX_LDFLAGS"
 
+export NIX_STRIP_DEBUG=
+export NIX_CFLAGS_COMPILE="-g $NIX_CFLAGS_COMPILE"
+
 tar xvfz $src
 cd octavefront-*
 ./autogen.sh
 ./configure --prefix=$out --disable-readline --enable-rna=$rna --enable-aterm
 make
 make install
-strip -S $out/lib/*/*.a
+#strip -S $out/lib/*/*.a
diff --git a/pkgs/stdenv/generic/builder.sh b/pkgs/stdenv/generic/builder.sh
index ac985160773..20145df08ab 100755
--- a/pkgs/stdenv/generic/builder.sh
+++ b/pkgs/stdenv/generic/builder.sh
@@ -1,5 +1,11 @@
 #! /bin/sh
 
+p1=$param1
+p2=$param2
+p3=$param3
+p4=$param4
+p5=$param5
+
 . $stdenv/setup
 
 mkdir $out || exit 1
@@ -9,9 +15,9 @@ sed \
  -e "s^@postHook@^$postHook^g" \
  -e "s^@initialPath@^$initialPath^g" \
  -e "s^@gcc@^$gcc^g" \
- -e "s^@param1@^$param1^g" \
- -e "s^@param2@^$param2^g" \
- -e "s^@param3@^$param3^g" \
- -e "s^@param4@^$param4^g" \
- -e "s^@param5@^$param5^g" \
+ -e "s^@param1@^$p1^g" \
+ -e "s^@param2@^$p2^g" \
+ -e "s^@param3@^$p3^g" \
+ -e "s^@param4@^$p4^g" \
+ -e "s^@param5@^$p5^g" \
  < $setup > $out/setup || exit 1
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 259417afaa3..21611278c21 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -30,6 +30,7 @@ if test -z "$SHELL"; then echo "SHELL not set"; exit 1; fi
 
 
 # Hack: run gcc's setup hook.
+envHooks=()
 if test -f $NIX_GCC/nix-support/setup-hook; then
     . $NIX_GCC/nix-support/setup-hook
 fi
@@ -47,13 +48,12 @@ findInputs()
     
     if test -f $pkg/nix-support/propagated-build-inputs; then
         for i in $(cat $pkg/nix-support/propagated-build-inputs); do
-            addToEnv $pkg
+            findInputs $i
         done
     fi
 }
 
 pkgs=()
-envHooks=()
 for i in $buildinputs; do
     findInputs $i
 done
@@ -69,6 +69,8 @@ addToEnv()
         export _PATH=$_PATH:$1/bin
     fi
 
+    echo "${envHooks[@]}"
+
     for i in "${envHooks[@]}"; do
         $i $pkg
     done
diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix
index 2fd6b670c39..8a57b10d71b 100644
--- a/pkgs/stdenv/native/default.nix
+++ b/pkgs/stdenv/native/default.nix
@@ -9,7 +9,8 @@
 
   gcc = (import ../../build-support/gcc-wrapper) {
     name = "gcc-native";
-    isNative = true;
+    nativeTools = true;
+    nativeGlibc = true;
     nativePrefix = "/usr";
     inherit stdenv;
   };
diff --git a/pkgs/stdenv/native/prehook.sh b/pkgs/stdenv/native/prehook.sh
index af1ba16ccbe..21248e16cdb 100644
--- a/pkgs/stdenv/native/prehook.sh
+++ b/pkgs/stdenv/native/prehook.sh
@@ -1 +1,3 @@
 export SHELL=/bin/sh
+
+export NIX_ENFORCE_PURITY=
diff --git a/pkgs/stdenv/nix-linux/boot.nix b/pkgs/stdenv/nix-linux/boot.nix
index cc5ab2122e8..b104add4318 100644
--- a/pkgs/stdenv/nix-linux/boot.nix
+++ b/pkgs/stdenv/nix-linux/boot.nix
@@ -1,16 +1,19 @@
-{stdenv, glibc}:
+{stdenv, pkgs, glibc}:
 
 (import ../generic) {
   name = "stdenv-nix-linux-boot";
   preHook = ./prehook-boot.sh;
-  initialPath = "/usr/local /usr /";
+  initialPath = (import ../nix/path.nix) {pkgs = pkgs;};
 
   inherit stdenv;
 
   gcc = (import ../../build-support/gcc-wrapper) {
-    name = "gcc-native";
-    isNative = true;
-    nativePrefix = "/usr";
+    name = pkgs.gcc.name;
+    nativeTools = false;
+    nativeGlibc = false;
+    inherit (pkgs) gcc binutils;
     inherit stdenv glibc;
   };
+
+  param1 = pkgs.bash;
 }
diff --git a/pkgs/stdenv/nix-linux/default.nix b/pkgs/stdenv/nix-linux/default.nix
index 51893975748..ecbbc488cb4 100644
--- a/pkgs/stdenv/nix-linux/default.nix
+++ b/pkgs/stdenv/nix-linux/default.nix
@@ -8,10 +8,10 @@
   inherit stdenv;
 
   gcc = (import ../../build-support/gcc-wrapper) {
-    name = "gcc-native";
-    isNative = false;
-    gcc = pkgs.gcc;
-    binutils = pkgs.binutils;
+    name = pkgs.gcc.name;
+    nativeTools = false;
+    nativeGlibc = false;
+    inherit (pkgs) gcc binutils;
     inherit stdenv glibc;
   };
 
diff --git a/pkgs/stdenv/nix-linux/prehook-boot.sh b/pkgs/stdenv/nix-linux/prehook-boot.sh
index af1ba16ccbe..33f8bc0bb6e 100644
--- a/pkgs/stdenv/nix-linux/prehook-boot.sh
+++ b/pkgs/stdenv/nix-linux/prehook-boot.sh
@@ -1 +1,3 @@
-export SHELL=/bin/sh
+export SHELL=$param1
+
+export NIX_ENFORCE_PURITY=
diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix
index 2c5c70eb2bd..5d454e26ce7 100644
--- a/pkgs/stdenv/nix/default.nix
+++ b/pkgs/stdenv/nix/default.nix
@@ -1,13 +1,19 @@
-{bootStdenv, pkgs}: (import ../generic) {
+{stdenv, pkgs}:
+
+(import ../generic) {
   name = "stdenv-nix";
-  system = bootStdenv.system;
-  prehook = ./prehook.sh;
-  posthook = ./posthook.sh;
+  preHook = ./prehook.sh;
   initialPath = (import ./path.nix) {pkgs = pkgs;};
+
+  inherit stdenv;
+
+  gcc = (import ../../build-support/gcc-wrapper) {
+    name = pkgs.gcc.name;
+    nativeTools = false;
+    nativeGlibc = true;
+    inherit (pkgs) gcc binutils;
+    inherit stdenv;
+  };
+
   param1 = pkgs.bash;
-  param2 = pkgs.gcc;
-  param3 = pkgs.binutils;
-  param4 = "";
-  param5 = "";
-  noSysDirs = false;
 }
diff --git a/pkgs/stdenv/nix/prehook.sh b/pkgs/stdenv/nix/prehook.sh
index e6052113f16..af5121f49c3 100644
--- a/pkgs/stdenv/nix/prehook.sh
+++ b/pkgs/stdenv/nix/prehook.sh
@@ -1,7 +1 @@
 export SHELL=$param1
-
-echo "SHELL = $SHELL"
-
-export NIX_CC=$param2/bin/gcc
-export NIX_CXX=$param2/bin/g++
-export NIX_LD=$param3/bin/ld
diff --git a/pkgs/system/all-packages-generic.nix b/pkgs/system/all-packages-generic.nix
index d656845994e..7a263f124ee 100644
--- a/pkgs/system/all-packages-generic.nix
+++ b/pkgs/system/all-packages-generic.nix
@@ -2,7 +2,9 @@
 # identifier and a standard build environment, returns the set of all
 # packages provided by the Nix Package Collection.
 
-{system, stdenv}: rec {
+{stdenv, noSysDirs ? true}:
+
+rec {
 
   inherit stdenv;
 
@@ -112,7 +114,7 @@
   ### DEVELOPMENT
 
   binutils = (import ../development/tools/misc/binutils) {
-    inherit fetchurl stdenv;
+    inherit fetchurl stdenv noSysDirs;
   };
 
   gnum4 = (import ../development/tools/misc/gnum4) {
@@ -198,16 +200,21 @@
   };
 
   gcc = (import ../development/compilers/gcc) {
-    inherit fetchurl stdenv;
+    inherit fetchurl stdenv noSysDirs;
   };
 
   g77 = (import ../build-support/gcc-wrapper) {
-    inherit stdenv;
+    name = "g77";
+    nativeTools = false;
+    nativeGlibc = false;
     gcc = (import ../development/compilers/gcc) {
-      inherit fetchurl stdenv;
+      inherit fetchurl stdenv noSysDirs;
       langF77 = true;
       langCC = false;
     };
+    binutils = stdenv.gcc.binutils;
+    glibc = stdenv.gcc.glibc;
+    inherit stdenv;
   };
 
   jikes = (import ../development/compilers/jikes) {
@@ -275,6 +282,7 @@
 
   glibc = (import ../development/libraries/glibc) {
     inherit fetchurl stdenv kernelHeaders;
+    patch = gnupatch;
   };
 
   aterm = (import ../development/libraries/aterm) {
@@ -351,10 +359,6 @@
     inherit fetchurl stdenv libxml2;
   };
 
-  libxml2_265 = (import ../development/libraries/libxml2/libxml2-2.6.5.nix) {
-    inherit fetchurl stdenv zlib;
-  };
-
   gettext = (import ../development/libraries/gettext) {
     inherit fetchurl stdenv;
   };
diff --git a/pkgs/system/all-packages.nix b/pkgs/system/all-packages.nix
index 666d0e67273..f1a0c917f71 100644
--- a/pkgs/system/all-packages.nix
+++ b/pkgs/system/all-packages.nix
@@ -12,6 +12,6 @@
   # Select the right instantiation.
   body =
     if system == "i686-linux"
-    then stdenvs.stdenvNativePkgs #stdenvs.stdenvLinuxPkgs
+    then stdenvs.stdenvLinuxPkgs
     else stdenvs.stdenvNixPkgs;
 }
diff --git a/pkgs/system/populate-cache.nix b/pkgs/system/populate-cache.nix
index aeaf8deae45..d8eeee34dda 100644
--- a/pkgs/system/populate-cache.nix
+++ b/pkgs/system/populate-cache.nix
@@ -23,7 +23,7 @@ let {
 #      pkgs.binutils
 #      pkgs.gnum4
 #      pkgs.valgrind
-      pkgs.texinfo
+#      pkgs.texinfo
       pkgs.octavefront
 #      pkgs.gnumake
 #      pkgs.bisonnew
@@ -38,8 +38,8 @@ let {
 #      pkgs.libxslt
 #      pkgs.docbook_xml_dtd
 #      pkgs.docbook_xml_xslt
-#      pkgs.subversion
-#      pkgs.pan
+      pkgs.subversion
+      pkgs.pan
 #      pkgs.sylpheed
 #      pkgs.firefox
 #      pkgs.MPlayer
diff --git a/pkgs/system/stdenvs.nix b/pkgs/system/stdenvs.nix
index d770d687499..e3381090f03 100644
--- a/pkgs/system/stdenvs.nix
+++ b/pkgs/system/stdenvs.nix
@@ -22,34 +22,35 @@
   # with it (e.g., because they require GNU Make).
   stdenvNative = (import ../stdenv/native) {stdenv = stdenvInitial;};
 
-  stdenvNativePkgs = allPackages {system = system; stdenv = stdenvNative;};
+  stdenvNativePkgs = allPackages {stdenv = stdenvNative; noSysDirs = false;};
 
 
   # The Nix build environment.
   stdenvNix = (import ../stdenv/nix) {
-    bootStdenv = stdenvNative;
-    pkgs = stdenvNativePkgs;
+    stdenv = stdenvNative;
+    pkgs = allPackages {stdenv = stdenvNative; noSysDirs = false;};
   };
 
-  stdenvNixPkgs = allPackages {system = system; stdenv = stdenvNix;};
+  stdenvNixPkgs = allPackages {stdenv = stdenvNix;};
 
 
   # The Linux build environment is a fully bootstrapped Nix
   # environment, that is, it should contain no external references.
 
-  # 1) Build glibc in the native build environment.  The result is
-  #    pure (I promise!).
-  stdenvLinuxGlibc = stdenvNativePkgs.glibc;
+  # 1) Build glibc in the Nix build environment.  The result is
+  #    pure.
+  stdenvLinuxGlibc = stdenvNativePkgs.glibc; # !!! should be NixPkgs, but doesn't work
 
   # 2) Construct a stdenv consisting of the native build environment,
   #    plus the pure glibc.
   stdenvLinuxBoot1 = (import ../stdenv/nix-linux/boot.nix) {
-    stdenv = stdenvInitial;
+    stdenv = stdenvNative;
+    pkgs = allPackages {stdenv = stdenvNative; noSysDirs = false;};
     glibc = stdenvLinuxGlibc;
   };
 
   # 3) Now we can build packages that will have the Nix glibc.
-  stdenvLinuxBoot1Pkgs = allPackages {system = system; stdenv = stdenvLinuxBoot1;};
+  stdenvLinuxBoot1Pkgs = allPackages {stdenv = stdenvLinuxBoot1;};
 
   # 4) However, since these packages are built by an native C compiler
   #    and linker, they may well pick up impure references (e.g., bash
@@ -62,11 +63,11 @@
   };
 
   # 5) These packages should be pure.
-  stdenvLinuxBoot2Pkgs = allPackages {system = system; stdenv = stdenvLinuxBoot2;};
+  stdenvLinuxBoot2Pkgs = allPackages {stdenv = stdenvLinuxBoot2;};
 
   # 6) So finally we can construct the Nix build environment.
   stdenvLinux = (import ../stdenv/nix-linux) {
-    bootStdenv = stdenvLinuxBoot2;
+    stdenv = stdenvLinuxBoot2;
     pkgs = stdenvLinuxBoot2Pkgs;
     glibc = stdenvLinuxGlibc;
   };
@@ -74,7 +75,7 @@
   # 7) And we can build all packages against that, but we don't
   #    rebuild stuff from step 6.
   stdenvLinuxPkgs =
-    allPackages {system = system; stdenv = stdenvLinux;} //
+    allPackages {stdenv = stdenvLinux;} //
     {inherit (stdenvLinuxBoot2Pkgs)
       gzip bzip2 bash binutils coreutils diffutils findutils gawk gcc
       gnumake gnused gnutar gnugrep wget;
diff --git a/pkgs/test/simple/builder.sh b/pkgs/test/simple/builder.sh
index 58bf16c43b3..cfc895ac139 100755
--- a/pkgs/test/simple/builder.sh
+++ b/pkgs/test/simple/builder.sh
@@ -1,10 +1,15 @@
 #! /bin/sh
 
+set -x
+
 export NIX_DEBUG=1
 
 . $stdenv/setup
 
-export NIX_ENFORCE_PURITY=1
+#echo starting shell
+#/bin/sh < /dev/tty > /dev/tty 2>&1 
+
+#exit 1
 
 mkdir $out
 mkdir $out/bin
@@ -24,8 +29,6 @@ gcc -L /nix/store/abcd/lib -isystem /usr/lib hello.c -o $out/bin/hello
 
 $out/bin/hello
 
-exit 0
-
 cat > hello2.cc <<EOF
 #include <iostream>
 
diff --git a/pkgs/test/simple/default.nix b/pkgs/test/simple/default.nix
index 9374a6ede28..39b0416fc9a 100644
--- a/pkgs/test/simple/default.nix
+++ b/pkgs/test/simple/default.nix
@@ -6,7 +6,7 @@ let {
     allPackages = import ../../system/all-packages-generic.nix;
   };
 
-  stdenv = stdenvs.stdenvLinuxBoot1;
+  stdenv = stdenvs.stdenvLinuxBoot2;
 
   test = derivation {
     name = "simple-test";
diff --git a/pkgs/tools/text/gnugrep/builder.sh b/pkgs/tools/text/gnugrep/builder.sh
index 3453b5b0cb8..cb2c91a6b07 100755
--- a/pkgs/tools/text/gnugrep/builder.sh
+++ b/pkgs/tools/text/gnugrep/builder.sh
@@ -1,10 +1,14 @@
-#! /bin/sh
+#! /bin/sh -e
 
+set -x
+export NIX_DEBUG=1
 buildinputs="$pcre"
-. $stdenv/setup || exit 1
+. $stdenv/setup
 
-tar xvfj $src || exit 1
-cd grep-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+echo $NIX_LDFLAGS
+
+tar xvfj $src
+cd grep-*
+./configure --prefix=$out
+make
+make install