summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2005-02-21 16:03:34 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2005-02-21 16:03:34 +0000
commite6744d0f893e0641b22996382cc6dcb81f8acc3d (patch)
treeba656c68d6348d24c4814a6da79bb204e06ff2d7 /pkgs
parentcdaecff49f9b06d74de87e217659c13b2b2bba98 (diff)
parent8125cd8915a1601280327503ce3ac14e0a356771 (diff)
downloadnixpkgs-e6744d0f893e0641b22996382cc6dcb81f8acc3d.tar
nixpkgs-e6744d0f893e0641b22996382cc6dcb81f8acc3d.tar.gz
nixpkgs-e6744d0f893e0641b22996382cc6dcb81f8acc3d.tar.bz2
nixpkgs-e6744d0f893e0641b22996382cc6dcb81f8acc3d.tar.lz
nixpkgs-e6744d0f893e0641b22996382cc6dcb81f8acc3d.tar.xz
nixpkgs-e6744d0f893e0641b22996382cc6dcb81f8acc3d.tar.zst
nixpkgs-e6744d0f893e0641b22996382cc6dcb81f8acc3d.zip
* Merge diff between trunk/pkgs@1646 and branches/nixos-pkgs@2256;
  this contains mostly Armijn's pure stdenv-linux.

* After unpacking the statically linked GCC, patch all store paths to
  /nix/store/ffffffffffffffffffffffffffffffff.  Ugly hack to prevent
  undeclared references but it works.

* We don't need Glib's dynamic libraries in the first bootstrap stage;
  delete them.  Actually the downloaded Glibc binary is only needed
  for building Glibc, since GCC needs a C compiler to build some
  programs in `configure'.  So static linking is fine for that.  Maybe
  it would be better to patch `configure' so that we don't need a
  pre-built Glibc at all.

* Set the svn:executable property on `cp' and `patchelf'.

* In Glibc, revert to LinuxThreads.  Maybe NPTL will work, but TLS
  support is a problem.

* Delete most Glibc patches; they're no longer needed since the branch
  updated it to 20050110.
  
* Some cleanups.

svn path=/nixpkgs/trunk/; revision=2258
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/gcc-wrapper/builder.sh9
-rw-r--r--pkgs/build-support/gcc-wrapper/gcc-wrapper.sh22
-rw-r--r--pkgs/build-support/gcc-wrapper/ld-wrapper.sh6
-rw-r--r--pkgs/development/libraries/glibc/builder.sh52
-rw-r--r--pkgs/development/libraries/glibc/default.nix37
-rw-r--r--pkgs/development/libraries/glibc/fixup.patch74
-rw-r--r--pkgs/development/libraries/glibc/glibc-2.3.2-sscanf-1.patch68
-rw-r--r--pkgs/development/libraries/glibc/glibc-pwd.patch74
-rw-r--r--pkgs/development/libraries/glibc/loadlocale.patch67
-rw-r--r--pkgs/development/libraries/glibc/no-unit-at-a-time.patch69
-rw-r--r--pkgs/development/libraries/glibc/utf8-locales.patch458
-rw-r--r--pkgs/os-specific/linux/kernel-headers/builder.sh2
-rw-r--r--pkgs/os-specific/linux/kernel-headers/default.nix6
-rw-r--r--pkgs/os-specific/linux/modutils/default.nix10
-rw-r--r--pkgs/os-specific/linux/net-tools/builder.sh1
-rw-r--r--pkgs/os-specific/linux/net-tools/default.nix1
-rw-r--r--pkgs/os-specific/linux/net-tools/net-tools-labels.patch38
-rw-r--r--pkgs/stdenv/nix-linux-static/curl-static/builder.sh2
-rw-r--r--pkgs/stdenv/nix-linux-static/curl-static/curl-7.12.0-static.tar.gzbin338173 -> 0 bytes
-rw-r--r--pkgs/stdenv/nix-linux-static/curl-static/curl-7.12.2-static.tar.gzbin0 -> 154508 bytes
-rw-r--r--pkgs/stdenv/nix-linux-static/curl-static/default.nix4
-rw-r--r--pkgs/stdenv/nix-linux-static/default.nix159
-rw-r--r--pkgs/stdenv/nix-linux-static/gcc-static/gcc-3.3.4-static.tar.gzbin2710650 -> 0 bytes
-rwxr-xr-xpkgs/stdenv/nix-linux-static/patchelf-static/bin/patchelfbin0 -> 437848 bytes
-rw-r--r--pkgs/stdenv/nix-linux-static/prehook.sh7
-rw-r--r--pkgs/stdenv/nix-linux-static/scripts/add-symlink.sh13
-rw-r--r--pkgs/stdenv/nix-linux-static/scripts/builder-stdenv-initial.sh10
-rw-r--r--pkgs/stdenv/nix-linux-static/scripts/curl-unpack8
-rw-r--r--pkgs/stdenv/nix-linux-static/scripts/download-script18
-rwxr-xr-xpkgs/stdenv/nix-linux-static/tools/cpbin0 -> 546108 bytes
-rw-r--r--pkgs/system/all-packages-generic.nix4
-rw-r--r--pkgs/system/stdenvs.nix75
-rw-r--r--pkgs/tools/networking/curl/configure-cxxcpp.patch21
-rw-r--r--pkgs/tools/networking/curl/default.nix1
-rw-r--r--pkgs/tools/networking/openssh/builder.sh10
35 files changed, 469 insertions, 857 deletions
diff --git a/pkgs/build-support/gcc-wrapper/builder.sh b/pkgs/build-support/gcc-wrapper/builder.sh
index c0c0c53a7a6..2e2c14f90bf 100644
--- a/pkgs/build-support/gcc-wrapper/builder.sh
+++ b/pkgs/build-support/gcc-wrapper/builder.sh
@@ -9,8 +9,12 @@ if test -z "$nativeGlibc"; then
     # 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
     # from being used by gcc in the first place.
+    # The dynamic linker is passed in `ldflagsBefore' to allow
+    # explicit overrides of the dynamic linker by callers to gcc/ld
+    # (the *last* value counts, so ours should come first).
     cflagsCompile="$cflagsCompile -B$glibc/lib -isystem $glibc/include"
-    ldflags="$ldflags -L$glibc/lib -dynamic-linker $glibc/lib/ld-linux.so.2"
+    ldflags="$ldflags -L$glibc/lib"
+    ldflagsBefore="-dynamic-linker $glibc/lib/ld-linux.so.2"
 fi
 
 if test -n "$nativeTools"; then
@@ -57,6 +61,7 @@ ln -s g77 $out/bin/f77
 sed \
     -e "s^@out@^$out^g" \
     -e "s^@ldflags@^$ldflags^g" \
+    -e "s^@ldflagsBefore@^$ldflagsBefore^g" \
     -e "s^@ld@^$ldPath/ld^g" \
     -e "s^@shell@^$shell^g" \
     < $ldWrapper > $out/bin/ld
@@ -71,7 +76,9 @@ cat > $out/nix-support/add-flags <<EOF
 export NIX_CFLAGS_COMPILE="$cflagsCompile \$NIX_CFLAGS_COMPILE"
 export NIX_CFLAGS_LINK="$cflagsLink \$NIX_CFLAGS_LINK"
 export NIX_LDFLAGS="$ldflags \$NIX_LDFLAGS"
+export NIX_LDFLAGS_BEFORE="$ldflagsBefore \$NIX_LDFLAGS_BEFORE"
 export NIX_GLIBC_FLAGS_SET=1
+#export GCC_EXEC_PREFIX=$gcc/libexec/gcc/i686-pc-linux-gnu/3.4.3
 EOF
 
 sed \
diff --git a/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh b/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh
index 149d6e2fcbc..fa2abe07650 100644
--- a/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh
+++ b/pkgs/build-support/gcc-wrapper/gcc-wrapper.sh
@@ -63,24 +63,28 @@ fi
 
 
 # Add the flags for the C compiler proper.
-extra=($NIX_CFLAGS_COMPILE)
+extraAfter=($NIX_CFLAGS_COMPILE)
+extraBefore=()
 
 if test "$dontLink" != "1"; then
 
     # Add the flags that should only be passed to the compiler when
     # linking.
-    extra=(${extra[@]} $NIX_CFLAGS_LINK)
+    extraAfter=(${extraAfter[@]} $NIX_CFLAGS_LINK)
 
     # Add the flags that should be passed to the linker (and prevent
     # `ld-wrapper' from adding NIX_LDFLAGS again).
+    for i in $NIX_LDFLAGS_BEFORE; do
+        extraBefore=(${extraBefore[@]} "-Wl,$i")
+    done
     for i in $NIX_LDFLAGS; do
-        extra=(${extra[@]} "-Wl,$i")
+        extraAfter=(${extraAfter[@]} "-Wl,$i")
     done
     export NIX_LDFLAGS_SET=1
 
     if test "$NIX_STRIP_DEBUG" = "1"; then
         # Add executable-stripping flags.
-        extra=(${extra[@]} $NIX_CFLAGS_STRIP)
+        extraAfter=(${extraAfter[@]} $NIX_CFLAGS_STRIP)
     fi
 fi
 
@@ -90,8 +94,12 @@ if test "$NIX_DEBUG" = "1"; then
   for i in "${params[@]}"; do
       echo "  $i" >&2
   done
-  echo "extra flags to @gcc@:" >&2
-  for i in ${extra[@]}; do
+  echo "extraBefore flags to @gcc@:" >&2
+  for i in ${extraBefore[@]}; do
+      echo "  $i" >&2
+  done
+  echo "extraAfter flags to @gcc@:" >&2
+  for i in ${extraAfter[@]}; do
       echo "  $i" >&2
   done
 fi
@@ -100,4 +108,4 @@ if test -n "$NIX_GCC_WRAPPER_EXEC_HOOK"; then
     . "$NIX_GCC_WRAPPER_EXEC_HOOK"
 fi
 
-exec @gcc@ "${params[@]}" ${extra[@]}
+exec @gcc@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
diff --git a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
index d90b290e007..a9ec7ce6951 100644
--- a/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
+++ b/pkgs/build-support/gcc-wrapper/ld-wrapper.sh
@@ -42,9 +42,11 @@ fi
 
 
 extra=()
+extraBefore=()
 
 if test -z "$NIX_LDFLAGS_SET"; then
     extra=(${extra[@]} $NIX_LDFLAGS)
+    extraBefore=(${extraBefore[@]} $NIX_LDFLAGS_BEFORE)
 fi
 
 
@@ -121,7 +123,6 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
     for i in $rpath; do
         extra=(${extra[@]} -rpath $i)
     done
-
 fi
 
 
@@ -141,4 +142,5 @@ if test -n "$NIX_LD_WRAPPER_EXEC_HOOK"; then
     . "$NIX_LD_WRAPPER_EXEC_HOOK"
 fi
 
-exec @ld@ "${params[@]}" ${extra[@]}
+echo "ld command: " @ld@ ${extraBefore[@]} "${params[@]}" ${extra[@]}
+exec @ld@ ${extraBefore[@]} "${params[@]}" ${extra[@]}
diff --git a/pkgs/development/libraries/glibc/builder.sh b/pkgs/development/libraries/glibc/builder.sh
index f06d25320b6..f9d9845a826 100644
--- a/pkgs/development/libraries/glibc/builder.sh
+++ b/pkgs/development/libraries/glibc/builder.sh
@@ -1,47 +1,61 @@
 # glibc cannot have itself in its rpath.
 export NIX_NO_SELF_RPATH=1
+export NIX_DONT_SET_RPATH=1
 
 . $stdenv/setup
+. $substitute
 
+glibc=`cat $NIX_GCC/nix-support/orig-glibc`
+echo $glibc
 
-postUnpack() {
-    cd $sourceRoot
-    unpackFile $linuxthreadsSrc
-    rm -rf nptl
-    cd ..
-}
+export LD_LIBRARY_PATH=$glibc/lib
 
-postUnpack=postUnpack
+# Explicitly tell glibc to use our pwd, not /bin/pwd.
+export PWD_P=$(type -tP pwd)
 
 
+preConfigure=preConfigure
 preConfigure() {
+
+    # Use Linuxthreads instead of NPTL.
+    rm -rf nptl
+
+    for i in configure io/ftwtest-sh; do
+        substituteInPlace "$i" \
+            --replace "@PWD@" "pwd"
+    done
+
     mkdir ../build
     cd ../build
+    
     configureScript=../$sourceRoot/configure
-    # `--with-tls --without-__thread' is required when for
-    # linuxthreads.  See
-    # http://sources.redhat.com/bugzilla/show_bug.cgi?id=317.  Be sure
-    # to read Drepper's comment for another classic example of glibc's
-    # release management strategy.
-    configureFlags="--enable-add-ons --disable-profile \
-      --with-headers=$kernelHeaders/include \
+    # `--with-tls --without-__thread' enables support for TLS but
+    # causes it not to be used.  Required if we don't want to barf on
+    # 2.4 kernels.  Or something.
+    configureFlags="--enable-add-ons \
+      --with-headers=$kernelHeaders/include
       --with-tls --without-__thread"
 }
 
-preConfigure=preConfigure
+
+postConfigure=postConfigure
+postConfigure() {
+    # Hack: get rid of the `-static' flag set by the bootstrap stdenv.
+    # This has to be done *after* `configure' because it builds some
+    # test binaries.
+    export NIX_CFLAGS_LINK=
+    export NIX_LDFLAGS_BEFORE=
+}
 
 
+postInstall=postInstall
 postInstall() {
     if test -n "$installLocales"; then
         make localedata/install-locales
     fi
     rm $out/etc/ld.so.cache
     (cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1
-    # `glibcbug' causes a retained dependency on the C compiler.
-    rm $out/bin/glibcbug
 }
 
-postInstall=postInstall
-
 
 genericBuild
diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix
index 66690277d4e..2231ec97bed 100644
--- a/pkgs/development/libraries/glibc/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -3,43 +3,14 @@
 stdenv.mkDerivation {
   name = "glibc-2.3.3";
   builder = ./builder.sh;
+  substitute = ../../../build-support/substitute/substitute.sh;
 
   src = fetchurl {
-    url = http://catamaran.labs.cs.uu.nl/dist/tarballs/glibc-2.3.3.tar.bz2;
-    md5 = "e825807b98042f807799ccc9dd96d31b";
+    url = ftp://sources.redhat.com/pub/glibc/snapshots/glibc-20050110.tar.bz2;
+    md5 = "1171587e4802f43fdda315910adc1854";
   };
-  linuxthreadsSrc = fetchurl {
-    url = http://catamaran.labs.cs.uu.nl/dist/tarballs/glibc-linuxthreads-2.3.3.tar.bz2;
-    md5 = "8149ea62922e75bd692bc3b92e5e766b";
-  };
-
-  patches = [
-    # This patch fixes the bug
-    # http://sources.redhat.com/bugzilla/show_bug.cgi?id=312.  Note
-    # that this bug was marked as `WORKSFORME' with the comment to
-    # just use glibc from CVS.  This and the unholy Linuxthreads/NPTL
-    # mess proves that glibc, together with the Linux kernel,
-    # constitutes an AXIS OF EVIL wrt release management.  Patch
-    # obtained from
-    # http://www.pengutronix.de/software/ptxdist/patches-cvs/glibc-2.3.2/generic/fixup.patch.
-    ./fixup.patch
-
-    # Likewise, this fixes the bug reported in
-    # http://sources.redhat.com/ml/libc-alpha/2003-07/msg00117.html.
-    # Die, glibc, die.
-    ./no-unit-at-a-time.patch
-
-    # This is a patch to make glibc compile under GCC 3.3.  Presumably
-    # later releases of glibc won't need this.
-#    ./glibc-2.3.2-sscanf-1.patch
-
-    # Fix for localedata loading bug.
-    ./loadlocale.patch
 
-    # Add a whole bunch of UTF-8 locales.  Most of these seem to be in
-    # the CVS mainline now.
-    ./utf8-locales.patch
-  ];
+  patches = [ ./glibc-pwd.patch ];
 
   inherit kernelHeaders installLocales;
 }
diff --git a/pkgs/development/libraries/glibc/fixup.patch b/pkgs/development/libraries/glibc/fixup.patch
deleted file mode 100644
index 5f1e8a4e63e..00000000000
--- a/pkgs/development/libraries/glibc/fixup.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-Fixes
-dl-runtime.c:56: error: conflicting types for 'fixup'
-../sysdeps/i386/dl-machine.h:158: error: previous declaration of 'fixup' was here
-when building with gcc-3.4.0
-
-First hunk:
-Define ARCH_FIXUP_ATTRIBUTE and use it in the fixup function declarations.
-http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/i386/dl-machine.h.diff?r1=1.124&r2=1.125&cvsroot=glibc
-
-Second hunk:
-If ARCH_FIXUP_ATTRIBUTE is not defined, provide dummy definition.
-Use macro in fixup function definitions.
-http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/elf/dl-runtime.c.diff?r1=1.64&r2=1.65&cvsroot=glibc
-[rediffed against glibc-2.3.2]
-
-===================================================================
-RCS file: /cvs/glibc/libc/sysdeps/i386/dl-machine.h,v
-retrieving revision 1.124
-retrieving revision 1.125
-diff -u -r1.124 -r1.125
---- libc/sysdeps/i386/dl-machine.h	2004/03/05 10:14:49	1.124
-+++ libc/sysdeps/i386/dl-machine.h	2004/03/09 07:42:29	1.125
-@@ -154,11 +154,14 @@
-    destroys the passed register information.  */
- /* GKM FIXME: Fix trampoline to pass bounds so we can do
-    without the `__unbounded' qualifier.  */
--static ElfW(Addr) fixup (struct link_map *__unbounded l, ElfW(Word) reloc_offset)
--     __attribute__ ((regparm (2), unused));
-+#define ARCH_FIXUP_ATTRIBUTE __attribute__ ((regparm (3), unused))
-+
-+static ElfW(Addr) fixup (struct link_map *__unbounded l,
-+			 ElfW(Word) reloc_offset)
-+     ARCH_FIXUP_ATTRIBUTE;
- static ElfW(Addr) profile_fixup (struct link_map *l, ElfW(Word) reloc_offset,
- 				 ElfW(Addr) retaddr)
--     __attribute__ ((regparm (3), unused));
-+     ARCH_FIXUP_ATTRIBUTE;
- # endif
- 
- /* This code is used in dl-runtime.c to call the `fixup' function
-===================================================================
---- /home/dank/downloads/glibc-2.3.2/elf/dl-runtime.c	Fri Feb  7 11:41:12 2003
-+++ glibc-2.3.2/elf/dl-runtime.c	Thu Apr  8 22:24:26 2004
-@@ -36,6 +36,12 @@
- # define VERSYMIDX(sym)	(DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
- #endif
- 
-+/* The fixup functions might have need special attributes.  If none
-+   are provided define the macro as empty.  */
-+#ifndef ARCH_FIXUP_ATTRIBUTE
-+# define ARCH_FIXUP_ATTRIBUTE
-+#endif
-+
- 
- /* This function is called through a special trampoline from the PLT the
-    first time each PLT entry is called.  We must perform the relocation
-@@ -45,7 +51,7 @@
-    function.  */
- 
- #ifndef ELF_MACHINE_NO_PLT
--static ElfW(Addr) __attribute_used__
-+static ElfW(Addr) __attribute_used__ ARCH_FIXUP_ATTRIBUTE
- fixup (
- # ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
-         ELF_MACHINE_RUNTIME_FIXUP_ARGS,
-@@ -132,7 +138,7 @@
- 
- #if !defined PROF && !defined ELF_MACHINE_NO_PLT && !__BOUNDED_POINTERS__
- 
--static ElfW(Addr) __attribute_used__
-+static ElfW(Addr) __attribute_used__ ARCH_FIXUP_ATTRIBUTE
- profile_fixup (
- #ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
-        ELF_MACHINE_RUNTIME_FIXUP_ARGS,
diff --git a/pkgs/development/libraries/glibc/glibc-2.3.2-sscanf-1.patch b/pkgs/development/libraries/glibc/glibc-2.3.2-sscanf-1.patch
deleted file mode 100644
index 78940884cbe..00000000000
--- a/pkgs/development/libraries/glibc/glibc-2.3.2-sscanf-1.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-Submitted By: David Shust (www.shustring.com)
-Date: 2003-08-15
-Initial Package Version: 2.3.2
-Origin: glibc CVS changes performed by Roland McGrath
-Description: patches stdio-common/sscanf.c, libio/{swprintf.c, swscanf.c}
-
-diff -Naur glibc-2.3.2/libio/swprintf.c glibc-2.3.2-new/libio/swprintf.c
---- glibc-2.3.2/libio/swprintf.c	2001-07-07 19:21:03.000000000 +0000
-+++ glibc-2.3.2-new/libio/swprintf.c	2003-08-15 19:36:42.000000000 +0000
-@@ -1,4 +1,5 @@
--/* Copyright (C) 1991,1995,1997,1998,1999,2000 Free Software Foundation, Inc.
-+/* Copyright (C) 1991,1995,1997,1998,1999,2000,2003
-+	Free Software Foundation, Inc.
-    This file is part of the GNU C Library.
- 
-    The GNU C Library is free software; you can redistribute it and/or
-@@ -22,10 +23,7 @@
- /* Write formatted output into S, according to the format string FORMAT.  */
- /* VARARGS3 */
- int
--swprintf (s, n, format)
--     wchar_t *s;
--     size_t n;
--     const wchar_t *format;
-+swprintf (wchar_t *s, size_t n, const wchar_t *format, ...)
- {
-   va_list arg;
-   int done;
-diff -Naur glibc-2.3.2/libio/swscanf.c glibc-2.3.2-new/libio/swscanf.c
---- glibc-2.3.2/libio/swscanf.c	2001-07-07 19:21:03.000000000 +0000
-+++ glibc-2.3.2-new/libio/swscanf.c	2003-08-15 19:36:42.000000000 +0000
-@@ -1,4 +1,4 @@
--/* Copyright (C) 1991, 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
-+/* Copyright (C) 1991,1995,1996,1998,1999,2003 Free Software Foundation, Inc.
-    This file is part of the GNU C Library.
- 
-    The GNU C Library is free software; you can redistribute it and/or
-@@ -22,9 +22,7 @@
- /* Read formatted input from S, according to the format string FORMAT.  */
- /* VARARGS2 */
- int
--swscanf (s, format)
--     const wchar_t *s;
--     const wchar_t *format;
-+swscanf (const wchar_t *s, const wchar_t *format, ...)
- {
-   va_list arg;
-   int done;
-diff -Naur glibc-2.3.2/stdio-common/sscanf.c glibc-2.3.2-new/stdio-common/sscanf.c
---- glibc-2.3.2/stdio-common/sscanf.c	2002-08-10 18:09:08.000000000 +0000
-+++ glibc-2.3.2-new/stdio-common/sscanf.c	2003-08-15 19:36:24.000000000 +0000
-@@ -1,4 +1,4 @@
--/* Copyright (C) 1991,95,96,98,2002 Free Software Foundation, Inc.
-+/* Copyright (C) 1991,1995,1996,1998,2002,2003 Free Software Foundation, Inc.
-    This file is part of the GNU C Library.
- 
-    The GNU C Library is free software; you can redistribute it and/or
-@@ -27,9 +27,7 @@
- /* Read formatted input from S, according to the format string FORMAT.  */
- /* VARARGS2 */
- int
--sscanf (s, format)
--     const char *s;
--     const char *format;
-+sscanf (const char *s, const char *format, ...)
- {
-   va_list arg;
-   int done;
diff --git a/pkgs/development/libraries/glibc/glibc-pwd.patch b/pkgs/development/libraries/glibc/glibc-pwd.patch
new file mode 100644
index 00000000000..07039718477
--- /dev/null
+++ b/pkgs/development/libraries/glibc/glibc-pwd.patch
@@ -0,0 +1,74 @@
+diff -ruN glibc-20050110/configure glibc-20050110.patched/configure
+--- glibc-20050110/configure	2005-01-05 10:39:53.000000000 +0100
++++ glibc-20050110.patched/configure	2005-01-18 13:33:01.000000000 +0100
+@@ -1393,7 +1393,7 @@
+ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+ 
+ 
+-if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
++if test "`cd $srcdir; @PWD@`" = "`@PWD@`"; then
+   { { echo "$as_me:$LINENO: error: you must configure in a separate build directory" >&5
+ echo "$as_me: error: you must configure in a separate build directory" >&2;}
+    { (exit 1); exit 1; }; }
+diff -ruN glibc-20050110/io/ftwtest-sh glibc-20050110.patched/io/ftwtest-sh
+--- glibc-20050110/io/ftwtest-sh	2004-02-09 21:12:23.000000000 +0100
++++ glibc-20050110.patched/io/ftwtest-sh	2005-01-18 13:33:15.000000000 +0100
+@@ -120,7 +120,7 @@
+     sort > $testout
+ 
+ # perhaps $tmp involves some symlinks...
+-tmpreal=`cd $tmp; /bin/pwd 2>/dev/null || /usr/bin/pwd`
++tmpreal=`cd $tmp; @PWD@ 2>/dev/null || /usr/bin/pwd`
+ 
+ cat <<EOF | cmp $testout - || exit 1
+ base = "$tmp/", file = "ftwtest.d", flag = FTW_D, cwd = $tmpreal, level = 0
+@@ -138,7 +138,7 @@
+ EOF
+ rm $testout
+ 
+-curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd`
++curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd`
+ cd "$tmp"
+ LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d |
+     sort > $testout
+@@ -160,7 +160,7 @@
+ EOF
+ rm $testout
+ 
+-curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd`
++curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd`
+ cd "$tmp"
+ LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/. |
+     sort > $testout
+@@ -182,7 +182,7 @@
+ EOF
+ rm $testout
+ 
+-curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd`
++curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd`
+ cd "$tmp"
+ LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/foo/lvl1/link@1 |
+     sort > $testout
+diff -ruN glibc-20050110/scripts/rellns-sh glibc-20050110.patched/scripts/rellns-sh
+--- glibc-20050110/scripts/rellns-sh	1999-12-19 00:40:25.000000000 +0100
++++ glibc-20050110.patched/scripts/rellns-sh	2005-01-18 13:35:53.245937423 +0100
+@@ -22,13 +22,13 @@
+   exit 1
+ fi
+ 
+-if test -x /bin/pwd; then
+-  pwd=/bin/pwd
+-elif test -x /usr/bin/pwd; then
+-  pwd=/usr/bin/pwd
+-else
++#if test -x /bin/pwd; then
++#  pwd=/bin/pwd
++#elif test -x /usr/bin/pwd; then
++#  pwd=/usr/bin/pwd
++#else
+   pwd='pwd'
+-fi
++#fi
+ 
+ # Make both paths absolute.
+ if test -d $1; then
diff --git a/pkgs/development/libraries/glibc/loadlocale.patch b/pkgs/development/libraries/glibc/loadlocale.patch
deleted file mode 100644
index 5bd00805200..00000000000
--- a/pkgs/development/libraries/glibc/loadlocale.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-This patch fixes
-http://sources.redhat.com/bugzilla/show_bug.cgi?id=356, "localedata:
-tests-mbwc/tst_iswalnum segfaults during make check".
-
-===================================================================
-RCS file: /cvs/glibc/libc/locale/loadlocale.c,v
-retrieving revision 1.44
-retrieving revision 1.45
-diff -u -r1.44 -r1.45
---- libc/locale/loadlocale.c	2003/09/03 07:54:22	1.44
-+++ libc/locale/loadlocale.c	2004/09/26 05:48:14	1.45
-@@ -1,5 +1,5 @@
- /* Functions to read locale data files.
--   Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc.
-+   Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-    This file is part of the GNU C Library.
-    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
- 
-@@ -115,15 +115,45 @@
- 	  __set_errno (EINVAL);
- 	  return NULL;
- 	}
--      if (__builtin_expect (_nl_value_types[category][cnt] == word, 0))
-+
-+      /* Determine the type.  There is one special case: the LC_CTYPE
-+	 category can have more elements than there are in the
-+	 _nl_value_type_LC_XYZ array.  There are all pointers.  */
-+      switch (category)
-+	{
-+#define CATTEST(cat) \
-+	case LC_##cat:							      \
-+	  assert (cnt < (sizeof (_nl_value_type_LC_##cat)		      \
-+			 / sizeof (_nl_value_type_LC_##cat[0])));	      \
-+	  break
-+	  CATTEST (NUMERIC);
-+	  CATTEST (TIME);
-+	  CATTEST (COLLATE);
-+	  CATTEST (MONETARY);
-+	  CATTEST (MESSAGES);
-+	  CATTEST (PAPER);
-+	  CATTEST (NAME);
-+	  CATTEST (ADDRESS);
-+	  CATTEST (TELEPHONE);
-+	  CATTEST (MEASUREMENT);
-+	  CATTEST (IDENTIFICATION);
-+	default:
-+	  assert (category == LC_CTYPE);
-+	  break;
-+	}
-+
-+      if ((category == LC_CTYPE
-+	   && cnt >= (sizeof (_nl_value_type_LC_CTYPE)
-+		      / sizeof (_nl_value_type_LC_CTYPE[0])))
-+	  || __builtin_expect (_nl_value_types[category][cnt] != word, 1))
-+	newdata->values[cnt].string = newdata->filedata + idx;
-+      else
- 	{
- 	  if (idx % __alignof__ (u_int32_t) != 0)
- 	    goto puntdata;
- 	  newdata->values[cnt].word =
- 	    *((const u_int32_t *) (newdata->filedata + idx));
- 	}
--      else
--	newdata->values[cnt].string = newdata->filedata + idx;
-     }
- 
-   return newdata;
diff --git a/pkgs/development/libraries/glibc/no-unit-at-a-time.patch b/pkgs/development/libraries/glibc/no-unit-at-a-time.patch
deleted file mode 100644
index 36b7639941b..00000000000
--- a/pkgs/development/libraries/glibc/no-unit-at-a-time.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-diff -rc glibc-orig/csu/Makefile glibc-2.3.3/csu/Makefile
-*** glibc-orig/csu/Makefile	2003-09-25 22:29:39.000000000 +0200
---- glibc-2.3.3/csu/Makefile	2004-09-17 11:06:56.000000000 +0200
-***************
-*** 104,110 ****
-  $(crtstuff:%=$(objpfx)%.o): %.o: %.S $(objpfx)defs.h
-  	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
-  
-! CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions
-  
-  vpath initfini.c $(full_config_sysdirs)
-  
---- 104,110 ----
-  $(crtstuff:%=$(objpfx)%.o): %.o: %.S $(objpfx)defs.h
-  	$(compile.S) -g0 $(ASFLAGS-.os) -o $@
-  
-! CFLAGS-initfini.s = -g0 -fPIC -fno-inline-functions -fno-unit-at-a-time
-  
-  vpath initfini.c $(full_config_sysdirs)
-  
-diff -rc glibc-orig/linuxthreads/Makefile glibc-2.3.3/linuxthreads/Makefile
-*** glibc-orig/linuxthreads/Makefile	2003-10-02 20:48:48.000000000 +0200
---- glibc-2.3.3/linuxthreads/Makefile	2004-09-17 13:06:20.000000000 +0200
-***************
-*** 68,74 ****
-  vpath %.c Examples
-  
-  tst-cancel-ARGS = "$(objpfx)"
-! CFLAGS-tst-cancel.c = -fno-inline -fno-inline-functions
-  
-  include ../Makeconfig
-  
---- 68,74 ----
-  vpath %.c Examples
-  
-  tst-cancel-ARGS = "$(objpfx)"
-! CFLAGS-tst-cancel.c = -fno-inline -fno-inline-functions -fno-unit-at-a-time
-  
-  include ../Makeconfig
-  
-***************
-*** 101,107 ****
-  extra-objs += $(crti-objs) $(crtn-objs)
-  omit-deps += crti crtn
-  
-! CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions
-  endif
-  
-  librt-tests = ex10 ex11
---- 101,107 ----
-  extra-objs += $(crti-objs) $(crtn-objs)
-  omit-deps += crti crtn
-  
-! CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions -fno-unit-at-a-time
-  endif
-  
-  librt-tests = ex10 ex11
-diff -rc glibc-orig/linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile glibc-2.3.3/linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile
-*** glibc-orig/linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile	2003-04-12 01:34:02.000000000 +0200
---- glibc-2.3.3/linuxthreads/sysdeps/unix/sysv/linux/x86_64/Makefile	2004-09-17 13:05:43.000000000 +0200
-***************
-*** 1,3 ****
-  ifeq ($(subdir),linuxthreads)
-! CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions -fno-asynchronous-unwind-tables
-  endif
---- 1,3 ----
-  ifeq ($(subdir),linuxthreads)
-! CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions -fno-asynchronous-unwind-tables -fno-unit-at-a-time
-  endif
diff --git a/pkgs/development/libraries/glibc/utf8-locales.patch b/pkgs/development/libraries/glibc/utf8-locales.patch
deleted file mode 100644
index 4c7b82668cb..00000000000
--- a/pkgs/development/libraries/glibc/utf8-locales.patch
+++ /dev/null
@@ -1,458 +0,0 @@
-diff -rc glibc-orig/localedata/SUPPORTED glibc-2.3.3/localedata/SUPPORTED
-*** glibc-orig/localedata/SUPPORTED	2003-11-08 18:34:50.000000000 +0100
---- glibc-2.3.3/localedata/SUPPORTED	2004-12-30 19:25:30.000000000 +0100
-***************
-*** 9,103 ****
---- 9,181 ----
-  af_ZA/ISO-8859-1 \
-  am_ET/UTF-8 \
-  an_ES/ISO-8859-15 \
-+ ar_AE.UTF-8/UTF-8 \
-  ar_AE/ISO-8859-6 \
-+ ar_BH.UTF-8/UTF-8 \
-  ar_BH/ISO-8859-6 \
-+ ar_DZ.UTF-8/UTF-8 \
-  ar_DZ/ISO-8859-6 \
-+ ar_EG.UTF-8/UTF-8 \
-  ar_EG/ISO-8859-6 \
-  ar_IN/UTF-8 \
-+ ar_IQ.UTF-8/UTF-8 \
-  ar_IQ/ISO-8859-6 \
-+ ar_JO.UTF-8/UTF-8 \
-  ar_JO/ISO-8859-6 \
-+ ar_KW.UTF-8/UTF-8 \
-  ar_KW/ISO-8859-6 \
-+ ar_LB.UTF-8/UTF-8 \
-  ar_LB/ISO-8859-6 \
-+ ar_LY.UTF-8/UTF-8 \
-  ar_LY/ISO-8859-6 \
-+ ar_MA.UTF-8/UTF-8 \
-  ar_MA/ISO-8859-6 \
-+ ar_OM.UTF-8/UTF-8 \
-  ar_OM/ISO-8859-6 \
-+ ar_QA.UTF-8/UTF-8 \
-  ar_QA/ISO-8859-6 \
-+ ar_SA.UTF-8/UTF-8 \
-  ar_SA/ISO-8859-6 \
-+ ar_SD.UTF-8/UTF-8 \
-  ar_SD/ISO-8859-6 \
-+ ar_SY.UTF-8/UTF-8 \
-  ar_SY/ISO-8859-6 \
-+ ar_TN.UTF-8/UTF-8 \
-  ar_TN/ISO-8859-6 \
-+ ar_YE.UTF-8/UTF-8 \
-  ar_YE/ISO-8859-6 \
-+ az_AZ.UTF-8/UTF-8 \
-+ be_BY.UTF-8/UTF-8 \
-  be_BY/CP1251 \
-+ bg_BG.UTF-8/UTF-8 \
-  bg_BG/CP1251 \
-+ bn_BD/UTF-8 \
-+ bn_IN/UTF-8 \
-  br_FR/ISO-8859-1 \
-+ br_FR@euro/ISO-8859-15 \
-  bs_BA/ISO-8859-2 \
-  byn_ER/UTF-8 \
-+ ca_ES.UTF-8/UTF-8 \
-  ca_ES/ISO-8859-1 \
-  ca_ES@euro/ISO-8859-15 \
-+ cs_CZ.UTF-8/UTF-8 \
-  cs_CZ/ISO-8859-2 \
-+ cy_GB.UTF-8/UTF-8 \
-  cy_GB/ISO-8859-14 \
-+ da_DK.UTF-8/UTF-8 \
-  da_DK/ISO-8859-1 \
-+ da_DK@euro/ISO-8859-15 \
-+ de_AT.UTF-8/UTF-8 \
-  de_AT/ISO-8859-1 \
-  de_AT@euro/ISO-8859-15 \
-+ de_BE.UTF-8/UTF-8 \
-  de_BE/ISO-8859-1 \
-  de_BE@euro/ISO-8859-15 \
-+ de_CH.UTF-8/UTF-8 \
-  de_CH/ISO-8859-1 \
-+ de_DE.UTF-8/UTF-8 \
-  de_DE/ISO-8859-1 \
-  de_DE@euro/ISO-8859-15 \
-+ de_LU.UTF-8/UTF-8 \
-  de_LU/ISO-8859-1 \
-  de_LU@euro/ISO-8859-15 \
-+ el_GR.UTF-8/UTF-8 \
-  el_GR/ISO-8859-7 \
-+ en_AU.UTF-8/UTF-8 \
-  en_AU/ISO-8859-1 \
-+ en_BW.UTF-8/UTF-8 \
-  en_BW/ISO-8859-1 \
-+ en_CA.UTF-8/UTF-8 \
-  en_CA/ISO-8859-1 \
-+ en_DK.UTF-8/UTF-8 \
-  en_DK/ISO-8859-1 \
-+ en_GB.UTF-8/UTF-8 \
-  en_GB/ISO-8859-1 \
-+ en_HK.UTF-8/UTF-8 \
-  en_HK/ISO-8859-1 \
-+ en_IE.UTF-8/UTF-8 \
-  en_IE/ISO-8859-1 \
-  en_IE@euro/ISO-8859-15 \
-  en_IN/UTF-8 \
-+ en_NZ.UTF-8/UTF-8 \
-  en_NZ/ISO-8859-1 \
-+ en_PH.UTF-8/UTF-8 \
-  en_PH/ISO-8859-1 \
-+ en_SG.UTF-8/UTF-8 \
-  en_SG/ISO-8859-1 \
-+ en_US.UTF-8/UTF-8 \
-  en_US/ISO-8859-1 \
-+ en_ZA.UTF-8/UTF-8 \
-  en_ZA/ISO-8859-1 \
-+ en_ZW.UTF-8/UTF-8 \
-  en_ZW/ISO-8859-1 \
-+ es_AR.UTF-8/UTF-8 \
-  es_AR/ISO-8859-1 \
-+ es_BO.UTF-8/UTF-8 \
-  es_BO/ISO-8859-1 \
-+ es_CL.UTF-8/UTF-8 \
-  es_CL/ISO-8859-1 \
-+ es_CO.UTF-8/UTF-8 \
-  es_CO/ISO-8859-1 \
-+ es_CR.UTF-8/UTF-8 \
-  es_CR/ISO-8859-1 \
-+ es_DO.UTF-8/UTF-8 \
-  es_DO/ISO-8859-1 \
-+ es_EC.UTF-8/UTF-8 \
-  es_EC/ISO-8859-1 \
-+ es_ES.UTF-8/UTF-8 \
-  es_ES/ISO-8859-1 \
-  es_ES@euro/ISO-8859-15 \
-+ es_GT.UTF-8/UTF-8 \
-  es_GT/ISO-8859-1 \
-+ es_HN.UTF-8/UTF-8 \
-  es_HN/ISO-8859-1 \
-+ es_MX.UTF-8/UTF-8 \
-  es_MX/ISO-8859-1 \
-+ es_NI.UTF-8/UTF-8 \
-  es_NI/ISO-8859-1 \
-+ es_PA.UTF-8/UTF-8 \
-  es_PA/ISO-8859-1 \
-+ es_PE.UTF-8/UTF-8 \
-  es_PE/ISO-8859-1 \
-+ es_PR.UTF-8/UTF-8 \
-  es_PR/ISO-8859-1 \
-+ es_PY.UTF-8/UTF-8 \
-  es_PY/ISO-8859-1 \
-+ es_SV.UTF-8/UTF-8 \
-  es_SV/ISO-8859-1 \
-+ es_US.UTF-8/UTF-8 \
-  es_US/ISO-8859-1 \
-+ es_UY.UTF-8/UTF-8 \
-  es_UY/ISO-8859-1 \
-+ es_VE.UTF-8/UTF-8 \
-  es_VE/ISO-8859-1 \
-+ et_EE.UTF-8/UTF-8 \
-  et_EE/ISO-8859-1 \
-+ et_EE.ISO-8859-15/ISO-8859-15 \
-+ eu_ES.UTF-8/UTF-8 \
-  eu_ES/ISO-8859-1 \
-  eu_ES@euro/ISO-8859-15 \
-  fa_IR/UTF-8 \
-+ fi_FI.UTF-8/UTF-8 \
-  fi_FI/ISO-8859-1 \
-  fi_FI@euro/ISO-8859-15 \
-+ fo_FO.UTF-8/UTF-8 \
-  fo_FO/ISO-8859-1 \
-+ fr_BE.UTF-8/UTF-8 \
-  fr_BE/ISO-8859-1 \
-  fr_BE@euro/ISO-8859-15 \
-+ fr_CA.UTF-8/UTF-8 \
-  fr_CA/ISO-8859-1 \
-+ fr_CH.UTF-8/UTF-8 \
-  fr_CH/ISO-8859-1 \
-+ fr_FR.UTF-8/UTF-8 \
-  fr_FR/ISO-8859-1 \
-  fr_FR@euro/ISO-8859-15 \
-+ fr_LU.UTF-8/UTF-8 \
-  fr_LU/ISO-8859-1 \
-  fr_LU@euro/ISO-8859-15 \
-+ ga_IE.UTF-8/UTF-8 \
-  ga_IE/ISO-8859-1 \
-  ga_IE@euro/ISO-8859-15 \
-  gd_GB/ISO-8859-15 \
-***************
-*** 105,199 ****
-  gez_ER@abegede/UTF-8 \
-  gez_ET/UTF-8 \
-  gez_ET@abegede/UTF-8 \
-  gl_ES/ISO-8859-1 \
-  gl_ES@euro/ISO-8859-15 \
-  gu_IN/UTF-8 \
-  gv_GB/ISO-8859-1 \
-  he_IL/ISO-8859-8 \
-  hi_IN/UTF-8 \
-  hr_HR/ISO-8859-2 \
-  hu_HU/ISO-8859-2 \
-  id_ID/ISO-8859-1 \
-  is_IS/ISO-8859-1 \
-  it_CH/ISO-8859-1 \
-  it_IT/ISO-8859-1 \
-  it_IT@euro/ISO-8859-15 \
-  iw_IL/ISO-8859-8 \
-  ja_JP.EUC-JP/EUC-JP \
-  ka_GE/GEORGIAN-PS \
-  kl_GL/ISO-8859-1 \
-  kn_IN/UTF-8 \
-  ko_KR.EUC-KR/EUC-KR \
-  ko_KR.UTF-8/UTF-8 \
-  kw_GB/ISO-8859-1 \
-  lo_LA/UTF-8 \
-  lt_LT/ISO-8859-13 \
-! lug_UG/ISO-8859-10 \
-  lv_LV/ISO-8859-13 \
-  mi_NZ/ISO-8859-13 \
-  mk_MK/ISO-8859-5 \
-  ml_IN/UTF-8 \
-  mn_MN/UTF-8 \
-  mr_IN/UTF-8 \
-  ms_MY/ISO-8859-1 \
-  mt_MT/ISO-8859-3 \
-  ne_NP/UTF-8 \
-  nl_BE/ISO-8859-1 \
-  nl_BE@euro/ISO-8859-15 \
-  nl_NL/ISO-8859-1 \
-  nl_NL@euro/ISO-8859-15 \
-! nb_NO/ISO-8859-1 \
-  nn_NO/ISO-8859-1 \
-  oc_FR/ISO-8859-1 \
-  om_ET/UTF-8 \
-  om_KE/ISO-8859-1 \
-  pa_IN/UTF-8 \
-  pl_PL/ISO-8859-2 \
-  pt_BR/ISO-8859-1 \
-  pt_PT/ISO-8859-1 \
-  pt_PT@euro/ISO-8859-15 \
-  ro_RO/ISO-8859-2 \
-- ru_RU/ISO-8859-5 \
-  ru_RU.KOI8-R/KOI8-R \
-  ru_UA/KOI8-U \
-  se_NO/UTF-8 \
-  sid_ET/UTF-8 \
-  sk_SK/ISO-8859-2 \
-  sl_SI/ISO-8859-2 \
-  so_DJ/ISO-8859-1 \
-  so_ET/UTF-8 \
-  so_KE/ISO-8859-1 \
-  so_SO/ISO-8859-1 \
-  sq_AL/ISO-8859-1 \
-! sr_YU/ISO-8859-2 \
-! sr_YU@cyrillic/ISO-8859-5 \
-  st_ZA/ISO-8859-1 \
-  sv_FI/ISO-8859-1 \
-  sv_FI@euro/ISO-8859-15 \
-  sv_SE/ISO-8859-1 \
-  ta_IN/UTF-8 \
-  te_IN/UTF-8 \
-  tg_TJ/KOI8-T \
-  th_TH/TIS-620 \
-  ti_ER/UTF-8 \
-  ti_ET/UTF-8 \
-  tig_ER/UTF-8 \
-  tl_PH/ISO-8859-1 \
-  tr_TR/ISO-8859-9 \
-  uk_UA/KOI8-U \
-  ur_PK/UTF-8 \
-  uz_UZ/ISO-8859-1 \
-  uz_UZ@cyrillic/UTF-8 \
-- vi_VN/UTF-8 \
-  vi_VN.TCVN/TCVN5712-1 \
-  wa_BE/ISO-8859-1 \
-  wa_BE@euro/ISO-8859-15 \
-  xh_ZA/ISO-8859-1 \
-  yi_US/CP1255 \
-- zh_CN/GB2312 \
-  zh_CN.GB18030/GB18030 \
-  zh_CN.GBK/GBK \
-  zh_HK/BIG5-HKSCS \
-! zh_TW/BIG5 \
-  zh_TW.EUC-TW/EUC-TW \
-  zu_ZA/ISO-8859-1 \
---- 183,363 ----
-  gez_ER@abegede/UTF-8 \
-  gez_ET/UTF-8 \
-  gez_ET@abegede/UTF-8 \
-+ gl_ES.UTF-8/UTF-8 \
-  gl_ES/ISO-8859-1 \
-  gl_ES@euro/ISO-8859-15 \
-  gu_IN/UTF-8 \
-+ gv_GB.UTF-8/UTF-8 \
-  gv_GB/ISO-8859-1 \
-+ he_IL.UTF-8/UTF-8 \
-  he_IL/ISO-8859-8 \
-  hi_IN/UTF-8 \
-+ hr_HR.UTF-8/UTF-8 \
-  hr_HR/ISO-8859-2 \
-+ hu_HU.UTF-8/UTF-8 \
-  hu_HU/ISO-8859-2 \
-+ id_ID.UTF-8/UTF-8 \
-  id_ID/ISO-8859-1 \
-+ is_IS.UTF-8/UTF-8 \
-  is_IS/ISO-8859-1 \
-+ it_CH.UTF-8/UTF-8 \
-  it_CH/ISO-8859-1 \
-+ it_IT.UTF-8/UTF-8 \
-  it_IT/ISO-8859-1 \
-  it_IT@euro/ISO-8859-15 \
-+ iw_IL.UTF-8/UTF-8 \
-  iw_IL/ISO-8859-8 \
-  ja_JP.EUC-JP/EUC-JP \
-+ ja_JP.UTF-8/UTF-8 \
-  ka_GE/GEORGIAN-PS \
-+ kk_KZ/PT154 \
-+ kl_GL.UTF-8/UTF-8 \
-  kl_GL/ISO-8859-1 \
-  kn_IN/UTF-8 \
-  ko_KR.EUC-KR/EUC-KR \
-  ko_KR.UTF-8/UTF-8 \
-+ kw_GB.UTF-8/UTF-8 \
-  kw_GB/ISO-8859-1 \
-+ lg_UG/ISO-8859-10 \
-  lo_LA/UTF-8 \
-+ lt_LT.UTF-8/UTF-8 \
-  lt_LT/ISO-8859-13 \
-! lv_LV.UTF-8/UTF-8 \
-  lv_LV/ISO-8859-13 \
-  mi_NZ/ISO-8859-13 \
-+ mk_MK.UTF-8/UTF-8 \
-  mk_MK/ISO-8859-5 \
-  ml_IN/UTF-8 \
-  mn_MN/UTF-8 \
-  mr_IN/UTF-8 \
-+ ms_MY.UTF-8/UTF-8 \
-  ms_MY/ISO-8859-1 \
-+ mt_MT.UTF-8/UTF-8 \
-  mt_MT/ISO-8859-3 \
-+ nb_NO.UTF-8/UTF-8 \
-+ nb_NO/ISO-8859-1 \
-  ne_NP/UTF-8 \
-+ nl_BE.UTF-8/UTF-8 \
-  nl_BE/ISO-8859-1 \
-  nl_BE@euro/ISO-8859-15 \
-+ nl_NL.UTF-8/UTF-8 \
-  nl_NL/ISO-8859-1 \
-  nl_NL@euro/ISO-8859-15 \
-! nn_NO.UTF-8/UTF-8 \
-  nn_NO/ISO-8859-1 \
-  oc_FR/ISO-8859-1 \
-  om_ET/UTF-8 \
-  om_KE/ISO-8859-1 \
-  pa_IN/UTF-8 \
-+ pl_PL.UTF-8/UTF-8 \
-  pl_PL/ISO-8859-2 \
-+ pt_BR.UTF-8/UTF-8 \
-  pt_BR/ISO-8859-1 \
-+ pt_PT.UTF-8/UTF-8 \
-  pt_PT/ISO-8859-1 \
-  pt_PT@euro/ISO-8859-15 \
-+ ro_RO.UTF-8/UTF-8 \
-  ro_RO/ISO-8859-2 \
-  ru_RU.KOI8-R/KOI8-R \
-+ ru_RU.UTF-8/UTF-8 \
-+ ru_RU/ISO-8859-5 \
-+ ru_UA.UTF-8/UTF-8 \
-  ru_UA/KOI8-U \
-  se_NO/UTF-8 \
-  sid_ET/UTF-8 \
-+ sk_SK.UTF-8/UTF-8 \
-  sk_SK/ISO-8859-2 \
-+ sl_SI.UTF-8/UTF-8 \
-  sl_SI/ISO-8859-2 \
-  so_DJ/ISO-8859-1 \
-  so_ET/UTF-8 \
-  so_KE/ISO-8859-1 \
-  so_SO/ISO-8859-1 \
-+ sq_AL.UTF-8/UTF-8 \
-  sq_AL/ISO-8859-1 \
-! st_ZA.UTF-8/UTF-8 \
-  st_ZA/ISO-8859-1 \
-+ sv_FI.UTF-8/UTF-8 \
-  sv_FI/ISO-8859-1 \
-  sv_FI@euro/ISO-8859-15 \
-+ sv_SE.UTF-8/UTF-8 \
-  sv_SE/ISO-8859-1 \
-  ta_IN/UTF-8 \
-  te_IN/UTF-8 \
-  tg_TJ/KOI8-T \
-+ th_TH.UTF-8/UTF-8 \
-  th_TH/TIS-620 \
-  ti_ER/UTF-8 \
-  ti_ET/UTF-8 \
-  tig_ER/UTF-8 \
-  tl_PH/ISO-8859-1 \
-+ tr_TR.UTF-8/UTF-8 \
-  tr_TR/ISO-8859-9 \
-+ tt_RU.UTF-8/UTF-8 \
-+ uk_UA.UTF-8/UTF-8 \
-  uk_UA/KOI8-U \
-  ur_PK/UTF-8 \
-  uz_UZ/ISO-8859-1 \
-  uz_UZ@cyrillic/UTF-8 \
-  vi_VN.TCVN/TCVN5712-1 \
-+ vi_VN/UTF-8 \
-  wa_BE/ISO-8859-1 \
-  wa_BE@euro/ISO-8859-15 \
-+ wa_BE.UTF-8/UTF-8 \
-+ xh_ZA.UTF-8/UTF-8 \
-  xh_ZA/ISO-8859-1 \
-  yi_US/CP1255 \
-  zh_CN.GB18030/GB18030 \
-  zh_CN.GBK/GBK \
-+ zh_CN.UTF-8/UTF-8 \
-+ zh_CN/GB2312 \
-+ zh_HK.UTF-8/UTF-8 \
-  zh_HK/BIG5-HKSCS \
-! zh_SG.GBK/GBK \
-! zh_SG/GB2312 \
-  zh_TW.EUC-TW/EUC-TW \
-+ zh_TW.UTF-8/UTF-8 \
-+ zh_TW/BIG5 \
-+ zu_ZA.UTF-8/UTF-8 \
-  zu_ZA/ISO-8859-1 \
-+ aa_DJ.UTF-8/UTF-8 \
-+ aa_ER.UTF-8/UTF-8 \
-+ aa_ET.UTF-8/UTF-8 \
-+ af_ZA.UTF-8/UTF-8 \
-+ am_ET.UTF-8/UTF-8 \
-+ an_ES.UTF-8/UTF-8 \
-+ ar_IN.UTF-8/UTF-8 \
-+ bn_BD.UTF-8/UTF-8 \
-+ bn_IN.UTF-8/UTF-8 \
-+ br_FR.UTF-8/UTF-8 \
-+ bs_BA.UTF-8/UTF-8 \
-+ byn_ER.UTF-8/UTF-8 \
-+ en_BE.UTF-8/UTF-8 \
-+ en_BE/ISO-8859-1 \
-+ en_BE@euro/ISO-8859-15 \
-+ en_GB.ISO-8859-15/ISO-8859-15 \
-+ en_US.ISO-8859-15/ISO-8859-15 \
-+ en_IN.UTF-8/UTF-8 \
-+ fa_IR.UTF-8/UTF-8 \
-+ hi_IN.UTF-8/UTF-8 \
-+ ja_JP.SJIS/SHIFT_JIS \
-+ ml_IN.UTF-8/UTF-8 \
-+ mn_MN.UTF-8/UTF-8 \
-+ mr_IN.UTF-8/UTF-8 \
-+ ne_NP.UTF-8/UTF-8 \
-+ om_ET.UTF-8/UTF-8 \
-+ pa_IN.UTF-8/UTF-8 \
-+ se_NO.UTF-8/UTF-8 \
-+ sh_YU.UTF-8/UTF-8 \
-+ sh_YU/ISO-8859-2 \
-+ sid_ET.UTF-8/UTF-8 \
-+ so_ET.UTF-8/UTF-8 \
-+ sv_SE.ISO-8859-15/ISO-8859-15 \
-+ ta_IN.UTF-8/UTF-8 \
-+ te_IN.UTF-8/UTF-8 \
-+ ti_ER.UTF-8/UTF-8 \
-+ ti_ET.UTF-8/UTF-8 \
-+ tig_ER.UTF-8/UTF-8 \
-+ ur_PK.UTF-8/UTF-8 \
-+ vi_VN.UTF-8/UTF-8 \
-+ zh_SG.UTF-8/UTF-8 \
diff --git a/pkgs/os-specific/linux/kernel-headers/builder.sh b/pkgs/os-specific/linux/kernel-headers/builder.sh
index 823b21ae411..1b734c5f426 100644
--- a/pkgs/os-specific/linux/kernel-headers/builder.sh
+++ b/pkgs/os-specific/linux/kernel-headers/builder.sh
@@ -11,7 +11,7 @@ buildPhase=buildPhase
 installPhase() {
     mkdir $out
     mkdir $out/include
-    cp -prvd include/linux include/asm-i386 $out/include
+    cp -prvd include/linux include/asm-i386 include/asm-generic $out/include
     cd $out/include
     ln -s asm-i386 asm
     echo -n > $out/include/linux/autoconf.h
diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix
index 2981ccb0cef..908f0b055bb 100644
--- a/pkgs/os-specific/linux/kernel-headers/default.nix
+++ b/pkgs/os-specific/linux/kernel-headers/default.nix
@@ -3,10 +3,10 @@
 assert stdenv.system == "i686-linux";
 
 stdenv.mkDerivation {
-  name = "linux-headers-2.4.25-i386";
+  name = "linux-headers-2.6.9-i386";
   builder = ./builder.sh;
   src = fetchurl {
-    url = http://catamaran.labs.cs.uu.nl/dist/tarballs/linux-2.4.25.tar.bz2;
-    md5 = "5fc8e9f43fa44ac29ddf9a9980af57d8";
+    url = ftp://ftp.nluug.nl/pub/os/Linux/system/kernel/v2.6/linux-2.6.9.tar.bz2;
+    md5 = "e921200f074ca97184e150ef5a4af825";
   };
 }
diff --git a/pkgs/os-specific/linux/modutils/default.nix b/pkgs/os-specific/linux/modutils/default.nix
new file mode 100644
index 00000000000..3f2b2a96ac6
--- /dev/null
+++ b/pkgs/os-specific/linux/modutils/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, bison, flex}:
+
+stdenv.mkDerivation {
+  name = "modutils-2.4.25";
+  src = fetchurl {
+    url = ftp://ftp.nl.kernel.org/pub/linux/utils/kernel/modutils/v2.4/modutils-2.4.25.tar.bz2;
+    md5 = "2c0cca3ef6330a187c6ef4fe41ecaa4d";
+  };
+  buildInputs = [bison flex];
+}
diff --git a/pkgs/os-specific/linux/net-tools/builder.sh b/pkgs/os-specific/linux/net-tools/builder.sh
index 17dea5297f6..c7f9975866a 100644
--- a/pkgs/os-specific/linux/net-tools/builder.sh
+++ b/pkgs/os-specific/linux/net-tools/builder.sh
@@ -6,6 +6,7 @@ cd net-tools-*
 cp $config config.h
 sed "s^/usr/share/man^/share^"  < man/Makefile > tmp
 mv tmp man/Makefile
+patch -p1 < $patch
 make
 mkdir $out
 make BASEDIR=$out install
diff --git a/pkgs/os-specific/linux/net-tools/default.nix b/pkgs/os-specific/linux/net-tools/default.nix
index 3fb269943fc..240e9b57152 100644
--- a/pkgs/os-specific/linux/net-tools/default.nix
+++ b/pkgs/os-specific/linux/net-tools/default.nix
@@ -8,4 +8,5 @@ stdenv.mkDerivation {
     md5 = "888774accab40217dde927e21979c165";
   };
   config = ./config.h;
+  patch = ./net-tools-labels.patch;
 }
diff --git a/pkgs/os-specific/linux/net-tools/net-tools-labels.patch b/pkgs/os-specific/linux/net-tools/net-tools-labels.patch
new file mode 100644
index 00000000000..82c3a27d9c6
--- /dev/null
+++ b/pkgs/os-specific/linux/net-tools/net-tools-labels.patch
@@ -0,0 +1,38 @@
+diff -ruN net-tools-1.60/hostname.c net-tools-1.60-new/hostname.c
+--- net-tools-1.60/hostname.c	2001-04-08 19:04:23.000000000 +0200
++++ net-tools-1.60-new/hostname.c	2004-12-17 14:48:15.624174382 +0100
+@@ -98,6 +98,7 @@
+ 	    fprintf(stderr, _("%s: name too long\n"), program_name);
+ 	    break;
+ 	default:
++	    break;
+ 	}
+ 	exit(1);
+     };
+@@ -117,6 +118,7 @@
+ 	    fprintf(stderr, _("%s: name too long\n"), program_name);
+ 	    break;
+ 	default:
++	    break;
+ 	}
+ 	exit(1);
+     };
+@@ -174,6 +176,7 @@
+ 	printf("%s\n", hp->h_name);
+ 	break;
+     default:
++	break;
+     }
+ }
+ 
+diff -ruN net-tools-1.60/lib/inet_sr.c net-tools-1.60-new/lib/inet_sr.c
+--- net-tools-1.60/lib/inet_sr.c	2000-02-20 22:46:45.000000000 +0100
++++ net-tools-1.60-new/lib/inet_sr.c	2004-12-17 14:37:15.416349441 +0100
+@@ -105,6 +105,7 @@
+     case 2:
+        isnet = 0; break;
+     default:
++	break;
+     }
+ 
+     /* Fill in the other fields. */
diff --git a/pkgs/stdenv/nix-linux-static/curl-static/builder.sh b/pkgs/stdenv/nix-linux-static/curl-static/builder.sh
index f7069c68a98..213b82e1e29 100644
--- a/pkgs/stdenv/nix-linux-static/curl-static/builder.sh
+++ b/pkgs/stdenv/nix-linux-static/curl-static/builder.sh
@@ -2,4 +2,4 @@
  
 tar zxvf $src
 mkdir $out
-cp -a curl-7.12.0/* $out
+cp -a curl-7.12.2/* $out
diff --git a/pkgs/stdenv/nix-linux-static/curl-static/curl-7.12.0-static.tar.gz b/pkgs/stdenv/nix-linux-static/curl-static/curl-7.12.0-static.tar.gz
deleted file mode 100644
index ba079ffa8c9..00000000000
--- a/pkgs/stdenv/nix-linux-static/curl-static/curl-7.12.0-static.tar.gz
+++ /dev/null
Binary files differdiff --git a/pkgs/stdenv/nix-linux-static/curl-static/curl-7.12.2-static.tar.gz b/pkgs/stdenv/nix-linux-static/curl-static/curl-7.12.2-static.tar.gz
new file mode 100644
index 00000000000..92e40e7ea19
--- /dev/null
+++ b/pkgs/stdenv/nix-linux-static/curl-static/curl-7.12.2-static.tar.gz
Binary files differdiff --git a/pkgs/stdenv/nix-linux-static/curl-static/default.nix b/pkgs/stdenv/nix-linux-static/curl-static/default.nix
index a68f371b061..b61ce46bb97 100644
--- a/pkgs/stdenv/nix-linux-static/curl-static/default.nix
+++ b/pkgs/stdenv/nix-linux-static/curl-static/default.nix
@@ -1,7 +1,7 @@
 {stdenv}:
  
 stdenv.mkDerivation {
-  name = "curl-static-7.12.0";
+  name = "curl-static-7.12.2";
   builder = ./builder.sh;
-  src = ./curl-7.12.0-static.tar.gz;
+  src = ./curl-7.12.2-static.tar.gz;
 }
diff --git a/pkgs/stdenv/nix-linux-static/default.nix b/pkgs/stdenv/nix-linux-static/default.nix
index d4afccabe6b..f8121fb5402 100644
--- a/pkgs/stdenv/nix-linux-static/default.nix
+++ b/pkgs/stdenv/nix-linux-static/default.nix
@@ -1,22 +1,151 @@
-{stdenv, glibc, pkgs, genericStdenv, gccWrapper}:
+rec {
 
-genericStdenv {
-  name = "stdenv-nix-linux-static";
-  preHook = ./prehook.sh;
-  initialPath = (import ./path.nix) {pkgs = (import ./pkgs.nix) {stdenv = stdenv;};};
+  curl = derivation {
+    name = "curl";
+    builder = ./bash-static/bash;
+    tar = ./gnutar-static/bin/tar;
+    gunzip = ./gzip-static/bin/gunzip;
+    curl = ./curl-static/curl-7.12.2-static.tar.gz;
+    cp = ./tools/cp;
+    system = "i686-linux";
+    args = [ ./scripts/curl-unpack ];
+  };
+
+  download =
+  { url, pkgname, postProcess ? [], addToPath ? []
+  , extra ? null, extra2 ? null
+  , extra3 ? null, extra4? null, patchelf ? null}:
+  derivation {
+    name = pkgname;
+    builder = ./bash-static/bash;
+    tar = ./gnutar-static/bin/tar;
+    gunzip = ./gzip-static/bin/gunzip;
+    inherit curl url;
+    cp = ./tools/cp;
+    system = "i686-linux";
+    args = [ ./scripts/download-script ];
+    inherit postProcess addToPath extra extra2 extra3 extra4 patchelf;
+  };
+
+  coreutils = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/coreutils-5.0-static.tar.gz;
+    pkgname = "coreutils";
+  };
+
+  patchelf = ./patchelf-static/bin/patchelf;
+
+  bzip2 = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/bzip2-1.0.2-static.tar.gz;
+    pkgname = "bzip2";
+  };
 
-  inherit stdenv;
+  gnumake = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/make-3.80-static.tar.gz;
+    pkgname = "gnumake";
+  };
+
+  binutils = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/binutils-2.15-static.tar.gz;
+    pkgname = "binutils";
+  };
+
+  diffutils = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/diffutils-2.8.1-static.tar.gz;
+    pkgname = "diffutils";
+  };
+
+  gnused = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/sed-4.0.7-static.tar.gz;
+    pkgname = "gnused";
+  };
 
-  gcc = gccWrapper {
-    #name = pkgs.gcc.name;
-    nativeTools = false;
-    nativeGlibc = false;
-    inherit (pkgs) binutils;
-    gcc = (import ./gcc-static) {stdenv = stdenv;};
-    inherit stdenv glibc;
-    shell = pkgs.bash ~ /bin/sh;
+  gnugrep = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/grep-2.5.1-static.tar.gz;
+    pkgname = "gnugrep";
   };
 
-  shell = pkgs.bash ~ /bin/sh;
+  gcc = (download {url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.4.2-static.tar.gz;
+    pkgname = "gcc";
+    postProcess = [./scripts/fix-outpath.sh];
+    addToPath = [coreutils findutils gnused];
+  }) // { langC = true; langCC = false; langF77 = false; };
 
+  gawk = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/gawk-3.1.3-static.tar.gz;
+    pkgname = "gawk";
+  };
+
+  patch = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/patch-2.5.4-static.tar.gz;
+    pkgname = "patch";
+  };
+
+  findutils = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/findutils-4.1.20-static.tar.gz;
+    pkgname = "findutils";
+  };
+
+  linuxHeaders = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/linux-headers-2.4.25-i386.tar.gz;
+    pkgname = "linux-headers";
+  };
+
+  glibc = download {
+    url = http://losser.st-lab.cs.uu.nl/~armijn/.nix/glibc-2.3.3-static-2.tar.gz;
+    pkgname = "glibc";
+    patchelf = ./patchelf-static/bin/patchelf;
+    postProcess = [./scripts/add-symlink.sh /* ./scripts/fix-outpath.sh */];
+    addToPath = [coreutils findutils gnused];
+    extra = linuxHeaders;
+  };
+
+  
+  stdenvInitial = let {
+
+    body = derivation {
+      name = "stdenv-linux-static-initial";
+      system = "i686-linux";
+      builder = ./bash-static/bash;
+      args = ./scripts/builder-stdenv-initial.sh;
+      inherit coreutils gnused;
+    }  // {
+      mkDerivation = attrs: derivation (attrs // {
+        builder = ./bash-static/bash;
+        args = ["-e" attrs.builder];
+        stdenv = body;
+        system = body.system;
+      });
+
+      shell = ./bash-static/bash;
+    };
+  };
+
+
+  stdenvBootFun = {glibc, gcc, binutils, staticGlibc}: (import ../generic) {
+    name = "stdenv-linux-static-boot";
+    param1 = if staticGlibc then "static" else "dynamic";
+    preHook = ./prehook.sh;
+    stdenv = stdenvInitial;
+    shell = ./bash-static/bash;
+    gcc = (import ../../build-support/gcc-wrapper) {
+      stdenv = stdenvInitial;
+      nativeTools = false;
+      nativeGlibc = false;
+      inherit gcc glibc binutils;
+    };
+    initialPath = [
+      coreutils
+      ./gnutar-static
+      ./gzip-static
+      bzip2
+      gnused
+      gnugrep
+      gawk
+      gnumake
+      findutils
+      diffutils
+      patch
+      ./patchelf-static
+    ];
+  };
 }
diff --git a/pkgs/stdenv/nix-linux-static/gcc-static/gcc-3.3.4-static.tar.gz b/pkgs/stdenv/nix-linux-static/gcc-static/gcc-3.3.4-static.tar.gz
deleted file mode 100644
index f57b203eee2..00000000000
--- a/pkgs/stdenv/nix-linux-static/gcc-static/gcc-3.3.4-static.tar.gz
+++ /dev/null
Binary files differdiff --git a/pkgs/stdenv/nix-linux-static/patchelf-static/bin/patchelf b/pkgs/stdenv/nix-linux-static/patchelf-static/bin/patchelf
new file mode 100755
index 00000000000..d0ac6a22f61
--- /dev/null
+++ b/pkgs/stdenv/nix-linux-static/patchelf-static/bin/patchelf
Binary files differdiff --git a/pkgs/stdenv/nix-linux-static/prehook.sh b/pkgs/stdenv/nix-linux-static/prehook.sh
index 08bb6c0332c..4ba81f1eef7 100644
--- a/pkgs/stdenv/nix-linux-static/prehook.sh
+++ b/pkgs/stdenv/nix-linux-static/prehook.sh
@@ -1 +1,8 @@
 export NIX_ENFORCE_PURITY=1
+
+if test "$param1" = "static"; then
+    export NIX_CFLAGS_LINK="-static"
+    export NIX_LDFLAGS_BEFORE="-static"
+fi
+
+havePatchELF=1
diff --git a/pkgs/stdenv/nix-linux-static/scripts/add-symlink.sh b/pkgs/stdenv/nix-linux-static/scripts/add-symlink.sh
new file mode 100644
index 00000000000..ff2716f21d3
--- /dev/null
+++ b/pkgs/stdenv/nix-linux-static/scripts/add-symlink.sh
@@ -0,0 +1,13 @@
+chmod u+w $out/include
+(cd $out/include && ln -s $extra/include/* .) || exit 1
+
+cd $out
+find . -not -type l -exec $extra2/bin/chmod u+w {} \;
+find . -exec $patchelf --interpreter $out/lib/ld-linux.so.2 --shrink-rpath {} \; || true
+
+$extra2/bin/rm -rf bin
+
+$extra2/bin/cat ./lib/libc.so | $extra4/bin/sed "s|/nix/store/[a-z0-9]*-glibc|$out|g" > ./lib/libc.so
+$extra2/bin/cat ./lib/libpthread.so | $extra4/bin/sed "s|/nix/store/[a-z0-9]*-glibc|$out|g" > ./lib/libpthread.so
+
+rm $out/lib/*.so*
diff --git a/pkgs/stdenv/nix-linux-static/scripts/builder-stdenv-initial.sh b/pkgs/stdenv/nix-linux-static/scripts/builder-stdenv-initial.sh
new file mode 100644
index 00000000000..bb9728af6dd
--- /dev/null
+++ b/pkgs/stdenv/nix-linux-static/scripts/builder-stdenv-initial.sh
@@ -0,0 +1,10 @@
+set -x
+set -e
+
+PATH=$coreutils/bin
+
+mkdir $out
+
+cat > $out/setup <<EOF
+PATH=$coreutils/bin:$gnused/bin
+EOF
\ No newline at end of file
diff --git a/pkgs/stdenv/nix-linux-static/scripts/curl-unpack b/pkgs/stdenv/nix-linux-static/scripts/curl-unpack
new file mode 100644
index 00000000000..b62465e5e56
--- /dev/null
+++ b/pkgs/stdenv/nix-linux-static/scripts/curl-unpack
@@ -0,0 +1,8 @@
+set -x
+set -e
+
+echo $curl
+
+$gunzip -d < $curl | $tar xvf -
+
+$cp -prvd * $out
diff --git a/pkgs/stdenv/nix-linux-static/scripts/download-script b/pkgs/stdenv/nix-linux-static/scripts/download-script
new file mode 100644
index 00000000000..a3cf210df15
--- /dev/null
+++ b/pkgs/stdenv/nix-linux-static/scripts/download-script
@@ -0,0 +1,18 @@
+set -e
+
+echo "using curl executable $curl"
+
+$curl/bin/curl "$url" > .tmp
+
+$gunzip -d < .tmp | $tar xvf -
+
+$cp -prd * $out
+
+if test -n "$postProcess"; then
+    for i in $addToPath; do
+        export PATH=$PATH:$i/bin
+    done
+    for i in $postProcess; do
+        source $i
+    done
+fi
diff --git a/pkgs/stdenv/nix-linux-static/tools/cp b/pkgs/stdenv/nix-linux-static/tools/cp
new file mode 100755
index 00000000000..b5974d88350
--- /dev/null
+++ b/pkgs/stdenv/nix-linux-static/tools/cp
Binary files differdiff --git a/pkgs/system/all-packages-generic.nix b/pkgs/system/all-packages-generic.nix
index 7e92044d662..1ccbe549a55 100644
--- a/pkgs/system/all-packages-generic.nix
+++ b/pkgs/system/all-packages-generic.nix
@@ -869,6 +869,10 @@ rec {
     inherit fetchurl stdenv;
   };
 
+  modutils = (import ../os-specific/linux/modutils) {
+    inherit fetchurl stdenv bison flex;
+  };
+
   shadowutils = (import ../os-specific/linux/shadow) {
     inherit fetchurl stdenv;
   };
diff --git a/pkgs/system/stdenvs.nix b/pkgs/system/stdenvs.nix
index 7399767f707..efbbcb0faad 100644
--- a/pkgs/system/stdenvs.nix
+++ b/pkgs/system/stdenvs.nix
@@ -28,41 +28,46 @@
     inherit genericStdenv gccWrapper;
   };
 
-  stdenvNativePkgsFun = bootstrap: allPackages {
+  stdenvNativePkgs = allPackages {
     stdenv = stdenvNative;
     bootCurl = null;
     noSysDirs = false;
-    gccWithCC = !bootstrap;
-    gccWithProfiling = !bootstrap;
   };
 
-  stdenvNativePkgs = stdenvNativePkgsFun false;
-
 
   # The Nix build environment.
-  stdenvNixFun = bootstrap: (import ../stdenv/nix) {
+  stdenvNix = (import ../stdenv/nix) {
     stdenv = stdenvNative;
-    pkgs = stdenvNativePkgsFun bootstrap;
+    pkgs = stdenvNativePkgs;
     inherit genericStdenv gccWrapper;
   };
 
-  stdenvNix = stdenvNixFun false;
-
-  stdenvNixPkgsFun = bootstrap: allPackages {
-    stdenv = stdenvNixFun bootstrap;
-    bootCurl = (stdenvNativePkgsFun bootstrap).curl;
+  stdenvNixPkgs = allPackages {
+    stdenv = stdenvNix;
+    bootCurl = stdenvNativePkgs.curl;
     noSysDirs = false;
   };
 
-  stdenvNixPkgs = stdenvNixPkgs false;
-
 
   # The Linux build environment is a fully bootstrapped Nix
   # environment, that is, it should contain no external references.
 
+  # 0) ...
+  stdenvLinuxBoot0 = (import ../stdenv/nix-linux-static).stdenvBootFun {
+    # Use the statically linked, downloaded glibc/gcc/binutils.
+    inherit (import ../stdenv/nix-linux-static) glibc gcc binutils;
+    staticGlibc = true;
+  };
+
+  stdenvLinuxBoot0Pkgs = allPackages {
+    stdenv = stdenvLinuxBoot0;
+    bootCurl = (import ../stdenv/nix-linux-static).curl;
+    noSysDirs = true;
+  };
+
   # 1) Build glibc in the Nix build environment.  The result is
   #    pure.
-  stdenvLinuxGlibc = (stdenvNixPkgsFun true).glibc;
+  stdenvLinuxGlibc = stdenvLinuxBoot0Pkgs.glibc;
 
   # 2) Construct a stdenv consisting of the Nix build environment, but
   #    with a gcc-wrapper that causes linking against the glibc from
@@ -70,11 +75,12 @@
   #    native system directories (e.g., `/usr/lib'), it doesn't
   #    prevent impurity in the things it builds (e.g., through
   #    `-lncurses').
-  stdenvLinuxBoot1 = (import ../stdenv/nix-linux) {
-    stdenv = stdenvNative;
-    pkgs = stdenvNativePkgsFun true;
+  stdenvLinuxBoot1 = (import ../stdenv/nix-linux-static).stdenvBootFun {
+    # Use the statically linked gcc/binutils, but the glibc we just
+    # built.
     glibc = stdenvLinuxGlibc;
-    inherit genericStdenv gccWrapper;
+    staticGlibc = false;
+    inherit (import ../stdenv/nix-linux-static) gcc binutils;
   };
 
   # 3) Now we can build packages that will link against the Nix
@@ -84,36 +90,33 @@
   #    *doesn't* search in `/lib' etc.  So these programs won't work.
   stdenvLinuxBoot1Pkgs = allPackages {
     stdenv = stdenvLinuxBoot1;
-    bootCurl = (stdenvNativePkgsFun true).curl;
-    noSysDirs = true;
-    gccWithCC = false;
-    gccWithProfiling = false;
+    bootCurl = (import ../stdenv/nix-linux-static).curl;
   };
 
   # 4) Therefore we build a new standard environment which is the same
   #    as the one in step 2, but with a gcc and binutils from step 3
   #    merged in.  Since these are pure (they don't search native
   #    system directories), things built by this stdenv should be pure.
-  stdenvLinuxBoot2 = (import ../stdenv/nix-linux) {
-    stdenv = stdenvLinuxBoot1;
-    pkgs = (stdenvNativePkgsFun true) // {
-      inherit (stdenvLinuxBoot1Pkgs) gcc binutils;
-    };
+  stdenvLinuxBoot2 = (import ../stdenv/nix-linux-static).stdenvBootFun {
+    # Use the glibc/gcc/binutils we just built (but all other tools are still downloaded).
     glibc = stdenvLinuxGlibc;
-    inherit genericStdenv gccWrapper;
+    staticGlibc = false;
+    inherit (stdenvLinuxBoot1Pkgs) gcc binutils;
   };
 
   # 5) So these packages should be pure.
   stdenvLinuxBoot2Pkgs = allPackages {
     stdenv = stdenvLinuxBoot2;
-    bootCurl = (stdenvNativePkgsFun true).curl;
+    bootCurl = (import ../stdenv/nix-linux-static).curl;
   };
 
   # 6) Finally we can construct the Nix build environment from the
   #    packages from step 5.
   stdenvLinux = (import ../stdenv/nix-linux) {
     stdenv = stdenvLinuxBoot2;
-    pkgs = stdenvLinuxBoot2Pkgs;
+    pkgs = stdenvLinuxBoot2Pkgs // {
+      inherit (stdenvLinuxBoot1Pkgs) gcc binutils;
+    };
     glibc = stdenvLinuxGlibc;
     inherit genericStdenv gccWrapper;
   };
@@ -148,7 +151,7 @@
   # (essentially it's just the native environment).
   stdenvDarwin = (import ../stdenv/darwin) {
     stdenv = stdenvInitial;
-    genericStdenv = import ../stdenv/generic;
+    genericStdenv = import ../stdenv/generic-branch;
     inherit gccWrapper;
   };
 
@@ -157,5 +160,11 @@
     bootCurl = null;
     noSysDirs = false;
   };
-  
+
+
+  stdenvTestPkgs = allPackages {
+    stdenv = (import ../stdenv/nix-linux-static).stdenvInitial;
+    bootCurl = (import ../stdenv/nix-linux-static).curl;
+    noSysDirs = true;
+  };
 }
diff --git a/pkgs/tools/networking/curl/configure-cxxcpp.patch b/pkgs/tools/networking/curl/configure-cxxcpp.patch
new file mode 100644
index 00000000000..5b8bc85cb15
--- /dev/null
+++ b/pkgs/tools/networking/curl/configure-cxxcpp.patch
@@ -0,0 +1,21 @@
+diff -ruN curl-7.12.2/configure curl-7.12.2-new/configure
+--- curl-7.12.2/configure	2004-10-18 00:22:10.000000000 +0200
++++ curl-7.12.2-new/configure	2004-12-09 13:58:57.670095179 +0100
+@@ -6835,11 +6835,12 @@
+ if $ac_preproc_ok; then
+   :
+ else
+-  { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details." >&5
+-echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+-See \`config.log' for more details." >&2;}
+-   { (exit 1); exit 1; }; }
++  #{ { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
++#See \`config.log' for more details." >&5
++#echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
++#See \`config.log' for more details." >&2;}
++   #{ (exit 1); exit 1; }; }
++  :
+ fi
+ 
+ ac_ext=cc
diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index e1f99d5b9aa..a5d0d9e561f 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -7,5 +7,6 @@ stdenv.mkDerivation {
     md5 = "47db6619b849600ba2771074f00da517";
   };
   buildInputs = [zlib];
+  patches = [./configure-cxxcpp.patch];
   configureFlags = "--without-ssl";
 }
diff --git a/pkgs/tools/networking/openssh/builder.sh b/pkgs/tools/networking/openssh/builder.sh
index f9fc634dce9..d5d4cb6a1cc 100644
--- a/pkgs/tools/networking/openssh/builder.sh
+++ b/pkgs/tools/networking/openssh/builder.sh
@@ -1,9 +1,11 @@
 . $stdenv/setup
 
+
 configureFlags="--with-privsep-path=$out/empty"
  
-genericBuild
+installPhase() {
+   make install-nokeys
+}
+installPhase=installPhase
 
-rm $out/etc/ssh_host_dsa_key $out/etc/ssh_host_dsa_key.pub $out/etc/ssh_host_key $out/etc/ssh_host_key.pub $out/etc/ssh_host_rsa_key $out/etc/ssh_host_rsa_key.pub
-
-chmod +r $out/libexec/ssh-keysign
+genericBuild