summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2013-12-28 18:26:50 +0100
committerVladimír Čunát <vcunat@gmail.com>2013-12-28 18:51:23 +0100
commitcb639302df235bc1a9a3f1c14901c021813ee6b5 (patch)
tree8da28d8c378ed00f783ee59c662b1bc4b1ac5fcc /pkgs
parent2265bab69d888abc8e82d31b0ee3fdee409102ca (diff)
parent28188fca3a6f56fc2d21485f0e14934901665cba (diff)
downloadnixpkgs-cb639302df235bc1a9a3f1c14901c021813ee6b5.tar
nixpkgs-cb639302df235bc1a9a3f1c14901c021813ee6b5.tar.gz
nixpkgs-cb639302df235bc1a9a3f1c14901c021813ee6b5.tar.bz2
nixpkgs-cb639302df235bc1a9a3f1c14901c021813ee6b5.tar.lz
nixpkgs-cb639302df235bc1a9a3f1c14901c021813ee6b5.tar.xz
nixpkgs-cb639302df235bc1a9a3f1c14901c021813ee6b5.tar.zst
nixpkgs-cb639302df235bc1a9a3f1c14901c021813ee6b5.zip
Merge glibc-2.18 branch into stdenv-updates
It's to separate from other changes coming from master.

Conflicts:
	pkgs/development/libraries/glibc/2.18/common.nix (taking both changes)
	pkgs/development/libraries/ncurses/5_4.nix (deleted)
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/graphics/ImageMagick/default.nix4
-rw-r--r--pkgs/applications/window-managers/dzen2/default.nix36
-rw-r--r--pkgs/development/compilers/gcc/4.4/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/4.5/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/4.6/default.nix2
-rw-r--r--pkgs/development/libraries/boost/1.44.nix1
-rw-r--r--pkgs/development/libraries/boost/1.49.nix2
-rw-r--r--pkgs/development/libraries/boost/1.53.nix91
-rw-r--r--pkgs/development/libraries/boost/1.54.nix91
-rw-r--r--pkgs/development/libraries/boost/boost-149-cstdint.patch15
-rw-r--r--pkgs/development/libraries/check/default.nix3
-rw-r--r--pkgs/development/libraries/glibc/2.13/builder.sh54
-rw-r--r--pkgs/development/libraries/glibc/2.13/catalan-firstdays.patch13
-rw-r--r--pkgs/development/libraries/glibc/2.13/common.nix244
-rw-r--r--pkgs/development/libraries/glibc/2.13/default.nix99
-rw-r--r--pkgs/development/libraries/glibc/2.13/dont_use_system_ld_so_cache.patch43
-rw-r--r--pkgs/development/libraries/glibc/2.13/glibc-elf-localscope.patch82
-rw-r--r--pkgs/development/libraries/glibc/2.13/info.nix26
-rw-r--r--pkgs/development/libraries/glibc/2.13/locales.nix47
-rw-r--r--pkgs/development/libraries/glibc/2.13/nix-locale-archive.patch116
-rw-r--r--pkgs/development/libraries/glibc/2.13/nss-skip-unavail.patch21
-rw-r--r--pkgs/development/libraries/glibc/2.13/rpcgen-path.patch72
-rw-r--r--pkgs/development/libraries/glibc/2.17/cve-2013-0242.patch87
-rw-r--r--pkgs/development/libraries/glibc/2.17/cve-2013-1914.patch52
-rw-r--r--pkgs/development/libraries/glibc/2.17/glibc-elf-localscope.patch82
-rw-r--r--pkgs/development/libraries/glibc/2.17/locales-builder.sh17
-rw-r--r--pkgs/development/libraries/glibc/2.17/locales.nix47
-rw-r--r--pkgs/development/libraries/glibc/2.18/builder.sh (renamed from pkgs/development/libraries/glibc/2.17/builder.sh)23
-rw-r--r--pkgs/development/libraries/glibc/2.18/common.nix (renamed from pkgs/development/libraries/glibc/2.17/common.nix)18
-rw-r--r--pkgs/development/libraries/glibc/2.18/cve-2012-4412+4424.patch1006
-rw-r--r--pkgs/development/libraries/glibc/2.18/cve-2013-4237.patch302
-rw-r--r--pkgs/development/libraries/glibc/2.18/cve-2013-4332.patch56
-rw-r--r--pkgs/development/libraries/glibc/2.18/cve-2013-4458.patch50
-rw-r--r--pkgs/development/libraries/glibc/2.18/cve-2013-4788.patch222
-rw-r--r--pkgs/development/libraries/glibc/2.18/default.nix (renamed from pkgs/development/libraries/glibc/2.17/default.nix)0
-rw-r--r--pkgs/development/libraries/glibc/2.18/dont-use-system-ld-so-cache.patch (renamed from pkgs/development/libraries/glibc/2.17/dont-use-system-ld-so-cache.patch)0
-rw-r--r--pkgs/development/libraries/glibc/2.18/fix_path_attribute_in_getconf.patch (renamed from pkgs/development/libraries/glibc/2.17/fix_path_attribute_in_getconf.patch)0
-rw-r--r--pkgs/development/libraries/glibc/2.18/glibc-crypt-blowfish.patch (renamed from pkgs/development/libraries/glibc/2.17/glibc-crypt-blowfish.patch)0
-rw-r--r--pkgs/development/libraries/glibc/2.18/glibc-rh739743.patch (renamed from pkgs/development/libraries/glibc/2.17/glibc-rh739743.patch)0
-rw-r--r--pkgs/development/libraries/glibc/2.18/info.nix (renamed from pkgs/development/libraries/glibc/2.17/info.nix)0
-rw-r--r--pkgs/development/libraries/glibc/2.18/locales-builder.sh (renamed from pkgs/development/libraries/glibc/2.13/locales-builder.sh)0
-rw-r--r--pkgs/development/libraries/glibc/2.18/locales.nix47
-rw-r--r--pkgs/development/libraries/glibc/2.18/nix-locale-archive.patch (renamed from pkgs/development/libraries/glibc/2.17/nix-locale-archive.patch)0
-rw-r--r--pkgs/development/libraries/glibc/2.18/rpcgen-path.patch (renamed from pkgs/development/libraries/glibc/2.17/rpcgen-path.patch)18
-rw-r--r--pkgs/development/libraries/glibc/2.18/scanf.patch21
-rw-r--r--pkgs/development/libraries/gsl/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/DAV/default.nix12
-rw-r--r--pkgs/development/libraries/haskell/async/2.0.1.5.nix17
-rw-r--r--pkgs/development/libraries/haskell/language-c-quote/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/mainland-pretty/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/scientific/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/smallcheck/default.nix4
-rw-r--r--pkgs/development/libraries/ncurses/5_4.nix79
-rw-r--r--pkgs/development/web/nodejs/default.nix2
-rw-r--r--pkgs/development/web/nodejs/no-xcode.patch39
-rw-r--r--pkgs/os-specific/linux/kernel/linux-3.4.nix2
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/legacy304.nix6
-rw-r--r--pkgs/tools/filesystems/jfsrec/default.nix6
-rw-r--r--pkgs/tools/text/source-highlight/default.nix18
-rw-r--r--pkgs/top-level/all-packages.nix54
-rw-r--r--pkgs/top-level/haskell-packages.nix5
-rw-r--r--pkgs/top-level/perl-packages.nix1
62 files changed, 1874 insertions, 1501 deletions
diff --git a/pkgs/applications/graphics/ImageMagick/default.nix b/pkgs/applications/graphics/ImageMagick/default.nix
index aa0bdbfe56c..a3d6eca4fa6 100644
--- a/pkgs/applications/graphics/ImageMagick/default.nix
+++ b/pkgs/applications/graphics/ImageMagick/default.nix
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
       export DVIDecodeDelegate=${tetex}/bin/dvips
     '' else "";
 
-  configureFlags = "" + stdenv.lib.optionalString (ghostscript != null && stdenv.system != "x86_64-darwin") ''
+  configureFlags = "" + stdenv.lib.optionalString (stdenv.system != "x86_64-darwin") ''
     --with-gs-font-dir=${ghostscript}/share/ghostscript/fonts
     --with-gslib
   '' + ''
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs =
     [ bzip2 fontconfig freetype libjpeg libpng libtiff libxml2 zlib librsvg
       libtool jasper libX11
-    ] ++ stdenv.lib.optional (ghostscript != null && stdenv.system != "x86_64-darwin") ghostscript;
+    ] ++ stdenv.lib.optional (stdenv.system != "x86_64-darwin") ghostscript;
 
   buildInputs = [ tetex pkgconfig ];
 
diff --git a/pkgs/applications/window-managers/dzen2/default.nix b/pkgs/applications/window-managers/dzen2/default.nix
new file mode 100644
index 00000000000..b3e970e90be
--- /dev/null
+++ b/pkgs/applications/window-managers/dzen2/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, pkgconfig, libX11, libXft, libXinerama, libXpm }:
+
+stdenv.mkDerivation rec {
+  name = "dzen2-0.9.5";
+
+  buildInputs = [ pkgconfig libX11 libXft libXinerama libXpm ];
+
+  src = fetchurl {
+    url = "https://github.com/robm/dzen/tarball/master/dzen2-0.9.5git.tar.gz";
+    sha256 = "d4f7943cd39dc23fd825eb684b49dc3484860fa8443d30b06ee38af72a53b556";
+  };
+
+  patchPhase = ''
+    CFLAGS=" -Wall -Os ''${INCS} -DVERSION=\"''${VERSION}\" -DDZEN_XINERAMA -DDZEN_XPM -DDZEN_XFT `pkg-config --cflags xft`"
+    LIBS=" -L/usr/lib -lc -lXft -lXpm -lXinerama -lX11"
+    echo "CFLAGS=$CFLAGS" >>config.mk
+    echo "LIBS=$LIBS" >>config.mk
+    echo "LDFLAGS=$LIBS" >>config.mk
+    substituteInPlace config.mk --replace /usr/local "$out"
+    substituteInPlace gadgets/config.mk --replace /usr/local "$out"
+  '';
+
+  buildPhase = ''
+    mkdir -p $out/bin $out/man/man1
+    make clean install
+    cd gadgets
+    make clean install
+  '';
+
+  meta = {
+    homepage = https://github.com/robm/dzen;
+    license = stdenv.lib.licenses.mit;
+    description = "X notification utility";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/development/compilers/gcc/4.4/default.nix b/pkgs/development/compilers/gcc/4.4/default.nix
index 4d896a14e8f..e81ca398319 100644
--- a/pkgs/development/compilers/gcc/4.4/default.nix
+++ b/pkgs/development/compilers/gcc/4.4/default.nix
@@ -246,7 +246,7 @@ stdenv.mkDerivation ({
       enableMultilib version; };
 
   # ghdl does not build fine with parallel building
-  enableParallelBuilding = !langVhdl;
+  enableParallelBuilding = !langVhdl && !langAda;
 
   meta = {
     homepage = http://gcc.gnu.org/;
diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix
index cb0432b6672..e63ff7947f6 100644
--- a/pkgs/development/compilers/gcc/4.5/default.nix
+++ b/pkgs/development/compilers/gcc/4.5/default.nix
@@ -360,7 +360,7 @@ stdenv.mkDerivation ({
   passthru = { inherit langC langCC langAda langFortran langVhdl
       enableMultilib version; };
 
-  enableParallelBuilding = true;
+  enableParallelBuilding = !langAda;
 
   meta = {
     homepage = http://gcc.gnu.org/;
diff --git a/pkgs/development/compilers/gcc/4.6/default.nix b/pkgs/development/compilers/gcc/4.6/default.nix
index d7d9325ca4f..35255d0af5b 100644
--- a/pkgs/development/compilers/gcc/4.6/default.nix
+++ b/pkgs/development/compilers/gcc/4.6/default.nix
@@ -434,7 +434,7 @@ stdenv.mkDerivation ({
   passthru = { inherit langC langCC langAda langFortran langVhdl
       langGo version; };
 
-  enableParallelBuilding = true;
+  enableParallelBuilding = !langAda;
 
   inherit (stdenv) is64bit;
 
diff --git a/pkgs/development/libraries/boost/1.44.nix b/pkgs/development/libraries/boost/1.44.nix
index 7ed3c311de2..b188586e84f 100644
--- a/pkgs/development/libraries/boost/1.44.nix
+++ b/pkgs/development/libraries/boost/1.44.nix
@@ -69,6 +69,7 @@ stdenv.mkDerivation {
        sha256 = "15k91ihzs6190pnryh4cl0b3c2pjpl9d790mr14x16zq52y7px2d";
      })
     ./time_utc_144.patch
+    ./boost-149-cstdint.patch
   ];
 
   crossAttrs = rec {
diff --git a/pkgs/development/libraries/boost/1.49.nix b/pkgs/development/libraries/boost/1.49.nix
index 6035232caf6..f502df4e19c 100644
--- a/pkgs/development/libraries/boost/1.49.nix
+++ b/pkgs/development/libraries/boost/1.49.nix
@@ -57,7 +57,7 @@ stdenv.mkDerivation {
   };
 
   # See <http://svn.boost.org/trac/boost/ticket/4688>.
-  patches = [ ./boost_filesystem_post_1_49_0.patch ./time_utc.patch ] ++ (stdenv.lib.optional stdenv.isDarwin ./boost-149-darwin.patch );
+  patches = [ ./boost_filesystem_post_1_49_0.patch ./time_utc.patch ./boost-149-cstdint.patch ] ++ (stdenv.lib.optional stdenv.isDarwin ./boost-149-darwin.patch );
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/boost/1.53.nix b/pkgs/development/libraries/boost/1.53.nix
deleted file mode 100644
index ff09dfd5954..00000000000
--- a/pkgs/development/libraries/boost/1.53.nix
+++ /dev/null
@@ -1,91 +0,0 @@
-{ stdenv, fetchurl, icu, expat, zlib, bzip2, python
-, enableRelease ? true
-, enableDebug ? false
-, enableSingleThreaded ? false
-, enableMultiThreaded ? true
-, enableShared ? true
-, enableStatic ? false
-, enablePIC ? false
-, enableExceptions ? false
-, taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic))
-}:
-
-let
-
-  variant = stdenv.lib.concatStringsSep ","
-    (stdenv.lib.optional enableRelease "release" ++
-     stdenv.lib.optional enableDebug "debug");
-
-  threading = stdenv.lib.concatStringsSep ","
-    (stdenv.lib.optional enableSingleThreaded "single" ++
-     stdenv.lib.optional enableMultiThreaded "multi");
-
-  link = stdenv.lib.concatStringsSep ","
-    (stdenv.lib.optional enableShared "shared" ++
-     stdenv.lib.optional enableStatic "static");
-
-  # To avoid library name collisions
-  layout = if taggedLayout then "tagged" else "system";
-
-  cflags = if enablePIC && enableExceptions then
-             "cflags=\"-fPIC -fexceptions\" cxxflags=-fPIC linkflags=-fPIC"
-           else if enablePIC then
-             "cflags=-fPIC cxxflags=-fPIC linkflags=-fPIC"
-           else if enableExceptions then
-             "cflags=-fexceptions"
-           else
-             "";
-in
-
-stdenv.mkDerivation {
-  name = "boost-1.53.0";
-
-  meta = {
-    homepage = "http://boost.org/";
-    description = "Boost C++ Library Collection";
-    license = "boost-license";
-
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.simons ];
-  };
-
-  src = fetchurl {
-    url = "mirror://sourceforge/boost/boost_1_53_0.tar.bz2";
-    sha256 = "15livg6y1l3gdsg6ybvp3y4gp0w3xh1rdcq5bjf0qaw804dh92pq";
-  };
-
-  enableParallelBuilding = true;
-
-  buildInputs = [icu expat zlib bzip2 python];
-
-  configureScript = "./bootstrap.sh";
-  configureFlags = "--with-icu=${icu} --with-python=${python}/bin/python";
-
-  buildPhase = "./b2 -j$NIX_BUILD_CORES -sEXPAT_INCLUDE=${expat}/include -sEXPAT_LIBPATH=${expat}/lib --layout=${layout} variant=${variant} threading=${threading} link=${link} ${cflags} install";
-
-  # normal install does not install bjam, this is a separate step
-  installPhase = ''
-    cd tools/build/v2
-    sh bootstrap.sh
-    ./b2 -j$NIX_BUILD_CORES -sEXPAT_INCLUDE=${expat}/include -sEXPAT_LIBPATH=${expat}/lib --layout=${layout} variant=${variant} threading=${threading} link=${link} ${cflags} install
-  '';
-
-  crossAttrs = rec {
-    buildInputs = [ expat.crossDrv zlib.crossDrv bzip2.crossDrv ];
-    # all buildInputs set previously fell into propagatedBuildInputs, as usual, so we have to
-    # override them.
-    propagatedBuildInputs = buildInputs;
-    # We want to substitute the contents of configureFlags, removing thus the
-    # usual --build and --host added on cross building.
-    preConfigure = ''
-      export configureFlags="--prefix=$out --without-icu"
-    '';
-    buildPhase = ''
-      set -x
-      cat << EOF > user-config.jam
-      using gcc : cross : $crossConfig-g++ ;
-      EOF
-      ./b2 -j$NIX_BUILD_CORES -sEXPAT_INCLUDE=${expat.crossDrv}/include -sEXPAT_LIBPATH=${expat.crossDrv}/lib --layout=${layout} --user-config=user-config.jam toolset=gcc-cross variant=${variant} threading=${threading} link=${link} ${cflags} --without-python install
-    '';
-  };
-}
diff --git a/pkgs/development/libraries/boost/1.54.nix b/pkgs/development/libraries/boost/1.54.nix
deleted file mode 100644
index ba4252feaa5..00000000000
--- a/pkgs/development/libraries/boost/1.54.nix
+++ /dev/null
@@ -1,91 +0,0 @@
-{ stdenv, fetchurl, icu, expat, zlib, bzip2, python
-, enableRelease ? true
-, enableDebug ? false
-, enableSingleThreaded ? false
-, enableMultiThreaded ? true
-, enableShared ? true
-, enableStatic ? false
-, enablePIC ? false
-, enableExceptions ? false
-, taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic))
-}:
-
-let
-
-  variant = stdenv.lib.concatStringsSep ","
-    (stdenv.lib.optional enableRelease "release" ++
-     stdenv.lib.optional enableDebug "debug");
-
-  threading = stdenv.lib.concatStringsSep ","
-    (stdenv.lib.optional enableSingleThreaded "single" ++
-     stdenv.lib.optional enableMultiThreaded "multi");
-
-  link = stdenv.lib.concatStringsSep ","
-    (stdenv.lib.optional enableShared "shared" ++
-     stdenv.lib.optional enableStatic "static");
-
-  # To avoid library name collisions
-  layout = if taggedLayout then "tagged" else "system";
-
-  cflags = if enablePIC && enableExceptions then
-             "cflags=\"-fPIC -fexceptions\" cxxflags=-fPIC linkflags=-fPIC"
-           else if enablePIC then
-             "cflags=-fPIC cxxflags=-fPIC linkflags=-fPIC"
-           else if enableExceptions then
-             "cflags=-fexceptions"
-           else
-             "";
-in
-
-stdenv.mkDerivation {
-  name = "boost-1.54.0";
-
-  meta = {
-    homepage = "http://boost.org/";
-    description = "Boost C++ Library Collection";
-    license = "boost-license";
-
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.simons ];
-  };
-
-  src = fetchurl {
-    url = "mirror://sourceforge/boost/boost_1_54_0.tar.bz2";
-    sha256 = "07df925k56pbz3gvhxpx54aij34qd40a7sxw4im11brnwdyr4zh4";
-  };
-
-  enableParallelBuilding = true;
-
-  buildInputs = [icu expat zlib bzip2 python];
-
-  configureScript = "./bootstrap.sh";
-  configureFlags = "--with-icu=${icu} --with-python=${python}/bin/python";
-
-  buildPhase = "./b2 -j$NIX_BUILD_CORES -sEXPAT_INCLUDE=${expat}/include -sEXPAT_LIBPATH=${expat}/lib --layout=${layout} variant=${variant} threading=${threading} link=${link} ${cflags} install";
-
-  # normal install does not install bjam, this is a separate step
-  installPhase = ''
-    cd tools/build/v2
-    sh bootstrap.sh
-    ./b2 -j$NIX_BUILD_CORES -sEXPAT_INCLUDE=${expat}/include -sEXPAT_LIBPATH=${expat}/lib --layout=${layout} variant=${variant} threading=${threading} link=${link} ${cflags} install
-  '';
-
-  crossAttrs = rec {
-    buildInputs = [ expat.crossDrv zlib.crossDrv bzip2.crossDrv ];
-    # all buildInputs set previously fell into propagatedBuildInputs, as usual, so we have to
-    # override them.
-    propagatedBuildInputs = buildInputs;
-    # We want to substitute the contents of configureFlags, removing thus the
-    # usual --build and --host added on cross building.
-    preConfigure = ''
-      export configureFlags="--prefix=$out --without-icu"
-    '';
-    buildPhase = ''
-      set -x
-      cat << EOF > user-config.jam
-      using gcc : cross : $crossConfig-g++ ;
-      EOF
-      ./b2 -j$NIX_BUILD_CORES -sEXPAT_INCLUDE=${expat.crossDrv}/include -sEXPAT_LIBPATH=${expat.crossDrv}/lib --layout=${layout} --user-config=user-config.jam toolset=gcc-cross variant=${variant} threading=${threading} link=${link} ${cflags} --without-python install
-    '';
-  };
-}
diff --git a/pkgs/development/libraries/boost/boost-149-cstdint.patch b/pkgs/development/libraries/boost/boost-149-cstdint.patch
new file mode 100644
index 00000000000..94c7b471666
--- /dev/null
+++ b/pkgs/development/libraries/boost/boost-149-cstdint.patch
@@ -0,0 +1,15 @@
+diff -ru -x '*~' boost_1_49_0-orig/boost/cstdint.hpp boost_1_49_0/boost/cstdint.hpp
+--- boost_1_49_0-orig/boost/cstdint.hpp	2012-01-29 22:58:13.000000000 +0100
++++ boost_1_49_0/boost/cstdint.hpp	2013-12-10 11:48:19.304042208 +0100
+@@ -41,7 +41,10 @@
+ // so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG.
+ // See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990
+ //
+-#if defined(BOOST_HAS_STDINT_H) && (!defined(__GLIBC__) || defined(__GLIBC_HAVE_LONG_LONG))
++#if defined(BOOST_HAS_STDINT_H)					\
++  && (!defined(__GLIBC__)					\
++      || defined(__GLIBC_HAVE_LONG_LONG)			\
++      || (defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 17)))))
+ 
+ // The following #include is an implementation artifact; not part of interface.
+ # ifdef __hpux
diff --git a/pkgs/development/libraries/check/default.nix b/pkgs/development/libraries/check/default.nix
index 9888da5c3ec..a424041dbc2 100644
--- a/pkgs/development/libraries/check/default.nix
+++ b/pkgs/development/libraries/check/default.nix
@@ -9,7 +9,8 @@ stdenv.mkDerivation {
     sha256 = "0dk9jx9hjjwsgly0iwvr5hhw870zlx21gwar7zxlzfq0zdzqqkpa";
   };
 
-  doCheck = true;
+  # Test can randomly fail: http://hydra.nixos.org/build/7243912
+  doCheck = false;
 
   meta = {
     description = "Check, a unit testing framework for C";
diff --git a/pkgs/development/libraries/glibc/2.13/builder.sh b/pkgs/development/libraries/glibc/2.13/builder.sh
deleted file mode 100644
index e68e13f9bec..00000000000
--- a/pkgs/development/libraries/glibc/2.13/builder.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-# Glibc cannot have itself in its RPATH.
-export NIX_NO_SELF_RPATH=1
-
-source $stdenv/setup
-
-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=
-
-    export NIX_DONT_SET_RPATH=1
-    unset CFLAGS
-}
-
-
-postInstall() {
-    if test -n "$installLocales"; then
-        make -j${NIX_BUILD_CORES:-1} -l${NIX_BUILD_CORES:-1} localedata/install-locales
-    fi
-    
-    test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache
-
-    # FIXME: Use `test -n $linuxHeaders' when `kernelHeaders' has been
-    # renamed.
-    if test -z "$hurdHeaders"; then
-        # Include the Linux kernel headers in Glibc, except the `scsi'
-        # subdirectory, which Glibc provides itself.
-	(cd $out/include && \
-	 ln -sv $(ls -d $kernelHeaders/include/* | grep -v 'scsi$') .)
-    fi
-
-    if test -f "$out/lib/libhurduser.so"; then
-	# libc.so, libhurduser.so, and libmachuser.so depend on each
-	# other, so add them to libc.so (a RUNPATH on libc.so.0.3
-	# would be ignored by the cross-linker.)
-	echo "adding \`libhurduser.so' and \`libmachuser.so' to the \`libc.so' linker script..."
-	sed -i "$out/lib/libc.so" \
-	    -e"s|\(libc\.so\.[^ ]\+\>\)|\1 $out/lib/libhurduser.so $out/lib/libmachuser.so|g"
-    fi
-	
-    # Fix for NIXOS-54 (ldd not working on x86_64).  Make a symlink
-    # "lib64" to "lib".
-    if test -n "$is64bit"; then
-        ln -s lib $out/lib64
-    fi
-
-    # This file, that should not remain in the glibc derivation,
-    # may have not been created during the preInstall
-    rm -f $out/lib/libgcc_s.so.1
-}
-
-genericBuild
diff --git a/pkgs/development/libraries/glibc/2.13/catalan-firstdays.patch b/pkgs/development/libraries/glibc/2.13/catalan-firstdays.patch
deleted file mode 100644
index 674e0aee884..00000000000
--- a/pkgs/development/libraries/glibc/2.13/catalan-firstdays.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-https://bugzilla.redhat.com/show_bug.cgi?id=454629
-
---- glibc-20090510T1842/localedata/locales/ca_ES.orig	2009-06-26 14:05:18.422043552 +0200
-+++ glibc-20090510T1842/localedata/locales/ca_ES	2009-06-26 14:05:38.292042700 +0200
-@@ -138,6 +138,8 @@
- date_fmt	"<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
- <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
- <U0025><U005A><U0020><U0025><U0059>"
-+first_weekday   2
-+first_workday   2
- END LC_TIME
- 
- LC_PAPER
diff --git a/pkgs/development/libraries/glibc/2.13/common.nix b/pkgs/development/libraries/glibc/2.13/common.nix
deleted file mode 100644
index eca215c3131..00000000000
--- a/pkgs/development/libraries/glibc/2.13/common.nix
+++ /dev/null
@@ -1,244 +0,0 @@
-/* Build configuration used to build glibc, Info files, and locale
-   information.  */
-
-cross :
-
-{ name, fetchurl, stdenv, installLocales ? false
-, gccCross ? null, kernelHeaders ? null
-, machHeaders ? null, hurdHeaders ? null, libpthreadHeaders ? null
-, mig ? null, fetchgit ? null
-, profilingLibraries ? false, meta
-, preConfigure ? "", ... }@args :
-
-let
-  # For GNU/Hurd, see below.
-  version = if hurdHeaders != null then "20120223" else "2.13";
-
-  needsPortsNative = stdenv.isMips || stdenv.isArm;
-  needsPortsCross = cross.arch == "mips" || cross.arch == "arm";
-  needsPorts =
-    if (stdenv ? cross) && stdenv.cross != null && hurdHeaders == null then true
-    else if cross == null then needsPortsNative
-    else needsPortsCross;
-
-  srcPorts = fetchurl {
-    url = "mirror://gnu/glibc/glibc-ports-2.13.tar.bz2";
-    sha256 = "0npffql62m1xba15l1wkaqf2p0l2bvb33720gx28764jmq0la75i";
-  };
-
-in
-
-assert (cross != null) -> (gccCross != null);
-
-assert (mig != null) -> (machHeaders != null);
-assert (machHeaders != null) -> (hurdHeaders != null);
-assert (hurdHeaders != null) -> (libpthreadHeaders != null);
-assert (hurdHeaders != null) -> (fetchgit != null);
-
-stdenv.mkDerivation ({
-  inherit kernelHeaders installLocales;
-
-  # The host/target system.
-  crossConfig = if cross != null then cross.config else null;
-
-  inherit (stdenv) is64bit;
-
-  enableParallelBuilding = true;
-
-  patches =
-    stdenv.lib.optional (fetchgit == null)
-    /* Fix for NIXPKGS-79: when doing host name lookups, when
-       nsswitch.conf contains a line like
-
-         hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
-
-       don't return an error when mdns4_minimal can't be found.  This
-       is a bug in Glibc: when a service can't be found, NSS should
-       continue to the next service unless "UNAVAIL=return" is set.
-       ("NOTFOUND=return" refers to the service returning a NOTFOUND
-       error, not the service itself not being found.)  The reason is
-       that the "status" variable (while initialised to UNAVAIL) is
-       outside of the loop that iterates over the services, the
-       "files" service sets status to NOTFOUND.  So when the call to
-       find "mdns4_minimal" fails, "status" will still be NOTFOUND,
-       and it will return instead of continuing to "dns".  Thus, the
-       line
-
-         hosts: mdns4_minimal [NOTFOUND=return] dns mdns4
-
-       does work because "status" will contain UNAVAIL after the
-       failure to find mdns4_minimal. */
-    ./nss-skip-unavail.patch
-  ++ [
-    /* Have rpcgen(1) look for cpp(1) in $PATH.  */
-    ./rpcgen-path.patch
-
-    /* Allow nixos and nix handle the locale-archive. */
-    ./nix-locale-archive.patch
-  ]
-
-  ++ (stdenv.lib.optional (hurdHeaders == null)
-
-      /* Don't use /etc/ld.so.cache, for non-NixOS systems.  Currently
-         disabled on GNU/Hurd, which uses a more recent libc snapshot. */
-         ./dont_use_system_ld_so_cache.patch )
-
-  ++ [
-    /* Without this patch many KDE binaries crash. */
-    ./glibc-elf-localscope.patch
-  ] ++ stdenv.lib.optional installLocales ./catalan-firstdays.patch;
-
-  postPatch = ''
-    # Needed for glibc to build with the gnumake 3.82
-    # http://comments.gmane.org/gmane.linux.lfs.support/31227
-    sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile
-
-    # nscd needs libgcc, and we don't want it dynamically linked
-    # because we don't want it to depend on bootstrap-tools libs.
-    echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
-  '';
-
-  configureFlags = [
-    "-C"
-    "--enable-add-ons"
-    "--sysconfdir=/etc"
-    "--localedir=/var/run/current-system/sw/lib/locale"
-    "libc_cv_ssp=no"
-    (if kernelHeaders != null
-     then "--with-headers=${kernelHeaders}/include"
-     else "--without-headers")
-    (if profilingLibraries
-     then "--enable-profile"
-     else "--disable-profile")
-  ] ++ stdenv.lib.optionals (cross == null && kernelHeaders != null) [
-    "--enable-kernel=2.6.35"
-  ] ++ stdenv.lib.optionals (cross != null) [
-    (if cross.withTLS then "--with-tls" else "--without-tls")
-    (if cross.float == "soft" then "--without-fp" else "--with-fp")
-  ] ++ stdenv.lib.optionals (cross != null
-        && cross.platform ? kernelMajor
-        && cross.platform.kernelMajor == "2.6") [
-    "--enable-kernel=2.6.0"
-    "--with-__thread"
-  ] ++ stdenv.lib.optionals (cross == null &&
-       (stdenv.system == "armv5tel-linux")) [
-    "--host=arm-linux-gnueabi"
-    "--build=arm-linux-gnueabi"
-    "--without-fp"
-
-    # To avoid linking with -lgcc_s (dynamic link)
-    # so the glibc does not depend on its compiler store path
-    "libc_cv_as_needed=no"
-  ] ++ stdenv.lib.optionals (cross == null && stdenv.platform.name == "raspberrypi") [
-    "--host=arm-linux-gnueabi"
-    "--build=arm-linux-gnueabi"
-    "--with-fp"
-
-    # To avoid linking with -lgcc_s (dynamic link)
-    # so the glibc does not depend on its compiler store path
-    "libc_cv_as_needed=no"
-  ];
-
-  installFlags = [ "sysconfdir=$(out)/etc" ];
-  
-  buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ]
-    ++ stdenv.lib.optional (mig != null) mig;
-
-  # Needed to install share/zoneinfo/zone.tab.  Set to impure /bin/sh to
-  # prevent a retained dependency on the bootstrap tools in the stdenv-linux
-  # bootstrap.
-  BASH_SHELL = "/bin/sh";
-
-  # Workaround for this bug:
-  #   http://sourceware.org/bugzilla/show_bug.cgi?id=411
-  # I.e. when gcc is compiled with --with-arch=i686, then the
-  # preprocessor symbol `__i686' will be defined to `1'.  This causes
-  # the symbol __i686.get_pc_thunk.dx to be mangled.
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.system == "i686-linux") "-U__i686";
-}
-
-# Remove the `gccCross' attribute so that the *native* glibc store path
-# doesn't depend on whether `gccCross' is null or not.
-// (removeAttrs args [ "gccCross" ]) //
-
-{
-  name = name + "-${version}" +
-    stdenv.lib.optionalString (cross != null) "-${cross.config}";
-
-  src =
-    if hurdHeaders != null
-    then fetchgit {
-      # Shamefully the "official" glibc won't build on GNU, so use the one
-      # maintained by the Hurd folks, `tschwinge/Roger_Whittaker' branch.
-      # See <http://www.gnu.org/software/hurd/source_repositories/glibc.html>.
-      url = "git://git.sv.gnu.org/hurd/glibc.git";
-      sha256 = "cecec9dd5a2bafc875c56b058b6d7628a22b250b53747513dec304f31ffdb82d";
-      rev = "d3cdecf18e6550b0984a42b43ed48c5fb26501e1";
-    }
-    else fetchurl {
-      url = "mirror://gnu/glibc/glibc-${version}.tar.bz2";
-      sha256 = "1cnv319ysc8nkwpqw6f6ymb6b8hbl0nyvyx48sddkrj50lmcjwq1";
-    };
-
-  # `fetchurl' is a function and thus should not be passed to the
-  # `derivation' primitive.
-  fetchurl = null;
-
-  # Remove absolute paths from `configure' & co.; build out-of-tree.
-  preConfigure = ''
-    export PWD_P=$(type -tP pwd)
-    for i in configure io/ftwtest-sh; do
-        # Can't use substituteInPlace here because replace hasn't been
-        # built yet in the bootstrap.
-        sed -i "$i" -e "s^/bin/pwd^$PWD_P^g"
-    done
-
-    ${if needsPorts then "tar xvf ${srcPorts}" else ""}
-
-    mkdir ../build
-    cd ../build
-
-    configureScript="`pwd`/../$sourceRoot/configure"
-
-    ${preConfigure}
-  '';
-
-  meta = {
-    homepage = http://www.gnu.org/software/libc/;
-    description = "The GNU C Library"
-      + stdenv.lib.optionalString (hurdHeaders != null) ", for GNU/Hurd";
-
-    longDescription =
-      '' Any Unix-like operating system needs a C library: the library which
-         defines the "system calls" and other basic facilities such as
-         open, malloc, printf, exit...
-
-         The GNU C library is used as the C library in the GNU system and
-         most systems with the Linux kernel.
-      '';
-
-    license = "LGPLv2+";
-
-    maintainers = [ ];
-    #platforms = stdenv.lib.platforms.linux;
-  } // meta;
-}
-
-//
-
-(if hurdHeaders != null
- then {
-   # Work around the fact that the configure snippet that looks for
-   # <hurd/version.h> does not honor `--with-headers=$sysheaders' and that
-   # glibc expects Mach, Hurd, and pthread headers to be in the same place.
-   CPATH = "${hurdHeaders}/include:${machHeaders}/include:${libpthreadHeaders}/include";
-
-   # `fetchgit' is a function and thus should not be passed to the
-   # `derivation' primitive.
-   fetchgit = null;
-
-   # Install NSS stuff in the right place.
-   # XXX: This will be needed for all new glibcs and isn't Hurd-specific.
-   makeFlags = ''vardbdir="$out/var/db"'';
- }
- else { }))
diff --git a/pkgs/development/libraries/glibc/2.13/default.nix b/pkgs/development/libraries/glibc/2.13/default.nix
deleted file mode 100644
index f80ed9372e6..00000000000
--- a/pkgs/development/libraries/glibc/2.13/default.nix
+++ /dev/null
@@ -1,99 +0,0 @@
-{ stdenv, fetchurl, kernelHeaders
-, machHeaders ? null, hurdHeaders ? null, libpthreadHeaders ? null
-, mig ? null, fetchgit ? null
-, installLocales ? true
-, profilingLibraries ? false
-, gccCross ? null
-, debugSymbols ? false
-}:
-
-assert stdenv.gcc.gcc != null;
-
-let
-  build = import ./common.nix;
-  cross = if gccCross != null then gccCross.target else null;
-in
-  build cross ({
-    name = "glibc"
-      + stdenv.lib.optionalString (hurdHeaders != null) "-hurd"
-      + stdenv.lib.optionalString debugSymbols "-debug";
-
-    inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries
-      gccCross;
-
-    builder = ./builder.sh;
-
-    # When building glibc from bootstrap-tools, we need libgcc_s at RPATH for
-    # any program we run, because the gcc will have been placed at a new
-    # store path than that determined when built (as a source for the
-    # bootstrap-tools tarball)
-    # Building from a proper gcc staying in the path where it was installed,
-    # libgcc_s will not be at {gcc}/lib, and gcc's libgcc will be found without
-    # any special hack.
-    preInstall = ''
-      if [ -f ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 ]; then
-          mkdir -p $out/lib
-          ln -s ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
-      fi
-    '';
-
-    meta.description = "The GNU C Library";
-  }
-
-  //
-
-  (if debugSymbols
-   then {
-     # Build with debugging symbols, but leave optimizations on and don't
-     # attempt to keep the build tree.
-     dontStrip = true;
-     dontCrossStrip = true;
-     NIX_STRIP_DEBUG = 0;
-   }
-   else {})
-
-  //
-
-  (if hurdHeaders != null
-   then rec {
-     inherit machHeaders hurdHeaders libpthreadHeaders mig fetchgit;
-
-     propagatedBuildInputs = [ machHeaders hurdHeaders libpthreadHeaders ];
-
-     passthru = {
-       # When building GCC itself `propagatedBuildInputs' above is not
-       # honored, so we pass it here so that the GCC builder can do the right
-       # thing.
-       inherit propagatedBuildInputs;
-     };
-   }
-   else { })
-
-  //
-
-  (if cross != null
-   then {
-      preConfigure = ''
-        sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig"
-
-        cat > config.cache << "EOF"
-        libc_cv_forced_unwind=yes
-        libc_cv_c_cleanup=yes
-        libc_cv_gnu89_inline=yes
-        # Only due to a problem in gcc configure scripts:
-        libc_cv_sparc64_tls=${if cross.withTLS then "yes" else "no"}
-        EOF
-        export BUILD_CC=gcc
-        export CC="$crossConfig-gcc"
-        export AR="$crossConfig-ar"
-        export RANLIB="$crossConfig-ranlib"
-
-        dontStrip=1
-      '';
-
-      # To avoid a dependency on the build system 'bash'.
-      preFixup = ''
-        rm $out/bin/{ldd,tzselect,catchsegv,xtrace}
-      '';
-    }
-   else {}))
diff --git a/pkgs/development/libraries/glibc/2.13/dont_use_system_ld_so_cache.patch b/pkgs/development/libraries/glibc/2.13/dont_use_system_ld_so_cache.patch
deleted file mode 100644
index 444eb8251e4..00000000000
--- a/pkgs/development/libraries/glibc/2.13/dont_use_system_ld_so_cache.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-diff -Naur glibc-2.13-orig/elf/ldconfig.c glibc-2.13/elf/ldconfig.c
---- glibc-2.13-orig/elf/ldconfig.c	2011-01-17 23:34:07.000000000 -0500
-+++ glibc-2.13/elf/ldconfig.c	2012-04-10 23:28:45.957492340 -0400
-@@ -51,7 +51,7 @@
- #endif
- 
- #ifndef LD_SO_CONF
--# define LD_SO_CONF SYSCONFDIR "/ld.so.conf"
-+# define LD_SO_CONF PREFIX "/etc/ld.so.conf"
- #endif
- 
- /* Get libc version number.  */
-diff -Naur glibc-2.13-orig/elf/Makefile glibc-2.13/elf/Makefile
---- glibc-2.13-orig/elf/Makefile	2011-01-17 23:34:07.000000000 -0500
-+++ glibc-2.13/elf/Makefile	2012-04-10 23:27:05.666477442 -0400
-@@ -459,11 +459,11 @@
- $(objpfx)sprof: $(libdl)
- 
- $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
--SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
--CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
-+PREFIX-FLAGS := -D'PREFIX="$(prefix)"'
-+CFLAGS-ldconfig.c = $(PREFIX-FLAGS) -D'LIBDIR="$(libdir)"' \
- 		    -D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
--CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
--CFLAGS-cache.c = $(SYSCONF-FLAGS)
-+CFLAGS-dl-cache.c = $(PREFIX-FLAGS)
-+CFLAGS-cache.c = $(PREFIX-FLAGS)
- 
- CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
- 
-diff -Naur glibc-2.13-orig/sysdeps/generic/dl-cache.h glibc-2.13/sysdeps/generic/dl-cache.h
---- glibc-2.13-orig/sysdeps/generic/dl-cache.h	2011-01-17 23:34:07.000000000 -0500
-+++ glibc-2.13/sysdeps/generic/dl-cache.h	2012-04-10 23:28:20.077488815 -0400
-@@ -29,7 +29,7 @@
- #endif
- 
- #ifndef LD_SO_CACHE
--# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
-+# define LD_SO_CACHE PREFIX "/etc/ld.so.cache"
- #endif
- 
- #ifndef add_system_dir
diff --git a/pkgs/development/libraries/glibc/2.13/glibc-elf-localscope.patch b/pkgs/development/libraries/glibc/2.13/glibc-elf-localscope.patch
deleted file mode 100644
index 98f7f81087b..00000000000
--- a/pkgs/development/libraries/glibc/2.13/glibc-elf-localscope.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-diff -ru a/elf/dl-close.c b/elf/dl-close.c
---- a/elf/dl-close.c	2011-02-04 00:35:03.000000000 +0100
-+++ b/elf/dl-close.c	2011-02-22 02:16:12.367883000 +0100
-@@ -180,24 +186,28 @@
-       /* Signal the object is still needed.  */
-       l->l_idx = IDX_STILL_USED;
- 
-+#define mark_used(dmap) \
-+  do {								\
-+    if ((dmap)->l_idx != IDX_STILL_USED)			\
-+      {								\
-+	assert ((dmap)->l_idx >= 0 && (dmap)->l_idx < nloaded);	\
-+								\
-+	if (!used[(dmap)->l_idx])				\
-+	  {							\
-+	    used[(dmap)->l_idx] = 1;				\
-+	    if ((dmap)->l_idx - 1 < done_index)			\
-+	      done_index = (dmap)->l_idx - 1;			\
-+	  }							\
-+      }								\
-+  } while (0)
-+
-       /* Mark all dependencies as used.  */
-       if (l->l_initfini != NULL)
- 	{
- 	  struct link_map **lp = &l->l_initfini[1];
- 	  while (*lp != NULL)
- 	    {
--	      if ((*lp)->l_idx != IDX_STILL_USED)
--		{
--		  assert ((*lp)->l_idx >= 0 && (*lp)->l_idx < nloaded);
--
--		  if (!used[(*lp)->l_idx])
--		    {
--		      used[(*lp)->l_idx] = 1;
--		      if ((*lp)->l_idx - 1 < done_index)
--			done_index = (*lp)->l_idx - 1;
--		    }
--		}
--
-+	      mark_used(*lp);
- 	      ++lp;
- 	    }
- 	}
-@@ -206,19 +216,25 @@
- 	for (unsigned int j = 0; j < l->l_reldeps->act; ++j)
- 	  {
- 	    struct link_map *jmap = l->l_reldeps->list[j];
--
--	    if (jmap->l_idx != IDX_STILL_USED)
--	      {
--		assert (jmap->l_idx >= 0 && jmap->l_idx < nloaded);
--
--		if (!used[jmap->l_idx])
--		  {
--		    used[jmap->l_idx] = 1;
--		    if (jmap->l_idx - 1 < done_index)
--		      done_index = jmap->l_idx - 1;
--		  }
--	      }
-+	    mark_used(jmap);
- 	  }
-+      /* And the same for owners of our scopes; normally, our last
-+	 scope provider would render us unused, but this can be
-+	 prevented by the NODELETE flag. */
-+      if (__builtin_expect(l->l_type == lt_loaded
-+	                   && (l->l_flags_1 & DF_1_NODELETE), 0))
-+	for (size_t cnt = 0; l->l_scope[cnt] != NULL; ++cnt)
-+	  /* This relies on l_scope[] entries being always set either
-+	     to its own l_symbolic_searchlist address, or some map's
-+	     l_searchlist address.  */
-+	  if (l->l_scope[cnt] != &l->l_symbolic_searchlist)
-+	    {
-+	      struct link_map *ls = (struct link_map *)
-+		((char *) l->l_scope[cnt]
-+		 - offsetof (struct link_map, l_searchlist));
-+	      assert (ls->l_ns == nsid);
-+	      mark_used(ls);
-+	    }
-     }
- 
-   /* Sort the entries.  */
diff --git a/pkgs/development/libraries/glibc/2.13/info.nix b/pkgs/development/libraries/glibc/2.13/info.nix
deleted file mode 100644
index 75bd996d9bc..00000000000
--- a/pkgs/development/libraries/glibc/2.13/info.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{ stdenv, fetchurl, texinfo, perl }:
-
-let build = import ./common.nix;
-in
-  /* null cross builder */
-  build null {
-    name = "glibc-info";
-
-    inherit fetchurl stdenv;
-
-    configureFlags = [ "--enable-add-ons" ];
-
-    buildInputs = [ texinfo perl ];
-
-    buildPhase = "make info";
-
-    # I don't know why the info is not generated in 'build'
-    # Somehow building the info still does not work, because the final
-    # libc.info hasn't a Top node.
-    installPhase = ''
-      mkdir -p "$out/share/info"
-      cp -v "../$sourceRoot/manual/"*.info* "$out/share/info"
-    '';
-
-    meta.description = "GNU Info manual of the GNU C Library";
-  }
diff --git a/pkgs/development/libraries/glibc/2.13/locales.nix b/pkgs/development/libraries/glibc/2.13/locales.nix
deleted file mode 100644
index b7eae50ca38..00000000000
--- a/pkgs/development/libraries/glibc/2.13/locales.nix
+++ /dev/null
@@ -1,47 +0,0 @@
-/* This function builds just the `lib/locale/locale-archive' file from
-   Glibc and nothing else.  If `allLocales' is true, all supported
-   locales are included; otherwise, just the locales listed in
-   `locales'.  See localedata/SUPPORTED in the Glibc source tree for
-   the list of all supported locales:
-   http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc
-*/
-
-{ stdenv, fetchurl, allLocales ? true, locales ? ["en_US.UTF-8/UTF-8"] }:
-
-let build = import ./common.nix;
-in
-  build null {
-    name = "glibc-locales";
-
-    inherit fetchurl stdenv;
-    installLocales = true;
-
-    builder = ./locales-builder.sh;
-
-    # Awful hack: `localedef' doesn't allow the path to `locale-archive'
-    # to be overriden, but you *can* specify a prefix, i.e. it will use
-    # <prefix>/<path-to-glibc>/lib/locale/locale-archive.  So we use
-    # $TMPDIR as a prefix, meaning that the locale-archive is placed in
-    # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
-    buildPhase =
-      ''
-        mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
-
-        # Hack to allow building of the locales (needed since glibc-2.12)
-        sed -i -e "s,^LOCALEDEF=.*,LOCALEDEF=localedef --prefix=$TMPDIR," -e \
-            /library-path/d ../glibc-2*/localedata/Makefile
-        ${if allLocales then "" else
-            "echo SUPPORTED-LOCALES=\"${toString locales}\" > ../glibc-2*/localedata/SUPPORTED"}
-
-        make localedata/install-locales \
-            localedir=$out/lib/locale \
-      '';
-
-    installPhase =
-      ''
-        mkdir -p "$out/lib/locale"
-        cp -v "$TMPDIR/nix/store/"*"/lib/locale/locale-archive" "$out/lib/locale"
-      '';
-
-    meta.description = "Locale information for the GNU C Library";
-  }
diff --git a/pkgs/development/libraries/glibc/2.13/nix-locale-archive.patch b/pkgs/development/libraries/glibc/2.13/nix-locale-archive.patch
deleted file mode 100644
index aca904f7ff4..00000000000
--- a/pkgs/development/libraries/glibc/2.13/nix-locale-archive.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-diff --git a/locale/loadarchive.c b/locale/loadarchive.c
-index d545f17..0d8638a 100644
---- a/locale/loadarchive.c
-+++ b/locale/loadarchive.c
-@@ -124,6 +124,25 @@ calculate_head_size (const struct locarhead *h)
- }
- 
- 
-+static int
-+open_locale_archive ()
-+{
-+  int fd = -1;
-+  char *path = getenv ("LOCALE_ARCHIVE_2_11");
-+  char *path2 = getenv ("LOCALE_ARCHIVE");
-+  const char *usualpath = "/usr/lib/locale/locale-archive";
-+  if (path)
-+    fd = open_not_cancel_2 (path, O_RDONLY|O_LARGEFILE);
-+  if (path2 && fd < 0)
-+    fd = open_not_cancel_2 (path2, O_RDONLY|O_LARGEFILE);
-+  if (fd < 0)
-+    fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
-+  if (fd < 0)
-+    fd = open_not_cancel_2 (usualpath, O_RDONLY|O_LARGEFILE);
-+  return fd;
-+}
-+
-+
- /* Find the locale *NAMEP in the locale archive, and return the
-    internalized data structure for its CATEGORY data.  If this locale has
-    already been loaded from the archive, just returns the existing data
-@@ -203,7 +222,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
-       archmapped = &headmap;
- 
-       /* The archive has never been opened.  */
--      fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
-+      fd = open_locale_archive ();
-       if (fd < 0)
- 	/* Cannot open the archive, for whatever reason.  */
- 	return NULL;
-@@ -394,7 +413,7 @@ _nl_load_locale_from_archive (int category, const char **namep)
- 	  if (fd == -1)
- 	    {
- 	      struct stat64 st;
--	      fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
-+	      fd = open_locale_archive ();
- 	      if (fd == -1)
- 		/* Cannot open the archive, for whatever reason.  */
- 		return NULL;
-diff --git a/locale/programs/locale.c b/locale/programs/locale.c
-index 77262b7..fddc00d 100644
---- a/locale/programs/locale.c
-+++ b/locale/programs/locale.c
-@@ -628,6 +628,20 @@ nameentcmp (const void *a, const void *b)
- 		  ((const struct nameent *) b)->name);
- }
- 
-+static int
-+open_nix_locale_archive (const char * fname, int access)
-+{
-+  int fd = -1;
-+  char *path = getenv ("LOCALE_ARCHIVE_2_11");
-+  char *path2 = getenv ("LOCALE_ARCHIVE");
-+  if (path)
-+    fd = open64 (path, access);
-+  if (path2 && fd < 0)
-+    fd = open64 (path2, access);
-+  if (fd < 0)
-+    fd = open64 (fname, access);
-+  return fd;
-+}
- 
- static int
- write_archive_locales (void **all_datap, char *linebuf)
-@@ -641,7 +658,7 @@ write_archive_locales (void **all_datap, char *linebuf)
-   int fd, ret = 0;
-   uint32_t cnt;
- 
--  fd = open64 (ARCHIVE_NAME, O_RDONLY);
-+  fd = open_nix_locale_archive (ARCHIVE_NAME, O_RDONLY);
-   if (fd < 0)
-     return 0;
- 
-diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
-index 85ba77d..3ad2af8 100644
---- a/locale/programs/locarchive.c
-+++ b/locale/programs/locarchive.c
-@@ -512,6 +512,20 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
-   *ah = new_ah;
- }
- 
-+static int
-+open_nix_locale_archive (const char * fname, int access)
-+{
-+  int fd = -1;
-+  char *path = getenv ("LOCALE_ARCHIVE_2_11");
-+  char *path2 = getenv ("LOCALE_ARCHIVE");
-+  if (path)
-+    fd = open64 (path, access);
-+  if (path2 && fd < 0)
-+    fd = open64 (path2, access);
-+  if (fd < 0)
-+    fd = open64 (fname, access);
-+  return fd;
-+}
- 
- void
- open_archive (struct locarhandle *ah, bool readonly)
-@@ -531,7 +548,7 @@ open_archive (struct locarhandle *ah, bool readonly)
-   while (1)
-     {
-       /* Open the archive.  We must have exclusive write access.  */
--      fd = open64 (archivefname, readonly ? O_RDONLY : O_RDWR);
-+      fd = open_nix_locale_archive (archivefname, readonly ? O_RDONLY : O_RDWR);
-       if (fd == -1)
- 	{
- 	  /* Maybe the file does not yet exist.  */
diff --git a/pkgs/development/libraries/glibc/2.13/nss-skip-unavail.patch b/pkgs/development/libraries/glibc/2.13/nss-skip-unavail.patch
deleted file mode 100644
index e48dc2bc0a6..00000000000
--- a/pkgs/development/libraries/glibc/2.13/nss-skip-unavail.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -ru glibc-2.11.2-orig/sysdeps/posix/getaddrinfo.c glibc-2.11.2/sysdeps/posix/getaddrinfo.c
---- glibc-2.11.2-orig/sysdeps/posix/getaddrinfo.c	2010-05-19 22:38:20.000000000 +0200
-+++ glibc-2.11.2/sysdeps/posix/getaddrinfo.c	2010-08-05 18:39:54.259556327 +0200
-@@ -505,8 +505,6 @@
- 	  int no_data = 0;
- 	  int no_inet6_data = 0;
- 	  service_user *nip = NULL;
--	  enum nss_status inet6_status = NSS_STATUS_UNAVAIL;
--	  enum nss_status status = NSS_STATUS_UNAVAIL;
- 	  int no_more;
- 	  int old_res_options;
- 
-@@ -702,6 +700,8 @@
- 
- 	  while (!no_more)
- 	    {
-+ 	      enum nss_status inet6_status = NSS_STATUS_UNAVAIL;
-+ 	      enum nss_status status = NSS_STATUS_UNAVAIL;
- 	      no_data = 0;
- 	      nss_gethostbyname4_r fct4
- 		= __nss_lookup_function (nip, "gethostbyname4_r");
diff --git a/pkgs/development/libraries/glibc/2.13/rpcgen-path.patch b/pkgs/development/libraries/glibc/2.13/rpcgen-path.patch
deleted file mode 100644
index fbb03dd5fad..00000000000
--- a/pkgs/development/libraries/glibc/2.13/rpcgen-path.patch
+++ /dev/null
@@ -1,72 +0,0 @@
-By default, rpcgen(1) looks for cpp(1) from a list of fixed absolute paths
-(`/lib/cpp', etc.), which may only be overrided with the `-Y' option.  This
-patch makes it run any `cpp' command found in $PATH.
-
---- glibc-2.7/sunrpc/rpc_main.c	2006-11-10 21:54:46.000000000 +0100
-+++ glibc-2.7/sunrpc/rpc_main.c	2009-04-22 14:32:10.000000000 +0200
-@@ -79,7 +79,7 @@ static const char *cmdname;
- 
- static const char *svcclosetime = "120";
- static int cppDefined;	/* explicit path for C preprocessor */
--static const char *CPP = SUNOS_CPP;
-+static const char *CPP = "cpp";
- static const char CPPFLAGS[] = "-C";
- static char *pathbuf;
- static int cpp_pid;
-@@ -108,7 +108,6 @@ static char *extendfile (const char *fil
- static void open_output (const char *infile, const char *outfile);
- static void add_warning (void);
- static void clear_args (void);
--static void find_cpp (void);
- static void open_input (const char *infile, const char *define);
- static int check_nettype (const char *name, const char *list_to_check[]);
- static void c_output (const char *infile, const char *define,
-@@ -327,31 +326,6 @@ clear_args (void)
-   argcount = FIXEDARGS;
- }
- 
--/* make sure that a CPP exists */
--static void
--find_cpp (void)
--{
--  struct stat buf;
--
--  if (stat (CPP, &buf) < 0)
--    {				/* /lib/cpp or explicit cpp does not exist */
--      if (cppDefined)
--	{
--	  fprintf (stderr, _ ("cannot find C preprocessor: %s \n"), CPP);
--	  crash ();
--	}
--      else
--	{			/* try the other one */
--	  CPP = SVR4_CPP;
--	  if (stat (CPP, &buf) < 0)
--	    {			/* can't find any cpp */
--	      fputs (_ ("cannot find any C preprocessor (cpp)\n"), stdout);
--	      crash ();
--	    }
--	}
--    }
--}
--
- /*
-  * Open input file with given define for C-preprocessor
-  */
-@@ -370,7 +344,6 @@ open_input (const char *infile, const ch
-   switch (cpp_pid)
-     {
-     case 0:
--      find_cpp ();
-       putarg (0, CPP);
-       putarg (1, CPPFLAGS);
-       addarg (define);
-@@ -380,7 +353,7 @@ open_input (const char *infile, const ch
-       close (1);
-       dup2 (pd[1], 1);
-       close (pd[0]);
--      execv (arglist[0], (char **) arglist);
-+      execvp (arglist[0], (char **) arglist);
-       perror ("execv");
-       exit (1);
-     case -1:
diff --git a/pkgs/development/libraries/glibc/2.17/cve-2013-0242.patch b/pkgs/development/libraries/glibc/2.17/cve-2013-0242.patch
deleted file mode 100644
index 1d6557071e1..00000000000
--- a/pkgs/development/libraries/glibc/2.17/cve-2013-0242.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-When extending regex buffers, make sure we allocate enough room for the
-state log.  Merely doubling the space may not be enough if the current
-node has accepted a long run of characters.  This part of the code only
-triggers with multibyte characters.
-
-Andreas.
-
-	[BZ #15078]
-	* posix/regexec.c (extend_buffers): Add parameter min_len.
-	(check_matching): Pass minimum needed length.
-	(clean_state_log_if_needed): Likewise.
-	(get_subexp): Likewise.
-	* posix/Makefile (tests): Add bug-regex34.
-	(bug-regex34-ENV): Define.
-	* posix/bug-regex34.c: New file.
-
-diff --git a/posix/regexec.c b/posix/regexec.c
-index 7f2de85..5ca2bf6 100644
---- a/posix/regexec.c
-+++ b/posix/regexec.c
-@@ -197,7 +197,7 @@ static int group_nodes_into_DFAstates (const re_dfa_t *dfa,
- static int check_node_accept (const re_match_context_t *mctx,
- 			      const re_token_t *node, int idx)
-      internal_function;
--static reg_errcode_t extend_buffers (re_match_context_t *mctx)
-+static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len)
-      internal_function;
- 
- /* Entry point for POSIX code.  */
-@@ -1160,7 +1160,7 @@ check_matching (re_match_context_t *mctx, int fl_longest_match,
- 	  || (BE (next_char_idx >= mctx->input.valid_len, 0)
- 	      && mctx->input.valid_len < mctx->input.len))
- 	{
--	  err = extend_buffers (mctx);
-+	  err = extend_buffers (mctx, next_char_idx + 1);
- 	  if (BE (err != REG_NOERROR, 0))
- 	    {
- 	      assert (err == REG_ESPACE);
-@@ -1738,7 +1738,7 @@ clean_state_log_if_needed (re_match_context_t *mctx, int next_state_log_idx)
- 	  && mctx->input.valid_len < mctx->input.len))
-     {
-       reg_errcode_t err;
--      err = extend_buffers (mctx);
-+      err = extend_buffers (mctx, next_state_log_idx + 1);
-       if (BE (err != REG_NOERROR, 0))
- 	return err;
-     }
-@@ -2792,7 +2792,7 @@ get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx)
- 		  if (bkref_str_off >= mctx->input.len)
- 		    break;
- 
--		  err = extend_buffers (mctx);
-+		  err = extend_buffers (mctx, bkref_str_off + 1);
- 		  if (BE (err != REG_NOERROR, 0))
- 		    return err;
- 
-@@ -4102,7 +4102,7 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
- 
- static reg_errcode_t
- internal_function __attribute_warn_unused_result__
--extend_buffers (re_match_context_t *mctx)
-+extend_buffers (re_match_context_t *mctx, int min_len)
- {
-   reg_errcode_t ret;
-   re_string_t *pstr = &mctx->input;
-@@ -4111,8 +4111,10 @@ extend_buffers (re_match_context_t *mctx)
-   if (BE (INT_MAX / 2 / sizeof (re_dfastate_t *) <= pstr->bufs_len, 0))
-     return REG_ESPACE;
- 
--  /* Double the lengthes of the buffers.  */
--  ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2));
-+  /* Double the lengthes of the buffers, but allocate at least MIN_LEN.  */
-+  ret = re_string_realloc_buffers (pstr,
-+				   MAX (min_len,
-+					MIN (pstr->len, pstr->bufs_len * 2)));
-   if (BE (ret != REG_NOERROR, 0))
-     return ret;
- 
--- 
-1.8.1.2
-
-
--- 
-Andreas Schwab, SUSE Labs, schwab@suse.de
-GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
-"And now for something completely different."
-
diff --git a/pkgs/development/libraries/glibc/2.17/cve-2013-1914.patch b/pkgs/development/libraries/glibc/2.17/cve-2013-1914.patch
deleted file mode 100644
index c2963249f5e..00000000000
--- a/pkgs/development/libraries/glibc/2.17/cve-2013-1914.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From: Andreas Schwab <schwab@suse.de>
-Date: Thu, 21 Mar 2013 14:50:27 +0000 (+0100)
-Subject: Fix stack overflow in getaddrinfo with many results
-X-Git-Url: http://sourceware.org/git/?p=glibc.git;a=commitdiff_plain;h=1cef1b19089528db11f221e938f60b9b048945d7
-
-Fix stack overflow in getaddrinfo with many results
----
-
-diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
-index d95c2d1..2309281 100644
---- a/sysdeps/posix/getaddrinfo.c
-+++ b/sysdeps/posix/getaddrinfo.c
-@@ -2489,11 +2489,27 @@ getaddrinfo (const char *name, const char *service,
-       __typeof (once) old_once = once;
-       __libc_once (once, gaiconf_init);
-       /* Sort results according to RFC 3484.  */
--      struct sort_result results[nresults];
--      size_t order[nresults];
-+      struct sort_result *results;
-+      size_t *order;
-       struct addrinfo *q;
-       struct addrinfo *last = NULL;
-       char *canonname = NULL;
-+      bool malloc_results;
-+
-+      malloc_results
-+	= !__libc_use_alloca (nresults * (sizeof (*results) + sizeof (size_t)));
-+      if (malloc_results)
-+	{
-+	  results = malloc (nresults * (sizeof (*results) + sizeof (size_t)));
-+	  if (results == NULL)
-+	    {
-+	      __free_in6ai (in6ai);
-+	      return EAI_MEMORY;
-+	    }
-+	}
-+      else
-+	results = alloca (nresults * (sizeof (*results) + sizeof (size_t)));
-+      order = (size_t *) (results + nresults);
- 
-       /* Now we definitely need the interface information.  */
-       if (! check_pf_called)
-@@ -2664,6 +2680,9 @@ getaddrinfo (const char *name, const char *service,
- 
-       /* Fill in the canonical name into the new first entry.  */
-       p->ai_canonname = canonname;
-+
-+      if (malloc_results)
-+	free (results);
-     }
- 
-   __free_in6ai (in6ai);
diff --git a/pkgs/development/libraries/glibc/2.17/glibc-elf-localscope.patch b/pkgs/development/libraries/glibc/2.17/glibc-elf-localscope.patch
deleted file mode 100644
index 98f7f81087b..00000000000
--- a/pkgs/development/libraries/glibc/2.17/glibc-elf-localscope.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-diff -ru a/elf/dl-close.c b/elf/dl-close.c
---- a/elf/dl-close.c	2011-02-04 00:35:03.000000000 +0100
-+++ b/elf/dl-close.c	2011-02-22 02:16:12.367883000 +0100
-@@ -180,24 +186,28 @@
-       /* Signal the object is still needed.  */
-       l->l_idx = IDX_STILL_USED;
- 
-+#define mark_used(dmap) \
-+  do {								\
-+    if ((dmap)->l_idx != IDX_STILL_USED)			\
-+      {								\
-+	assert ((dmap)->l_idx >= 0 && (dmap)->l_idx < nloaded);	\
-+								\
-+	if (!used[(dmap)->l_idx])				\
-+	  {							\
-+	    used[(dmap)->l_idx] = 1;				\
-+	    if ((dmap)->l_idx - 1 < done_index)			\
-+	      done_index = (dmap)->l_idx - 1;			\
-+	  }							\
-+      }								\
-+  } while (0)
-+
-       /* Mark all dependencies as used.  */
-       if (l->l_initfini != NULL)
- 	{
- 	  struct link_map **lp = &l->l_initfini[1];
- 	  while (*lp != NULL)
- 	    {
--	      if ((*lp)->l_idx != IDX_STILL_USED)
--		{
--		  assert ((*lp)->l_idx >= 0 && (*lp)->l_idx < nloaded);
--
--		  if (!used[(*lp)->l_idx])
--		    {
--		      used[(*lp)->l_idx] = 1;
--		      if ((*lp)->l_idx - 1 < done_index)
--			done_index = (*lp)->l_idx - 1;
--		    }
--		}
--
-+	      mark_used(*lp);
- 	      ++lp;
- 	    }
- 	}
-@@ -206,19 +216,25 @@
- 	for (unsigned int j = 0; j < l->l_reldeps->act; ++j)
- 	  {
- 	    struct link_map *jmap = l->l_reldeps->list[j];
--
--	    if (jmap->l_idx != IDX_STILL_USED)
--	      {
--		assert (jmap->l_idx >= 0 && jmap->l_idx < nloaded);
--
--		if (!used[jmap->l_idx])
--		  {
--		    used[jmap->l_idx] = 1;
--		    if (jmap->l_idx - 1 < done_index)
--		      done_index = jmap->l_idx - 1;
--		  }
--	      }
-+	    mark_used(jmap);
- 	  }
-+      /* And the same for owners of our scopes; normally, our last
-+	 scope provider would render us unused, but this can be
-+	 prevented by the NODELETE flag. */
-+      if (__builtin_expect(l->l_type == lt_loaded
-+	                   && (l->l_flags_1 & DF_1_NODELETE), 0))
-+	for (size_t cnt = 0; l->l_scope[cnt] != NULL; ++cnt)
-+	  /* This relies on l_scope[] entries being always set either
-+	     to its own l_symbolic_searchlist address, or some map's
-+	     l_searchlist address.  */
-+	  if (l->l_scope[cnt] != &l->l_symbolic_searchlist)
-+	    {
-+	      struct link_map *ls = (struct link_map *)
-+		((char *) l->l_scope[cnt]
-+		 - offsetof (struct link_map, l_searchlist));
-+	      assert (ls->l_ns == nsid);
-+	      mark_used(ls);
-+	    }
-     }
- 
-   /* Sort the entries.  */
diff --git a/pkgs/development/libraries/glibc/2.17/locales-builder.sh b/pkgs/development/libraries/glibc/2.17/locales-builder.sh
deleted file mode 100644
index d732e208fa2..00000000000
--- a/pkgs/development/libraries/glibc/2.17/locales-builder.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-# Glibc cannot have itself in its RPATH.
-export NIX_NO_SELF_RPATH=1
-
-source $stdenv/setup
-
-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=
-
-    export NIX_DONT_SET_RPATH=1
-    unset CFLAGS
-}
-
-genericBuild
diff --git a/pkgs/development/libraries/glibc/2.17/locales.nix b/pkgs/development/libraries/glibc/2.17/locales.nix
deleted file mode 100644
index e818b84bc62..00000000000
--- a/pkgs/development/libraries/glibc/2.17/locales.nix
+++ /dev/null
@@ -1,47 +0,0 @@
-/* This function builds just the `lib/locale/locale-archive' file from
-   Glibc and nothing else.  If `allLocales' is true, all supported
-   locales are included; otherwise, just the locales listed in
-   `locales'.  See localedata/SUPPORTED in the Glibc source tree for
-   the list of all supported locales:
-   http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc
-*/
-
-{ stdenv, fetchurl, allLocales ? true, locales ? ["en_US.UTF-8/UTF-8"] }:
-
-let build = import ./common.nix;
-in
-  build null {
-    name = "glibc-locales";
-
-    inherit fetchurl stdenv;
-    installLocales = true;
-
-    builder = ./locales-builder.sh;
-
-    # Awful hack: `localedef' doesn't allow the path to `locale-archive'
-    # to be overriden, but you *can* specify a prefix, i.e. it will use
-    # <prefix>/<path-to-glibc>/lib/locale/locale-archive.  So we use
-    # $TMPDIR as a prefix, meaning that the locale-archive is placed in
-    # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
-    buildPhase =
-      ''
-        mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
-
-        # Hack to allow building of the locales (needed since glibc-2.12)
-        sed -i -e "s,^LOCALEDEF=.*,LOCALEDEF=localedef --prefix=$TMPDIR," -e \
-            /library-path/d ../glibc-2*/localedata/Makefile
-        ${if allLocales then "" else
-            "echo SUPPORTED-LOCALES=\"${toString locales}\" > ../glibc-2*/localedata/SUPPORTED"}
-
-        make localedata/install-locales \
-            localedir=$out/lib/locale \
-      '';
-
-    installPhase =
-      ''
-        mkdir -p "$out/lib/locale"
-        cp -v "$TMPDIR/$NIX_STORE/"*"/lib/locale/locale-archive" "$out/lib/locale"
-      '';
-
-    meta.description = "Locale information for the GNU C Library";
-  }
diff --git a/pkgs/development/libraries/glibc/2.17/builder.sh b/pkgs/development/libraries/glibc/2.18/builder.sh
index e68e13f9bec..3b077cbb3fd 100644
--- a/pkgs/development/libraries/glibc/2.17/builder.sh
+++ b/pkgs/development/libraries/glibc/2.18/builder.sh
@@ -19,7 +19,7 @@ postInstall() {
     if test -n "$installLocales"; then
         make -j${NIX_BUILD_CORES:-1} -l${NIX_BUILD_CORES:-1} localedata/install-locales
     fi
-    
+
     test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache
 
     # FIXME: Use `test -n $linuxHeaders' when `kernelHeaders' has been
@@ -27,19 +27,19 @@ postInstall() {
     if test -z "$hurdHeaders"; then
         # Include the Linux kernel headers in Glibc, except the `scsi'
         # subdirectory, which Glibc provides itself.
-	(cd $out/include && \
-	 ln -sv $(ls -d $kernelHeaders/include/* | grep -v 'scsi$') .)
+        (cd $out/include && \
+         ln -sv $(ls -d $kernelHeaders/include/* | grep -v 'scsi$') .)
     fi
 
     if test -f "$out/lib/libhurduser.so"; then
-	# libc.so, libhurduser.so, and libmachuser.so depend on each
-	# other, so add them to libc.so (a RUNPATH on libc.so.0.3
-	# would be ignored by the cross-linker.)
-	echo "adding \`libhurduser.so' and \`libmachuser.so' to the \`libc.so' linker script..."
-	sed -i "$out/lib/libc.so" \
-	    -e"s|\(libc\.so\.[^ ]\+\>\)|\1 $out/lib/libhurduser.so $out/lib/libmachuser.so|g"
+        # libc.so, libhurduser.so, and libmachuser.so depend on each
+        # other, so add them to libc.so (a RUNPATH on libc.so.0.3
+        # would be ignored by the cross-linker.)
+        echo "adding \`libhurduser.so' and \`libmachuser.so' to the \`libc.so' linker script..."
+        sed -i "$out/lib/libc.so" \
+            -e"s|\(libc\.so\.[^ ]\+\>\)|\1 $out/lib/libhurduser.so $out/lib/libmachuser.so|g"
     fi
-	
+
     # Fix for NIXOS-54 (ldd not working on x86_64).  Make a symlink
     # "lib64" to "lib".
     if test -n "$is64bit"; then
@@ -49,6 +49,9 @@ postInstall() {
     # This file, that should not remain in the glibc derivation,
     # may have not been created during the preInstall
     rm -f $out/lib/libgcc_s.so.1
+
+    # Get rid of more unnecessary stuff.
+    rm -rf $out/var $out/sbin/sln
 }
 
 genericBuild
diff --git a/pkgs/development/libraries/glibc/2.17/common.nix b/pkgs/development/libraries/glibc/2.18/common.nix
index e82cceda7c7..9e58b2163c6 100644
--- a/pkgs/development/libraries/glibc/2.17/common.nix
+++ b/pkgs/development/libraries/glibc/2.18/common.nix
@@ -13,7 +13,7 @@ cross:
 
 let
 
-  version = "2.17";
+  version = "2.18";
 
 in
 
@@ -44,9 +44,6 @@ stdenv.mkDerivation ({
       /* Don't use /etc/ld.so.cache, for non-NixOS systems.  */
       ./dont-use-system-ld-so-cache.patch
 
-      /* Without this patch many KDE binaries crash. */
-      ./glibc-elf-localscope.patch
-
       /* Add blowfish password hashing support.  This is needed for
          compatibility with old NixOS installations (since NixOS used
          to default to blowfish). */
@@ -57,16 +54,19 @@ stdenv.mkDerivation ({
          src->results[i].native == a2_native' failed." crashes. */
       ./glibc-rh739743.patch
 
+      ./scanf.patch
+
       /* The command "getconf CS_PATH" returns the default search path
          "/bin:/usr/bin", which is inappropriate on NixOS machines. This
          patch extends the search path by "/run/current-system/sw/bin". */
       ./fix_path_attribute_in_getconf.patch
 
-      /* Fix buffer overrun in regexp matcher. */
-      ./cve-2013-0242.patch
 
-      /* Fix stack overflow in getaddrinfo with many results. */
-      ./cve-2013-1914.patch
+      ./cve-2012-4412+4424.patch
+      ./cve-2013-4237.patch
+      ./cve-2013-4332.patch
+      ./cve-2013-4458.patch
+      ./cve-2013-4788.patch
     ];
 
   postPatch = ''
@@ -150,7 +150,7 @@ stdenv.mkDerivation ({
     }
     else fetchurl {
       url = "mirror://gnu/glibc/glibc-${version}.tar.gz";
-      sha256 = "0ym3zk9ii64279wgw7pw9xkbxczy2ci7ka6mnfs05rhlainhicm3";
+      sha256 = "0d3pnh6kg5r48ga5rg4lhwlc1062brr6fiqs4j23327gzssjgry8";
     };
 
   # Remove absolute paths from `configure' & co.; build out-of-tree.
diff --git a/pkgs/development/libraries/glibc/2.18/cve-2012-4412+4424.patch b/pkgs/development/libraries/glibc/2.18/cve-2012-4412+4424.patch
new file mode 100644
index 00000000000..67ffbbc217b
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.18/cve-2012-4412+4424.patch
@@ -0,0 +1,1006 @@
+https://projects.archlinux.org/svntogit/packages.git/tree/trunk/glibc-2.18-strcoll-CVE-2012-4412+4424.patch?h=packages/glibc
+
+diff --git a/string/strcoll_l.c b/string/strcoll_l.c
+index ecda08f..bb34a72 100644
+--- a/string/strcoll_l.c
++++ b/string/strcoll_l.c
+@@ -41,11 +41,434 @@
+ 
+ #include "../locale/localeinfo.h"
+ 
++/* Track status while looking for sequences in a string.  */
++typedef struct
++{
++  int len;			/* Length of the current sequence.  */
++  size_t val;			/* Position of the sequence relative to the
++				   previous non-ignored sequence.  */
++  size_t idxnow;		/* Current index in sequences.  */
++  size_t idxmax;		/* Maximum index in sequences.  */
++  size_t idxcnt;		/* Current count of indices.  */
++  size_t backw;			/* Current Backward sequence index.  */
++  size_t backw_stop;		/* Index where the backward sequences stop.  */
++  const USTRING_TYPE *us;	/* The string.  */
++  int32_t *idxarr;		/* Array to cache weight indices.  */
++  unsigned char *rulearr;	/* Array to cache rules.  */
++  unsigned char rule;		/* Saved rule for the first sequence.  */
++  int32_t idx;			/* Index to weight of the current sequence.  */
++  int32_t save_idx;		/* Save looked up index of a forward
++				   sequence after the last backward
++				   sequence.  */
++  const USTRING_TYPE *back_us;	/* Beginning of the backward sequence.  */
++} coll_seq;
++
++/* Get next sequence.  The weight indices are cached, so we don't need to
++   traverse the string.  */
++static void
++get_next_seq_cached (coll_seq *seq, int nrules, int pass,
++		     const unsigned char *rulesets,
++		     const USTRING_TYPE *weights)
++{
++  size_t val = seq->val = 0;
++  int len = seq->len;
++  size_t backw_stop = seq->backw_stop;
++  size_t backw = seq->backw;
++  size_t idxcnt = seq->idxcnt;
++  size_t idxmax = seq->idxmax;
++  size_t idxnow = seq->idxnow;
++  unsigned char *rulearr = seq->rulearr;
++  int32_t *idxarr = seq->idxarr;
++
++  while (len == 0)
++    {
++      ++val;
++      if (backw_stop != ~0ul)
++	{
++	  /* There is something pushed.  */
++	  if (backw == backw_stop)
++	    {
++	      /* The last pushed character was handled.  Continue
++		 with forward characters.  */
++	      if (idxcnt < idxmax)
++		{
++		  idxnow = idxcnt;
++		  backw_stop = ~0ul;
++		}
++	      else
++		{
++		  /* Nothing any more.  The backward sequence
++		     ended with the last sequence in the string.  */
++		  idxnow = ~0ul;
++		  break;
++		}
++	    }
++	  else
++	    idxnow = --backw;
++	}
++      else
++	{
++	  backw_stop = idxcnt;
++
++	  while (idxcnt < idxmax)
++	    {
++	      if ((rulesets[rulearr[idxcnt] * nrules + pass]
++		   & sort_backward) == 0)
++		/* No more backward characters to push.  */
++		break;
++	      ++idxcnt;
++	    }
++
++	  if (backw_stop == idxcnt)
++	    {
++	      /* No sequence at all or just one.  */
++	      if (idxcnt == idxmax)
++		/* Note that LEN is still zero.  */
++		break;
++
++	      backw_stop = ~0ul;
++	      idxnow = idxcnt++;
++	    }
++	  else
++	    /* We pushed backward sequences.  */
++	    idxnow = backw = idxcnt - 1;
++	}
++      len = weights[idxarr[idxnow]++];
++    }
++
++  /* Update the structure.  */
++  seq->val = val;
++  seq->len = len;
++  seq->backw_stop = backw_stop;
++  seq->backw = backw;
++  seq->idxcnt = idxcnt;
++  seq->idxnow = idxnow;
++}
++
++/* Get next sequence.  Traverse the string as required.  */
++static void
++get_next_seq (coll_seq *seq, int nrules, const unsigned char *rulesets,
++	      const USTRING_TYPE *weights, const int32_t *table,
++	      const USTRING_TYPE *extra, const int32_t *indirect)
++{
++#include WEIGHT_H
++  size_t val = seq->val = 0;
++  int len = seq->len;
++  size_t backw_stop = seq->backw_stop;
++  size_t backw = seq->backw;
++  size_t idxcnt = seq->idxcnt;
++  size_t idxmax = seq->idxmax;
++  size_t idxnow = seq->idxnow;
++  unsigned char *rulearr = seq->rulearr;
++  int32_t *idxarr = seq->idxarr;
++  const USTRING_TYPE *us = seq->us;
++
++  while (len == 0)
++    {
++      ++val;
++      if (backw_stop != ~0ul)
++	{
++	  /* There is something pushed.  */
++	  if (backw == backw_stop)
++	    {
++	      /* The last pushed character was handled.  Continue
++		 with forward characters.  */
++	      if (idxcnt < idxmax)
++		{
++		  idxnow = idxcnt;
++		  backw_stop = ~0ul;
++		}
++	      else
++		/* Nothing any more.  The backward sequence ended with
++		   the last sequence in the string.  Note that LEN
++		   is still zero.  */
++		break;
++	    }
++	  else
++	    idxnow = --backw;
++	}
++      else
++	{
++	  backw_stop = idxmax;
++
++	  while (*us != L('\0'))
++	    {
++	      int32_t tmp = findidx (&us, -1);
++	      rulearr[idxmax] = tmp >> 24;
++	      idxarr[idxmax] = tmp & 0xffffff;
++	      idxcnt = idxmax++;
++
++	      if ((rulesets[rulearr[idxcnt] * nrules]
++		   & sort_backward) == 0)
++		/* No more backward characters to push.  */
++		break;
++	      ++idxcnt;
++	    }
++
++	  if (backw_stop >= idxcnt)
++	    {
++	      /* No sequence at all or just one.  */
++	      if (idxcnt == idxmax || backw_stop > idxcnt)
++		/* Note that LEN is still zero.  */
++		break;
++
++	      backw_stop = ~0ul;
++	      idxnow = idxcnt;
++	    }
++	  else
++	    /* We pushed backward sequences.  */
++	    idxnow = backw = idxcnt - 1;
++	}
++      len = weights[idxarr[idxnow]++];
++    }
++
++  /* Update the structure.  */
++  seq->val = val;
++  seq->len = len;
++  seq->backw_stop = backw_stop;
++  seq->backw = backw;
++  seq->idxcnt = idxcnt;
++  seq->idxmax = idxmax;
++  seq->idxnow = idxnow;
++  seq->us = us;
++}
++
++/* Get next sequence.  Traverse the string as required.  This function does not
++   set or use any index or rule cache.  */
++static void
++get_next_seq_nocache (coll_seq *seq, int nrules, const unsigned char *rulesets,
++		      const USTRING_TYPE *weights, const int32_t *table,
++		      const USTRING_TYPE *extra, const int32_t *indirect,
++		      int pass)
++{
++#include WEIGHT_H
++  size_t val = seq->val = 0;
++  int len = seq->len;
++  size_t backw_stop = seq->backw_stop;
++  size_t backw = seq->backw;
++  size_t idxcnt = seq->idxcnt;
++  size_t idxmax = seq->idxmax;
++  int32_t idx = seq->idx;
++  const USTRING_TYPE *us = seq->us;
++
++  while (len == 0)
++    {
++      ++val;
++      if (backw_stop != ~0ul)
++	{
++	  /* There is something pushed.  */
++	  if (backw == backw_stop)
++	    {
++	      /* The last pushed character was handled.  Continue
++		 with forward characters.  */
++	      if (idxcnt < idxmax)
++		{
++		  idx = seq->save_idx;
++		  backw_stop = ~0ul;
++		}
++	      else
++		{
++		  /* Nothing anymore.  The backward sequence ended with
++		     the last sequence in the string.  Note that len is
++		     still zero.  */
++		  idx = 0;
++		  break;
++	        }
++	    }
++	  else
++	    {
++	      /* XXX Traverse BACKW sequences from the beginning of
++		 BACKW_STOP to get the next sequence.  Is ther a quicker way
++	         to do this?  */
++	      size_t i = backw_stop;
++	      us = seq->back_us;
++	      while (i < backw)
++		{
++		  int32_t tmp = findidx (&us, -1);
++		  idx = tmp & 0xffffff;
++		  i++;
++		}
++	      --backw;
++	      us = seq->us;
++	    }
++	}
++      else
++	{
++	  backw_stop = idxmax;
++	  int32_t prev_idx = idx;
++
++	  while (*us != L('\0'))
++	    {
++	      int32_t tmp = findidx (&us, -1);
++	      unsigned char rule = tmp >> 24;
++	      prev_idx = idx;
++	      idx = tmp & 0xffffff;
++	      idxcnt = idxmax++;
++
++	      /* Save the rule for the first sequence.  */
++	      if (__glibc_unlikely (idxcnt == 0))
++	        seq->rule = rule;
++
++	      if ((rulesets[rule * nrules + pass]
++		   & sort_backward) == 0)
++		/* No more backward characters to push.  */
++		break;
++	      ++idxcnt;
++	    }
++
++	  if (backw_stop >= idxcnt)
++	    {
++	      /* No sequence at all or just one.  */
++	      if (idxcnt == idxmax || backw_stop > idxcnt)
++		/* Note that len is still zero.  */
++		break;
++
++	      backw_stop = ~0ul;
++	    }
++	  else
++	    {
++	      /* We pushed backward sequences.  If the stream ended with the
++		 backward sequence, then we process the last sequence we
++		 found.  Otherwise we process the sequence before the last
++		 one since the last one was a forward sequence.  */
++	      seq->back_us = seq->us;
++	      seq->us = us;
++	      backw = idxcnt;
++	      if (idxmax > idxcnt)
++		{
++		  backw--;
++		  seq->save_idx = idx;
++		  idx = prev_idx;
++		}
++	      if (backw > backw_stop)
++		backw--;
++	    }
++	}
++
++      len = weights[idx++];
++      /* Skip over indices of previous levels.  */
++      for (int i = 0; i < pass; i++)
++	{
++	  idx += len;
++	  len = weights[idx];
++	  idx++;
++	}
++    }
++
++  /* Update the structure.  */
++  seq->val = val;
++  seq->len = len;
++  seq->backw_stop = backw_stop;
++  seq->backw = backw;
++  seq->idxcnt = idxcnt;
++  seq->idxmax = idxmax;
++  seq->us = us;
++  seq->idx = idx;
++}
++
++/* Compare two sequences.  This version does not use the index and rules
++   cache.  */
++static int
++do_compare_nocache (coll_seq *seq1, coll_seq *seq2, int position,
++		    const USTRING_TYPE *weights)
++{
++  int seq1len = seq1->len;
++  int seq2len = seq2->len;
++  size_t val1 = seq1->val;
++  size_t val2 = seq2->val;
++  int idx1 = seq1->idx;
++  int idx2 = seq2->idx;
++  int result = 0;
++
++  /* Test for position if necessary.  */
++  if (position && val1 != val2)
++    {
++      result = val1 > val2 ? 1 : -1;
++      goto out;
++    }
++
++  /* Compare the two sequences.  */
++  do
++    {
++      if (weights[idx1] != weights[idx2])
++	{
++	  /* The sequences differ.  */
++	  result = weights[idx1] - weights[idx2];
++	  goto out;
++	}
++
++      /* Increment the offsets.  */
++      ++idx1;
++      ++idx2;
++
++      --seq1len;
++      --seq2len;
++    }
++  while (seq1len > 0 && seq2len > 0);
++
++  if (position && seq1len != seq2len)
++    result = seq1len - seq2len;
++
++out:
++  seq1->len = seq1len;
++  seq2->len = seq2len;
++  seq1->idx = idx1;
++  seq2->idx = idx2;
++  return result;
++}
++
++/* Compare two sequences using the index cache.  */
++static int
++do_compare (coll_seq *seq1, coll_seq *seq2, int position,
++	    const USTRING_TYPE *weights)
++{
++  int seq1len = seq1->len;
++  int seq2len = seq2->len;
++  size_t val1 = seq1->val;
++  size_t val2 = seq2->val;
++  int32_t *idx1arr = seq1->idxarr;
++  int32_t *idx2arr = seq2->idxarr;
++  int idx1now = seq1->idxnow;
++  int idx2now = seq2->idxnow;
++  int result = 0;
++
++  /* Test for position if necessary.  */
++  if (position && val1 != val2)
++    {
++      result = val1 > val2 ? 1 : -1;
++      goto out;
++    }
++
++  /* Compare the two sequences.  */
++  do
++    {
++      if (weights[idx1arr[idx1now]] != weights[idx2arr[idx2now]])
++	{
++	  /* The sequences differ.  */
++	  result = weights[idx1arr[idx1now]] - weights[idx2arr[idx2now]];
++	  goto out;
++	}
++
++      /* Increment the offsets.  */
++      ++idx1arr[idx1now];
++      ++idx2arr[idx2now];
++
++      --seq1len;
++      --seq2len;
++    }
++  while (seq1len > 0 && seq2len > 0);
++
++  if (position && seq1len != seq2len)
++    result = seq1len - seq2len;
++
++out:
++  seq1->len = seq1len;
++  seq2->len = seq2len;
++  return result;
++}
++
+ int
+-STRCOLL (s1, s2, l)
+-     const STRING_TYPE *s1;
+-     const STRING_TYPE *s2;
+-     __locale_t l;
++STRCOLL (const STRING_TYPE *s1, const STRING_TYPE *s2, __locale_t l)
+ {
+   struct __locale_data *current = l->__locales[LC_COLLATE];
+   uint_fast32_t nrules = current->values[_NL_ITEM_INDEX (_NL_COLLATE_NRULES)].word;
+@@ -56,34 +479,6 @@ STRCOLL (s1, s2, l)
+   const USTRING_TYPE *weights;
+   const USTRING_TYPE *extra;
+   const int32_t *indirect;
+-  uint_fast32_t pass;
+-  int result = 0;
+-  const USTRING_TYPE *us1;
+-  const USTRING_TYPE *us2;
+-  size_t s1len;
+-  size_t s2len;
+-  int32_t *idx1arr;
+-  int32_t *idx2arr;
+-  unsigned char *rule1arr;
+-  unsigned char *rule2arr;
+-  size_t idx1max;
+-  size_t idx2max;
+-  size_t idx1cnt;
+-  size_t idx2cnt;
+-  size_t idx1now;
+-  size_t idx2now;
+-  size_t backw1_stop;
+-  size_t backw2_stop;
+-  size_t backw1;
+-  size_t backw2;
+-  int val1;
+-  int val2;
+-  int position;
+-  int seq1len;
+-  int seq2len;
+-  int use_malloc;
+-
+-#include WEIGHT_H
+ 
+   if (nrules == 0)
+     return STRCMP (s1, s2);
+@@ -98,7 +493,6 @@ STRCOLL (s1, s2, l)
+     current->values[_NL_ITEM_INDEX (CONCAT(_NL_COLLATE_EXTRA,SUFFIX))].string;
+   indirect = (const int32_t *)
+     current->values[_NL_ITEM_INDEX (CONCAT(_NL_COLLATE_INDIRECT,SUFFIX))].string;
+-  use_malloc = 0;
+ 
+   assert (((uintptr_t) table) % __alignof__ (table[0]) == 0);
+   assert (((uintptr_t) weights) % __alignof__ (weights[0]) == 0);
+@@ -106,18 +500,13 @@ STRCOLL (s1, s2, l)
+   assert (((uintptr_t) indirect) % __alignof__ (indirect[0]) == 0);
+ 
+   /* We need this a few times.  */
+-  s1len = STRLEN (s1);
+-  s2len = STRLEN (s2);
++  size_t s1len = STRLEN (s1);
++  size_t s2len = STRLEN (s2);
+ 
+   /* Catch empty strings.  */
+-  if (__builtin_expect (s1len == 0, 0) || __builtin_expect (s2len == 0, 0))
++  if (__glibc_unlikely (s1len == 0) || __glibc_unlikely (s2len == 0))
+     return (s1len != 0) - (s2len != 0);
+ 
+-  /* We need the elements of the strings as unsigned values since they
+-     are used as indeces.  */
+-  us1 = (const USTRING_TYPE *) s1;
+-  us2 = (const USTRING_TYPE *) s2;
+-
+   /* Perform the first pass over the string and while doing this find
+      and store the weights for each character.  Since we want this to
+      be as fast as possible we are using `alloca' to store the temporary
+@@ -127,411 +516,124 @@ STRCOLL (s1, s2, l)
+ 
+      Please note that the localedef programs makes sure that `position'
+      is not used at the first level.  */
+-  if (! __libc_use_alloca ((s1len + s2len) * (sizeof (int32_t) + 1)))
+-    {
+-      idx1arr = (int32_t *) malloc ((s1len + s2len) * (sizeof (int32_t) + 1));
+-      idx2arr = &idx1arr[s1len];
+-      rule1arr = (unsigned char *) &idx2arr[s2len];
+-      rule2arr = &rule1arr[s1len];
+-
+-      if (idx1arr == NULL)
+-	/* No memory.  Well, go with the stack then.
+-
+-	   XXX Once this implementation is stable we will handle this
+-	   differently.  Instead of precomputing the indeces we will
+-	   do this in time.  This means, though, that this happens for
+-	   every pass again.  */
+-	goto try_stack;
+-      use_malloc = 1;
+-    }
+-  else
+-    {
+-    try_stack:
+-      idx1arr = (int32_t *) alloca (s1len * sizeof (int32_t));
+-      idx2arr = (int32_t *) alloca (s2len * sizeof (int32_t));
+-      rule1arr = (unsigned char *) alloca (s1len);
+-      rule2arr = (unsigned char *) alloca (s2len);
+-    }
+ 
+-  idx1cnt = 0;
+-  idx2cnt = 0;
+-  idx1max = 0;
+-  idx2max = 0;
+-  idx1now = 0;
+-  idx2now = 0;
+-  backw1_stop = ~0ul;
+-  backw2_stop = ~0ul;
+-  backw1 = ~0ul;
+-  backw2 = ~0ul;
+-  seq1len = 0;
+-  seq2len = 0;
+-  position = rulesets[0] & sort_position;
+-  while (1)
+-    {
+-      val1 = 0;
+-      val2 = 0;
+-
+-      /* Get the next non-IGNOREd element for string `s1'.  */
+-      if (seq1len == 0)
+-	do
+-	  {
+-	    ++val1;
+-
+-	    if (backw1_stop != ~0ul)
+-	      {
+-		/* The is something pushed.  */
+-		if (backw1 == backw1_stop)
+-		  {
+-		    /* The last pushed character was handled.  Continue
+-		       with forward characters.  */
+-		    if (idx1cnt < idx1max)
+-		      {
+-			idx1now = idx1cnt;
+-			backw1_stop = ~0ul;
+-		      }
+-		    else
+-		      /* Nothing anymore.  The backward sequence ended with
+-			 the last sequence in the string.  Note that seq1len
+-			 is still zero.  */
+-		      break;
+-		  }
+-		else
+-		  idx1now = --backw1;
+-	      }
+-	    else
+-	      {
+-		backw1_stop = idx1max;
+-
+-		while (*us1 != L('\0'))
+-		  {
+-		    int32_t tmp = findidx (&us1, -1);
+-		    rule1arr[idx1max] = tmp >> 24;
+-		    idx1arr[idx1max] = tmp & 0xffffff;
+-		    idx1cnt = idx1max++;
+-
+-		    if ((rulesets[rule1arr[idx1cnt] * nrules]
+-			 & sort_backward) == 0)
+-		      /* No more backward characters to push.  */
+-		      break;
+-		    ++idx1cnt;
+-		  }
+-
+-		if (backw1_stop >= idx1cnt)
+-		  {
+-		    /* No sequence at all or just one.  */
+-		    if (idx1cnt == idx1max || backw1_stop > idx1cnt)
+-		      /* Note that seq1len is still zero.  */
+-		      break;
+-
+-		    backw1_stop = ~0ul;
+-		    idx1now = idx1cnt;
+-		  }
+-		else
+-		  /* We pushed backward sequences.  */
+-		  idx1now = backw1 = idx1cnt - 1;
+-	      }
+-	  }
+-	while ((seq1len = weights[idx1arr[idx1now]++]) == 0);
+-
+-      /* And the same for string `s2'.  */
+-      if (seq2len == 0)
+-	do
+-	  {
+-	    ++val2;
+-
+-	    if (backw2_stop != ~0ul)
+-	      {
+-		/* The is something pushed.  */
+-		if (backw2 == backw2_stop)
+-		  {
+-		    /* The last pushed character was handled.  Continue
+-		       with forward characters.  */
+-		    if (idx2cnt < idx2max)
+-		      {
+-			idx2now = idx2cnt;
+-			backw2_stop = ~0ul;
+-		      }
+-		    else
+-		      /* Nothing anymore.  The backward sequence ended with
+-			 the last sequence in the string.  Note that seq2len
+-			 is still zero.  */
+-		      break;
+-		  }
+-		else
+-		  idx2now = --backw2;
+-	      }
+-	    else
+-	      {
+-		backw2_stop = idx2max;
+-
+-		while (*us2 != L('\0'))
+-		  {
+-		    int32_t tmp = findidx (&us2, -1);
+-		    rule2arr[idx2max] = tmp >> 24;
+-		    idx2arr[idx2max] = tmp & 0xffffff;
+-		    idx2cnt = idx2max++;
+-
+-		    if ((rulesets[rule2arr[idx2cnt] * nrules]
+-			 & sort_backward) == 0)
+-		      /* No more backward characters to push.  */
+-		      break;
+-		    ++idx2cnt;
+-		  }
+-
+-		if (backw2_stop >= idx2cnt)
+-		  {
+-		    /* No sequence at all or just one.  */
+-		    if (idx2cnt == idx2max || backw2_stop > idx2cnt)
+-		      /* Note that seq1len is still zero.  */
+-		      break;
+-
+-		    backw2_stop = ~0ul;
+-		    idx2now = idx2cnt;
+-		  }
+-		else
+-		  /* We pushed backward sequences.  */
+-		  idx2now = backw2 = idx2cnt - 1;
+-	      }
+-	  }
+-	while ((seq2len = weights[idx2arr[idx2now]++]) == 0);
+-
+-      /* See whether any or both strings are empty.  */
+-      if (seq1len == 0 || seq2len == 0)
+-	{
+-	  if (seq1len == seq2len)
+-	    /* Both ended.  So far so good, both strings are equal at the
+-	       first level.  */
+-	    break;
+-
+-	  /* This means one string is shorter than the other.  Find out
+-	     which one and return an appropriate value.  */
+-	  result = seq1len == 0 ? -1 : 1;
+-	  goto free_and_return;
+-	}
++  coll_seq seq1, seq2;
++  bool use_malloc = false;
++  int result = 0;
+ 
+-      /* Test for position if necessary.  */
+-      if (position && val1 != val2)
+-	{
+-	  result = val1 - val2;
+-	  goto free_and_return;
+-	}
++  memset (&seq1, 0, sizeof (seq1));
++  seq2 = seq1;
+ 
+-      /* Compare the two sequences.  */
+-      do
+-	{
+-	  if (weights[idx1arr[idx1now]] != weights[idx2arr[idx2now]])
+-	    {
+-	      /* The sequences differ.  */
+-	      result = weights[idx1arr[idx1now]] - weights[idx2arr[idx2now]];
+-	      goto free_and_return;
+-	    }
++  size_t size_max = SIZE_MAX / (sizeof (int32_t) + 1);
+ 
+-	  /* Increment the offsets.  */
+-	  ++idx1arr[idx1now];
+-	  ++idx2arr[idx2now];
++  /* If the strings are long enough to cause overflow in the size request, then
++     skip the allocation and proceed with the non-cached routines.  */
++  if (MIN (s1len, s2len) > size_max
++      || MAX (s1len, s2len) > size_max - MIN (s1len, s2len))
++    goto begin_collate;
+ 
+-	  --seq1len;
+-	  --seq2len;
+-	}
+-      while (seq1len > 0 && seq2len > 0);
++  if (! __libc_use_alloca ((s1len + s2len) * (sizeof (int32_t) + 1)))
++    {
++      seq1.idxarr = (int32_t *) malloc ((s1len + s2len) * (sizeof (int32_t) + 1));
+ 
+-      if (position && seq1len != seq2len)
++      /* If we failed to allocate memory, we leave everything as NULL so that
++	 we use the nocache version of traversal and comparison functions.  */
++      if (seq1.idxarr != NULL)
+ 	{
+-	  result = seq1len - seq2len;
+-	  goto free_and_return;
++	  seq2.idxarr = &seq1.idxarr[s1len];
++	  seq1.rulearr = (unsigned char *) &seq2.idxarr[s2len];
++	  seq2.rulearr = &seq1.rulearr[s1len];
++	  use_malloc = true;
+ 	}
+     }
++  else
++    {
++      seq1.idxarr = (int32_t *) alloca (s1len * sizeof (int32_t));
++      seq2.idxarr = (int32_t *) alloca (s2len * sizeof (int32_t));
++      seq1.rulearr = (unsigned char *) alloca (s1len);
++      seq2.rulearr = (unsigned char *) alloca (s2len);
++    }
+ 
+-  /* Now the remaining passes over the weights.  We now use the
+-     indeces we found before.  */
+-  for (pass = 1; pass < nrules; ++pass)
++  int rule;
++
++ begin_collate:
++  rule = 0;
++  /* Cache values in the first pass and if needed, use them in subsequent
++     passes.  */
++  for (int pass = 0; pass < nrules; ++pass)
+     {
++      seq1.idxcnt = 0;
++      seq1.idx = 0;
++      seq2.idx = 0;
++      seq1.backw_stop = ~0ul;
++      seq1.backw = ~0ul;
++      seq2.idxcnt = 0;
++      seq2.backw_stop = ~0ul;
++      seq2.backw = ~0ul;
++
++      /* We need the elements of the strings as unsigned values since they
++	 are used as indices.  */
++      seq1.us = (const USTRING_TYPE *) s1;
++      seq2.us = (const USTRING_TYPE *) s2;
++
+       /* We assume that if a rule has defined `position' in one section
+ 	 this is true for all of them.  */
+-      idx1cnt = 0;
+-      idx2cnt = 0;
+-      backw1_stop = ~0ul;
+-      backw2_stop = ~0ul;
+-      backw1 = ~0ul;
+-      backw2 = ~0ul;
+-      position = rulesets[rule1arr[0] * nrules + pass] & sort_position;
++      int position = rulesets[rule * nrules + pass] & sort_position;
+ 
+       while (1)
+ 	{
+-	  val1 = 0;
+-	  val2 = 0;
+-
+-	  /* Get the next non-IGNOREd element for string `s1'.  */
+-	  if (seq1len == 0)
+-	    do
+-	      {
+-		++val1;
+-
+-		if (backw1_stop != ~0ul)
+-		  {
+-		    /* The is something pushed.  */
+-		    if (backw1 == backw1_stop)
+-		      {
+-			/* The last pushed character was handled.  Continue
+-			   with forward characters.  */
+-			if (idx1cnt < idx1max)
+-			  {
+-			    idx1now = idx1cnt;
+-			    backw1_stop = ~0ul;
+-			  }
+-			else
+-			  {
+-			    /* Nothing anymore.  The backward sequence
+-			       ended with the last sequence in the string.  */
+-			    idx1now = ~0ul;
+-			    break;
+-			  }
+-		      }
+-		    else
+-		      idx1now = --backw1;
+-		  }
+-		else
+-		  {
+-		    backw1_stop = idx1cnt;
+-
+-		    while (idx1cnt < idx1max)
+-		      {
+-			if ((rulesets[rule1arr[idx1cnt] * nrules + pass]
+-			     & sort_backward) == 0)
+-			  /* No more backward characters to push.  */
+-			  break;
+-			++idx1cnt;
+-		      }
+-
+-		    if (backw1_stop == idx1cnt)
+-		      {
+-			/* No sequence at all or just one.  */
+-			if (idx1cnt == idx1max)
+-			  /* Note that seq1len is still zero.  */
+-			  break;
+-
+-			backw1_stop = ~0ul;
+-			idx1now = idx1cnt++;
+-		      }
+-		    else
+-		      /* We pushed backward sequences.  */
+-		      idx1now = backw1 = idx1cnt - 1;
+-		  }
+-	      }
+-	    while ((seq1len = weights[idx1arr[idx1now]++]) == 0);
+-
+-	  /* And the same for string `s2'.  */
+-	  if (seq2len == 0)
+-	    do
+-	      {
+-		++val2;
+-
+-		if (backw2_stop != ~0ul)
+-		  {
+-		    /* The is something pushed.  */
+-		    if (backw2 == backw2_stop)
+-		      {
+-			/* The last pushed character was handled.  Continue
+-			   with forward characters.  */
+-			if (idx2cnt < idx2max)
+-			  {
+-			    idx2now = idx2cnt;
+-			    backw2_stop = ~0ul;
+-			  }
+-			else
+-			  {
+-			    /* Nothing anymore.  The backward sequence
+-			       ended with the last sequence in the string.  */
+-			    idx2now = ~0ul;
+-			    break;
+-			  }
+-		      }
+-		    else
+-		      idx2now = --backw2;
+-		  }
+-		else
+-		  {
+-		    backw2_stop = idx2cnt;
+-
+-		    while (idx2cnt < idx2max)
+-		      {
+-			if ((rulesets[rule2arr[idx2cnt] * nrules + pass]
+-			     & sort_backward) == 0)
+-			  /* No more backward characters to push.  */
+-			  break;
+-			++idx2cnt;
+-		      }
+-
+-		    if (backw2_stop == idx2cnt)
+-		      {
+-			/* No sequence at all or just one.  */
+-			if (idx2cnt == idx2max)
+-			  /* Note that seq2len is still zero.  */
+-			  break;
+-
+-			backw2_stop = ~0ul;
+-			idx2now = idx2cnt++;
+-		      }
+-		    else
+-		      /* We pushed backward sequences.  */
+-		      idx2now = backw2 = idx2cnt - 1;
+-		  }
+-	      }
+-	    while ((seq2len = weights[idx2arr[idx2now]++]) == 0);
++	  if (__glibc_unlikely (seq1.idxarr == NULL))
++	    {
++	      get_next_seq_nocache (&seq1, nrules, rulesets, weights, table,
++				    extra, indirect, pass);
++	      get_next_seq_nocache (&seq2, nrules, rulesets, weights, table,
++				    extra, indirect, pass);
++	    }
++	  else if (pass == 0)
++	    {
++	      get_next_seq (&seq1, nrules, rulesets, weights, table, extra,
++			    indirect);
++	      get_next_seq (&seq2, nrules, rulesets, weights, table, extra,
++			    indirect);
++	    }
++	  else
++	    {
++	      get_next_seq_cached (&seq1, nrules, pass, rulesets, weights);
++	      get_next_seq_cached (&seq2, nrules, pass, rulesets, weights);
++	    }
+ 
+ 	  /* See whether any or both strings are empty.  */
+-	  if (seq1len == 0 || seq2len == 0)
++	  if (seq1.len == 0 || seq2.len == 0)
+ 	    {
+-	      if (seq1len == seq2len)
++	      if (seq1.len == seq2.len)
+ 		/* Both ended.  So far so good, both strings are equal
+ 		   at this level.  */
+ 		break;
+ 
+ 	      /* This means one string is shorter than the other.  Find out
+ 		 which one and return an appropriate value.  */
+-	      result = seq1len == 0 ? -1 : 1;
++	      result = seq1.len == 0 ? -1 : 1;
+ 	      goto free_and_return;
+ 	    }
+ 
+-	  /* Test for position if necessary.  */
+-	  if (position && val1 != val2)
+-	    {
+-	      result = val1 - val2;
+-	      goto free_and_return;
+-	    }
+-
+-	  /* Compare the two sequences.  */
+-	  do
+-	    {
+-	      if (weights[idx1arr[idx1now]] != weights[idx2arr[idx2now]])
+-		{
+-		  /* The sequences differ.  */
+-		  result = (weights[idx1arr[idx1now]]
+-			    - weights[idx2arr[idx2now]]);
+-		  goto free_and_return;
+-		}
+-
+-	      /* Increment the offsets.  */
+-	      ++idx1arr[idx1now];
+-	      ++idx2arr[idx2now];
+-
+-	      --seq1len;
+-	      --seq2len;
+-	    }
+-	  while (seq1len > 0 && seq2len > 0);
+-
+-	  if (position && seq1len != seq2len)
+-	    {
+-	      result = seq1len - seq2len;
+-	      goto free_and_return;
+-	    }
++	  if (__glibc_unlikely (seq1.idxarr == NULL))
++	    result = do_compare_nocache (&seq1, &seq2, position, weights);
++	  else
++	    result = do_compare (&seq1, &seq2, position, weights);
++	  if (result != 0)
++	    goto free_and_return;
+ 	}
++
++      if (__glibc_likely (seq1.rulearr != NULL))
++	rule = seq1.rulearr[0];
++      else
++	rule = seq1.rule;
+     }
+ 
+   /* Free the memory if needed.  */
+  free_and_return:
+   if (use_malloc)
+-    free (idx1arr);
++    free (seq1.idxarr);
+ 
+   return result;
+ }
diff --git a/pkgs/development/libraries/glibc/2.18/cve-2013-4237.patch b/pkgs/development/libraries/glibc/2.18/cve-2013-4237.patch
new file mode 100644
index 00000000000..f745cb003aa
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.18/cve-2013-4237.patch
@@ -0,0 +1,302 @@
+commit 91ce40854d0b7f865cf5024ef95a8026b76096f3
+Author: Florian Weimer <fweimer@redhat.com>
+Date:   Fri Aug 16 09:38:52 2013 +0200
+
+    CVE-2013-4237, BZ #14699: Buffer overflow in readdir_r
+    
+    	* sysdeps/posix/dirstream.h (struct __dirstream): Add errcode
+    	member.
+    	* sysdeps/posix/opendir.c (__alloc_dir): Initialize errcode
+    	member.
+    	* sysdeps/posix/rewinddir.c (rewinddir): Reset errcode member.
+    	* sysdeps/posix/readdir_r.c (__READDIR_R): Enforce NAME_MAX limit.
+    	Return delayed error code.  Remove GETDENTS_64BIT_ALIGNED
+    	conditional.
+    	* sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c: Do not define
+    	GETDENTS_64BIT_ALIGNED.
+    	* sysdeps/unix/sysv/linux/i386/readdir64_r.c: Likewise.
+    	* manual/filesys.texi (Reading/Closing Directory): Document
+    	ENAMETOOLONG return value of readdir_r.  Recommend readdir more
+    	strongly.
+    	* manual/conf.texi (Limits for Files): Add portability note to
+    	NAME_MAX, PATH_MAX.
+    	(Pathconf): Add portability note for _PC_NAME_MAX, _PC_PATH_MAX.
+
+diff --git a/manual/conf.texi b/manual/conf.texi
+index 7eb8b36..c720063 100644
+--- a/manual/conf.texi
++++ b/manual/conf.texi
+@@ -1149,6 +1149,9 @@ typed ahead as input.  @xref{I/O Queues}.
+ @deftypevr Macro int NAME_MAX
+ The uniform system limit (if any) for the length of a file name component, not
+ including the terminating null character.
++
++@strong{Portability Note:} On some systems, @theglibc{} defines
++@code{NAME_MAX}, but does not actually enforce this limit.
+ @end deftypevr
+ 
+ @comment limits.h
+@@ -1157,6 +1160,9 @@ including the terminating null character.
+ The uniform system limit (if any) for the length of an entire file name (that
+ is, the argument given to system calls such as @code{open}), including the
+ terminating null character.
++
++@strong{Portability Note:} @Theglibc{} does not enforce this limit
++even if @code{PATH_MAX} is defined.
+ @end deftypevr
+ 
+ @cindex limits, pipe buffer size
+@@ -1476,6 +1482,9 @@ Inquire about the value of @code{POSIX_REC_MIN_XFER_SIZE}.
+ Inquire about the value of @code{POSIX_REC_XFER_ALIGN}.
+ @end table
+ 
++@strong{Portability Note:} On some systems, @theglibc{} does not
++enforce @code{_PC_NAME_MAX} or @code{_PC_PATH_MAX} limits.
++
+ @node Utility Limits
+ @section Utility Program Capacity Limits
+ 
+diff --git a/manual/filesys.texi b/manual/filesys.texi
+index 1df9cf2..814c210 100644
+--- a/manual/filesys.texi
++++ b/manual/filesys.texi
+@@ -444,9 +444,9 @@ symbols are declared in the header file @file{dirent.h}.
+ @comment POSIX.1
+ @deftypefun {struct dirent *} readdir (DIR *@var{dirstream})
+ This function reads the next entry from the directory.  It normally
+-returns a pointer to a structure containing information about the file.
+-This structure is statically allocated and can be rewritten by a
+-subsequent call.
++returns a pointer to a structure containing information about the
++file.  This structure is associated with the @var{dirstream} handle
++and can be rewritten by a subsequent call.
+ 
+ @strong{Portability Note:} On some systems @code{readdir} may not
+ return entries for @file{.} and @file{..}, even though these are always
+@@ -461,19 +461,61 @@ conditions are defined for this function:
+ The @var{dirstream} argument is not valid.
+ @end table
+ 
+-@code{readdir} is not thread safe.  Multiple threads using
+-@code{readdir} on the same @var{dirstream} may overwrite the return
+-value.  Use @code{readdir_r} when this is critical.
++To distinguish between an end-of-directory condition or an error, you
++must set @code{errno} to zero before calling @code{readdir}.  To avoid
++entering an infinite loop, you should stop reading from the directory
++after the first error.
++
++In POSIX.1-2008, @code{readdir} is not thread-safe.  In @theglibc{}
++implementation, it is safe to call @code{readdir} concurrently on
++different @var{dirstream}s, but multiple threads accessing the same
++@var{dirstream} result in undefined behavior.  @code{readdir_r} is a
++fully thread-safe alternative, but suffers from poor portability (see
++below).  It is recommended that you use @code{readdir}, with external
++locking if multiple threads access the same @var{dirstream}.
+ @end deftypefun
+ 
+ @comment dirent.h
+ @comment GNU
+ @deftypefun int readdir_r (DIR *@var{dirstream}, struct dirent *@var{entry}, struct dirent **@var{result})
+-This function is the reentrant version of @code{readdir}.  Like
+-@code{readdir} it returns the next entry from the directory.  But to
+-prevent conflicts between simultaneously running threads the result is
+-not stored in statically allocated memory.  Instead the argument
+-@var{entry} points to a place to store the result.
++This function is a version of @code{readdir} which performs internal
++locking.  Like @code{readdir} it returns the next entry from the
++directory.  To prevent conflicts between simultaneously running
++threads the result is stored inside the @var{entry} object.
++
++@strong{Portability Note:} It is recommended to use @code{readdir}
++instead of @code{readdir_r} for the following reasons:
++
++@itemize @bullet
++@item
++On systems which do not define @code{NAME_MAX}, it may not be possible
++to use @code{readdir_r} safely because the caller does not specify the
++length of the buffer for the directory entry.
++
++@item
++On some systems, @code{readdir_r} cannot read directory entries with
++very long names.  If such a name is encountered, @theglibc{}
++implementation of @code{readdir_r} returns with an error code of
++@code{ENAMETOOLONG} after the final directory entry has been read.  On
++other systems, @code{readdir_r} may return successfully, but the
++@code{d_name} member may not be NUL-terminated or may be truncated.
++
++@item
++POSIX-1.2008 does not guarantee that @code{readdir} is thread-safe,
++even when access to the same @var{dirstream} is serialized.  But in
++current implementations (including @theglibc{}), it is safe to call
++@code{readdir} concurrently on different @var{dirstream}s, so there is
++no need to use @code{readdir_r} in most multi-threaded programs.  In
++the rare case that multiple threads need to read from the same
++@var{dirstream}, it is still better to use @code{readdir} and external
++synchronization.
++
++@item
++It is expected that future versions of POSIX will obsolete
++@code{readdir_r} and mandate the level of thread safety for
++@code{readdir} which is provided by @theglibc{} and other
++implementations today.
++@end itemize
+ 
+ Normally @code{readdir_r} returns zero and sets @code{*@var{result}}
+ to @var{entry}.  If there are no more entries in the directory or an
+@@ -481,15 +523,6 @@ error is detected, @code{readdir_r} sets @code{*@var{result}} to a
+ null pointer and returns a nonzero error code, also stored in
+ @code{errno}, as described for @code{readdir}.
+ 
+-@strong{Portability Note:} On some systems @code{readdir_r} may not
+-return a NUL terminated string for the file name, even when there is no
+-@code{d_reclen} field in @code{struct dirent} and the file
+-name is the maximum allowed size.  Modern systems all have the
+-@code{d_reclen} field, and on old systems multi-threading is not
+-critical.  In any case there is no such problem with the @code{readdir}
+-function, so that even on systems without the @code{d_reclen} member one
+-could use multiple threads by using external locking.
+-
+ It is also important to look at the definition of the @code{struct
+ dirent} type.  Simply passing a pointer to an object of this type for
+ the second parameter of @code{readdir_r} might not be enough.  Some
+diff --git a/sysdeps/posix/dirstream.h b/sysdeps/posix/dirstream.h
+index a7a074d..8e8570d 100644
+--- a/sysdeps/posix/dirstream.h
++++ b/sysdeps/posix/dirstream.h
+@@ -39,6 +39,8 @@ struct __dirstream
+ 
+     off_t filepos;		/* Position of next entry to read.  */
+ 
++    int errcode;		/* Delayed error code.  */
++
+     /* Directory block.  */
+     char data[0] __attribute__ ((aligned (__alignof__ (void*))));
+   };
+diff --git a/sysdeps/posix/opendir.c b/sysdeps/posix/opendir.c
+index ddfc3a7..fc05b0f 100644
+--- a/sysdeps/posix/opendir.c
++++ b/sysdeps/posix/opendir.c
+@@ -231,6 +231,7 @@ __alloc_dir (int fd, bool close_fd, int flags, const struct stat64 *statp)
+   dirp->size = 0;
+   dirp->offset = 0;
+   dirp->filepos = 0;
++  dirp->errcode = 0;
+ 
+   return dirp;
+ }
+diff --git a/sysdeps/posix/readdir_r.c b/sysdeps/posix/readdir_r.c
+index b5a8e2e..8ed5c3f 100644
+--- a/sysdeps/posix/readdir_r.c
++++ b/sysdeps/posix/readdir_r.c
+@@ -40,6 +40,7 @@ __READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
+   DIRENT_TYPE *dp;
+   size_t reclen;
+   const int saved_errno = errno;
++  int ret;
+ 
+   __libc_lock_lock (dirp->lock);
+ 
+@@ -70,10 +71,10 @@ __READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
+ 		  bytes = 0;
+ 		  __set_errno (saved_errno);
+ 		}
++	      if (bytes < 0)
++		dirp->errcode = errno;
+ 
+ 	      dp = NULL;
+-	      /* Reclen != 0 signals that an error occurred.  */
+-	      reclen = bytes != 0;
+ 	      break;
+ 	    }
+ 	  dirp->size = (size_t) bytes;
+@@ -106,29 +107,46 @@ __READDIR_R (DIR *dirp, DIRENT_TYPE *entry, DIRENT_TYPE **result)
+       dirp->filepos += reclen;
+ #endif
+ 
+-      /* Skip deleted files.  */
++#ifdef NAME_MAX
++      if (reclen > offsetof (DIRENT_TYPE, d_name) + NAME_MAX + 1)
++	{
++	  /* The record is very long.  It could still fit into the
++	     caller-supplied buffer if we can skip padding at the
++	     end.  */
++	  size_t namelen = _D_EXACT_NAMLEN (dp);
++	  if (namelen <= NAME_MAX)
++	    reclen = offsetof (DIRENT_TYPE, d_name) + namelen + 1;
++	  else
++	    {
++	      /* The name is too long.  Ignore this file.  */
++	      dirp->errcode = ENAMETOOLONG;
++	      dp->d_ino = 0;
++	      continue;
++	    }
++	}
++#endif
++
++      /* Skip deleted and ignored files.  */
+     }
+   while (dp->d_ino == 0);
+ 
+   if (dp != NULL)
+     {
+-#ifdef GETDENTS_64BIT_ALIGNED
+-      /* The d_reclen value might include padding which is not part of
+-	 the DIRENT_TYPE data structure.  */
+-      reclen = MIN (reclen,
+-		    offsetof (DIRENT_TYPE, d_name) + sizeof (dp->d_name));
+-#endif
+       *result = memcpy (entry, dp, reclen);
+-#ifdef GETDENTS_64BIT_ALIGNED
++#ifdef _DIRENT_HAVE_D_RECLEN
+       entry->d_reclen = reclen;
+ #endif
++      ret = 0;
+     }
+   else
+-    *result = NULL;
++    {
++      *result = NULL;
++      ret = dirp->errcode;
++    }
+ 
+   __libc_lock_unlock (dirp->lock);
+ 
+-  return dp != NULL ? 0 : reclen ? errno : 0;
++  return ret;
+ }
+ 
+ #ifdef __READDIR_R_ALIAS
+diff --git a/sysdeps/posix/rewinddir.c b/sysdeps/posix/rewinddir.c
+index 2935a8e..d4991ad 100644
+--- a/sysdeps/posix/rewinddir.c
++++ b/sysdeps/posix/rewinddir.c
+@@ -33,6 +33,7 @@ rewinddir (dirp)
+   dirp->filepos = 0;
+   dirp->offset = 0;
+   dirp->size = 0;
++  dirp->errcode = 0;
+ #ifndef NOT_IN_libc
+   __libc_lock_unlock (dirp->lock);
+ #endif
+diff --git a/sysdeps/unix/sysv/linux/i386/readdir64_r.c b/sysdeps/unix/sysv/linux/i386/readdir64_r.c
+index 8ebbcfd..a7d114e 100644
+--- a/sysdeps/unix/sysv/linux/i386/readdir64_r.c
++++ b/sysdeps/unix/sysv/linux/i386/readdir64_r.c
+@@ -18,7 +18,6 @@
+ #define __READDIR_R __readdir64_r
+ #define __GETDENTS __getdents64
+ #define DIRENT_TYPE struct dirent64
+-#define GETDENTS_64BIT_ALIGNED 1
+ 
+ #include <sysdeps/posix/readdir_r.c>
+ 
+diff --git a/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c b/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c
+index 5ed8e95..290f2c8 100644
+--- a/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c
++++ b/sysdeps/unix/sysv/linux/wordsize-64/readdir_r.c
+@@ -1,5 +1,4 @@
+ #define readdir64_r __no_readdir64_r_decl
+-#define GETDENTS_64BIT_ALIGNED 1
+ #include <sysdeps/posix/readdir_r.c>
+ #undef readdir64_r
+ weak_alias (__readdir_r, readdir64_r)
diff --git a/pkgs/development/libraries/glibc/2.18/cve-2013-4332.patch b/pkgs/development/libraries/glibc/2.18/cve-2013-4332.patch
new file mode 100644
index 00000000000..94d25d7bbe1
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.18/cve-2013-4332.patch
@@ -0,0 +1,56 @@
+https://projects.archlinux.org/svntogit/packages.git/tree/trunk/glibc-2.18-malloc-corrupt-CVE-2013-4332.patch?h=packages/glibc
+
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index dd295f5..7f43ba3 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -3082,6 +3082,13 @@ __libc_pvalloc(size_t bytes)
+   size_t page_mask = GLRO(dl_pagesize) - 1;
+   size_t rounded_bytes = (bytes + page_mask) & ~(page_mask);
+ 
++  /* Check for overflow.  */
++  if (bytes > SIZE_MAX - 2*pagesz - MINSIZE)
++    {
++      __set_errno (ENOMEM);
++      return 0;
++    }
++
+   void *(*hook) (size_t, size_t, const void *) =
+     force_reg (__memalign_hook);
+   if (__builtin_expect (hook != NULL, 0))
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 7f43ba3..3148c5f 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -3046,6 +3046,13 @@ __libc_valloc(size_t bytes)
+ 
+   size_t pagesz = GLRO(dl_pagesize);
+ 
++  /* Check for overflow.  */
++  if (bytes > SIZE_MAX - pagesz - MINSIZE)
++    {
++      __set_errno (ENOMEM);
++      return 0;
++    }
++
+   void *(*hook) (size_t, size_t, const void *) =
+     force_reg (__memalign_hook);
+   if (__builtin_expect (hook != NULL, 0))
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index 3148c5f..f7718a9 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -3015,6 +3015,13 @@ __libc_memalign(size_t alignment, size_t bytes)
+   /* Otherwise, ensure that it is at least a minimum chunk size */
+   if (alignment <  MINSIZE) alignment = MINSIZE;
+ 
++  /* Check for overflow.  */
++  if (bytes > SIZE_MAX - alignment - MINSIZE)
++    {
++      __set_errno (ENOMEM);
++      return 0;
++    }
++
+   arena_get(ar_ptr, bytes + alignment + MINSIZE);
+   if(!ar_ptr)
+     return 0;
diff --git a/pkgs/development/libraries/glibc/2.18/cve-2013-4458.patch b/pkgs/development/libraries/glibc/2.18/cve-2013-4458.patch
new file mode 100644
index 00000000000..bec4acde754
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.18/cve-2013-4458.patch
@@ -0,0 +1,50 @@
+commit 7cbcdb3699584db8913ca90f705d6337633ee10f
+Author: Siddhesh Poyarekar <siddhesh@redhat.com>
+Date:   Fri Oct 25 10:22:12 2013 +0530
+
+    Fix stack overflow due to large AF_INET6 requests
+    
+    Resolves #16072 (CVE-2013-4458).
+    
+    This patch fixes another stack overflow in getaddrinfo when it is
+    called with AF_INET6.  The AF_UNSPEC case was fixed as CVE-2013-1914,
+    but the AF_INET6 case went undetected back then.
+
+diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
+index e6ce4cf..8ff74b4 100644
+--- a/sysdeps/posix/getaddrinfo.c
++++ b/sysdeps/posix/getaddrinfo.c
+@@ -197,7 +197,22 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
+ 				&rc, &herrno, NULL, &localcanon));	      \
+     if (rc != ERANGE || herrno != NETDB_INTERNAL)			      \
+       break;								      \
+-    tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);		      \
++    if (!malloc_tmpbuf && __libc_use_alloca (alloca_used + 2 * tmpbuflen))    \
++      tmpbuf = extend_alloca_account (tmpbuf, tmpbuflen, 2 * tmpbuflen,	      \
++				      alloca_used);			      \
++    else								      \
++      {									      \
++	char *newp = realloc (malloc_tmpbuf ? tmpbuf : NULL,		      \
++			      2 * tmpbuflen);				      \
++	if (newp == NULL)						      \
++	  {								      \
++	    result = -EAI_MEMORY;					      \
++	    goto free_and_return;					      \
++	  }								      \
++	tmpbuf = newp;							      \
++	malloc_tmpbuf = true;						      \
++	tmpbuflen = 2 * tmpbuflen;					      \
++      }									      \
+   }									      \
+   if (status == NSS_STATUS_SUCCESS && rc == 0)				      \
+     h = &th;								      \
+@@ -209,7 +224,8 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
+ 	{								      \
+ 	  __set_h_errno (herrno);					      \
+ 	  _res.options |= old_res_options & RES_USE_INET6;		      \
+-	  return -EAI_SYSTEM;						      \
++	  result = -EAI_SYSTEM;						      \
++	  goto free_and_return;						      \
+ 	}								      \
+       if (herrno == TRY_AGAIN)						      \
+ 	no_data = EAI_AGAIN;						      \
diff --git a/pkgs/development/libraries/glibc/2.18/cve-2013-4788.patch b/pkgs/development/libraries/glibc/2.18/cve-2013-4788.patch
new file mode 100644
index 00000000000..cf8c7911f68
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.18/cve-2013-4788.patch
@@ -0,0 +1,222 @@
+commit c61b4d41c9647a54a329aa021341c0eb032b793e
+Author: Carlos O'Donell <carlos@redhat.com>
+Date:   Mon Sep 23 00:52:09 2013 -0400
+
+    BZ #15754: CVE-2013-4788
+    
+    The pointer guard used for pointer mangling was not initialized for
+    static applications resulting in the security feature being disabled.
+    The pointer guard is now correctly initialized to a random value for
+    static applications. Existing static applications need to be
+    recompiled to take advantage of the fix.
+    
+    The test tst-ptrguard1-static and tst-ptrguard1 add regression
+    coverage to ensure the pointer guards are sufficiently random
+    and initialized to a default value.
+
+diff --git a/csu/libc-start.c b/csu/libc-start.c
+index e5da3ef..c898d06 100644
+--- a/csu/libc-start.c
++++ b/csu/libc-start.c
+@@ -37,6 +37,12 @@ extern void __pthread_initialize_minimal (void);
+    in thread local area.  */
+ uintptr_t __stack_chk_guard attribute_relro;
+ # endif
++# ifndef  THREAD_SET_POINTER_GUARD
++/* Only exported for architectures that don't store the pointer guard
++   value in thread local area.  */
++uintptr_t __pointer_chk_guard_local
++	attribute_relro attribute_hidden __attribute__ ((nocommon));
++# endif
+ #endif
+ 
+ #ifdef HAVE_PTR_NTHREADS
+@@ -195,6 +201,16 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
+ # else
+   __stack_chk_guard = stack_chk_guard;
+ # endif
++
++  /* Set up the pointer guard value.  */
++  uintptr_t pointer_chk_guard = _dl_setup_pointer_guard (_dl_random,
++							 stack_chk_guard);
++# ifdef THREAD_SET_POINTER_GUARD
++  THREAD_SET_POINTER_GUARD (pointer_chk_guard);
++# else
++  __pointer_chk_guard_local = pointer_chk_guard;
++# endif
++
+ #endif
+ 
+   /* Register the destructor of the dynamic linker if there is any.  */
+diff --git a/ports/sysdeps/ia64/stackguard-macros.h b/ports/sysdeps/ia64/stackguard-macros.h
+index dc683c2..3907293 100644
+--- a/ports/sysdeps/ia64/stackguard-macros.h
++++ b/ports/sysdeps/ia64/stackguard-macros.h
+@@ -2,3 +2,6 @@
+ 
+ #define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("adds %0 = -8, r13;; ld8 %0 = [%0]" : "=r" (x)); x; })
++
++#define POINTER_CHK_GUARD \
++  ({ uintptr_t x; asm ("adds %0 = -16, r13;; ld8 %0 = [%0]" : "=r" (x)); x; })
+diff --git a/ports/sysdeps/tile/stackguard-macros.h b/ports/sysdeps/tile/stackguard-macros.h
+index 589ea2b..f2e041b 100644
+--- a/ports/sysdeps/tile/stackguard-macros.h
++++ b/ports/sysdeps/tile/stackguard-macros.h
+@@ -4,11 +4,17 @@
+ # if __WORDSIZE == 64
+ #  define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("addi %0, tp, -16; ld %0, %0" : "=r" (x)); x; })
++#  define POINTER_CHK_GUARD \
++  ({ uintptr_t x; asm ("addi %0, tp, -24; ld %0, %0" : "=r" (x)); x; })
+ # else
+ #  define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("addi %0, tp, -8; ld4s %0, %0" : "=r" (x)); x; })
++#  define POINTER_CHK_GUARD \
++  ({ uintptr_t x; asm ("addi %0, tp, -12; ld4s %0, %0" : "=r" (x)); x; })
+ # endif
+ #else
+ # define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("addi %0, tp, -8; lw %0, %0" : "=r" (x)); x; })
++# define POINTER_CHK_GUARD \
++  ({ uintptr_t x; asm ("addi %0, tp, -12; lw %0, %0" : "=r" (x)); x; })
+ #endif
+diff --git a/sysdeps/generic/stackguard-macros.h b/sysdeps/generic/stackguard-macros.h
+index ababf65..4fa3d96 100644
+--- a/sysdeps/generic/stackguard-macros.h
++++ b/sysdeps/generic/stackguard-macros.h
+@@ -2,3 +2,6 @@
+ 
+ extern uintptr_t __stack_chk_guard;
+ #define STACK_CHK_GUARD __stack_chk_guard
++
++extern uintptr_t __pointer_chk_guard_local;
++#define POINTER_CHK_GUARD __pointer_chk_guard_local
+diff --git a/sysdeps/i386/stackguard-macros.h b/sysdeps/i386/stackguard-macros.h
+index 8c31e19..0397629 100644
+--- a/sysdeps/i386/stackguard-macros.h
++++ b/sysdeps/i386/stackguard-macros.h
+@@ -2,3 +2,11 @@
+ 
+ #define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("movl %%gs:0x14, %0" : "=r" (x)); x; })
++
++#define POINTER_CHK_GUARD \
++  ({							\
++     uintptr_t x;					\
++     asm ("movl %%gs:%c1, %0" : "=r" (x)		\
++	  : "i" (offsetof (tcbhead_t, pointer_guard)));	\
++     x;							\
++   })
+diff --git a/sysdeps/powerpc/powerpc32/stackguard-macros.h b/sysdeps/powerpc/powerpc32/stackguard-macros.h
+index 839f6a4..b3d0af8 100644
+--- a/sysdeps/powerpc/powerpc32/stackguard-macros.h
++++ b/sysdeps/powerpc/powerpc32/stackguard-macros.h
+@@ -2,3 +2,13 @@
+ 
+ #define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("lwz %0,-28680(2)" : "=r" (x)); x; })
++
++#define POINTER_CHK_GUARD \
++  ({												\
++     uintptr_t x;										\
++     asm ("lwz %0,%1(2)"									\
++	  : "=r" (x)										\
++	  : "i" (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t))	\
++         );											\
++     x;												\
++   })
+diff --git a/sysdeps/powerpc/powerpc64/stackguard-macros.h b/sysdeps/powerpc/powerpc64/stackguard-macros.h
+index 9da879c..4620f96 100644
+--- a/sysdeps/powerpc/powerpc64/stackguard-macros.h
++++ b/sysdeps/powerpc/powerpc64/stackguard-macros.h
+@@ -2,3 +2,13 @@
+ 
+ #define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("ld %0,-28688(13)" : "=r" (x)); x; })
++
++#define POINTER_CHK_GUARD \
++  ({												\
++     uintptr_t x;										\
++     asm ("ld %0,%1(2)"										\
++	  : "=r" (x)										\
++	  : "i" (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t))	\
++         );											\
++     x;												\
++   })
+diff --git a/sysdeps/s390/s390-32/stackguard-macros.h b/sysdeps/s390/s390-32/stackguard-macros.h
+index b74c579..449e8d4 100644
+--- a/sysdeps/s390/s390-32/stackguard-macros.h
++++ b/sysdeps/s390/s390-32/stackguard-macros.h
+@@ -2,3 +2,14 @@
+ 
+ #define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("ear %0,%%a0; l %0,0x14(%0)" : "=a" (x)); x; })
++
++/* On s390/s390x there is no unique pointer guard, instead we use the
++   same value as the stack guard.  */
++#define POINTER_CHK_GUARD \
++  ({							\
++     uintptr_t x;					\
++     asm ("ear %0,%%a0; l %0,%1(%0)"			\
++	  : "=a" (x)					\
++	  : "i" (offsetof (tcbhead_t, stack_guard)));	\
++     x;							\
++   })
+diff --git a/sysdeps/s390/s390-64/stackguard-macros.h b/sysdeps/s390/s390-64/stackguard-macros.h
+index 0cebb5f..c8270fb 100644
+--- a/sysdeps/s390/s390-64/stackguard-macros.h
++++ b/sysdeps/s390/s390-64/stackguard-macros.h
+@@ -2,3 +2,17 @@
+ 
+ #define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("ear %0,%%a0; sllg %0,%0,32; ear %0,%%a1; lg %0,0x28(%0)" : "=a" (x)); x; })
++
++/* On s390/s390x there is no unique pointer guard, instead we use the
++   same value as the stack guard.  */
++#define POINTER_CHK_GUARD \
++  ({							\
++     uintptr_t x;					\
++     asm ("ear %0,%%a0;"				\
++	  "sllg %0,%0,32;"				\
++	  "ear %0,%%a1;"				\
++	  "lg %0,%1(%0)"				\
++	 : "=a" (x)					\
++	 : "i" (offsetof (tcbhead_t, stack_guard)));	\
++     x;							\
++   })
+diff --git a/sysdeps/sparc/sparc32/stackguard-macros.h b/sysdeps/sparc/sparc32/stackguard-macros.h
+index c0b02b0..1eef0f1 100644
+--- a/sysdeps/sparc/sparc32/stackguard-macros.h
++++ b/sysdeps/sparc/sparc32/stackguard-macros.h
+@@ -2,3 +2,6 @@
+ 
+ #define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("ld [%%g7+0x14], %0" : "=r" (x)); x; })
++
++#define POINTER_CHK_GUARD \
++  ({ uintptr_t x; asm ("ld [%%g7+0x18], %0" : "=r" (x)); x; })
+diff --git a/sysdeps/sparc/sparc64/stackguard-macros.h b/sysdeps/sparc/sparc64/stackguard-macros.h
+index 80f0635..cc0c12c 100644
+--- a/sysdeps/sparc/sparc64/stackguard-macros.h
++++ b/sysdeps/sparc/sparc64/stackguard-macros.h
+@@ -2,3 +2,6 @@
+ 
+ #define STACK_CHK_GUARD \
+   ({ uintptr_t x; asm ("ldx [%%g7+0x28], %0" : "=r" (x)); x; })
++
++#define POINTER_CHK_GUARD \
++  ({ uintptr_t x; asm ("ldx [%%g7+0x30], %0" : "=r" (x)); x; })
+diff --git a/sysdeps/x86_64/stackguard-macros.h b/sysdeps/x86_64/stackguard-macros.h
+index d7fedb3..1948800 100644
+--- a/sysdeps/x86_64/stackguard-macros.h
++++ b/sysdeps/x86_64/stackguard-macros.h
+@@ -4,3 +4,8 @@
+   ({ uintptr_t x;						\
+      asm ("mov %%fs:%c1, %0" : "=r" (x)				\
+ 	  : "i" (offsetof (tcbhead_t, stack_guard))); x; })
++
++#define POINTER_CHK_GUARD \
++  ({ uintptr_t x;						\
++     asm ("mov %%fs:%c1, %0" : "=r" (x)				\
++	  : "i" (offsetof (tcbhead_t, pointer_guard))); x; })
diff --git a/pkgs/development/libraries/glibc/2.17/default.nix b/pkgs/development/libraries/glibc/2.18/default.nix
index 52a94bd0a0d..52a94bd0a0d 100644
--- a/pkgs/development/libraries/glibc/2.17/default.nix
+++ b/pkgs/development/libraries/glibc/2.18/default.nix
diff --git a/pkgs/development/libraries/glibc/2.17/dont-use-system-ld-so-cache.patch b/pkgs/development/libraries/glibc/2.18/dont-use-system-ld-so-cache.patch
index 95f53773320..95f53773320 100644
--- a/pkgs/development/libraries/glibc/2.17/dont-use-system-ld-so-cache.patch
+++ b/pkgs/development/libraries/glibc/2.18/dont-use-system-ld-so-cache.patch
diff --git a/pkgs/development/libraries/glibc/2.17/fix_path_attribute_in_getconf.patch b/pkgs/development/libraries/glibc/2.18/fix_path_attribute_in_getconf.patch
index 714e49db560..714e49db560 100644
--- a/pkgs/development/libraries/glibc/2.17/fix_path_attribute_in_getconf.patch
+++ b/pkgs/development/libraries/glibc/2.18/fix_path_attribute_in_getconf.patch
diff --git a/pkgs/development/libraries/glibc/2.17/glibc-crypt-blowfish.patch b/pkgs/development/libraries/glibc/2.18/glibc-crypt-blowfish.patch
index a0a8acdab63..a0a8acdab63 100644
--- a/pkgs/development/libraries/glibc/2.17/glibc-crypt-blowfish.patch
+++ b/pkgs/development/libraries/glibc/2.18/glibc-crypt-blowfish.patch
diff --git a/pkgs/development/libraries/glibc/2.17/glibc-rh739743.patch b/pkgs/development/libraries/glibc/2.18/glibc-rh739743.patch
index c390b772b16..c390b772b16 100644
--- a/pkgs/development/libraries/glibc/2.17/glibc-rh739743.patch
+++ b/pkgs/development/libraries/glibc/2.18/glibc-rh739743.patch
diff --git a/pkgs/development/libraries/glibc/2.17/info.nix b/pkgs/development/libraries/glibc/2.18/info.nix
index e4cdb42dd68..e4cdb42dd68 100644
--- a/pkgs/development/libraries/glibc/2.17/info.nix
+++ b/pkgs/development/libraries/glibc/2.18/info.nix
diff --git a/pkgs/development/libraries/glibc/2.13/locales-builder.sh b/pkgs/development/libraries/glibc/2.18/locales-builder.sh
index d732e208fa2..d732e208fa2 100644
--- a/pkgs/development/libraries/glibc/2.13/locales-builder.sh
+++ b/pkgs/development/libraries/glibc/2.18/locales-builder.sh
diff --git a/pkgs/development/libraries/glibc/2.18/locales.nix b/pkgs/development/libraries/glibc/2.18/locales.nix
new file mode 100644
index 00000000000..9f9fb86a396
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.18/locales.nix
@@ -0,0 +1,47 @@
+/* This function builds just the `lib/locale/locale-archive' file from
+   Glibc and nothing else.  If `allLocales' is true, all supported
+   locales are included; otherwise, just the locales listed in
+   `locales'.  See localedata/SUPPORTED in the Glibc source tree for
+   the list of all supported locales:
+   http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc
+*/
+
+{ stdenv, fetchurl, allLocales ? true, locales ? ["en_US.UTF-8/UTF-8"] }:
+
+let build = import ./common.nix; in
+
+build null {
+  name = "glibc-locales";
+
+  inherit fetchurl stdenv;
+  installLocales = true;
+
+  builder = ./locales-builder.sh;
+
+  # Awful hack: `localedef' doesn't allow the path to `locale-archive'
+  # to be overriden, but you *can* specify a prefix, i.e. it will use
+  # <prefix>/<path-to-glibc>/lib/locale/locale-archive.  So we use
+  # $TMPDIR as a prefix, meaning that the locale-archive is placed in
+  # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
+  buildPhase =
+    ''
+      mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
+
+      # Hack to allow building of the locales (needed since glibc-2.12)
+      sed -i -e "s,^LOCALEDEF=.*,LOCALEDEF=localedef --prefix=$TMPDIR," -e \
+          /library-path/d ../glibc-2*/localedata/Makefile
+      ${if allLocales then "" else
+          "echo SUPPORTED-LOCALES=\"${toString locales}\" > ../glibc-2*/localedata/SUPPORTED"}
+
+      make localedata/install-locales \
+          localedir=$out/lib/locale \
+    '';
+
+  installPhase =
+    ''
+      mkdir -p "$out/lib/locale"
+      cp -v "$TMPDIR/$NIX_STORE/"*"/lib/locale/locale-archive" "$out/lib/locale"
+    '';
+
+  meta.description = "Locale information for the GNU C Library";
+}
diff --git a/pkgs/development/libraries/glibc/2.17/nix-locale-archive.patch b/pkgs/development/libraries/glibc/2.18/nix-locale-archive.patch
index 88c8adef922..88c8adef922 100644
--- a/pkgs/development/libraries/glibc/2.17/nix-locale-archive.patch
+++ b/pkgs/development/libraries/glibc/2.18/nix-locale-archive.patch
diff --git a/pkgs/development/libraries/glibc/2.17/rpcgen-path.patch b/pkgs/development/libraries/glibc/2.18/rpcgen-path.patch
index fd81ab5324e..3349449d916 100644
--- a/pkgs/development/libraries/glibc/2.17/rpcgen-path.patch
+++ b/pkgs/development/libraries/glibc/2.18/rpcgen-path.patch
@@ -1,7 +1,7 @@
-diff -ru glibc-2.17-orig/sunrpc/rpc_main.c glibc-2.17/sunrpc/rpc_main.c
---- glibc-2.17-orig/sunrpc/rpc_main.c	2012-12-25 04:02:13.000000000 +0100
-+++ glibc-2.17/sunrpc/rpc_main.c	2012-12-29 00:21:04.124698455 +0100
-@@ -77,7 +77,7 @@
+diff -ru glibc-2.18-orig/sunrpc/rpc_main.c glibc-2.18/sunrpc/rpc_main.c
+--- glibc-2.18-orig/sunrpc/rpc_main.c	2013-08-11 00:52:55.000000000 +0200
++++ glibc-2.18/sunrpc/rpc_main.c	2013-11-15 12:04:48.041006977 +0100
+@@ -78,7 +78,7 @@
  
  static const char *svcclosetime = "120";
  static int cppDefined;	/* explicit path for C preprocessor */
@@ -10,7 +10,7 @@ diff -ru glibc-2.17-orig/sunrpc/rpc_main.c glibc-2.17/sunrpc/rpc_main.c
  static const char CPPFLAGS[] = "-C";
  static char *pathbuf;
  static int cpp_pid;
-@@ -106,7 +106,6 @@
+@@ -107,7 +107,6 @@
  static void open_output (const char *infile, const char *outfile);
  static void add_warning (void);
  static void clear_args (void);
@@ -18,7 +18,7 @@ diff -ru glibc-2.17-orig/sunrpc/rpc_main.c glibc-2.17/sunrpc/rpc_main.c
  static void open_input (const char *infile, const char *define);
  static int check_nettype (const char *name, const char *list_to_check[]);
  static void c_output (const char *infile, const char *define,
-@@ -318,25 +317,6 @@
+@@ -322,25 +321,6 @@
    argcount = FIXEDARGS;
  }
  
@@ -26,9 +26,9 @@ diff -ru glibc-2.17-orig/sunrpc/rpc_main.c glibc-2.17/sunrpc/rpc_main.c
 -static void
 -find_cpp (void)
 -{
--  struct stat buf;
+-  struct stat64 buf;
 -
--  if (stat (CPP, &buf) == 0)
+-  if (stat64 (CPP, &buf) == 0)
 -    return;
 -
 -  if (cppDefined) /* user specified cpp but it does not exist */
@@ -44,7 +44,7 @@ diff -ru glibc-2.17-orig/sunrpc/rpc_main.c glibc-2.17/sunrpc/rpc_main.c
  /*
   * Open input file with given define for C-preprocessor
   */
-@@ -355,7 +335,6 @@
+@@ -359,7 +339,6 @@
    switch (cpp_pid)
      {
      case 0:
diff --git a/pkgs/development/libraries/glibc/2.18/scanf.patch b/pkgs/development/libraries/glibc/2.18/scanf.patch
new file mode 100644
index 00000000000..4eed86ca110
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.18/scanf.patch
@@ -0,0 +1,21 @@
+https://sourceware.org/bugzilla/show_bug.cgi?id=15917
+
+commit a4966c6104918ac884ee1131a4ed23c5ad6b4c5a
+Author: Andreas Schwab <schwab@suse.de>
+Date:   Thu Oct 31 12:51:03 2013 +0100
+
+    Fix parsing of 0e+0 as float
+
+diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
+index 78dc2fc..e6fa8f3 100644
+--- a/stdio-common/vfscanf.c
++++ b/stdio-common/vfscanf.c
+@@ -1966,6 +1966,8 @@ _IO_vfscanf_internal (_IO_FILE *s, const char *format, _IO_va_list argptr,
+ 		  if (width > 0)
+ 		    --width;
+ 		}
++	      else
++		got_digit = 1;
+ 	    }
+ 
+ 	  while (1)
diff --git a/pkgs/development/libraries/gsl/default.nix b/pkgs/development/libraries/gsl/default.nix
index 94b422d7a91..eee977e9703 100644
--- a/pkgs/development/libraries/gsl/default.nix
+++ b/pkgs/development/libraries/gsl/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv }:
 
 stdenv.mkDerivation rec {
-  name = "gsl-1.16";
+  name = "gsl-1.15";
 
   src = fetchurl {
     url = "mirror://gnu/gsl/${name}.tar.gz";
-    sha256 = "0lrgipi0z6559jqh82yx8n4xgnxkhzj46v96dl77hahdp58jzg3k";
+    sha256 = "18qf6jzz1r3mzb5qynywv4xx3z9g61hgkbpkdrhbgqh2g7jhgfc5";
   };
 
   # ToDo: there might be more impurities than FMA support check
diff --git a/pkgs/development/libraries/haskell/DAV/default.nix b/pkgs/development/libraries/haskell/DAV/default.nix
index 4a908e46d93..a7e15f2d6b4 100644
--- a/pkgs/development/libraries/haskell/DAV/default.nix
+++ b/pkgs/development/libraries/haskell/DAV/default.nix
@@ -1,18 +1,18 @@
 { cabal, caseInsensitive, httpClient, httpClientTls, httpTypes
-, lens, liftedBase, mtl, network, optparseApplicative, resourcet
-, transformers, xmlConduit, xmlHamlet
+, lens, liftedBase, monadControl, mtl, network, optparseApplicative
+, transformers, transformersBase, xmlConduit, xmlHamlet
 }:
 
 cabal.mkDerivation (self: {
   pname = "DAV";
-  version = "0.5.1";
-  sha256 = "12r5hy6g5k5bdf3n84hpq9b90nz6v2v3xwy7prxkvv99iaxf2lsj";
+  version = "0.6";
+  sha256 = "1lqc1w40mzj5gvpd3gc4qwgz3zrivwkz6ssa5592dsnwz81k1dxk";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [
     caseInsensitive httpClient httpClientTls httpTypes lens liftedBase
-    mtl network optparseApplicative resourcet transformers xmlConduit
-    xmlHamlet
+    monadControl mtl network optparseApplicative transformers
+    transformersBase xmlConduit xmlHamlet
   ];
   meta = {
     homepage = "http://floss.scru.org/hDAV";
diff --git a/pkgs/development/libraries/haskell/async/2.0.1.5.nix b/pkgs/development/libraries/haskell/async/2.0.1.5.nix
new file mode 100644
index 00000000000..d3340fb3678
--- /dev/null
+++ b/pkgs/development/libraries/haskell/async/2.0.1.5.nix
@@ -0,0 +1,17 @@
+{ cabal, HUnit, stm, testFramework, testFrameworkHunit }:
+
+cabal.mkDerivation (self: {
+  pname = "async";
+  version = "2.0.1.5";
+  sha256 = "0g587b64zgn971qb2lh846ihg4z89037f18821kyaqsgixasq4yd";
+  buildDepends = [ stm ];
+  testDepends = [ HUnit testFramework testFrameworkHunit ];
+  jailbreak = true;
+  meta = {
+    homepage = "https://github.com/simonmar/async";
+    description = "Run IO operations asynchronously and wait for their results";
+    license = self.stdenv.lib.licenses.bsd3;
+    platforms = self.ghc.meta.platforms;
+    maintainers = [ self.stdenv.lib.maintainers.andres ];
+  };
+})
diff --git a/pkgs/development/libraries/haskell/language-c-quote/default.nix b/pkgs/development/libraries/haskell/language-c-quote/default.nix
index f4774ecd14b..94eb72633de 100644
--- a/pkgs/development/libraries/haskell/language-c-quote/default.nix
+++ b/pkgs/development/libraries/haskell/language-c-quote/default.nix
@@ -5,8 +5,8 @@
 
 cabal.mkDerivation (self: {
   pname = "language-c-quote";
-  version = "0.7.5";
-  sha256 = "1ms6bjcqm0mfv0kqznn68svclbpvbwy5rlni0b8i0axhwfgq1l73";
+  version = "0.7.6";
+  sha256 = "15sfasbrr9wzqkwv9xg9nvb3gnn4drkll3b3cappiyzkmawp2hkr";
   buildDepends = [
     exceptionMtl exceptionTransformers filepath haskellSrcMeta
     mainlandPretty mtl srcloc syb symbol
diff --git a/pkgs/development/libraries/haskell/mainland-pretty/default.nix b/pkgs/development/libraries/haskell/mainland-pretty/default.nix
index 2bcf2037cbe..60990d2dbca 100644
--- a/pkgs/development/libraries/haskell/mainland-pretty/default.nix
+++ b/pkgs/development/libraries/haskell/mainland-pretty/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "mainland-pretty";
-  version = "0.2.6";
-  sha256 = "1mjw79jg0vq8qvgvjdinidw1pvfj3mych3z0f6g031vmqz7fqvzy";
+  version = "0.2.7";
+  sha256 = "1g4s2xscj6dpkcghs5lws658ki0rhriivpdr5ilcycvr28k3l35q";
   buildDepends = [ srcloc text ];
   meta = {
     homepage = "http://www.eecs.harvard.edu/~mainland/";
diff --git a/pkgs/development/libraries/haskell/scientific/default.nix b/pkgs/development/libraries/haskell/scientific/default.nix
index 42d1c4b8612..8494168df15 100644
--- a/pkgs/development/libraries/haskell/scientific/default.nix
+++ b/pkgs/development/libraries/haskell/scientific/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "scientific";
-  version = "0.1.0.0";
-  sha256 = "1x3c8z1d7nhr1z5dlbs60pxfrgclfbwjhrkpvr0jnz0fpy2m9x5r";
+  version = "0.1.0.1";
+  sha256 = "0s401gxwap4xwz9rxypc76rs5w344s3an45295ybf3id6yal5140";
   buildDepends = [ deepseq hashable text ];
   testDepends = [ smallcheck tasty tastySmallcheck text ];
   doCheck = false;
diff --git a/pkgs/development/libraries/haskell/smallcheck/default.nix b/pkgs/development/libraries/haskell/smallcheck/default.nix
index ef8f0e5e5ba..e81a8872f7a 100644
--- a/pkgs/development/libraries/haskell/smallcheck/default.nix
+++ b/pkgs/development/libraries/haskell/smallcheck/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "smallcheck";
-  version = "1.1.0.1";
-  sha256 = "02yv4pa6hilxl7fwskayd5nzs4hq46k91wh04sqj4yfk2s3pgb0m";
+  version = "1.1.1";
+  sha256 = "1ygrabxh40bym3grnzqyfqn96lirnxspb8cmwkkr213239y605sd";
   buildDepends = [ logict mtl ];
   meta = {
     homepage = "https://github.com/feuerbach/smallcheck";
diff --git a/pkgs/development/libraries/ncurses/5_4.nix b/pkgs/development/libraries/ncurses/5_4.nix
deleted file mode 100644
index fd35a1d4887..00000000000
--- a/pkgs/development/libraries/ncurses/5_4.nix
+++ /dev/null
@@ -1,79 +0,0 @@
-{stdenv, fetchurl, unicode ? true}:
-
-let
-  /* C++ bindings fail to build on `i386-pc-solaris2.11' with GCC 3.4.3:
-     <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6395191>.
-     It seems that it could be worked around by #including <wchar.h> in the
-     right place, according to
-     <http://mail.python.org/pipermail/python-bugs-list/2006-September/035362.html>,
-     but this is left as an exercise to the reader.
-     So disable them for now.  */
-  cxx = stdenv.system != "i686-solaris";
-in
-stdenv.mkDerivation (rec {
-  name = "ncurses-5.4";
-
-  src = fetchurl {
-    url = "mirror://gnu/ncurses/${name}.tar.gz";
-    sha256 = "0div11f5flig67v702fd3sj362zagrnaj0d8wvs905s3rxiy1g2s";
-  };
-
-  configureFlags = ''
-    --with-shared --without-debug
-    ${if unicode then "--enable-widec" else ""}${if cxx then "" else "--without-cxx-binding"}
-  '';
-
-  preConfigure = ''
-    export configureFlags="$configureFlags --includedir=$out/include"
-  '';
-
-  selfNativeBuildInput = true;
-
-  enableParallelBuilding = true;
-
-  preBuild =
-    # On Darwin, we end up using the native `sed' during bootstrap, and it
-    # fails to run this command, which isn't needed anyway.
-    stdenv.lib.optionalString (!stdenv.isDarwin)
-    ''sed -e "s@\([[:space:]]\)sh @\1''${SHELL} @" -i */Makefile Makefile'';
-
-  # When building a wide-character (Unicode) build, create backward
-  # compatibility links from the the "normal" libraries to the
-  # wide-character libraries (e.g. libncurses.so to libncursesw.so).
-  postInstall = if unicode then ''
-    ${if cxx then "chmod 644 $out/lib/libncurses++w.a" else ""}
-    for lib in curses ncurses form panel menu; do
-      if test -e $out/lib/lib''${lib}w.a; then
-        rm -f $out/lib/lib$lib.so
-        echo "INPUT(-l''${lib}w)" > $out/lib/lib$lib.so
-        ln -svf lib''${lib}w.a $out/lib/lib$lib.a
-        ln -svf lib''${lib}w.so.5 $out/lib/lib$lib.so.5
-      fi
-    done;
-  '' else "";
-
-  meta = {
-    description = "GNU Ncurses, a free software emulation of curses in SVR4 and more";
-
-    longDescription = ''
-      The Ncurses (new curses) library is a free software emulation of
-      curses in System V Release 4.0, and more.  It uses Terminfo
-      format, supports pads and color and multiple highlights and
-      forms characters and function-key mapping, and has all the other
-      SYSV-curses enhancements over BSD Curses.
-
-      The ncurses code was developed under GNU/Linux.  It has been in
-      use for some time with OpenBSD as the system curses library, and
-      on FreeBSD and NetBSD as an external package.  It should port
-      easily to any ANSI/POSIX-conforming UNIX.  It has even been
-      ported to OS/2 Warp!
-    '';
-
-    homepage = http://www.gnu.org/software/ncurses/;
-
-    license = "X11";
-
-    maintainers = [ stdenv.lib.maintainers.ludo ];
-    platforms = stdenv.lib.platforms.all;
-  };
-} // ( if stdenv.isDarwin then { postFixup = "rm $out/lib/*.so"; } else { } ) )
diff --git a/pkgs/development/web/nodejs/default.nix b/pkgs/development/web/nodejs/default.nix
index 47c5178cc79..ae990ca3245 100644
--- a/pkgs/development/web/nodejs/default.nix
+++ b/pkgs/development/web/nodejs/default.nix
@@ -52,6 +52,6 @@ in stdenv.mkDerivation {
     homepage = http://nodejs.org;
     license = licenses.mit;
     maintainers = [ maintainers.goibhniu maintainers.shlevy ];
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
   };
 }
diff --git a/pkgs/development/web/nodejs/no-xcode.patch b/pkgs/development/web/nodejs/no-xcode.patch
index 47a37bfaf3c..534d5204a2e 100644
--- a/pkgs/development/web/nodejs/no-xcode.patch
+++ b/pkgs/development/web/nodejs/no-xcode.patch
@@ -1,23 +1,9 @@
-diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
-index 806f92b..5256856 100644
---- a/tools/gyp/pylib/gyp/xcode_emulation.py
-+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
-@@ -224,8 +224,7 @@ class XcodeSettings(object):
- 
-   def _GetSdkVersionInfoItem(self, sdk, infoitem):
-     job = subprocess.Popen(['xcodebuild', '-version', '-sdk', sdk, infoitem],
--                           stdout=subprocess.PIPE,
--                           stderr=subprocess.STDOUT)
-+                           stdout=subprocess.PIPE)
-     out = job.communicate()[0]
-     if job.returncode != 0:
-       sys.stderr.write(out + '\n')
-@@ -234,9 +233,17 @@ class XcodeSettings(object):
- 
-   def _SdkPath(self):
-     sdk_root = self.GetPerTargetSetting('SDKROOT', default='macosx')
-+    if sdk_root.startswith('/'):
-+      return sdk_root
+diff -Naur a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
+--- a/tools/gyp/pylib/gyp/xcode_emulation.py	2013-11-12 21:22:12.000000000 +0100
++++ b/tools/gyp/pylib/gyp/xcode_emulation.py	2013-12-17 11:07:11.000000000 +0100
+@@ -285,8 +285,15 @@
+     if sdk_root.startswith('/'):
+       return sdk_root
      if sdk_root not in XcodeSettings._sdk_path_cache:
 -      XcodeSettings._sdk_path_cache[sdk_root] = self._GetSdkVersionInfoItem(
 -          sdk_root, 'Path')
@@ -29,10 +15,11 @@ index 806f92b..5256856 100644
 +        # the user is probably on a CLT-only system, where there
 +        # is no valid SDK root
 +        XcodeSettings._sdk_path_cache[sdk_root] = None
++
      return XcodeSettings._sdk_path_cache[sdk_root]
  
    def _AppendPlatformVersionMinFlags(self, lst):
-@@ -339,10 +346,11 @@ class XcodeSettings(object):
+@@ -397,10 +404,11 @@
  
      cflags += self._Settings().get('WARNING_CFLAGS', [])
  
@@ -48,7 +35,7 @@ index 806f92b..5256856 100644
  
      self.configname = None
      return cflags
-@@ -572,10 +580,11 @@ class XcodeSettings(object):
+@@ -647,10 +655,11 @@
      for rpath in self._Settings().get('LD_RUNPATH_SEARCH_PATHS', []):
        ldflags.append('-Wl,-rpath,' + rpath)
  
@@ -64,15 +51,15 @@ index 806f92b..5256856 100644
  
      self.configname = None
      return ldflags
-@@ -700,7 +709,10 @@ class XcodeSettings(object):
+@@ -826,7 +835,10 @@
          l = '-l' + m.group(1)
        else:
          l = library
--    return l.replace('$(SDKROOT)', self._SdkPath())
+-    return l.replace('$(SDKROOT)', self._SdkPath(config_name))
 +    if self._SdkPath():
-+      return l.replace('$(SDKROOT)', self._SdkPath())
++      return l.replace('$(SDKROOT)', self._SdkPath(config_name))
 +    else:
 +      return l
  
-   def AdjustLibraries(self, libraries):
+   def AdjustLibraries(self, libraries, config_name=None):
      """Transforms entries like 'Cocoa.framework' in libraries into entries like
diff --git a/pkgs/os-specific/linux/kernel/linux-3.4.nix b/pkgs/os-specific/linux/kernel/linux-3.4.nix
index 8608eee8456..46a87e65c50 100644
--- a/pkgs/os-specific/linux/kernel/linux-3.4.nix
+++ b/pkgs/os-specific/linux/kernel/linux-3.4.nix
@@ -5,7 +5,7 @@ import ./generic.nix (args // rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.xz";
-    sha256 = "0nkiy2hxwam91707vccprmap28wiwxar2v2ishj1bb2xzkbnxwpd";
+    sha256 = "189b7391shzsf0383c3yqf8wy9w82wkzfqmqzxkm77312px1b2yb";
   };
 
   features.iwlwifi = true;
diff --git a/pkgs/os-specific/linux/nvidia-x11/legacy304.nix b/pkgs/os-specific/linux/nvidia-x11/legacy304.nix
index e2739b291d4..bd88e847b6e 100644
--- a/pkgs/os-specific/linux/nvidia-x11/legacy304.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/legacy304.nix
@@ -8,7 +8,7 @@
 
 with stdenv.lib;
 
-let versionNumber = "304.84"; in
+let versionNumber = "304.117"; in
 
 stdenv.mkDerivation {
   name = "nvidia-x11-${versionNumber}${optionalString (!libsOnly) "-${kernelDev.version}"}";
@@ -19,12 +19,12 @@ stdenv.mkDerivation {
     if stdenv.system == "i686-linux" then
       fetchurl {
         url = "http://us.download.nvidia.com/XFree86/Linux-x86/${versionNumber}/NVIDIA-Linux-x86-${versionNumber}.run";
-        sha256 = "14hfx3rhf3vf3x3klkhz5qkjrg51r22nqqdzffilcwkxdjfg10j1";
+        sha256 = "16a09iinz3zgrvj8cywyxsy7i8kpan28b814xhfbl88zadyj0hy3";
       }
     else if stdenv.system == "x86_64-linux" then
       fetchurl {
         url = "http://us.download.nvidia.com/XFree86/Linux-x86_64/${versionNumber}/NVIDIA-Linux-x86_64-${versionNumber}-no-compat32.run";
-        sha256 = "1ixxkykl78g874g537apvxalggp3kw0mm5q69rl99jlw6jibbm80";
+        sha256 = "0kzcxfwnp4aw4q53vl57ypc9yck4yj1hfhy8v9wfjlxvi6w6cp0v";
       }
     else throw "nvidia-x11 does not support platform ${stdenv.system}";
 
diff --git a/pkgs/tools/filesystems/jfsrec/default.nix b/pkgs/tools/filesystems/jfsrec/default.nix
index fb5b72d714a..5b5e7c8808e 100644
--- a/pkgs/tools/filesystems/jfsrec/default.nix
+++ b/pkgs/tools/filesystems/jfsrec/default.nix
@@ -1,8 +1,8 @@
 { stdenv, fetchurl, boost }:
 
 stdenv.mkDerivation {
-  name = "jfsrec-pre-svn-7";
-  
+  name = "jfsrec-0-pre-svn-7";
+
   src = fetchurl {
     url = mirror://sourceforge/jfsrec/jfsrec-svn-7.tar.gz;
     sha256 = "163z6ljr05vw2k5mj4fim2nlg4khjyibrii95370pvn474mg28vg";
@@ -14,10 +14,10 @@ stdenv.mkDerivation {
   preConfigure =
     ''
       sed -e '/[#]include [<]config.h[>]/a\#include <string.h>' -i src/unicode_to_utf8.cpp
-      cat src/unicode_to_utf8.cpp
     '';
 
   meta = {
     description = "JFS recovery tool";
+    homepage = http://jfsrec.sourceforge.net/;
   };
 }
diff --git a/pkgs/tools/text/source-highlight/default.nix b/pkgs/tools/text/source-highlight/default.nix
index e5928e16256..21a866cf87e 100644
--- a/pkgs/tools/text/source-highlight/default.nix
+++ b/pkgs/tools/text/source-highlight/default.nix
@@ -8,21 +8,23 @@ stdenv.mkDerivation {
   name = "${name}-${version}";
 
   src = fetchurl {
-      url = "mirror://gnu/src-highlite/${name}-${version}.tar.gz";
-      sha256 = "1s49ld8cnpzhhwq0r7s0sfm3cg3nhhm0wla27lwraifrrl3y1cp1";
-    };
+    url = "mirror://gnu/src-highlite/${name}-${version}.tar.gz";
+    sha256 = "1s49ld8cnpzhhwq0r7s0sfm3cg3nhhm0wla27lwraifrrl3y1cp1";
+  };
 
   configureFlags = [ "--with-boost=${boost}" ];
 
-  buildInputs = [boost];
+  buildInputs = [ boost ];
+
+  enableParallelBuilding = false;
+
   doCheck = true;
 
   meta = {
-    description = "source code renderer with syntax highlighting";
-    homepage = "http://www.gnu.org/software/src-highlite/";
+    description = "Source code renderer with syntax highlighting";
+    homepage = http://www.gnu.org/software/src-highlite/;
     license = "GPLv3+";
-    maintainers = [ ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = stdenv.lib.platforms.linux;
     longDescription =
       ''
         GNU Source-highlight, given a source file, produces a document
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index deed3b7d68e..39838ae4fd5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1826,7 +1826,7 @@ let
 
   sourceHighlight = callPackage ../tools/text/source-highlight {
     # Boost 1.54 causes the "test_regexranges" test to fail
-    boost = boost153;
+    boost = boost149;
   };
 
   squashfsTools = callPackage ../tools/filesystems/squashfs { };
@@ -2366,7 +2366,7 @@ let
 
     # bootstrapping a profiled compiler does not work in the sheevaplug:
     # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43944
-    profiledCompiler = !stdenv.isArm;
+    profiledCompiler = false;
 
     # When building `gcc.crossDrv' (a "Canadian cross", with host == target
     # and host != build), `cross' must be null but the cross-libc must still
@@ -2501,7 +2501,7 @@ let
 
     # bootstrapping a profiled compiler does not work in the sheevaplug:
     # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43944
-    profiledCompiler = !stdenv.isArm;
+    profiledCompiler = false;
 
     # When building `gcc.crossDrv' (a "Canadian cross", with host == target
     # and host != build), `cross' must be null but the cross-libc must still
@@ -3931,8 +3931,6 @@ let
 
   boost144 = callPackage ../development/libraries/boost/1.44.nix { };
   boost149 = callPackage ../development/libraries/boost/1.49.nix { };
-  boost153 = callPackage ../development/libraries/boost/1.53.nix { };
-  boost154 = callPackage ../development/libraries/boost/1.54.nix { };
   boost155 = callPackage ../development/libraries/boost/1.55.nix { };
   boost = boost155;
 
@@ -4238,30 +4236,7 @@ let
 
   glfw = callPackage ../development/libraries/glfw { };
 
-  glibcCross = glibc217Cross;
-
-  glibc213 = (callPackage ../development/libraries/glibc/2.13 {
-    kernelHeaders = linuxHeaders;
-    installLocales = config.glibc.locales or false;
-    machHeaders = null;
-    hurdHeaders = null;
-    gccCross = null;
-  }) // (if crossSystem != null then { crossDrv = glibc213Cross; } else {});
-
-  glibc213Cross = forceNativeDrv (makeOverridable (import ../development/libraries/glibc/2.13)
-    (let crossGNU = crossSystem != null && crossSystem.config == "i586-pc-gnu";
-     in {
-       inherit stdenv fetchurl;
-       gccCross = gccCrossStageStatic;
-       kernelHeaders = if crossGNU then gnu.hurdHeaders else linuxHeadersCross;
-       installLocales = config.glibc.locales or false;
-     }
-     // lib.optionalAttrs crossGNU {
-        inherit (gnu) machHeaders hurdHeaders libpthreadHeaders mig;
-        inherit fetchgit;
-      }));
-
-  glibc = callPackage ../development/libraries/glibc/2.17 {
+  glibc = callPackage ../development/libraries/glibc/2.18 {
     kernelHeaders = linuxHeaders;
     installLocales = config.glibc.locales or false;
     machHeaders = null;
@@ -4269,13 +4244,13 @@ let
     gccCross = null;
   };
 
-  glibc_memusage = callPackage ../development/libraries/glibc/2.17 {
+  glibc_memusage = callPackage ../development/libraries/glibc/2.18 {
     kernelHeaders = linuxHeaders;
     installLocales = false;
     withGd = true;
   };
 
-  glibc217Cross = forceNativeDrv (makeOverridable (import ../development/libraries/glibc/2.17)
+  glibcCross = forceNativeDrv (makeOverridable (import ../development/libraries/glibc/2.18)
     (let crossGNU = crossSystem != null && crossSystem.config == "i586-pc-gnu";
      in {
        inherit stdenv fetchurl;
@@ -4304,9 +4279,9 @@ let
     installLocales = config.glibc.locales or false;
   };
 
-  glibcLocales = callPackage ../development/libraries/glibc/2.17/locales.nix { };
+  glibcLocales = callPackage ../development/libraries/glibc/2.18/locales.nix { };
 
-  glibcInfo = callPackage ../development/libraries/glibc/2.17/info.nix { };
+  glibcInfo = callPackage ../development/libraries/glibc/2.18/info.nix { };
 
   glibc_multi =
     runCommand "${glibc.name}-multi"
@@ -5308,15 +5283,7 @@ let
 
   nanomsg = callPackage ../development/libraries/nanomsg { };
 
-  ncurses_5_4 = makeOverridable (import ../development/libraries/ncurses/5_4.nix) {
-    inherit fetchurl;
-    unicode = system != "i686-cygwin";
-    stdenv = if stdenv.isDarwin
-      then allStdenvs.stdenvNative
-      else stdenv;
-  };
-  ncurses_5_9 = makeOverridable (import ../development/libraries/ncurses) {
-    inherit fetchurl;
+  ncurses = callPackage ../development/libraries/ncurses {
     unicode = system != "i686-cygwin";
     stdenv =
       # On Darwin, NCurses uses `-no-cpp-precomp', which is specific to
@@ -5326,7 +5293,6 @@ let
       then allStdenvs.stdenvNative
       else stdenv;
   };
-  ncurses = ncurses_5_9;
 
   neon = callPackage ../development/libraries/neon {
     compressionSupport = true;
@@ -7696,6 +7662,8 @@ let
     patches = config.dwm.patches or [];
   };
 
+  dzen2 = callPackage ../applications/window-managers/dzen2 { };
+
   eaglemode = callPackage ../applications/misc/eaglemode { };
 
   eclipses = recurseIntoAttrs (callPackage ../applications/editors/eclipse { });
diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix
index f00ac246546..37d560ff439 100644
--- a/pkgs/top-level/haskell-packages.nix
+++ b/pkgs/top-level/haskell-packages.nix
@@ -141,7 +141,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x
 
   haskellPlatformArgs_future = self : {
     inherit (self) cabal ghc;
-    async        = self.async_2_0_1_4;
+    async        = self.async_2_0_1_5;
     attoparsec   = self.attoparsec_0_10_4_0;
     caseInsensitive = self.caseInsensitive_1_1_0_2;
     cgi          = self.cgi_3001_1_8_4;
@@ -558,7 +558,8 @@ let result = let callPackage = x : y : modifyPrio (newScope result.finalReturn x
 
   async_2_0_1_3 = callPackage ../development/libraries/haskell/async/2.0.1.3.nix {};
   async_2_0_1_4 = callPackage ../development/libraries/haskell/async/2.0.1.4.nix {};
-  async = self.async_2_0_1_4;
+  async_2_0_1_5 = callPackage ../development/libraries/haskell/async/2.0.1.5.nix {};
+  async = self.async_2_0_1_5;
 
   atomicPrimops = callPackage ../development/libraries/haskell/atomic-primops {};
 
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index 6873e214544..8d17c6c20f1 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -439,6 +439,7 @@ rec {
       sha256 = "1zykapgl9lxnlx79xfghzb26qimhry94xfxfyswwfhra1ywd9yyg";
     };
     propagatedBuildInputs = [ TimeDate DBFile DigestSHA1 FileNFSLock HeapFibonacci IOString ];
+    doCheck = false; # can time out
     meta = {
       maintainers = with maintainers; [ ocharles ];
       platforms   = stdenv.lib.platforms.unix;