summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/gcc/4.2/default.nix6
-rw-r--r--pkgs/development/compilers/gcc/4.2/siginfo_t.patch15
-rw-r--r--pkgs/development/compilers/gcc/4.3/default.nix16
-rw-r--r--pkgs/development/compilers/gcc/4.4/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/4.4/sources.nix14
-rwxr-xr-xpkgs/development/compilers/gcc/4.4/update-gcc.sh4
-rw-r--r--pkgs/development/compilers/gcc/4.8/arm-eabi.patch (renamed from pkgs/development/compilers/gcc/4.7/arm-eabi.patch)0
-rw-r--r--pkgs/development/compilers/gcc/4.8/builder.sh (renamed from pkgs/development/compilers/gcc/4.7/builder.sh)15
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix (renamed from pkgs/development/compilers/gcc/4.7/default.nix)124
-rw-r--r--pkgs/development/compilers/gcc/4.8/gfortran-driving.patch (renamed from pkgs/development/compilers/gcc/4.7/gfortran-driving.patch)0
-rw-r--r--pkgs/development/compilers/gcc/4.8/gnat-cflags.patch (renamed from pkgs/development/compilers/gcc/4.7/gnat-cflags.patch)0
-rw-r--r--pkgs/development/compilers/gcc/4.8/java-jvgenmain-link.patch (renamed from pkgs/development/compilers/gcc/4.7/java-jvgenmain-link.patch)0
-rw-r--r--pkgs/development/compilers/gcc/4.8/libstdc++-target.patch (renamed from pkgs/development/compilers/gcc/4.7/libstdc++-target.patch)0
-rw-r--r--pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch (renamed from pkgs/development/compilers/gcc/4.7/no-sys-dirs.patch)0
-rw-r--r--pkgs/development/compilers/gcc/4.8/parallel-bconfig.patch32
-rwxr-xr-xpkgs/development/compilers/ghc/ghc-get-packages.sh21
-rw-r--r--pkgs/development/compilers/llvm/default.nix10
-rw-r--r--pkgs/development/compilers/llvm/no-rule-aarch64.patch8
-rw-r--r--pkgs/development/compilers/mlton/default.nix17
-rw-r--r--pkgs/development/compilers/openjdk/default.nix1
-rw-r--r--pkgs/development/interpreters/perl/5.14/default.nix3
-rw-r--r--pkgs/development/interpreters/perl/5.14/ld-shared.patch11
-rw-r--r--pkgs/development/interpreters/perl/5.16/default.nix35
-rw-r--r--pkgs/development/interpreters/perl/5.16/ld-shared.patch11
-rw-r--r--pkgs/development/interpreters/perl/5.16/no-sys-dirs.patch113
-rw-r--r--pkgs/development/interpreters/python/2.6/default.nix2
-rw-r--r--pkgs/development/interpreters/python/2.7/default.nix2
-rw-r--r--pkgs/development/libraries/acl/default.nix4
-rw-r--r--pkgs/development/libraries/attr/default.nix4
-rw-r--r--pkgs/development/libraries/cloog/default.nix4
-rw-r--r--pkgs/development/libraries/coin3d/default.nix9
-rw-r--r--pkgs/development/libraries/coin3d/gcc-4.8.patch38
-rw-r--r--pkgs/development/libraries/ctl/default.nix8
-rw-r--r--pkgs/development/libraries/ctl/gcc47.patch15
-rw-r--r--pkgs/development/libraries/dbus-cplusplus/default.nix6
-rw-r--r--pkgs/development/libraries/gettext/default.nix22
-rw-r--r--pkgs/development/libraries/gettext/no-gets.patch42
-rw-r--r--pkgs/development/libraries/glib/default.nix5
-rw-r--r--pkgs/development/libraries/glibc/2.18/common.nix12
-rw-r--r--pkgs/development/libraries/glibc/2.18/fix_path_attribute_in_getconf.patch6
-rw-r--r--pkgs/development/libraries/gmp/4.3.2.nix4
-rw-r--r--pkgs/development/libraries/gmp/5.1.x.nix (renamed from pkgs/development/libraries/gmp/5.1.1.nix)9
-rw-r--r--pkgs/development/libraries/gsl/default.nix4
-rw-r--r--pkgs/development/libraries/gsl/disable-fma.patch32
-rw-r--r--pkgs/development/libraries/icu/default.nix8
-rw-r--r--pkgs/development/libraries/isl/default.nix10
-rw-r--r--pkgs/development/libraries/isl/fix-gcc-build.diff12
-rw-r--r--pkgs/development/libraries/kerberos/krb5.nix8
-rw-r--r--pkgs/development/libraries/libarchive/default.nix8
-rw-r--r--pkgs/development/libraries/libgcrypt/default.nix2
-rw-r--r--pkgs/development/libraries/libmsn/default.nix1
-rw-r--r--pkgs/development/libraries/libmsn/fix-ftbfs-gcc4.7.diff16
-rw-r--r--pkgs/development/libraries/libofa/curl-types.patch13
-rw-r--r--pkgs/development/libraries/libofa/default.nix17
-rw-r--r--pkgs/development/libraries/libofa/gcc-4.x.patch12
-rw-r--r--pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.3.patch36
-rw-r--r--pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.patch39
-rw-r--r--pkgs/development/libraries/libproxy/default.nix8
-rw-r--r--pkgs/development/libraries/libxml2/default.nix2
-rw-r--r--pkgs/development/libraries/libxslt/default.nix26
-rw-r--r--pkgs/development/libraries/libxslt/patch-ah.patch69
-rw-r--r--pkgs/development/libraries/mpc/default.nix4
-rw-r--r--pkgs/development/libraries/mpfr/3.1.2.nix51
-rw-r--r--pkgs/development/libraries/mpfr/default.nix28
-rw-r--r--pkgs/development/libraries/ncurses/default.nix21
-rw-r--r--pkgs/development/libraries/ncurses/patch-ac40
-rw-r--r--pkgs/development/libraries/ois/default.nix13
-rw-r--r--pkgs/development/libraries/openssl/default.nix8
-rw-r--r--pkgs/development/libraries/pcre/default.nix9
-rw-r--r--pkgs/development/libraries/ppl/default.nix8
-rw-r--r--pkgs/development/libraries/ppl/upstream-based.patch42
-rw-r--r--pkgs/development/libraries/qca2/default.nix2
-rw-r--r--pkgs/development/libraries/qca2/gcc47.patch12
-rw-r--r--pkgs/development/libraries/strigi/default.nix2
-rw-r--r--pkgs/development/libraries/strigi/export_bufferedstream.patch12
-rw-r--r--pkgs/development/libraries/sword/default.nix2
-rw-r--r--pkgs/development/libraries/sword/gcc47.patch35
-rw-r--r--pkgs/development/libraries/v8/default.nix5
-rw-r--r--pkgs/development/libraries/vigra/default.nix4
-rw-r--r--pkgs/development/libraries/xbase/default.nix8
-rw-r--r--pkgs/development/libraries/zlib/default.nix6
-rw-r--r--pkgs/development/lisp-modules/stumpwm/default.nix8
-rw-r--r--pkgs/development/tools/build-managers/cmake/762-13887.patch17
-rw-r--r--pkgs/development/tools/build-managers/cmake/default.nix14
-rw-r--r--pkgs/development/tools/build-managers/cmake/search-path.patch72
-rwxr-xr-xpkgs/development/tools/build-managers/cmake/setup-hook.sh17
-rw-r--r--pkgs/development/tools/misc/binutils/default.nix34
-rw-r--r--pkgs/development/tools/misc/elfutils/default.nix12
-rw-r--r--pkgs/development/tools/misc/gnum4/default.nix10
-rw-r--r--pkgs/development/tools/misc/gnum4/no-gets.patch26
-rw-r--r--pkgs/development/tools/misc/gnum4/readlink-EINVAL.patch18
-rw-r--r--pkgs/development/tools/misc/patchelf/default.nix4
-rw-r--r--pkgs/development/tools/misc/patchelf/unstable.nix16
-rw-r--r--pkgs/development/tools/misc/texinfo/4.9.nix10
-rw-r--r--pkgs/development/tools/misc/texinfo/5.2.nix (renamed from pkgs/development/tools/misc/texinfo/5.1.nix)8
-rw-r--r--pkgs/development/tools/parsing/alex/2.3.1.nix1
-rw-r--r--pkgs/development/tools/parsing/alex/2.3.2.nix1
-rw-r--r--pkgs/development/tools/parsing/alex/2.3.3.nix1
-rw-r--r--pkgs/development/tools/parsing/alex/2.3.5.nix1
-rw-r--r--pkgs/development/tools/parsing/alex/adapt-crazy-perl-regex-for-cpp-4.8.0.patch12
-rw-r--r--pkgs/development/tools/parsing/bison/2.x.nix6
-rw-r--r--pkgs/development/tools/parsing/bison/3.x.nix6
-rw-r--r--pkgs/development/tools/parsing/flex/default.nix (renamed from pkgs/development/tools/parsing/flex/flex-2.5.35.nix)14
-rw-r--r--pkgs/development/tools/parsing/flex/flex-2.5.33.nix20
-rw-r--r--pkgs/development/tools/parsing/flex/flex-2.5.34.nix19
-rw-r--r--pkgs/development/tools/parsing/flex/flex-2.5.4a.nix12
-rw-r--r--pkgs/development/tools/parsing/happy/1.18.4.nix1
-rw-r--r--pkgs/development/tools/parsing/happy/1.18.5.nix1
-rw-r--r--pkgs/development/tools/parsing/happy/1.18.6.nix1
-rw-r--r--pkgs/development/tools/parsing/happy/1.18.8.nix1
-rw-r--r--pkgs/development/tools/parsing/happy/adapt-crazy-perl-regex-for-cpp-4.8.0.patch12
111 files changed, 1013 insertions, 647 deletions
diff --git a/pkgs/development/compilers/gcc/4.2/default.nix b/pkgs/development/compilers/gcc/4.2/default.nix
index 68a174cc5797..69cac159d4a5 100644
--- a/pkgs/development/compilers/gcc/4.2/default.nix
+++ b/pkgs/development/compilers/gcc/4.2/default.nix
@@ -30,11 +30,11 @@ stdenv.mkDerivation {
       url = "mirror://gnu/gcc/gcc-${version}/gcc-fortran-${version}.tar.bz2";
       sha256 = "013yqiqhdavgxzjryvylgf3lcnknmw89fx41jf2v4899srn0bhkg";
     });
-    
+
   patches =
-    [./pass-cxxcpp.patch]
+    [./pass-cxxcpp.patch ./siginfo_t.patch]
     ++ optional noSysDirs [./no-sys-dirs.patch];
-    
+
   inherit noSysDirs profiledCompiler staticCompiler;
 
   buildInputs = [gmp mpfr texinfo];
diff --git a/pkgs/development/compilers/gcc/4.2/siginfo_t.patch b/pkgs/development/compilers/gcc/4.2/siginfo_t.patch
new file mode 100644
index 000000000000..bfb9f9753728
--- /dev/null
+++ b/pkgs/development/compilers/gcc/4.2/siginfo_t.patch
@@ -0,0 +1,15 @@
+https://bbs.archlinux.org/viewtopic.php?id=144949
+--- a/gcc/config/i386/linux-unwind.h	2011-01-03 20:52:22.000000000 +0000
++++ b/gcc/config/i386/linux-unwind.h	2012-07-06 12:23:51.562859470 +0100
+@@ -133,9 +133,9 @@
+     {
+       struct rt_sigframe {
+ 	int sig;
+-	struct siginfo *pinfo;
++	siginfo_t *pinfo;
+ 	void *puc;
+-	struct siginfo info;
++	siginfo_t info;
+ 	struct ucontext uc;
+       } *rt_ = context->cfa;
+       /* The void * cast is necessary to avoid an aliasing warning.
diff --git a/pkgs/development/compilers/gcc/4.3/default.nix b/pkgs/development/compilers/gcc/4.3/default.nix
index 7dd5be781859..4446876ab1f8 100644
--- a/pkgs/development/compilers/gcc/4.3/default.nix
+++ b/pkgs/development/compilers/gcc/4.3/default.nix
@@ -29,7 +29,7 @@ assert langVhdl -> gnat != null;
 with stdenv.lib;
 
 let
-  version = "4.3.4";
+  version = "4.3.6";
 
   crossConfigureFlags =
     "--target=${cross.config}" +
@@ -54,27 +54,27 @@ in
 
 stdenv.mkDerivation ({
   name = "${name}-${version}" + crossNameAddon;
-  
+
   builder = ./builder.sh;
-  
+
   src =
     optional /*langC*/ true (fetchurl {
       url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
-      sha256 = "1yk80nwyw8vkpw8d3x7lkg3zrv3ngjqlvj0i8zslzgj7a27q729i";
+      sha256 = "0ygrfw3hgp48hkqipbl9lw38f27npigc2sm6f01g9iswpq1igbw6";
     }) ++
     optional langCC (fetchurl {
       url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
-      sha256 = "0d8pyk5c9zmph25f4fl63vd8vhljj6ildbxpz2hr594g5i6pplpq";
+      sha256 = "105xz3991b57zx3146xwlpchdb2sjmlknclvi1iac2gawm4mhxhf";
     }) ++
     optional langFortran (fetchurl {
       url = "mirror://gcc/releases/gcc-${version}/gcc-fortran-${version}.tar.bz2";
-      sha256 = "1xf2njykv1qcgxiqwj693dxjf77ss1rcxirylvnsp5hs89mdlj12";
+      sha256 = "12bqvf53hvhrwjnh101vn9frb5g8cr98cra4f11dzhzs4ppydpi1";
     }) ++
     optional langJava (fetchurl {
       url = "mirror://gcc/releases/gcc-${version}/gcc-java-${version}.tar.bz2";
-      sha256 = "1v3krhxi3zyaqfj0x8dbxvg67fjp29cr1psyf71r9zf757p3vqsw";
+      sha256 = "03w6jln9gmdv149s774rlw4rzi2zhbqna54r86cd6mql8flmy7fs";
     });
-    
+
   patches =
     [ ./pass-cxxcpp.patch ./libmudflap-cpp.patch ./siginfo_t_fix.patch ]
     ++ optional noSysDirs ./no-sys-dirs.patch
diff --git a/pkgs/development/compilers/gcc/4.4/default.nix b/pkgs/development/compilers/gcc/4.4/default.nix
index 3ecaf5cb5d29..e81ca3983196 100644
--- a/pkgs/development/compilers/gcc/4.4/default.nix
+++ b/pkgs/development/compilers/gcc/4.4/default.nix
@@ -31,7 +31,7 @@ assert langVhdl     -> gnat != null;
 
 with stdenv.lib;
 
-let version = "4.4.6";
+let version = "4.4.7";
     javaEcj = fetchurl {
       # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
       # `configure' time.
diff --git a/pkgs/development/compilers/gcc/4.4/sources.nix b/pkgs/development/compilers/gcc/4.4/sources.nix
index 357cc2634edc..5517e7c3b922 100644
--- a/pkgs/development/compilers/gcc/4.4/sources.nix
+++ b/pkgs/development/compilers/gcc/4.4/sources.nix
@@ -1,26 +1,26 @@
 /* Automatically generated by `update-gcc.sh', do not edit.
-   For GCC 4.4.6.  */
+   For GCC 4.4.7.  */
 { fetchurl, optional, version, langC, langCC, langFortran, langJava, langAda }:
 
-assert version == "4.4.6";
+assert version == "4.4.7";
 optional /* langC */ true (fetchurl {
   url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
-  sha256 = "c2959820de3e42eee6b1d381586992f26430f0083b9a51db31d706080fc9b44a";
+  sha256 = "c4663b7023909a4a075d3c2b2e17f6e082a9625aebfd0ce7f1d7817e44bf5542";
 }) ++
 optional langCC (fetchurl {
   url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
-  sha256 = "6d5d2dacab9569472e4caa291abe94017a9b19574b9b0d866de7b04702634ddf";
+  sha256 = "1882ff29be51eeb3fb349cbcda9df200a5c3cd20c97dd1d593101e0998b3c469";
 }) ++
 optional langFortran (fetchurl {
   url = "mirror://gcc/releases/gcc-${version}/gcc-fortran-${version}.tar.bz2";
-  sha256 = "2b9998716a16b80f4cf843ce81da1cf58ce116e0b85422e3004ce4454e8ff923";
+  sha256 = "545a1e8e97d9364de4408c6a91830f9051ce24b4fbfbfdc56e72c7b4be17ebdd";
 }) ++
 optional langJava (fetchurl {
   url = "mirror://gcc/releases/gcc-${version}/gcc-java-${version}.tar.bz2";
-  sha256 = "7c8c12eac21d2a5c605ea4d9b7aa52e482354205b801bc93d62603b6f0956b35";
+  sha256 = "3c31ddd80f945b797d8d4ed7761426c26343781c361ec1b33bcea9874cc4c6c0";
 }) ++
 optional langAda (fetchurl {
   url = "mirror://gcc/releases/gcc-${version}/gcc-ada-${version}.tar.bz2";
-  sha256 = "771ef0e90abf61208ce84689bed15391ad249287e36a28e816d6a044035af0c6";
+  sha256 = "fb9f30b85d48838390554b948d137487f0db09ad5f8ba73ca4d7ca35765c6ed8";
 }) ++
 []
diff --git a/pkgs/development/compilers/gcc/4.4/update-gcc.sh b/pkgs/development/compilers/gcc/4.4/update-gcc.sh
index 6b0bbb993309..03297fbadd64 100755
--- a/pkgs/development/compilers/gcc/4.4/update-gcc.sh
+++ b/pkgs/development/compilers/gcc/4.4/update-gcc.sh
@@ -21,7 +21,7 @@ options["g++"]="langCC"
 options["fortran"]="langFortran"
 options["java"]="langJava"
 options["ada"]="langAda"
-options["go"]="langGo"
+#options["go"]="langGo"
 
 cat > "$out"<<EOF
 /* Automatically generated by \`$(basename $0)', do not edit.
@@ -32,7 +32,7 @@ cat > "$out"<<EOF
 assert version == "${version}";
 EOF
 
-for component in core g++ fortran java ada go
+for component in core g++ fortran java ada #go
 do
     dir="ftp.gnu.org/gnu/gcc/gcc-${version}"
     file="gcc-${component}-${version}.tar.bz2"
diff --git a/pkgs/development/compilers/gcc/4.7/arm-eabi.patch b/pkgs/development/compilers/gcc/4.8/arm-eabi.patch
index 63b017062b5b..63b017062b5b 100644
--- a/pkgs/development/compilers/gcc/4.7/arm-eabi.patch
+++ b/pkgs/development/compilers/gcc/4.8/arm-eabi.patch
diff --git a/pkgs/development/compilers/gcc/4.7/builder.sh b/pkgs/development/compilers/gcc/4.8/builder.sh
index 37400fba5bf5..b781fa6c7ef6 100644
--- a/pkgs/development/compilers/gcc/4.7/builder.sh
+++ b/pkgs/development/compilers/gcc/4.8/builder.sh
@@ -33,7 +33,7 @@ if test "$noSysDirs" = "1"; then
 
         # The path to the Glibc binaries such as `crti.o'.
         glibc_libdir="$(cat $NIX_GCC/nix-support/orig-libc)/lib"
-        
+
     else
         # Hack: support impure environments.
         extraFlags="-isystem /usr/include"
@@ -50,10 +50,10 @@ if test "$noSysDirs" = "1"; then
     # bootstrap compiler are optimized and (optionally) contain
     # debugging information (info "(gccinstall) Building").
     if test -n "$dontStrip"; then
-	extraFlags="-O2 -g $extraFlags"
+        extraFlags="-O2 -g $extraFlags"
     else
-	# Don't pass `-g' at all; this saves space while building.
-	extraFlags="-O2 $extraFlags"
+        # Don't pass `-g' at all; this saves space while building.
+        extraFlags="-O2 $extraFlags"
     fi
 
     EXTRA_FLAGS="$extraFlags"
@@ -155,7 +155,7 @@ if test -n "$targetConfig"; then
     dontStrip=1
 fi
 
-
+providedPreConfigure="$preConfigure";
 preConfigure() {
     if test -n "$newlibSrc"; then
         tar xvf "$newlibSrc" -C ..
@@ -188,6 +188,9 @@ preConfigure() {
         configureFlags="$configureFlags --with-build-sysroot=`pwd`/.."
     fi
 
+    # Eval the preConfigure script from nix expression.
+    eval $providedPreConfigure;
+    env;
     # Perform the build in a different directory.
     mkdir ../build
     cd ../build
@@ -210,7 +213,7 @@ postInstall() {
     # previous gcc.
     rm -rf $out/libexec/gcc/*/*/install-tools
     rm -rf $out/lib/gcc/*/*/install-tools
-    
+
     # More dependencies with the previous gcc or some libs (gccbug stores the build command line)
     rm -rf $out/bin/gccbug
     # Take out the bootstrap-tools from the rpath, as it's not needed at all having $out
diff --git a/pkgs/development/compilers/gcc/4.7/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 4f260d75afcc..8bd3ee145541 100644
--- a/pkgs/development/compilers/gcc/4.7/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -11,7 +11,7 @@
 , perl ? null # optional, for texi2pod (then pod2man); required for Java
 , gmp, mpfr, mpc, gettext, which
 , libelf                      # optional, for link-time optimizations (LTO)
-, ppl ? null, cloog ? null # optional, for the Graphite optimization framework.
+, ppl ? null, cloog ? null, isl ? null # optional, for the Graphite optimization framework.
 , zlib ? null, boehmgc ? null
 , zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null
 , libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
@@ -37,6 +37,9 @@ assert langJava     -> zip != null && unzip != null
 assert langAda      -> gnatboot != null;
 assert langVhdl     -> gnat != null;
 
+# We enable the isl cloog backend.
+assert cloog != null -> isl != null;
+
 # LTO needs libelf and zlib.
 assert libelf != null -> zlib != null;
 
@@ -49,12 +52,23 @@ assert langGo -> langCC;
 with stdenv.lib;
 with builtins;
 
-let version = "4.7.3";
+let version = "4.8.2";
 
     # Whether building a cross-compiler for GNU/Hurd.
     crossGNU = cross != null && cross.config == "i586-pc-gnu";
 
+  /* gccinstall.info says that "parallel make is currently not supported since
+     collisions in profile collecting may occur".
+
+     Parallel make of gfortran is disabled because of an apparent race
+     condition concerning the generation of "bconfig.h". Please try and
+     re-enable parallel make for a later release of gfortran to check whether
+     the error has been fixed.
+  */
+    enableParallelBuilding = !profiledCompiler && !langFortran;
+
     patches = []
+      ++ optional enableParallelBuilding ./parallel-bconfig.patch
       ++ optional stdenv.isArm [ ./arm-eabi.patch ]
       ++ optional (cross != null) ./libstdc++-target.patch
       # ++ optional noSysDirs ./no-sys-dirs.patch
@@ -88,35 +102,35 @@ let version = "4.7.3";
 
     /* Platform flags */
     platformFlags = let
-        gccArch = stdenv.lib.attrByPath [ "platform" "gcc" "arch" ] null stdenv;
-        gccCpu = stdenv.lib.attrByPath [ "platform" "gcc" "cpu" ] null stdenv;
-        gccAbi = stdenv.lib.attrByPath [ "platform" "gcc" "abi" ] null stdenv;
-        gccFpu = stdenv.lib.attrByPath [ "platform" "gcc" "fpu" ] null stdenv;
-        gccFloat = stdenv.lib.attrByPath [ "platform" "gcc" "float" ] null stdenv;
-        gccMode = stdenv.lib.attrByPath [ "platform" "gcc" "mode" ] null stdenv;
+        gccArch = stdenv.platform.gcc.arch or null;
+        gccCpu = stdenv.platform.gcc.cpu or null;
+        gccAbi = stdenv.platform.gcc.abi or null;
+        gccFpu = stdenv.platform.gcc.fpu or null;
+        gccFloat = stdenv.platform.gcc.float or null;
+        gccMode = stdenv.platform.gcc.mode or null;
         withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
         withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
         withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
         withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
         withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
         withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
-      in 
-        (withArch +
+      in
+        withArch +
         withCpu +
         withAbi +
         withFpu +
         withFloat +
-        withMode);
+        withMode;
 
     /* Cross-gcc settings */
     crossMingw = (cross != null && cross.libc == "msvcrt");
     crossConfigureFlags = let
-        gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
-        gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
-        gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
-        gccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null cross;
-        gccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null cross;
-        gccMode = stdenv.lib.attrByPath [ "gcc" "mode" ] null cross;
+        gccArch = stdenv.cross.gcc.arch or null;
+        gccCpu = stdenv.cross.gcc.cpu or null;
+        gccAbi = stdenv.cross.gcc.abi or null;
+        gccFpu = stdenv.cross.gcc.fpu or null;
+        gccFloat = stdenv.cross.gcc.float or null;
+        gccMode = stdenv.cross.gcc.mode or null;
         withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
         withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
         withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
@@ -179,8 +193,7 @@ let version = "4.7.3";
             " --enable-nls" +
             " --disable-decimal-float") # No final libdecnumber (it may work only in 386)
           );
-    stageNameAddon = if crossStageStatic then "-stage-static" else
-      "-stage-final";
+    stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
     crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
 
   bootstrap = cross == null && !stdenv.isArm && !stdenv.isMips;
@@ -197,7 +210,7 @@ stdenv.mkDerivation ({
 
   src = fetchurl {
     url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
-    sha256 = "1hx9h64ivarlzi4hxvq42as5m9vlr5cyzaaq4gzj4i619zmkfz1g";
+    sha256 = "1j6dwgby4g3p3lz7zkss32ghr45zpdidrg8xvazvn91lqxv25p09";
   };
 
   inherit patches;
@@ -266,6 +279,7 @@ stdenv.mkDerivation ({
   buildInputs = [ gmp mpfr mpc libelf ]
     ++ (optional (ppl != null) ppl)
     ++ (optional (cloog != null) cloog)
+    ++ (optional (isl != null) isl)
     ++ (optional (zlib != null) zlib)
     ++ (optionals langJava [ boehmgc zip unzip ])
     ++ (optionals javaAwtGtk ([ gtk libart_lgpl ] ++ xlibs))
@@ -278,22 +292,42 @@ stdenv.mkDerivation ({
     ++ (optional stdenv.isDarwin gnused)
     ;
 
-  configureFlagsArray = stdenv.lib.optionals
-    (ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic)
-        [ "--with-host-libstdcxx=-lstdc++ -lgcc_s" ];
+  NIX_LDFLAGS = stdenv.lib.optionalString  stdenv.isSunOS "-lm -ldl";
+
+  preConfigure = ''
+    configureFlagsArray=(
+      ${stdenv.lib.optionalString (ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic)
+        "'--with-host-libstdcxx=-lstdc++ -lgcc_s'"}
+      ${stdenv.lib.optionalString (ppl != null && stdenv.isSunOS)
+        "\"--with-host-libstdcxx=-Wl,-rpath,\$prefix/lib/amd64 -lstdc++\"
+         \"--with-boot-ldflags=-L../prev-x86_64-pc-solaris2.11/libstdc++-v3/src/.libs\""}
+    );
+    ${stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit)
+      ''
+        export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
+        export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
+        export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
+        export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET"
+      ''}
+    '';
 
   # 'iant' at #go-nuts@freenode, gccgo maintainer, said that
   # they have a bug in 4.7.1 if adding "--disable-static"
-  dontDisableStatic = langGo;
+  dontDisableStatic = langGo || staticCompiler;
 
   configureFlags = "
+    ${if stdenv.isSunOS then
+      " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
+      # On Illumos/Solaris GNU as is preferred
+      " --with-gnu-as --without-gnu-ld "
+      else ""}
+    --enable-lto
     ${if enableMultilib then "" else "--disable-multilib"}
     ${if enableShared then "" else "--disable-shared"}
-    ${if enablePlugin then "--enable-plugin" else ""}
-    ${if ppl != null then "--with-ppl=${ppl}" else ""}
-    ${if cloog != null then
-      "--with-cloog=${cloog} --enable-cloog-backend=isl"
-      else ""}
+    ${if enablePlugin then "--enable-plugin" else "--disable-plugin"}
+    ${if ppl != null then "--with-ppl=${ppl} --disable-ppl-version-check" else ""}
+    ${optionalString (isl != null) "--with-isl=${isl}"}
+    ${optionalString (cloog != null) "--with-cloog=${cloog} --disable-cloog-version-check --enable-cloog-backend=isl"}
     ${if langJava then
       "--with-ecj-jar=${javaEcj} " +
 
@@ -344,11 +378,11 @@ stdenv.mkDerivation ({
     else "install";
 
   crossAttrs = let
-    xgccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null stdenv.cross;
-    xgccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null stdenv.cross;
-    xgccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null stdenv.cross;
-    xgccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null stdenv.cross;
-    xgccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null stdenv.cross;
+    xgccArch = stdenv.cross.gcc.arch or null;
+    xgccCpu = stdenv.cross.gcc.cpu or null;
+    xgccAbi = stdenv.cross.gcc.abi or null;
+    xgccFpu = stdenv.cross.gcc.fpu or null;
+    xgccFloat = stdenv.cross.gcc.float or null;
     xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else "";
     xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else "";
     xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else "";
@@ -407,7 +441,8 @@ stdenv.mkDerivation ({
   # Needed for the cross compilation to work
   AR = "ar";
   LD = "ld";
-  CC = "gcc";
+  # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
+  CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
 
   # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
   # the library headers and binaries, regarless of the language being
@@ -431,8 +466,7 @@ stdenv.mkDerivation ({
 
                                    # On GNU/Hurd glibc refers to Mach & Hurd
                                    # headers.
-                                   ++ optionals (libcCross != null &&
-                                                 hasAttr "propagatedBuildInputs" libcCross)
+                                   ++ optionals (libcCross != null && libcCross ? "propagatedBuildInputs" )
                                         libcCross.propagatedBuildInputs)));
 
   LIBRARY_PATH = concatStrings
@@ -455,14 +489,10 @@ stdenv.mkDerivation ({
            " -L${libpthreadCross}/lib -Wl,${libpthreadCross.TARGET_LDFLAGS}")
     else null;
 
-  passthru = { inherit langC langCC langAda langFortran langVhdl
-      langGo enableMultilib version; };
+  passthru =
+    { inherit langC langCC langAda langFortran langVhdl langGo enableMultilib version; };
 
-  /* From gccinstall.info:
-     "parallel make is currently not supported since collisions in profile
-     collecting may occur"
-  */
-  enableParallelBuilding = !profiledCompiler;
+  inherit enableParallelBuilding;
 
   meta = {
     homepage = http://gcc.gnu.org/;
@@ -479,11 +509,7 @@ stdenv.mkDerivation ({
       compiler used in the GNU system including the GNU/Linux variant.
     '';
 
-    maintainers = [
-      stdenv.lib.maintainers.ludo
-      stdenv.lib.maintainers.viric
-      stdenv.lib.maintainers.shlevy
-    ];
+    maintainers = with stdenv.lib.maintainers; [ ludo viric shlevy simons ];
 
     # Volunteers needed for the {Cyg,Dar}win ports of *PPL.
     # gnatboot is not available out of linux platforms, so we disable the darwin build
diff --git a/pkgs/development/compilers/gcc/4.7/gfortran-driving.patch b/pkgs/development/compilers/gcc/4.8/gfortran-driving.patch
index 70708886b405..70708886b405 100644
--- a/pkgs/development/compilers/gcc/4.7/gfortran-driving.patch
+++ b/pkgs/development/compilers/gcc/4.8/gfortran-driving.patch
diff --git a/pkgs/development/compilers/gcc/4.7/gnat-cflags.patch b/pkgs/development/compilers/gcc/4.8/gnat-cflags.patch
index bf2acf065e9b..bf2acf065e9b 100644
--- a/pkgs/development/compilers/gcc/4.7/gnat-cflags.patch
+++ b/pkgs/development/compilers/gcc/4.8/gnat-cflags.patch
diff --git a/pkgs/development/compilers/gcc/4.7/java-jvgenmain-link.patch b/pkgs/development/compilers/gcc/4.8/java-jvgenmain-link.patch
index 2612e8bfbbbc..2612e8bfbbbc 100644
--- a/pkgs/development/compilers/gcc/4.7/java-jvgenmain-link.patch
+++ b/pkgs/development/compilers/gcc/4.8/java-jvgenmain-link.patch
diff --git a/pkgs/development/compilers/gcc/4.7/libstdc++-target.patch b/pkgs/development/compilers/gcc/4.8/libstdc++-target.patch
index fb622b395806..fb622b395806 100644
--- a/pkgs/development/compilers/gcc/4.7/libstdc++-target.patch
+++ b/pkgs/development/compilers/gcc/4.8/libstdc++-target.patch
diff --git a/pkgs/development/compilers/gcc/4.7/no-sys-dirs.patch b/pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch
index 79901703cb82..79901703cb82 100644
--- a/pkgs/development/compilers/gcc/4.7/no-sys-dirs.patch
+++ b/pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch
diff --git a/pkgs/development/compilers/gcc/4.8/parallel-bconfig.patch b/pkgs/development/compilers/gcc/4.8/parallel-bconfig.patch
new file mode 100644
index 000000000000..bc56ac698f5a
--- /dev/null
+++ b/pkgs/development/compilers/gcc/4.8/parallel-bconfig.patch
@@ -0,0 +1,32 @@
+Hacky work-around for highly parallel builds.
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57125
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index aad927c..182f666 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -3908,21 +3908,21 @@ build/gengtype-lex.o: $(BCONFIG_H)
+ 
+ gengtype-parse.o build/gengtype-parse.o : gengtype-parse.c gengtype.h \
+   $(SYSTEM_H)
+-gengtype-parse.o: $(CONFIG_H)
++gengtype-parse.o: $(CONFIG_H) $(BCONFIG_H)
+ CFLAGS-gengtype-parse.o += -DGENERATOR_FILE
+ build/gengtype-parse.o: $(BCONFIG_H)
+ 
+ gengtype-state.o build/gengtype-state.o: gengtype-state.c $(SYSTEM_H) \
+   gengtype.h errors.h double-int.h version.h $(HASHTAB_H) $(OBSTACK_H) \
+   $(XREGEX_H)
+-gengtype-state.o: $(CONFIG_H)
++gengtype-state.o: $(CONFIG_H) $(BCONFIG_H)
+ CFLAGS-gengtype-state.o += -DGENERATOR_FILE
+ build/gengtype-state.o: $(BCONFIG_H)
+ 
+ gengtype.o build/gengtype.o : gengtype.c $(SYSTEM_H) gengtype.h 	\
+   rtl.def insn-notes.def errors.h double-int.h version.h $(HASHTAB_H) \
+   $(OBSTACK_H) $(XREGEX_H)
+-gengtype.o: $(CONFIG_H)
++gengtype.o: $(CONFIG_H) $(BCONFIG_H)
+ CFLAGS-gengtype.o += -DGENERATOR_FILE
+ build/gengtype.o: $(BCONFIG_H)
+ 
diff --git a/pkgs/development/compilers/ghc/ghc-get-packages.sh b/pkgs/development/compilers/ghc/ghc-get-packages.sh
deleted file mode 100755
index 9ed1455d2321..000000000000
--- a/pkgs/development/compilers/ghc/ghc-get-packages.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#! /bin/sh
-# Usage:
-#  $1: version of GHC
-#  $2: invocation path of GHC
-#  $3: prefix
-version="$1"
-if test -z "$3"; then
-  prefix="-package-conf "
-else
-  prefix="$3"
-fi
-PATH="$2:$PATH"
-IFS=":"
-for p in $PATH; do
-  PkgDir="$p/../lib/ghc-pkgs/ghc-$version"
-  for i in $PkgDir/*.installedconf; do
-    # output takes place here
-    test -f $i && echo -n " $prefix$i"
-  done
-done
-test -f "$2/../lib/ghc-$version/package.conf" && echo -n " $prefix$2/../lib/ghc-$version/package.conf"
diff --git a/pkgs/development/compilers/llvm/default.nix b/pkgs/development/compilers/llvm/default.nix
index bed6bf1fc13b..62ce2cdab14c 100644
--- a/pkgs/development/compilers/llvm/default.nix
+++ b/pkgs/development/compilers/llvm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, groff, cmake, python, libffi, binutils_gold }:
+{ stdenv, fetchurl, perl, groff, cmake, python, libffi, binutils }:
 
 let version = "3.3"; in
 
@@ -10,8 +10,10 @@ stdenv.mkDerivation rec {
     sha256 = "0y3mfbb5qzcpw3v5qncn69x1hdrrrfirgs82ypi2annhf0g6nxk8";
   };
 
-  # The default rlimits are too low for shared libraries.
-  patches = [ ./more-memory-for-bugpoint.patch ];
+  patches = [
+    ./more-memory-for-bugpoint.patch # The default rlimits are too low for shared libraries.
+    ./no-rule-aarch64.patch # http://llvm.org/bugs/show_bug.cgi?id=16625
+  ];
 
   # libffi was propagated before, but it wasn't even being used, so
   # unless something needs it just an input is fine.
@@ -24,7 +26,7 @@ stdenv.mkDerivation rec {
   cmakeFlags = with stdenv; [
     "-DCMAKE_BUILD_TYPE=Release"
     "-DLLVM_ENABLE_FFI=ON"
-    "-DLLVM_BINUTILS_INCDIR=${binutils_gold}/include"
+    "-DLLVM_BINUTILS_INCDIR=${binutils}/include"
     "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=R600" # for mesa
   ] ++ lib.optional (!isDarwin) "-DBUILD_SHARED_LIBS=ON";
 
diff --git a/pkgs/development/compilers/llvm/no-rule-aarch64.patch b/pkgs/development/compilers/llvm/no-rule-aarch64.patch
new file mode 100644
index 000000000000..ea7214febe5a
--- /dev/null
+++ b/pkgs/development/compilers/llvm/no-rule-aarch64.patch
@@ -0,0 +1,8 @@
+--- llvm/lib/Target/AArch64/Utils/CMakeLists.txt	2013/05/18 04:32:15	182189
++++ llvm/lib/Target/AArch64/Utils/CMakeLists.txt	2013/05/18 08:17:47	182190
+@@ -3,3 +3,5 @@
+ add_llvm_library(LLVMAArch64Utils
+   AArch64BaseInfo.cpp
+   )
++
++add_dependencies(LLVMAArch64Utils AArch64CommonTableGen)
diff --git a/pkgs/development/compilers/mlton/default.nix b/pkgs/development/compilers/mlton/default.nix
index a5ff613a9b45..47c4404a818e 100644
--- a/pkgs/development/compilers/mlton/default.nix
+++ b/pkgs/development/compilers/mlton/default.nix
@@ -1,23 +1,26 @@
 { stdenv, fetchurl, gmp }:
 
+let
+  version = "20130715";
+in
 stdenv.mkDerivation rec {
-  name = "mlton-20100608";
+  name = "mlton-${version}";
 
   binSrc =
     if stdenv.system == "i686-linux" then (fetchurl {
-      url = "http://sourceforge.net/projects/mlton/files/mlton/20100608/${name}-1.x86-linux.static.tgz";
-      sha256 = "16qg8df9hg2pmnsblkgxp6bgm7334rsqkxqzskv5fl21wivmnwfw";
+      url = "http://sourceforge.net/projects/mlton/files/mlton/${version}/${name}-1.x86-linux.tgz";
+      sha256 = "1kxjjmnw4xk2d9hpvz43w9dvyhb3025k4zvjx785c33nrwkrdn4j";
     })
     else if stdenv.system == "x86_64-linux" then (fetchurl {
-        url = "http://sourceforge.net/projects/mlton/files/mlton/20100608/${name}-1.amd64-linux.static.tgz";
-        sha256 = "0i6ic8f6prl0cigrmf6bj9kqz3plzappxn17lz1rg2v832nfbw9r";
+        url = "http://sourceforge.net/projects/mlton/files/mlton/${version}/${name}-1.amd64-linux.tgz";
+        sha256 = "0fyhwxb4nmpirjbjcvk9f6w67gmn2gkz7xcgz0xbfih9kc015ygn";
     })
     else throw "Architecture not supported";
 
   codeSrc =
     fetchurl {
-      url = "http://sourceforge.net/projects/mlton/files/mlton/20100608/${name}.src.tgz";
-      sha256 = "0cqb3k6ld9965hyyfyayi510f205vqzd5qqm3crh13nasvq2rjzj";
+      url = "http://sourceforge.net/projects/mlton/files/mlton/${version}/${name}.src.tgz";
+      sha256 = "0v1x2hrh9hiqkvnbq11kf34v4i5a2x0ffxbzqaa8skyl26nmfn11";
     };
 
   srcs = [ binSrc codeSrc ];
diff --git a/pkgs/development/compilers/openjdk/default.nix b/pkgs/development/compilers/openjdk/default.nix
index fd229cf5b139..4d4a129d573a 100644
--- a/pkgs/development/compilers/openjdk/default.nix
+++ b/pkgs/development/compilers/openjdk/default.nix
@@ -105,6 +105,7 @@ stdenv.mkDerivation rec {
     "DEVTOOLS_PATH="
     "UNIXCOMMAND_PATH="
     "BOOTDIR=${jdk}"
+    "STATIC_CXX=false"
     "UNLIMITED_CRYPTO=1"
   ];
 
diff --git a/pkgs/development/interpreters/perl/5.14/default.nix b/pkgs/development/interpreters/perl/5.14/default.nix
index 08690e9507fa..dd4e7acf71f3 100644
--- a/pkgs/development/interpreters/perl/5.14/default.nix
+++ b/pkgs/development/interpreters/perl/5.14/default.nix
@@ -17,7 +17,8 @@ stdenv.mkDerivation rec {
   patches = 
     [ # Do not look in /usr etc. for dependencies.
       ./no-sys-dirs.patch
-    ] 
+    ]
+    ++ stdenv.lib.optional stdenv.isSunOS  ./ld-shared.patch
     ++ stdenv.lib.optional stdenv.isDarwin ./no-libutil.patch;
 
   # Build a thread-safe Perl with a dynamic libperls.o.  We need the
diff --git a/pkgs/development/interpreters/perl/5.14/ld-shared.patch b/pkgs/development/interpreters/perl/5.14/ld-shared.patch
new file mode 100644
index 000000000000..b1834ff7a1f2
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.14/ld-shared.patch
@@ -0,0 +1,11 @@
+--- perl-5.14.2/hints/solaris_2.sh.orig	2013-02-14 19:29:49.453988140 +0000
++++ perl-5.14.2/hints/solaris_2.sh	2013-02-14 19:30:31.681631019 +0000
+@@ -568,7 +568,7 @@
+ #		    ccflags="$ccflags -Wa,`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
+ #		fi
+ 		ldflags="$ldflags -m64"
+-		lddlflags="$lddlflags -G -m64"
++		lddlflags="$lddlflags -shared -m64"
+ 		;;
+ 	    *)
+ 		getconfccflags="`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
diff --git a/pkgs/development/interpreters/perl/5.16/default.nix b/pkgs/development/interpreters/perl/5.16/default.nix
index a3ab0ef4b96f..a8c175453037 100644
--- a/pkgs/development/interpreters/perl/5.16/default.nix
+++ b/pkgs/development/interpreters/perl/5.16/default.nix
@@ -6,6 +6,10 @@ let
 
 in
 
+with {
+  inherit (stdenv.lib) optional optionalString;
+};
+
 stdenv.mkDerivation rec {
   name = "perl-5.16.3";
 
@@ -18,7 +22,8 @@ stdenv.mkDerivation rec {
     [ # Do not look in /usr etc. for dependencies.
       ./no-sys-dirs.patch
     ]
-    ++ stdenv.lib.optionals stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
+    ++ optional stdenv.isSunOS  ./ld-shared.patch
+    ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
 
   # Build a thread-safe Perl with a dynamic libperls.o.  We need the
   # "installstyle" option to ensure that modules are put under
@@ -34,7 +39,7 @@ stdenv.mkDerivation rec {
       "-Dlocincpth=${libc}/include"
       "-Dloclibpth=${libc}/lib"
     ]
-    ++ stdenv.lib.optional (stdenv ? glibc) "-Dusethreads";
+    ++ optional (stdenv ? glibc) "-Dusethreads";
 
   configureScript = "${stdenv.shell} ./Configure";
 
@@ -46,12 +51,12 @@ stdenv.mkDerivation rec {
     ''
       configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
 
-      ${stdenv.lib.optionalString stdenv.isArm ''
+      ${optionalString stdenv.isArm ''
         configureFlagsArray=(-Dldflags="-lm -lrt")
       ''}
     '';
 
-  preBuild = stdenv.lib.optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
+  preBuild = optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
     ''
       # Make Cwd work on NixOS (where we don't have a /bin/pwd).
       substituteInPlace dist/Cwd/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
@@ -59,5 +64,27 @@ stdenv.mkDerivation rec {
 
   setupHook = ./setup-hook.sh;
 
+  doCheck = !stdenv.isDarwin;
+
+  # some network-related tests don't work, mostly probably due to our sandboxing
+  testsToSkip = ''
+    lib/Net/hostent.t \
+    dist/IO/t/{io_multihomed.t,io_sock.t} \
+    t/porting/{maintainers.t,regen.t} \
+    cpan/Socket/t/get{name,addr}info.t \
+  '' + optionalString stdenv.isFreeBSD ''
+    cpan/CPANPLUS/t/04_CPANPLUS-Module.t \
+    cpan/CPANPLUS/t/20_CPANPLUS-Dist-MM.t \
+  '' + " ";
+
+  postPatch = optionalString (!stdenv.isDarwin) /* this failed on Darwin, no idea why */ ''
+    for test in ${testsToSkip}; do
+      echo "Removing test" $test
+      rm "$test"
+      pat=`echo "$test" | sed 's,/,\\\\/,g'` # just escape slashes
+      sed "/^$pat/d" -i MANIFEST
+    done
+  '';
+
   passthru.libPrefix = "lib/perl5/site_perl";
 }
diff --git a/pkgs/development/interpreters/perl/5.16/ld-shared.patch b/pkgs/development/interpreters/perl/5.16/ld-shared.patch
new file mode 100644
index 000000000000..be45230c8a73
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.16/ld-shared.patch
@@ -0,0 +1,11 @@
+--- perl-5.16.2/hints/solaris_2.sh.orig	2013-02-14 19:29:49.453988140 +0000
++++ perl-5.16.2/hints/solaris_2.sh	2013-02-14 19:30:31.681631019 +0000
+@@ -568,7 +568,7 @@
+ #		    ccflags="$ccflags -Wa,`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
+ #		fi
+ 		ldflags="$ldflags -m64"
+-		lddlflags="$lddlflags -G -m64"
++		lddlflags="$lddlflags -shared -m64"
+ 		;;
+ 	    *)
+ 		getconfccflags="`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
diff --git a/pkgs/development/interpreters/perl/5.16/no-sys-dirs.patch b/pkgs/development/interpreters/perl/5.16/no-sys-dirs.patch
index 54ffb28e2065..883b24889c37 100644
--- a/pkgs/development/interpreters/perl/5.16/no-sys-dirs.patch
+++ b/pkgs/development/interpreters/perl/5.16/no-sys-dirs.patch
@@ -1,7 +1,8 @@
-diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
---- perl-5.14.2-orig/Configure	2011-09-26 11:44:34.000000000 +0200
-+++ perl-5.14.2/Configure	2012-01-20 17:05:23.089223129 +0100
-@@ -106,15 +106,7 @@
+diff --git a/Configure b/Configure
+index fdbbf20..ba1fd07 100755
+--- a/Configure
++++ b/Configure
+@@ -106,15 +106,7 @@ if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
  fi
  
  : Proper PATH setting
@@ -18,7 +19,7 @@ diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
  
  for p in $paths
  do
-@@ -1311,8 +1303,7 @@
+@@ -1323,8 +1315,7 @@ archobjs=''
  archname=''
  : Possible local include directories to search.
  : Set locincpth to "" in a hint file to defeat local include searches.
@@ -28,8 +29,8 @@ diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
  :
  : no include file wanted by default
  inclwanted=''
-@@ -1328,17 +1319,12 @@
- archobjs=''
+@@ -1335,17 +1326,12 @@ DEBUGGING=''
+ 
  libnames=''
  : change the next line if compiling for Xenix/286 on Xenix/386
 -xlibpth='/usr/lib/386 /lib/386'
@@ -49,7 +50,7 @@ diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
  
  : Private path used by Configure to find libraries.  Its value
  : is prepended to libpth. This variable takes care of special
-@@ -1371,8 +1357,6 @@
+@@ -1380,8 +1366,6 @@ libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
  libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
  : We probably want to search /usr/shlib before most other libraries.
  : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
@@ -58,7 +59,7 @@ diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
  : Do not use vfork unless overridden by a hint file.
  usevfork=false
  
-@@ -2380,7 +2364,6 @@
+@@ -2389,7 +2373,6 @@ uname
  zip
  "
  pth=`echo $PATH | sed -e "s/$p_/ /g"`
@@ -66,7 +67,7 @@ diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
  for file in $loclist; do
  	eval xxx=\$$file
  	case "$xxx" in
-@@ -4785,7 +4768,7 @@
+@@ -4708,7 +4691,7 @@ $rm -f testcpp.c testcpp.out
  : Set private lib path
  case "$plibpth" in
  '') if ./mips; then
@@ -75,7 +76,7 @@ diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
  	fi;;
  esac
  case "$libpth" in
-@@ -8390,13 +8373,8 @@
+@@ -8354,13 +8337,8 @@ esac
  echo " "
  case "$sysman" in
  '') 
@@ -91,7 +92,7 @@ diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
  	;;
  esac
  if $test -d "$sysman"; then
-@@ -19721,9 +19699,10 @@
+@@ -19742,9 +19720,10 @@ $rm_try tryp
  case "$full_ar" in
  '') full_ar=$ar ;;
  esac
@@ -103,10 +104,11 @@ diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
  
  : see what type gids are declared as in the kernel
  echo " "
-diff -ru -x '*~' perl-5.14.2-orig/ext/Errno/Errno_pm.PL perl-5.14.2/ext/Errno/Errno_pm.PL
---- perl-5.14.2-orig/ext/Errno/Errno_pm.PL	2011-09-26 11:44:34.000000000 +0200
-+++ perl-5.14.2/ext/Errno/Errno_pm.PL	2012-01-20 17:02:07.938138311 +0100
-@@ -137,11 +137,7 @@
+diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
+index 439f254..2cdfdb0 100644
+--- a/ext/Errno/Errno_pm.PL
++++ b/ext/Errno/Errno_pm.PL
+@@ -137,11 +137,7 @@ sub get_files {
  	if ($dep =~ /(\S+errno\.h)/) {
  	     $file{$1} = 1;
  	}
@@ -119,10 +121,11 @@ diff -ru -x '*~' perl-5.14.2-orig/ext/Errno/Errno_pm.PL perl-5.14.2/ext/Errno/Er
  	# Some Linuxes have weird errno.hs which generate
  	# no #file or #line directives
  	my $linux_errno_h = -e '/usr/include/errno.h' ?
-diff -ru -x '*~' perl-5.14.2-orig/hints/freebsd.sh perl-5.14.2/hints/freebsd.sh
---- perl-5.14.2-orig/hints/freebsd.sh	2011-09-19 15:18:22.000000000 +0200
-+++ perl-5.14.2/hints/freebsd.sh	2012-01-20 17:10:37.267924044 +0100
-@@ -118,21 +118,21 @@
+diff --git a/hints/freebsd.sh b/hints/freebsd.sh
+index a67c0bb..0f07ca5 100644
+--- a/hints/freebsd.sh
++++ b/hints/freebsd.sh
+@@ -119,21 +119,21 @@ case "$osvers" in
          objformat=`/usr/bin/objformat`
          if [ x$objformat = xaout ]; then
              if [ -e /usr/lib/aout ]; then
@@ -150,3 +153,73 @@ diff -ru -x '*~' perl-5.14.2-orig/hints/freebsd.sh perl-5.14.2/hints/freebsd.sh
         ldflags="-Wl,-E "
          lddlflags="-shared "
          cccdlflags='-DPIC -fPIC'
+diff --git a/hints/linux.sh b/hints/linux.sh
+index 688c68d..c12f5f5 100644
+--- a/hints/linux.sh
++++ b/hints/linux.sh
+@@ -60,17 +60,6 @@ libswanted="$*"
+ # Debian 4.0 puts ndbm in the -lgdbm_compat library.
+ libswanted="$libswanted gdbm_compat"
+ 
+-# If you have glibc, then report the version for ./myconfig bug reporting.
+-# (Configure doesn't need to know the specific version since it just uses
+-# gcc to load the library for all tests.)
+-# We don't use __GLIBC__ and  __GLIBC_MINOR__ because they
+-# are insufficiently precise to distinguish things like
+-# libc-2.0.6 and libc-2.0.7.
+-if test -L /lib/libc.so.6; then
+-    libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
+-    libc=/lib/$libc
+-fi
+-
+ # Configure may fail to find lstat() since it's a static/inline
+ # function in <sys/stat.h>.
+ d_lstat=define
+@@ -154,24 +143,6 @@ case "$optimize" in
+     ;;
+ esac
+ 
+-# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
+-# (such as -lm) in /lib or /usr/lib.  So we have to ask gcc to tell us
+-# where to look.  We don't want gcc's own libraries, however, so we
+-# filter those out.
+-# This could be conditional on Unbuntu, but other distributions may
+-# follow suit, and this scheme seems to work even on rather old gcc's.
+-# This unconditionally uses gcc because even if the user is using another
+-# compiler, we still need to find the math library and friends, and I don't
+-# know how other compilers will cope with that situation.
+-# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
+-# we don't want its libraries. So we try to prefer the system gcc
+-# Still, as an escape hatch, allow Configure command line overrides to
+-# plibpth to bypass this check.
+-if [ -x /usr/bin/gcc ] ; then
+-    gcc=/usr/bin/gcc
+-else
+-    gcc=gcc
+-fi
+ 
+ case "$plibpth" in
+ '') plibpth=`LANG=C LC_ALL=C $gcc -print-search-dirs | grep libraries |
+@@ -345,22 +316,6 @@ sparc*)
+ 	;;
+ esac
+ 
+-# SuSE8.2 has /usr/lib/libndbm* which are ld scripts rather than
+-# true libraries. The scripts cause binding against static
+-# version of -lgdbm which is a bad idea. So if we have 'nm'
+-# make sure it can read the file
+-# NI-S 2003/08/07
+-if [ -r /usr/lib/libndbm.so  -a  -x /usr/bin/nm ] ; then
+-   if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
+-    echo 'Your shared -lndbm seems to be a real library.'
+-   else
+-    echo 'Your shared -lndbm is not a real library.'
+-    set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+-    shift
+-    libswanted="$*"
+-   fi
+-fi
+-
+ 
+ # This script UU/usethreads.cbu will get 'called-back' by Configure
+ # after it has prompted the user for whether to use threads.
diff --git a/pkgs/development/interpreters/python/2.6/default.nix b/pkgs/development/interpreters/python/2.6/default.nix
index 7fba70377d74..7c6516fe668c 100644
--- a/pkgs/development/interpreters/python/2.6/default.nix
+++ b/pkgs/development/interpreters/python/2.6/default.nix
@@ -45,7 +45,7 @@ let
     C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs);
     LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs);
 
-    configureFlags = "--enable-shared --with-threads --enable-unicode --with-wctype-functions";
+    configureFlags = "--enable-shared --with-threads --enable-unicode";
 
     preConfigure =
       ''
diff --git a/pkgs/development/interpreters/python/2.7/default.nix b/pkgs/development/interpreters/python/2.7/default.nix
index 617be4f29f13..043094c03036 100644
--- a/pkgs/development/interpreters/python/2.7/default.nix
+++ b/pkgs/development/interpreters/python/2.7/default.nix
@@ -59,7 +59,7 @@ let
     C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") buildInputs);
     LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") buildInputs);
 
-    configureFlags = "--enable-shared --with-threads --enable-unicode --with-wctype-functions";
+    configureFlags = "--enable-shared --with-threads --enable-unicode";
 
     preConfigure = "${ensurePurity}" + optionalString stdenv.isCygwin
       ''
diff --git a/pkgs/development/libraries/acl/default.nix b/pkgs/development/libraries/acl/default.nix
index bc0821f39fdd..d37d8926fbdc 100644
--- a/pkgs/development/libraries/acl/default.nix
+++ b/pkgs/development/libraries/acl/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, gettext, attr }:
 
 stdenv.mkDerivation rec {
-  name = "acl-2.2.51";
+  name = "acl-2.2.52";
 
   src = fetchurl {
     url = "mirror://savannah/acl/${name}.src.tar.gz";
-    sha256 = "09aj30m49ivycl3irram8c3givc0crivjm3ymw0nhfaxrwhlb186";
+    sha256 = "08qd9s3wfhv0ajswsylnfwr5h0d7j9d4rgip855nrh400nxp940p";
   };
 
   nativeBuildInputs = [ gettext ];
diff --git a/pkgs/development/libraries/attr/default.nix b/pkgs/development/libraries/attr/default.nix
index 3c5855ea284f..8d87e2ee50dd 100644
--- a/pkgs/development/libraries/attr/default.nix
+++ b/pkgs/development/libraries/attr/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, gettext }:
 
 stdenv.mkDerivation rec {
-  name = "attr-2.4.46";
+  name = "attr-2.4.47";
 
   src = fetchurl {
     url = "mirror://savannah/attr/${name}.src.tar.gz";
-    sha256 = "07qf6kb2zk512az481bbnsk9jycn477xpva1a726n5pzlzf9pmnw";
+    sha256 = "0nd8y0m6awc9ahv0ciiwf8gy54c8d3j51pw9xg7f7cn579jjyxr5";
   };
 
   nativeBuildInputs = [ gettext ];
diff --git a/pkgs/development/libraries/cloog/default.nix b/pkgs/development/libraries/cloog/default.nix
index ab5737b20ede..c3878ef4b789 100644
--- a/pkgs/development/libraries/cloog/default.nix
+++ b/pkgs/development/libraries/cloog/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv, gmp, isl }:
 
 stdenv.mkDerivation rec {
-  name = "cloog-0.16.3";
+  name = "cloog-0.18.0";
 
   src = fetchurl {
     url = "http://www.bastoul.net/cloog/pages/download/count.php3?url=./${name}.tar.gz";
-    sha256 = "0lzbsszfzsr0jfwkccfbsvx913d2yc45dqwa472plmxkhbwykmc9";
+    sha256 = "1c4aa8dde7886be9cbe0f9069c334843b21028f61d344a2d685f88cb1dcf2228";
   };
 
   buildInputs = [ gmp ];
diff --git a/pkgs/development/libraries/coin3d/default.nix b/pkgs/development/libraries/coin3d/default.nix
index 2ada02441492..f866b2299c1f 100644
--- a/pkgs/development/libraries/coin3d/default.nix
+++ b/pkgs/development/libraries/coin3d/default.nix
@@ -9,6 +9,15 @@ stdenv.mkDerivation rec {
     sha256 = "05ylhrcglm81dajbk132l1w892634z2i97x10fm64y1ih72phd2q";
   };
 
+  patches = [
+    (fetchurl {
+      url = http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-libs/coin/files/coin-3.1.3-gcc-4.7.patch;
+      name = "gcc-4.7.patch";
+      sha256 = "076dyc52swk8qc7ylps53fg6iqmd52x8s7m18i80x49dd109yw20";
+    })
+    ./gcc-4.8.patch # taken from FC-17 source rpm
+  ];
+
   buildInputs = [ mesa ];
 
   meta = {
diff --git a/pkgs/development/libraries/coin3d/gcc-4.8.patch b/pkgs/development/libraries/coin3d/gcc-4.8.patch
new file mode 100644
index 000000000000..be5b8b03b638
--- /dev/null
+++ b/pkgs/development/libraries/coin3d/gcc-4.8.patch
@@ -0,0 +1,38 @@
+From 9f5d96a2b9a71ab539237d2dab4c54fc46fc5c5b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ralf=20Cors=C3=A9pius?= <corsepiu@corsepiu.home>
+Date: Thu, 18 Apr 2013 19:17:06 +0200
+Subject: [PATCH 10/10] GCC-4.8.0 fixes
+
+---
+ src/fonts/freetype.cpp | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/fonts/freetype.cpp b/src/fonts/freetype.cpp
+index 760b88b..e705d3a 100644
+--- a/src/fonts/freetype.cpp
++++ b/src/fonts/freetype.cpp
+@@ -32,18 +32,18 @@
+ 
+    20050613 mortene. */
+ 
+-#include "fonts/freetype.h"
+-
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif /* HAVE_CONFIG_H */
+ 
+-#include <stdlib.h>
++#include <cstdlib>
+ #include <assert.h>
+ 
+ #include "glue/freetype.h"
+ #include "glue/GLUWrapper.h"
+ 
++#include "fonts/freetype.h"
++
+ /* ************************************************************************* */
+ 
+ #ifdef __cplusplus
+-- 
+1.8.1.4
+
diff --git a/pkgs/development/libraries/ctl/default.nix b/pkgs/development/libraries/ctl/default.nix
index a802f5716746..65489ee8c88d 100644
--- a/pkgs/development/libraries/ctl/default.nix
+++ b/pkgs/development/libraries/ctl/default.nix
@@ -8,12 +8,12 @@ stdenv.mkDerivation {
     sha256 = "16lzgbpxdyhykdwndj1i9vx3h4bfkxqqcrvasvgg70gb5raxj0mj";
   };
 
-  patches = [ ./patch.patch ];
-  
+  patches = [ ./patch.patch ./gcc47.patch ];
+
   propagatedBuildInputs = [ ilmbase ];
-  
+
   configureFlags = "--with-ilmbase-prefix=${ilmbase}";
-  
+
   #configurePhase = "
     #export CXXFLAGS=\"-I${ilmbase}/include -L${ilmbase}/lib\"
     #echo $CXXFLAGS
diff --git a/pkgs/development/libraries/ctl/gcc47.patch b/pkgs/development/libraries/ctl/gcc47.patch
new file mode 100644
index 000000000000..1aa4be4fe6d0
--- /dev/null
+++ b/pkgs/development/libraries/ctl/gcc47.patch
@@ -0,0 +1,15 @@
+ https://bugs.gentoo.org/426368
+ 
+ IlmCtl/CtlInterpreter.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/IlmCtl/CtlInterpreter.cpp
++++ b/IlmCtl/CtlInterpreter.cpp
+@@ -64,6 +64,7 @@
+ #include <fstream>
+ #include <algorithm>
+ #include <cassert>
++#include <unistd.h>
+ 
+ #ifdef WIN32
+     #include <io.h>
diff --git a/pkgs/development/libraries/dbus-cplusplus/default.nix b/pkgs/development/libraries/dbus-cplusplus/default.nix
index 0a4b80d3f3ea..2bd4f8149853 100644
--- a/pkgs/development/libraries/dbus-cplusplus/default.nix
+++ b/pkgs/development/libraries/dbus-cplusplus/default.nix
@@ -10,6 +10,12 @@ stdenv.mkDerivation rec {
     sha256 = "0qafmy2i6dzx4n1dqp6pygyy6gjljnb7hwjcj2z11c1wgclsq4dw";
   };
 
+  patches = [( fetchurl {
+    url = http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/dbus-c%2B%2B/files/dbus-c%2B%2B-0.9.0-gcc-4.7.patch;
+    name = "gcc-4.7.patch";
+    sha256 = "0rwcz9pvc13b3yfr0lkifnfz0vb5q6dg240bzgf37ni4s8rpc72g";
+  })];
+
   buildInputs = [ dbus glib gtkmm pkgconfig expat ];
 
   configureFlags = "--disable-ecore";
diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix
index 4908662591cb..4d400a6ea7da 100644
--- a/pkgs/development/libraries/gettext/default.nix
+++ b/pkgs/development/libraries/gettext/default.nix
@@ -1,19 +1,17 @@
-{ stdenv, fetchurl, libiconvOrEmpty }:
-
-with { inherit (stdenv.lib) optionals optionalAttrs; };
+{ stdenv, fetchurl, libiconv, xz }:
 
 stdenv.mkDerivation (rec {
-  name = "gettext-0.18.1.1";
+  name = "gettext-0.18.2";
 
   src = fetchurl {
     url = "mirror://gnu/gettext/${name}.tar.gz";
-    sha256 = "1sa3ch12qxa4h3ya6hkz119yclcccmincl9j20dhrdx5mykp3b4k";
+    sha256 = "516a6370b3b3f46e2fc5a5e222ff5ecd76f3089bc956a7587a6e4f89de17714c";
   };
 
-  patches = [ ./no-gets.patch ];
+  LDFLAGS = if stdenv.isSunOS then "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec" else "";
 
-  configureFlags = [ "--disable-csharp" ]
-     ++ (optionals stdenv.isCygwin
+  configureFlags = [ "--disable-csharp" "--with-xz" ]
+     ++ (stdenv.lib.optionals stdenv.isCygwin
           [ # We have a static libiconv, so we can only build the static lib.
             "--disable-shared" "--enable-static"
 
@@ -32,12 +30,12 @@ stdenv.mkDerivation (rec {
     fi
   '';
 
-  buildInputs = libiconvOrEmpty;
+  buildInputs = [ xz ] ++ stdenv.lib.optional (!stdenv.isLinux) libiconv;
 
   enableParallelBuilding = true;
 
   crossAttrs = {
-    buildInputs = optional (stdenv.gccCross.libc ? libiconv)
+    buildInputs = stdenv.lib.optional (stdenv.gccCross.libc ? libiconv)
       stdenv.gccCross.libc.libiconv.crossDrv;
     # Gettext fails to guess the cross compiler
     configureFlags = "CXX=${stdenv.cross.config}-g++";
@@ -72,11 +70,11 @@ stdenv.mkDerivation (rec {
   };
 }
 
-// optionalAttrs stdenv.isDarwin {
+// stdenv.lib.optionalAttrs stdenv.isDarwin {
   makeFlags = "CFLAGS=-D_FORTIFY_SOURCE=0";
 }
 
-// optionalAttrs stdenv.isCygwin {
+// stdenv.lib.optionalAttrs stdenv.isCygwin {
   patchPhase =
    # Make sure `error.c' gets compiled and is part of `libgettextlib.la'.
    # This fixes:
diff --git a/pkgs/development/libraries/gettext/no-gets.patch b/pkgs/development/libraries/gettext/no-gets.patch
deleted file mode 100644
index 9daa48eae649..000000000000
--- a/pkgs/development/libraries/gettext/no-gets.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-hack until gzip pulls a newer gnulib version
-
-From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001
-From: Eric Blake <eblake@redhat.com>
-Date: Thu, 29 Mar 2012 13:30:41 -0600
-Subject: [PATCH] stdio: don't assume gets any more
-
-Gnulib intentionally does not have a gets module, and now that C11
-and glibc have dropped it, we should be more proactive about warning
-any user on a platform that still has a declaration of this dangerous
-interface.
-
---- a/gettext-tools/libgettextpo/stdio.in.h
-+++ b/gettext-tools/libgettextpo/stdio.in.h
-@@ -125,7 +125,6 @@
-    so any use of gets warrants an unconditional warning.  Assume it is
-    always declared, since it is required by C89.  */
- #undef gets
--_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
- 
- #if @GNULIB_FOPEN@
- # if @REPLACE_FOPEN@
---- a/gettext-tools/gnulib-lib/stdio.in.h
-+++ b/gettext-tools/gnulib-lib/stdio.in.h
-@@ -125,7 +125,6 @@
-    so any use of gets warrants an unconditional warning.  Assume it is
-    always declared, since it is required by C89.  */
- #undef gets
--_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
- 
- #if @GNULIB_FOPEN@
- # if @REPLACE_FOPEN@
---- a/gettext-runtime/gnulib-lib/stdio.in.h
-+++ b/gettext-runtime/gnulib-lib/stdio.in.h
-@@ -125,7 +125,6 @@
-    so any use of gets warrants an unconditional warning.  Assume it is
-    always declared, since it is required by C89.  */
- #undef gets
--_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
- 
- #if @GNULIB_FOPEN@
- # if @REPLACE_FOPEN@
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index e7bae0100a4f..812148c7adc6 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -54,7 +54,10 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ pcre zlib libffi ] ++ libiconvOrEmpty ++ libintlOrEmpty;
 
   preConfigure = "autoreconf -fi";
-  configureFlags = "--with-pcre=system --disable-fam";
+
+  configureFlags = stdenv.lib.optional stdenv.isSunOS "--disable-modular-tests";
+
+  CPPFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-DBSD_COMP";
 
   NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-lintl";
 
diff --git a/pkgs/development/libraries/glibc/2.18/common.nix b/pkgs/development/libraries/glibc/2.18/common.nix
index 9271e33cf07b..518615b1739a 100644
--- a/pkgs/development/libraries/glibc/2.18/common.nix
+++ b/pkgs/development/libraries/glibc/2.18/common.nix
@@ -56,14 +56,20 @@ stdenv.mkDerivation ({
 
       ./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
+
+
       ./cve-2012-4412+4424.patch
       ./cve-2013-4237.patch
       ./cve-2013-4332.patch
       ./cve-2013-4458.patch
       ./cve-2013-4788.patch
-    ]
-      # the problem only seems to affect i686, so avoid re-hash x86_64 ATM
-      ++ stdenv.lib.optional stdenv.isi686 ./strstr-sse42-hack.patch;
+
+      ./strstr-sse42-hack.patch
+    ];
 
   postPatch = ''
     # Needed for glibc to build with the gnumake 3.82
diff --git a/pkgs/development/libraries/glibc/2.18/fix_path_attribute_in_getconf.patch b/pkgs/development/libraries/glibc/2.18/fix_path_attribute_in_getconf.patch
new file mode 100644
index 000000000000..714e49db5607
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.18/fix_path_attribute_in_getconf.patch
@@ -0,0 +1,6 @@
+diff -ubr glibc-2.17-orig/sysdeps/unix/confstr.h glibc-2.17/sysdeps/unix/confstr.h
+--- glibc-2.17-orig/sysdeps/unix/confstr.h	2013-06-03 22:01:44.829726968 +0200
++++ glibc-2.17/sysdeps/unix/confstr.h	2013-06-03 22:04:39.469376740 +0200
+@@ -1 +1 @@
+-#define	CS_PATH	"/bin:/usr/bin"
++#define	CS_PATH	"/run/current-system/sw/bin:/bin:/usr/bin"
diff --git a/pkgs/development/libraries/gmp/4.3.2.nix b/pkgs/development/libraries/gmp/4.3.2.nix
index df7bd0ea3b96..f003979c701c 100644
--- a/pkgs/development/libraries/gmp/4.3.2.nix
+++ b/pkgs/development/libraries/gmp/4.3.2.nix
@@ -23,7 +23,9 @@ stdenv.mkDerivation rec {
 
   configureFlags = if cxx then "--enable-cxx" else "--disable-cxx";
 
-  doCheck = true;
+  # The test t-lucnum_ui fails (on Linux/x86_64) when built with GCC 4.8.
+  # Newer versions of GMP don't have that issue anymore.
+  doCheck = false;
 
   meta = {
     description = "GMP, the GNU multiple precision arithmetic library";
diff --git a/pkgs/development/libraries/gmp/5.1.1.nix b/pkgs/development/libraries/gmp/5.1.x.nix
index 1f43e07e58d5..a25eabbee86e 100644
--- a/pkgs/development/libraries/gmp/5.1.1.nix
+++ b/pkgs/development/libraries/gmp/5.1.x.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, m4, cxx ? true }:
 
 stdenv.mkDerivation rec {
-  name = "gmp-5.1.1";
+  name = "gmp-5.1.3";
 
-  src = fetchurl {
+  src = fetchurl { # we need to use bz2, others aren't in bootstrapping stdenv
     urls = [ "mirror://gnu/gmp/${name}.tar.bz2" "ftp://ftp.gmplib.org/pub/${name}/${name}.tar.bz2" ];
-    sha256 = "1bdgf04k2i12pfivxgjq68iarz3ngix9hpzbmkgijrdk92gpgm50";
+    sha256 = "0q5i39pxrasgn9qdxzpfbwhh11ph80p57x6hf48m74261d97j83m";
   };
 
   nativeBuildInputs = [ m4 ];
@@ -15,7 +15,8 @@ stdenv.mkDerivation rec {
     # (x86), except on Solaris where some tests crash with "Memory fault".
     # See <http://hydra.nixos.org/build/2760931>, for instance.
     (stdenv.lib.optional (!stdenv.isSunOS) "--enable-fat")
-    ++ (if cxx then [ "--enable-cxx" ] else [ "--disable-cxx" ]);
+    ++ (if cxx then [ "--enable-cxx" ] else [ "--disable-cxx" ])
+    ++ (if stdenv.is64bit then [ "--with-pic" ] else []);
 
   doCheck = true;
 
diff --git a/pkgs/development/libraries/gsl/default.nix b/pkgs/development/libraries/gsl/default.nix
index 49364f882429..eee977e97037 100644
--- a/pkgs/development/libraries/gsl/default.nix
+++ b/pkgs/development/libraries/gsl/default.nix
@@ -8,6 +8,10 @@ stdenv.mkDerivation rec {
     sha256 = "18qf6jzz1r3mzb5qynywv4xx3z9g61hgkbpkdrhbgqh2g7jhgfc5";
   };
 
+  # ToDo: there might be more impurities than FMA support check
+  patches = [ ./disable-fma.patch ]; # http://lists.gnu.org/archive/html/bug-gsl/2011-11/msg00019.html
+  patchFlags = "-p0";
+
   doCheck = true;
 
   meta = {
diff --git a/pkgs/development/libraries/gsl/disable-fma.patch b/pkgs/development/libraries/gsl/disable-fma.patch
new file mode 100644
index 000000000000..d5c0d620863e
--- /dev/null
+++ b/pkgs/development/libraries/gsl/disable-fma.patch
@@ -0,0 +1,32 @@
+--- configure.ac        2011-09-22 16:13:22 +0000
++++ configure.ac        2011-11-26 23:55:24 +0000
+@@ -381,6 +381,28 @@
+ AC_SUBST(HAVE_DARWIN_IEEE_INTERFACE)
+ AC_SUBST(HAVE_DARWIN86_IEEE_INTERFACE)
+ 
++dnl check for compiler flags to disable use of FMA
++save_cflags="$CFLAGS"
++AC_CACHE_CHECK([for compiler flags to disable use of FMA], ac_cv_c_fma_flags,
++[
++if test X"$GCC" = Xyes; then
++    fma_flags='-ffp-contract=off'
++else
++    fma_flags=
++fi
++if test X"$fma_flags" != X; then
++  CFLAGS="$fma_flags $CFLAGS"
++  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int foo;]])],[ac_cv_c_fma_flags="$fma_flags"],[ac_cv_c_fma_flags="none"])
++else
++  ac_cv_c_fma_flags="none"
++fi])
++
++if test "$ac_cv_c_fma_flags" != "none" ; then
++   CFLAGS="$ac_cv_c_fma_flags $save_cflags"
++else
++   CFLAGS="$save_cflags"
++fi
++
+ dnl Check for IEEE control flags
+ 
+ save_cflags="$CFLAGS"
+
diff --git a/pkgs/development/libraries/icu/default.nix b/pkgs/development/libraries/icu/default.nix
index 4437fc4bad2e..2ab163d4b33c 100644
--- a/pkgs/development/libraries/icu/default.nix
+++ b/pkgs/development/libraries/icu/default.nix
@@ -3,16 +3,14 @@
 let
 
   pname = "icu4c";
-  ver_maj = "52";
-  ver_min = "1";
-  version = "${ver_maj}.${ver_min}";
+  version = "52.1";
 in
-
 stdenv.mkDerivation {
   name = pname + "-" + version;
 
   src = fetchurl {
-    url = "http://download.icu-project.org/files/icu4c/${version}/icu4c-${ver_maj}_${ver_min}-src.tgz";
+    url = "http://download.icu-project.org/files/${pname}/${version}/${pname}-"
+      + (stdenv.lib.replaceChars ["."] ["_"] version) + "-src.tgz";
     sha256 = "14l0kl17nirc34frcybzg0snknaks23abhdxkmsqg3k9sil5wk9g";
   };
 
diff --git a/pkgs/development/libraries/isl/default.nix b/pkgs/development/libraries/isl/default.nix
index aaec37eae8f2..7711d4f170f9 100644
--- a/pkgs/development/libraries/isl/default.nix
+++ b/pkgs/development/libraries/isl/default.nix
@@ -1,17 +1,15 @@
 { stdenv, fetchurl, gmp }:
 
 stdenv.mkDerivation rec {
-  name = "isl-0.07"; # CLooG 0.16.3 fails to build with ISL 0.08.
+  name = "isl-0.11.1"; # CLooG 0.16.3 fails to build with ISL 0.08.
 
   src = fetchurl {
-    urls = [
-        "http://www.kotnet.org/~skimo/isl/${name}.tar.bz2"
-        "ftp://ftp.linux.student.kuleuven.be/pub/people/skimo/isl/${name}.tar.bz2"
-      ];
-    sha256 = "0kpxmvhrwwdygqqafqzjf9xiksq7paac2x24g9jhr3f9ajj3zkyx";
+    url = "http://pkgs.fedoraproject.org/repo/pkgs/gcc/isl-0.11.1.tar.bz2/bce1586384d8635a76d2f017fb067cd2/isl-0.11.1.tar.bz2";
+    sha256 = "13d9cqa5rzhbjq0xf0b2dyxag7pqa72xj9dhsa03m8ccr1a4npq9";
   };
 
   buildInputs = [ gmp ];
+  patches = [ ./fix-gcc-build.diff ];
 
   meta = {
     homepage = http://www.kotnet.org/~skimo/isl/;
diff --git a/pkgs/development/libraries/isl/fix-gcc-build.diff b/pkgs/development/libraries/isl/fix-gcc-build.diff
new file mode 100644
index 000000000000..6fbd1f9d478b
--- /dev/null
+++ b/pkgs/development/libraries/isl/fix-gcc-build.diff
@@ -0,0 +1,12 @@
+diff -ru isl-0.11.1/include/isl/int.h isl-0.11.1.new/include/isl/int.h
+--- isl-0.11.1/include/isl/int.h        2012-11-29 09:47:32.000000000 +0100
++++ isl-0.11.1.new/include/isl/int.h    2013-10-27 15:35:31.348553812 +0100
+@@ -14,7 +14,7 @@
+ #include <string.h>
+ #include <gmp.h>
+ #if defined(__cplusplus)
+-#include <iostream>
++#include <ostream>
+ #endif
+ 
+ #if defined(__cplusplus)
diff --git a/pkgs/development/libraries/kerberos/krb5.nix b/pkgs/development/libraries/kerberos/krb5.nix
index 5c408e9a76c5..647a6b031138 100644
--- a/pkgs/development/libraries/kerberos/krb5.nix
+++ b/pkgs/development/libraries/kerberos/krb5.nix
@@ -23,11 +23,13 @@ stdenv.mkDerivation (rec {
     cd ${name}/src
   '';
 
+  #doCheck = true; # report: No suitable file for testing purposes
+
   enableParallelBuilding = true;
 
   meta = {
-      description = "MIT Kerberos 5";
-      homepage = webpage;
-      license = "MPL";
+    description = "MIT Kerberos 5";
+    homepage = webpage;
+    license = "MPL";
   };
 })
diff --git a/pkgs/development/libraries/libarchive/default.nix b/pkgs/development/libraries/libarchive/default.nix
index 851601fe9639..e0f2ba77de2d 100644
--- a/pkgs/development/libraries/libarchive/default.nix
+++ b/pkgs/development/libraries/libarchive/default.nix
@@ -2,11 +2,11 @@
 , sharutils }:
 
 stdenv.mkDerivation rec {
-  name = "libarchive-3.0.4";
+  name = "libarchive-3.1.2";
 
   src = fetchurl {
-    url = "https://github.com/downloads/libarchive/libarchive/${name}.tar.gz";
-    sha256 = "76e8d7c7b100ec4071e48c1b7d3f3ea1d22b39db3e45b7189f75b5ff4df90fac";
+    url = "${meta.homepage}/downloads/${name}.tar.gz";
+    sha256 = "0pixqnrcf35dnqgv0lp7qlcw7k13620qkhgxr288v7p4iz6ym1zb";
   };
 
   buildInputs = [ sharutils libxml2 zlib bzip2 openssl xz ] ++
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
       compressions formats including (but not limited to) tar, shar, cpio, zip, and
       compressed with gzip, bzip2, lzma, xz, .. 
     '';
-    homepage = http://libarchive.github.com/;
+    homepage = http://libarchive.org;
     license = stdenv.lib.licenses.bsd3;
     platforms = with stdenv.lib.platforms; all;
     maintainers = with stdenv.lib.maintainers; [ jcumming ];
diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix
index 997e9cfc5b88..c53b5479b7b2 100644
--- a/pkgs/development/libraries/libgcrypt/default.nix
+++ b/pkgs/development/libraries/libgcrypt/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation (rec {
 
   propagatedBuildInputs = [ libgpgerror ];
 
-  doCheck = true;
+  doCheck = stdenv.system != "i686-linux"; # "basic" test fails after stdenv+glibc-2.18
 
   # For some reason the tests don't find `libgpg-error.so'.
   checkPhase = ''
diff --git a/pkgs/development/libraries/libmsn/default.nix b/pkgs/development/libraries/libmsn/default.nix
index 4ec5e62ea04d..77fe3403de77 100644
--- a/pkgs/development/libraries/libmsn/default.nix
+++ b/pkgs/development/libraries/libmsn/default.nix
@@ -6,5 +6,6 @@ stdenv.mkDerivation rec {
     url = "mirror://sourceforge/libmsn/${name}.tar.bz2";
     sha256 = "338369c7455b123e84b9a7a858ac0ed2b1dc32e6529f460fdc01d28869a20fde";
   };
+  patches = [ ./fix-ftbfs-gcc4.7.diff ];
   buildInputs = [ cmake openssl ];
 }
diff --git a/pkgs/development/libraries/libmsn/fix-ftbfs-gcc4.7.diff b/pkgs/development/libraries/libmsn/fix-ftbfs-gcc4.7.diff
new file mode 100644
index 000000000000..46aeab31c842
--- /dev/null
+++ b/pkgs/development/libraries/libmsn/fix-ftbfs-gcc4.7.diff
@@ -0,0 +1,16 @@
+Fix g++ 4.7 build failure
+
+Kudos to Matthias Klose for the patch
+
+Index: libmsn-4.2/msn/util.cpp
+===================================================================
+--- libmsn-4.2.orig/msn/util.cpp	2009-07-22 19:57:10.000000000 +0000
++++ libmsn-4.2/msn/util.cpp	2012-04-16 20:52:18.068767213 +0000
+@@ -25,6 +25,7 @@
+ #include <msn/util.h>
+ #include <sstream>
+ #include <errno.h>
++#include <unistd.h>
+ #include <cctype>
+ #include <fstream>
+ #include <openssl/rand.h>
diff --git a/pkgs/development/libraries/libofa/curl-types.patch b/pkgs/development/libraries/libofa/curl-types.patch
deleted file mode 100644
index acd8d9aeabb8..000000000000
--- a/pkgs/development/libraries/libofa/curl-types.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff -rc libofa-0.9.3/examples/protocol.cpp libofa-0.9.3-new/examples/protocol.cpp
-*** libofa-0.9.3/examples/protocol.cpp	2006-05-10 14:05:42.000000000 -0400
---- libofa-0.9.3-new/examples/protocol.cpp	2011-11-06 09:24:05.653283203 -0500
-***************
-*** 12,18 ****
-  #include <map>
-  #include <expat.h>
-  #include <curl/curl.h>
-- #include <curl/types.h>
-  #include <curl/easy.h>
-  
-  using namespace std;
---- 12,17 ----
diff --git a/pkgs/development/libraries/libofa/default.nix b/pkgs/development/libraries/libofa/default.nix
index 6b1ceee40f1c..2e2640e86362 100644
--- a/pkgs/development/libraries/libofa/default.nix
+++ b/pkgs/development/libraries/libofa/default.nix
@@ -1,17 +1,24 @@
 { stdenv, fetchurl, expat, curl, fftw }:
 
+let
+  version = "0.9.3";
+  deb_patch = "5";
+in
 stdenv.mkDerivation rec {
-  name = "libofa-0.9.3";
-
-  propagatedBuildInputs = [ expat curl fftw ];
-
-  patches = [ ./libofa-0.9.3-gcc-4.patch ./libofa-0.9.3-gcc-4.3.patch ./gcc-4.x.patch ./curl-types.patch ];
+  name = "libofa-${version}";
 
   src = fetchurl {
     url = "http://musicip-libofa.googlecode.com/files/${name}.tar.gz";
     sha256 = "184ham039l7lwhfgg0xr2vch2xnw1lwh7sid432mh879adhlc5h2";
   };
 
+  patches = fetchurl {
+    url = "mirror://debian/pool/main/libo/libofa/libofa_${version}-${deb_patch}.debian.tar.gz";
+    sha256 = "1rfkyz13cm8izm90c1xflp4rvsa24aqs6qpbbbqqcbmvzsj6j9yn";
+  };
+
+  propagatedBuildInputs = [ expat curl fftw ];
+
   meta = {
     homepage = http://code.google.com/musicip-libofa/;
     description = "LibOFA - Library Open Fingerprint Architecture";
diff --git a/pkgs/development/libraries/libofa/gcc-4.x.patch b/pkgs/development/libraries/libofa/gcc-4.x.patch
deleted file mode 100644
index 50f72bb428c6..000000000000
--- a/pkgs/development/libraries/libofa/gcc-4.x.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/examples/example.cpp b/examples/example.cpp
-index ef978d5..7d58a0f 100644
---- a/examples/example.cpp
-+++ b/examples/example.cpp
-@@ -10,6 +10,7 @@
- #include "protocol.h"
- 
- #include <string.h>
-+#include <stdio.h>
-  
- AudioData* loadWaveFile(char *file);
- AudioData* loadDataUsingLAME(char *file);
diff --git a/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.3.patch b/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.3.patch
deleted file mode 100644
index 7682e3710514..000000000000
--- a/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.3.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Fix build with gcc >=4.3
-diff -ur libofa-0.9.3.orig/examples/example.cpp libofa-0.9.3/examples/example.cpp
---- libofa-0.9.3.orig/examples/example.cpp	2006-05-10 21:05:37.000000000 +0300
-+++ libofa-0.9.3/examples/example.cpp	2008-04-16 15:51:49.000000000 +0300
-@@ -9,6 +9,8 @@
- 
- #include "protocol.h"
- 
-+#include <string.h>
-+ 
- AudioData* loadWaveFile(char *file);
- AudioData* loadDataUsingLAME(char *file);
- 
-Vain hakemistossa libofa-0.9.3/examples: example.cpp.orig
-diff -ur libofa-0.9.3.orig/examples/protocol.cpp libofa-0.9.3/examples/protocol.cpp
---- libofa-0.9.3.orig/examples/protocol.cpp	2006-05-10 21:05:42.000000000 +0300
-+++ libofa-0.9.3/examples/protocol.cpp	2008-04-16 15:51:49.000000000 +0300
-@@ -8,6 +8,7 @@
- -------------------------------------------------------------------*/
- #include <stdio.h>
- #include <stdlib.h>
-+#include <cstring>
- #include <string>
- #include <map>
- #include <expat.h>
-diff -ur libofa-0.9.3.orig/lib/signal_op.cpp libofa-0.9.3/lib/signal_op.cpp
---- libofa-0.9.3.orig/lib/signal_op.cpp	2006-05-10 21:01:12.000000000 +0300
-+++ libofa-0.9.3/lib/signal_op.cpp	2008-04-16 15:51:49.000000000 +0300
-@@ -12,6 +12,7 @@
- // DATE CREATED: 1/12/06
- 
- 
-+#include <cstdlib>
- #include <math.h>
- #include "signal_op.h"
- #include "AFLIB/aflibConverter.h"
diff --git a/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.patch b/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.patch
deleted file mode 100644
index 920c383c657b..000000000000
--- a/pkgs/development/libraries/libofa/libofa-0.9.3-gcc-4.patch
+++ /dev/null
@@ -1,39 +0,0 @@
---- a/lib/JAMA/tnt_math_utils.h	2006-06-17 01:46:22.000000000 +0300
-+++ b/lib/JAMA/tnt_math_utils.h	2006-06-17 01:47:02.000000000 +0300
-@@ -20,11 +20,20 @@
- namespace TNT

- {

- /**

-+	@returns the absolute value of a real (no-complex) scalar.

-+*/

-+template <class Real>

-+Real abs(const Real &a)

-+{

-+	return  (a > 0 ? a : -a);

-+}

-+/**

- 	@returns hypotenuse of real (non-complex) scalars a and b by 

- 	avoiding underflow/overflow

- 	using (a * sqrt( 1 + (b/a) * (b/a))), rather than

- 	sqrt(a*a + b*b).

- */

-+

- template <class Real>

- Real hypot(const Real &a, const Real &b)

- {

-@@ -56,15 +65,6 @@
- }

- */

- 

--/**

--	@returns the absolute value of a real (no-complex) scalar.

--*/

--template <class Real>

--Real abs(const Real &a)

--{

--	return  (a > 0 ? a : -a);

--}

--

- }

- #endif

- /* MATH_UTILS_H */

diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix
index 68c3ac5130df..7085236feb52 100644
--- a/pkgs/development/libraries/libproxy/default.nix
+++ b/pkgs/development/libraries/libproxy/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, cmake, zlib}:
+{ stdenv, fetchurl, pkgconfig, cmake, zlib, glib }:
 
 stdenv.mkDerivation rec {
   name = "libproxy-0.4.11";
@@ -6,5 +6,9 @@ stdenv.mkDerivation rec {
     url = "http://libproxy.googlecode.com/files/${name}.tar.gz";
     sha256 = "0jw6454gxjykmbnbh544axi8hzz9gmm4jz1y5gw1hdqnakg36gyw";
   };
-  buildInputs = [cmake zlib];
+
+  nativeBuildInputs = [ pkgconfig cmake ];
+  propagatedBuildInputs = [ zlib ]
+    # now some optional deps, but many more are possible
+    ++ [ glib ];
 }
diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix
index b86df4969c29..b235c746e1a0 100644
--- a/pkgs/development/libraries/libxml2/default.nix
+++ b/pkgs/development/libraries/libxml2/default.nix
@@ -41,7 +41,7 @@ stdenv.mkDerivation (rec {
   preInstall = ''substituteInPlace python/libxml2mod.la --replace "${python}" "$out"'';
   installFlags = ''pythondir="$(out)/lib/${python.libPrefix}/site-packages"'';
 
-} // stdenv.lib.optionalAttrs (!pythonSupport && stdenv.isFreeBSD) {
+} // stdenv.lib.optionalAttrs (!pythonSupport) {
   configureFlags = "--with-python=no"; # otherwise build impurity bites us
 })
 
diff --git a/pkgs/development/libraries/libxslt/default.nix b/pkgs/development/libraries/libxslt/default.nix
index d8794142b7dc..fd84c53c88fd 100644
--- a/pkgs/development/libraries/libxslt/default.nix
+++ b/pkgs/development/libraries/libxslt/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, libxml2 }:
 
-stdenv.mkDerivation (rec {
+stdenv.mkDerivation rec {
   name = "libxslt-1.1.28";
 
   src = fetchurl {
@@ -10,6 +10,17 @@ stdenv.mkDerivation (rec {
 
   buildInputs = [ libxml2 ];
 
+  patches = stdenv.lib.optionals stdenv.isSunOS [ ./patch-ah.patch ];
+
+  configureFlags = [
+    "--with-libxml-prefix=${libxml2}"
+    "--without-python"
+    "--without-crypto"
+    "--without-debug"
+    "--without-mem-debug"
+    "--without-debugger"
+  ];
+
   postInstall = ''
     mkdir -p $out/nix-support
     ln -s ${libxml2}/nix-support/setup-hook $out/nix-support/
@@ -22,15 +33,4 @@ stdenv.mkDerivation (rec {
     platforms = stdenv.lib.platforms.unix;
     maintainers = [ stdenv.lib.maintainers.eelco ];
   };
-} // (if !stdenv.isFreeBSD then {} else {
-  buildInputs = [];
-
-  configureFlags = [
-    "--with-libxml-prefix=${libxml2}"
-    "--without-python"
-    "--without-crypto"
-    "--without-debug"
-    "--without-mem-debug"
-    "--without-debugger"
-  ];
-}))
+}
diff --git a/pkgs/development/libraries/libxslt/patch-ah.patch b/pkgs/development/libraries/libxslt/patch-ah.patch
new file mode 100644
index 000000000000..ea75b01178e3
--- /dev/null
+++ b/pkgs/development/libraries/libxslt/patch-ah.patch
@@ -0,0 +1,69 @@
+$NetBSD: patch-ah,v 1.3 2012/11/27 12:17:51 adam Exp $
+
+Fix syms file for stricter solaris ld
+
+--- libxslt-1.1.28/libxslt/libxslt.syms.orig	2012-11-27 12:04:43.000000000 +0000
++++ libxslt-1.1.28/libxslt/libxslt.syms
+@@ -107,7 +107,7 @@ LIBXML2_1.0.11 {
+   xsltFreeCompMatchList;
+   xsltFreeTemplateHashes;
+   xsltGetTemplate;
+-  xsltMatchPattern;
++# xsltMatchPattern;
+   xsltTestCompMatchList;
+ 
+ # preproc
+@@ -407,7 +407,7 @@ LIBXML2_1.1.18 {
+     global:
+ 
+ # xsltInternals
+-  xsltConstNamespaceNameXSLT; # variable
++# xsltConstNamespaceNameXSLT; # variable
+   xsltExtensionInstructionResultFinalize;
+   xsltExtensionInstructionResultRegister;
+   xsltInitCtxtKey;
+@@ -416,24 +416,24 @@ LIBXML2_1.1.18 {
+   xsltInit;
+ 
+ # xsltInternals
+-  xsltParseAnyXSLTElem;
+-  xsltParseSequenceConstructor;
+-  xsltPointerListAddSize;
+-  xsltPointerListClear;
+-  xsltPointerListCreate;
+-  xsltPointerListFree;
++# xsltParseAnyXSLTElem;
++# xsltParseSequenceConstructor;
++# xsltPointerListAddSize;
++# xsltPointerListClear;
++# xsltPointerListCreate;
++# xsltPointerListFree;
+   xsltRegisterLocalRVT;
+   xsltReleaseRVT;
+-  xsltRestoreDocumentNamespaces;
++# xsltRestoreDocumentNamespaces;
+ 
+ # extensions
+-  xsltStyleStylesheetLevelGetExtData;
++# xsltStyleStylesheetLevelGetExtData;
+ 
+ # xsltInternals
+ # xsltTransStorageAdd; removed in 1.1.28
+ # xsltTransStorageRemove; removed in 1.1.28
+   xsltUninit;
+-  xsltXSLTAttrMarker; # variable
++# xsltXSLTAttrMarker; # variable
+ } LIBXML2_1.1.9;
+ 
+ LIBXML2_1.1.20 {
+@@ -476,6 +476,10 @@ LIBXML2_1.1.26 {
+ 
+ # transform
+   xsltProcessOneNode;
++
++# Solaris ld needs explicit auto-reduction (or, alternatively, "-B local")
++    local:
++  *;
+ } LIBXML2_1.1.25;
+ 
+ LIBXML2_1.1.27 {
diff --git a/pkgs/development/libraries/mpc/default.nix b/pkgs/development/libraries/mpc/default.nix
index 3824e3d3755b..e5d212dc2690 100644
--- a/pkgs/development/libraries/mpc/default.nix
+++ b/pkgs/development/libraries/mpc/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv, gmp, mpfr }:
 
 stdenv.mkDerivation rec {
-  name = "mpc-0.9";
+  name = "mpc-1.0.1";
 
   src = fetchurl {
     url = "http://www.multiprecision.org/mpc/download/${name}.tar.gz";
-    sha1 = "229722d553030734d49731844abfef7617b64f1a";
+    sha1 = "vxg0rkyn4cs40wr2cp6bbcyr1nnijzlc";
   };
 
   buildInputs = [ gmp mpfr ];
diff --git a/pkgs/development/libraries/mpfr/3.1.2.nix b/pkgs/development/libraries/mpfr/3.1.2.nix
deleted file mode 100644
index fd164cf91052..000000000000
--- a/pkgs/development/libraries/mpfr/3.1.2.nix
+++ /dev/null
@@ -1,51 +0,0 @@
-
-{stdenv, fetchurl, gmp}:
-
-stdenv.mkDerivation (rec {
-  name = "mpfr-3.1.2";
-
-  src = fetchurl {
-    url = "mirror://gnu/mpfr/${name}.tar.bz2";
-    sha256 = "0sqvpfkzamxdr87anzakf9dhkfh15lfmm5bsqajk02h1mxh3zivr";
-  };
-
-  buildInputs = [ gmp ];
-
-  doCheck = true;
-
-  enableParallelBuilding = true;
-
-  meta = {
-    homepage = http://www.mpfr.org/;
-    description = "GNU MPFR, a library for multiple-precision floating-point arithmetic";
-
-    longDescription = ''
-      The GNU MPFR library is a C library for multiple-precision
-      floating-point computations with correct rounding.  MPFR is
-      based on the GMP multiple-precision library.
-
-      The main goal of MPFR is to provide a library for
-      multiple-precision floating-point computation which is both
-      efficient and has a well-defined semantics.  It copies the good
-      ideas from the ANSI/IEEE-754 standard for double-precision
-      floating-point arithmetic (53-bit mantissa).
-    '';
-
-    license = "LGPLv2+";
-
-    maintainers = [ stdenv.lib.maintainers.ludo ];
-    platforms = stdenv.lib.platforms.all;
-  };
-}
-
-//
-
-(stdenv.lib.optionalAttrs stdenv.isFreeBSD {
-   /* Work around a FreeBSD bug that otherwise leads to segfaults in
-      the test suite:
-        http://hydra.bordeaux.inria.fr/build/34862
-        http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00015.html
-        http://www.freebsd.org/cgi/query-pr.cgi?pr=161344
-    */
-   configureFlags = [ "--disable-thread-safe" ];
- }))
diff --git a/pkgs/development/libraries/mpfr/default.nix b/pkgs/development/libraries/mpfr/default.nix
index faa2e1b1a71e..8e3281c862ae 100644
--- a/pkgs/development/libraries/mpfr/default.nix
+++ b/pkgs/development/libraries/mpfr/default.nix
@@ -1,15 +1,24 @@
-{stdenv, fetchurl, gmp}:
+{ stdenv, fetchurl, gmp }:
 
-stdenv.mkDerivation (rec {
-  name = "mpfr-3.1.0";
+stdenv.mkDerivation rec {
+  name = "mpfr-3.1.2";
 
   src = fetchurl {
     url = "mirror://gnu/mpfr/${name}.tar.bz2";
-    sha256 = "105nx8qqx5x8f4rlplr2wk4cyv61iw5j3jgi2k21rpb8s6xbp9vl";
+    sha256 = "0sqvpfkzamxdr87anzakf9dhkfh15lfmm5bsqajk02h1mxh3zivr";
   };
 
   buildInputs = [ gmp ];
 
+  configureFlags =
+    /* Work around a FreeBSD bug that otherwise leads to segfaults in the test suite:
+          http://hydra.bordeaux.inria.fr/build/34862
+          http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00015.html
+          http://www.freebsd.org/cgi/query-pr.cgi?pr=161344
+      */
+    stdenv.lib.optional (stdenv.isSunOS or stdenv.isFreeBSD) "--disable-thread-safe" ++
+    stdenv.lib.optional stdenv.is64bit "--with-pic";
+
   doCheck = true;
 
   enableParallelBuilding = true;
@@ -37,14 +46,3 @@ stdenv.mkDerivation (rec {
   };
 }
 
-//
-
-(stdenv.lib.optionalAttrs stdenv.isFreeBSD {
-   /* Work around a FreeBSD bug that otherwise leads to segfaults in
-      the test suite:
-        http://hydra.bordeaux.inria.fr/build/34862
-        http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00015.html
-        http://www.freebsd.org/cgi/query-pr.cgi?pr=161344
-    */
-   configureFlags = [ "--disable-thread-safe" ];
- }))
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index 569d7fe2a328..2e5db48b7df3 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -8,7 +8,7 @@ let
      <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";
+  cxx = !stdenv.isSunOS;
 in
 stdenv.mkDerivation (rec {
   name = "ncurses-5.9";
@@ -18,11 +18,25 @@ stdenv.mkDerivation (rec {
     sha256 = "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh";
   };
 
+  patches = [ ./patch-ac ];
+
   configureFlags = ''
-    --with-shared --includedir=''${out}/include --without-debug
+    --with-shared --without-debug --enable-pc-files
     ${if unicode then "--enable-widec" else ""}${if cxx then "" else "--without-cxx-binding"}
   '';
 
+  # PKG_CONFIG_LIBDIR is where the *.pc files will be installed. If this
+  # directory doesn't exist, the configure script will disable installation of
+  # *.pc files. The configure script usually (on LSB distros) pick $(path of
+  # pkg-config)/../lib/pkgconfig. On NixOS that path doesn't exist and is not
+  # the place we want to put *.pc files from other packages anyway. So we must
+  # tell it explicitly where to install with PKG_CONFIG_LIBDIR.
+  preConfigure = ''
+    export configureFlags="$configureFlags --includedir=$out/include"
+    export PKG_CONFIG_LIBDIR="$out/lib/pkgconfig"
+    mkdir -p "$PKG_CONFIG_LIBDIR"
+  '';
+
   selfNativeBuildInput = true;
 
   enableParallelBuilding = true;
@@ -44,8 +58,11 @@ stdenv.mkDerivation (rec {
         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
+        ln -svf ''${lib}w.pc $out/lib/pkgconfig/$lib.pc
       fi
     done;
+    ln -svf . $out/include/ncursesw
+    ln -svf ncursesw5-config $out/bin/ncurses5-config
   '' else "";
 
   meta = {
diff --git a/pkgs/development/libraries/ncurses/patch-ac b/pkgs/development/libraries/ncurses/patch-ac
new file mode 100644
index 000000000000..73578f8a3675
--- /dev/null
+++ b/pkgs/development/libraries/ncurses/patch-ac
@@ -0,0 +1,40 @@
+$NetBSD: patch-ac,v 1.18 2011/11/01 14:47:46 hans Exp $
+
+--- ncurses-5.9/configure.orig	2011-02-21 01:40:36.000000000 +0000
++++ ncurses-5.9/configure
+@@ -7096,6 +7096,13 @@ sco*) #(vi
+ 	# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
+ 	;;
+ solaris2.1[0-9]) #(vi
++	case "$GCC_VERSION" in 
++		4.[67].*)
++			cf_XOPEN_SOURCE=600
++			cf_add_cflags=-std=c99
++			CPPFLAGS="$CPPFLAGS -std=c99"
++			;;
++	esac
+ 	cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+ 	;;
+ solaris2.[1-9]) #(vi
+@@ -9640,12 +9647,7 @@ case ".$MANPAGE_RENAMES" in #(vi
+ .no) #(vi
+   ;;
+ .|.yes)
+-  # Debian 'man' program?
+-  if test -f /etc/debian_version ; then
+-    MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
+-  else
+     MANPAGE_RENAMES=no
+-  fi
+   ;;
+ esac
+ 
+@@ -18449,7 +18444,7 @@ echo "${ECHO_T}$LIB_SUBSETS" >&6
+ 
+ ### Construct the list of include-directories to be generated
+ 
+-CPPFLAGS="$CPPFLAGS -I. -I../include"
++CPPFLAGS="-I. -I../include $CPPFLAGS"
+ if test "$srcdir" != "."; then
+ 	CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
+ fi
diff --git a/pkgs/development/libraries/ois/default.nix b/pkgs/development/libraries/ois/default.nix
index abf6c7112a5c..67df3645eb90 100644
--- a/pkgs/development/libraries/ois/default.nix
+++ b/pkgs/development/libraries/ois/default.nix
@@ -1,4 +1,4 @@
-x@{builderDefsPackage
+x@{builderDefsPackage, fetchurl
   , autoconf, automake, libtool, m4
   , libX11, xproto, libXi, inputproto
   , libXaw, libXmu, libXt
@@ -30,10 +30,17 @@ rec {
   inherit (sourceInfo) name version;
   inherit buildInputs;
 
-  phaseNames = ["doConfigure" "doMakeInstall"];
+  phaseNames = ["doPatch" "doConfigure" "doMakeInstall"];
+
+  patches = [(fetchurl {
+    url = http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-games/ois/files/ois-1.3-gcc47.patch;
+    sha256 = "026jw06n42bcrmg0sbdhzc4cqxsnf7fw30a2z9cigd9x282zhii8";
+    name = "gcc47.patch";
+  })];
+  patchFlags = "-p0";
 
   configureCommand = ''sh bootstrap; sh configure'';
-      
+
   meta = {
     description = "Object-oriented C++ input system";
     maintainers = with a.lib.maintainers;
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 640b99df5473..7d7ccacd14ad 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -2,7 +2,7 @@
 , withCryptodev ? false, cryptodevHeaders }:
 
 let
-  name = "openssl-1.0.1e";
+  name = "openssl-1.0.1f";
 
   opensslCrossSystem = stdenv.lib.attrByPath [ "openssl" "system" ]
     (throw "openssl needs its platform name cross building" null)
@@ -41,7 +41,7 @@ stdenv.mkDerivation {
       "http://www.openssl.org/source/${name}.tar.gz"
       "http://openssl.linux-mirror.org/source/${name}.tar.gz"
     ];
-    sha256 = "1qqskk39jh85fvdn3ycmdqjdf67c0b97dwmmbcysl4gzr3l1akzp";
+    sha256 = "0nnbr70dg67raqsqvlypzxa1v5xsv9gp91f9pavyckfn2w5sihkc";
   };
 
   patches = patchesCross false;
@@ -53,7 +53,9 @@ stdenv.mkDerivation {
   # On x86_64-darwin, "./config" misdetects the system as
   # "darwin-i386-cc".  So specify the system type explicitly.
   configureScript =
-    if stdenv.system == "x86_64-darwin" then "./Configure darwin64-x86_64-cc" else "./config";
+    if stdenv.system == "x86_64-darwin" then "./Configure darwin64-x86_64-cc"
+    else if stdenv.system == "x86_64-solaris" then "./Configure solaris64-x86_64-gcc"
+    else "./config";
 
   configureFlags = "shared --libdir=lib --openssldir=etc/ssl" +
     stdenv.lib.optionalString withCryptodev " -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS";
diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix
index e59c249348a8..a8a89a4569c7 100644
--- a/pkgs/development/libraries/pcre/default.nix
+++ b/pkgs/development/libraries/pcre/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, unicodeSupport ? true, cplusplusSupport ? true }:
 
 stdenv.mkDerivation rec {
-  name = "pcre-8.31";
+  name = "pcre-8.33";
 
   src = fetchurl {
     url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${name}.tar.bz2";
-    sha256 = "5778a02535473c7ee7838ea598c19f451e63cf5eec0bf0307a688301c9078c3c";
+    sha256 = "0y04pkrxjvhi30qpnb9ijgn6cjgv3k3lhq2zmw21r0b695x9a0y6";
   };
 
   # The compiler on Darwin crashes with an internal error while building the
@@ -13,11 +13,14 @@ stdenv.mkDerivation rec {
   # problem. In case we ever update the Darwin GCC version, the exception for
   # that platform ought to be removed.
   configureFlags = ''
+    --enable-jit
     ${if unicodeSupport then "--enable-unicode-properties" else ""}
     ${if !cplusplusSupport then "--disable-cpp" else ""}
   '' + stdenv.lib.optionalString stdenv.isDarwin "CXXFLAGS=-O0";
 
-  doCheck = !stdenv.isCygwin;                   # XXX: test failure on Cygwin
+  doCheck = with stdenv; !(isCygwin || isFreeBSD);
+    # XXX: test failure on Cygwin
+    # we are running out of stack on both freeBSDs on Hydra
 
   meta = {
     homepage = "http://www.pcre.org/";
diff --git a/pkgs/development/libraries/ppl/default.nix b/pkgs/development/libraries/ppl/default.nix
index 2ba6b5cb9078..cbdb7b128b45 100644
--- a/pkgs/development/libraries/ppl/default.nix
+++ b/pkgs/development/libraries/ppl/default.nix
@@ -1,13 +1,13 @@
 { fetchurl, stdenv, gmpxx, perl, gnum4 }:
 
-let version = "0.11.2"; in
+let version = "1.0"; in
 
 stdenv.mkDerivation rec {
   name = "ppl-${version}";
 
   src = fetchurl {
     url = "http://bugseng.com/products/ppl/download/ftp/releases/${version}/ppl-${version}.tar.bz2";
-    sha256 = "1sxviip4yk6gp453pid5scy1ba66dzdpr02i1416yk7lkv0x3yz3";
+    sha256 = "0m0b6dzablci8mlavpsmn5w1v3r46li0wpjwvsybgxx0p1ifjsf1";
   };
 
   nativeBuildInputs = [ perl gnum4 ];
@@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
 
   configureFlags = "--disable-watchdog";
 
+  patches = [ ./upstream-based.patch ];
+
   # Beware!  It took ~6 hours to compile PPL and run its tests on a 1.2 GHz
   # x86_64 box.  Nevertheless, being a dependency of GCC, it probably ought
   # to be tested.
@@ -40,7 +42,7 @@ stdenv.mkDerivation rec {
       version of the simplex algorithm.
     '';
 
-    homepage = http://www.cs.unipr.it/ppl/;
+    homepage = http://bugseng.com/products/ppl/;
 
     license = "GPLv3+";
 
diff --git a/pkgs/development/libraries/ppl/upstream-based.patch b/pkgs/development/libraries/ppl/upstream-based.patch
new file mode 100644
index 000000000000..551050f67bf9
--- /dev/null
+++ b/pkgs/development/libraries/ppl/upstream-based.patch
@@ -0,0 +1,42 @@
+https://bugs.gentoo.org/show_bug.cgi?id=447928
+--- ppl-1.0/src/p_std_bits.cc.org	2012-12-30 00:37:03.033948083 +0100
++++ ppl-1.0/src/mp_std_bits.cc	2012-12-30 00:44:12.893019313 +0100
+@@ -25,6 +25,9 @@
+ #include "ppl-config.h"
+ #include "mp_std_bits.defs.hh"
+ 
++#if __GNU_MP_VERSION < 5 \
++  || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
++
+ const bool std::numeric_limits<mpz_class>::is_specialized;
+ const int std::numeric_limits<mpz_class>::digits;
+ const int std::numeric_limits<mpz_class>::digits10;
+@@ -70,3 +73,6 @@
+ const bool std::numeric_limits<mpq_class>::traps;
+ const bool std::numeric_limits<mpq_class>::tininess_before;
+ const std::float_round_style std::numeric_limits<mpq_class>::round_style;
++
++#endif // __GNU_MP_VERSION < 5
++       // || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
+--- ppl-1.0/src/mp_std_bits.defs.hh.org	2012-12-30 00:37:03.037948187 +0100
++++ ppl-1.0/src/mp_std_bits.defs.hh	2012-12-30 00:42:32.002424189 +0100
+@@ -38,6 +38,9 @@
+ #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
+ void swap(mpq_class& x, mpq_class& y);
+ 
++#if __GNU_MP_VERSION < 5 \
++  || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
++
+ namespace std {
+ 
+ #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
+@@ -164,6 +167,9 @@
+ 
+ } // namespace std
+ 
++#endif // __GNU_MP_VERSION < 5
++       // || (__GNU_MP_VERSION == 5 && __GNU_MP_VERSION_MINOR < 1)
++
+ #include "mp_std_bits.inlines.hh"
+ 
+ #endif // !defined(PPL_mp_std_bits_defs_hh)
diff --git a/pkgs/development/libraries/qca2/default.nix b/pkgs/development/libraries/qca2/default.nix
index 1da9ef193b5f..952bdfa29cee 100644
--- a/pkgs/development/libraries/qca2/default.nix
+++ b/pkgs/development/libraries/qca2/default.nix
@@ -21,6 +21,8 @@ stdenv.mkDerivation rec {
               EMSA3_SHA512      ///< SHA512, with EMSA3 (ie PKCS#1 Version 1.5) encoding'
     '';
 
+  patches = [ ./gcc47.patch ];
+
   configureFlags = "--no-separate-debug-info";
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/libraries/qca2/gcc47.patch b/pkgs/development/libraries/qca2/gcc47.patch
new file mode 100644
index 000000000000..08711884a570
--- /dev/null
+++ b/pkgs/development/libraries/qca2/gcc47.patch
@@ -0,0 +1,12 @@
+# Thanks to http://lists.pld-linux.org/mailman/pipermail/pld-cvs-commit/Week-of-Mon-20120917/347917.html
+--- qca-2.0.3/src/botantools/botan/botan/secmem.h.orig 2007-04-19 23:26:13.000000000 +0200
++++ qca-2.0.3/src/botantools/botan/botan/secmem.h  2012-09-16 23:28:43.767480490 +0200
+@@ -214,7 +214,7 @@
+ 
+       SecureVector(u32bit n = 0) { MemoryRegion<T>::init(true, n); }
+       SecureVector(const T in[], u32bit n)
+-         { MemoryRegion<T>::init(true); set(in, n); }
++         { MemoryRegion<T>::init(true); this->set(in, n); }
+       SecureVector(const MemoryRegion<T>& in)
+          { MemoryRegion<T>::init(true); set(in); }
+       SecureVector(const MemoryRegion<T>& in1, const MemoryRegion<T>& in2)
diff --git a/pkgs/development/libraries/strigi/default.nix b/pkgs/development/libraries/strigi/default.nix
index fc8dc123032a..6b8b611d3f7a 100644
--- a/pkgs/development/libraries/strigi/default.nix
+++ b/pkgs/development/libraries/strigi/default.nix
@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkgconfig perl ];
 
+  patches = [ ./export_bufferedstream.patch ];
+
   enableParallelBuilding = true;
 
   meta = {
diff --git a/pkgs/development/libraries/strigi/export_bufferedstream.patch b/pkgs/development/libraries/strigi/export_bufferedstream.patch
new file mode 100644
index 000000000000..4c6b34fe1bec
--- /dev/null
+++ b/pkgs/development/libraries/strigi/export_bufferedstream.patch
@@ -0,0 +1,12 @@
+diff -u -r strigi-0.7.8/libstreams/include/strigi/bufferedstream.h strigi-0.7.8_new/libstreams/include/strigi/bufferedstream.h
+--- strigi-0.7.8/libstreams/include/strigi/bufferedstream.h	2013-02-05 13:34:57.000000000 -0800
++++ strigi-0.7.8_new/libstreams/include/strigi/bufferedstream.h	2013-07-14 17:01:54.000000000 -0700
+@@ -34,7 +34,7 @@
+  * BufferedStream will do the rest.
+  */
+ template <class T>
+-class BufferedStream : public StreamBase<T> {
++class STRIGI_EXPORT BufferedStream : public StreamBase<T> {
+ private:
+     StreamBuffer<T> buffer;
+     bool finishedWritingToBuffer;
diff --git a/pkgs/development/libraries/sword/default.nix b/pkgs/development/libraries/sword/default.nix
index bd177ffc6600..f8c5a213ee3b 100644
--- a/pkgs/development/libraries/sword/default.nix
+++ b/pkgs/development/libraries/sword/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ pkgconfig icu clucene_core curl ];
 
   # because curl/types.h disappeared since at least curl 7.21.7
-  patches = [ ./dont_include_curl_types_h.patch ];
+  patches = [ ./dont_include_curl_types_h.patch ./gcc47.patch ];
 
   prePatch = ''
     patchShebangs .;
diff --git a/pkgs/development/libraries/sword/gcc47.patch b/pkgs/development/libraries/sword/gcc47.patch
new file mode 100644
index 000000000000..7b55de75b646
--- /dev/null
+++ b/pkgs/development/libraries/sword/gcc47.patch
@@ -0,0 +1,35 @@
+https://bugs.gentoo.org/419505
+
+
+--- a/include/multimapwdef.h
++++ b/include/multimapwdef.h
+@@ -12,21 +12,21 @@ class multimapwithdefault : public std::multimap<Key, T, Compare> {
+ public:
+ 	typedef std::pair<const Key, T> value_type;
+ 	T& getWithDefault(const Key& k, const T& defaultValue) {
+-		if (find(k) == this->end()) {
+-			insert(value_type(k, defaultValue));
++		if (this->find(k) == this->end()) {
++			this->insert(value_type(k, defaultValue));
+ 		}
+-		return (*(find(k))).second;
++		return (*(this->find(k))).second;
+ 	}
+ 
+ 	T& operator[](const Key& k) {
+-		if (find(k) == this->end()) {
+-			insert(value_type(k, T()));
++		if (this->find(k) == this->end()) {
++			this->insert(value_type(k, T()));
+ 		}
+-		return (*(find(k))).second;
++		return (*(this->find(k))).second;
+ 	}
+ 	bool has(const Key& k, const T &val) const {
+-		typename std::multimap<Key, T, Compare>::const_iterator start = lower_bound(k);
+-		typename std::multimap<Key, T, Compare>::const_iterator end = upper_bound(k);
++		typename std::multimap<Key, T, Compare>::const_iterator start = this->lower_bound(k);
++		typename std::multimap<Key, T, Compare>::const_iterator end = this->upper_bound(k);
+ 		for (; start!=end; start++) {
+ 			if (start->second == val)
+ 				return true;
diff --git a/pkgs/development/libraries/v8/default.nix b/pkgs/development/libraries/v8/default.nix
index 5ac2487c9edc..0564e6887957 100644
--- a/pkgs/development/libraries/v8/default.nix
+++ b/pkgs/development/libraries/v8/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
       ln -sv ${gyp}/bin/gyp build/gyp/gyp
     '';
 
-    nativeBuildInputs = stdenv.lib.optional (system == "i686-linux") which;
+    nativeBuildInputs = [ which ];
     buildInputs = [ readline python ];
 
     buildFlags = [
@@ -35,6 +35,9 @@ stdenv.mkDerivation {
       "${arch}.release"
     ];
 
+    # http://code.google.com/p/v8/issues/detail?id=2149
+    NIX_CFLAGS_COMPILE = "-Wno-unused-local-typedefs -Wno-aggressive-loop-optimizations";
+
     enableParallelBuilding = true;
 
     installPhase = ''
diff --git a/pkgs/development/libraries/vigra/default.nix b/pkgs/development/libraries/vigra/default.nix
index 83b921dd49b9..5130abc9a963 100644
--- a/pkgs/development/libraries/vigra/default.nix
+++ b/pkgs/development/libraries/vigra/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, cmake, libtiff, libpng, libjpeg, doxygen, python,
   fftw, fftwSinglePrec, hdf5, boost, numpy }:
 stdenv.mkDerivation rec {
-  name = "vigra-1.8.0";
+  name = "vigra-1.9.0";
 
   src = fetchurl {
     url = "${meta.homepage}/${name}-src.tar.gz";
-    sha256 = "0542qy1bqaq73l7i8aqdhwdbhd6m1wldsn1w2sfyf8yf4398ffpw";
+    sha256 = "00fg64da6dj9k42d90dz6y7x91xw1xqppcla14im74m4afswrgcg";
   };
 
   buildInputs = [ cmake fftw fftwSinglePrec libtiff libpng libjpeg python boost
diff --git a/pkgs/development/libraries/xbase/default.nix b/pkgs/development/libraries/xbase/default.nix
index 847ca6510e5a..81447276db79 100644
--- a/pkgs/development/libraries/xbase/default.nix
+++ b/pkgs/development/libraries/xbase/default.nix
@@ -9,7 +9,13 @@ stdenv.mkDerivation {
   };
 
   prePatch = "find . -type f -not -name configure -print0 | xargs -0 chmod -x";
-  patches = [ ./xbase-fixes.patch ];
+  patches = [
+    ./xbase-fixes.patch
+    (fetchurl {
+      url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-db/xbase/files/xbase-3.1.2-gcc47.patch?revision=1.1";
+      sha256 = "1kpcrkkcqdwl609yd0qxlvp743icz3vni13993sz6fkgn5lah8yl";
+    })
+  ];
 
   meta = {
     homepage = http://linux.techass.com/projects/xdb/;
diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index ec47c35c1530..0d4abaf25e0a 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -1,16 +1,16 @@
 { stdenv, fetchurl, static ? false }:
 
-let version = "1.2.7"; in
+let version = "1.2.8"; in
 
 stdenv.mkDerivation rec {
   name = "zlib-${version}";
-  
+
   src = fetchurl {
     urls =
       [ "http://www.zlib.net/${name}.tar.gz"  # old versions vanish from here
         "mirror://sourceforge/libpng/zlib/${version}/${name}.tar.gz"
       ];
-    sha256 = "1i96gsdvxqb6skp9a58bacf1wxamwi9m9pg4yn7cpf7g7239r77s";
+    sha256 = "039agw5rqvqny92cpkrfn243x2gd4xn13hs3xi6isk55d2vqqr9n";
   };
 
   configureFlags = if static then "" else "--shared";
diff --git a/pkgs/development/lisp-modules/stumpwm/default.nix b/pkgs/development/lisp-modules/stumpwm/default.nix
index 57939526f565..ae0dab1ec9d4 100644
--- a/pkgs/development/lisp-modules/stumpwm/default.nix
+++ b/pkgs/development/lisp-modules/stumpwm/default.nix
@@ -1,4 +1,4 @@
-{pkgs, nixLib, clwrapper, cl-ppcre, clx, buildLispPackage}: 
+{pkgs, nixLib, clwrapper, cl-ppcre, clx, buildLispPackage}:
 buildLispPackage rec {
   baseName = "stumpwm";
   version = "2013-09";
@@ -9,7 +9,7 @@ buildLispPackage rec {
   };
   description = "Tiling window manager for X11";
   deps = [cl-ppcre clx];
-  buildInputs = with pkgs; [texinfo autoconf which makeWrapper];
+  buildInputs = with pkgs; [texinfo4 autoconf which makeWrapper];
   meta = {
     maintainers = [nixLib.maintainers.raskin];
     platforms = nixLib.platforms.linux;
@@ -18,11 +18,11 @@ buildLispPackage rec {
     preConfigure = ''
       ${x.deployConfigScript}
       export CL_SOURCE_REGISTRY="$CL_SOURCE_REGISTRY:$PWD/"
-      ./autogen.sh 
+      ./autogen.sh
       configureFlags=" --with-lisp=$NIX_LISP --with-$NIX_LISP=$(which common-lisp.sh) --with-contrib-dir=$out/lib/common-lisp/stumpwm/contrib/"
     '';
     installPhase = with pkgs; x.installPhase + ''
-      make install 
+      make install
 
       if [ "$NIX_LISP" = "sbcl" ]; then
         wrapProgram "$out"/bin/stumpwm --set SBCL_HOME "${clwrapper.lisp}/lib/sbcl"
diff --git a/pkgs/development/tools/build-managers/cmake/762-13887.patch b/pkgs/development/tools/build-managers/cmake/762-13887.patch
new file mode 100644
index 000000000000..3ef27a09b5c2
--- /dev/null
+++ b/pkgs/development/tools/build-managers/cmake/762-13887.patch
@@ -0,0 +1,17 @@
+diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
+index e7491bb..57b4348 100644
+--- a/Source/CTest/cmCTestTestHandler.cxx
++++ b/Source/CTest/cmCTestTestHandler.cxx
+@@ -1303,10 +1303,9 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)
+   for ( it = vec.begin(); it != vec.end(); ++it )
+     {
+     int retVal = 0;
+-    std::string cmd = cmSystemTools::ConvertToOutputPath(it->c_str());
+-    cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << cmd
++    cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it
+       << std::endl);
+-    if ( !cmSystemTools::RunSingleCommand(cmd.c_str(), 0, &retVal, 0,
++    if ( !cmSystemTools::RunSingleCommand((*it).c_str(), 0, &retVal, 0,
+                                           cmSystemTools::OUTPUT_MERGE
+         /*this->Verbose*/) || retVal != 0 )
+       {
diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix
index d66149a95096..35ae214266dc 100644
--- a/pkgs/development/tools/build-managers/cmake/default.nix
+++ b/pkgs/development/tools/build-managers/cmake/default.nix
@@ -7,7 +7,7 @@ with stdenv.lib;
 let
   os = stdenv.lib.optionalString;
   majorVersion = "2.8";
-  minorVersion = "9";
+  minorVersion = "11.2";
   version = "${majorVersion}.${minorVersion}";
 in
 
@@ -18,13 +18,19 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}files/v${majorVersion}/cmake-${version}.tar.gz";
-    sha256 = "1yg68ng732cfm5c0h91chqwhg06zdh45bybm353kd1myk5rwqgfw";
+    sha256 = "0qh5dhd7ff08n2h569j7g9m92gb3bz14wvhwjhwl7lgx794cnamk";
   };
 
+  enableParallelBuilding = true;
+
   patches =
+    # See https://github.com/NixOS/nixpkgs/issues/762
+    # and http://public.kitware.com/Bug/view.php?id=13887
+    # Remove this patch when a CMake release contains the corresponding fix
+    [ ./762-13887.patch ]
     # Don't search in non-Nix locations such as /usr, but do search in
-    # Nixpkgs' Glibc.
-    optional (stdenv ? glibc) ./search-path.patch;
+    # Nixpkgs' Glibc. 
+    ++ optional (stdenv ? glibc) ./search-path.patch;
 
   buildInputs = [ curl expat zlib bzip2 libarchive ]
     ++ optional useNcurses ncurses
diff --git a/pkgs/development/tools/build-managers/cmake/search-path.patch b/pkgs/development/tools/build-managers/cmake/search-path.patch
index ef8a9eef7c18..31c85d6f5220 100644
--- a/pkgs/development/tools/build-managers/cmake/search-path.patch
+++ b/pkgs/development/tools/build-managers/cmake/search-path.patch
@@ -1,41 +1,43 @@
-diff -ru -x '*~' cmake-2.8.5-orig/Modules/Platform/Linux.cmake cmake-2.8.5/Modules/Platform/Linux.cmake
---- cmake-2.8.5-orig/Modules/Platform/Linux.cmake	2011-07-08 14:21:44.000000000 +0200
-+++ cmake-2.8.5/Modules/Platform/Linux.cmake	2011-07-21 19:45:00.000000000 +0200
-@@ -36,13 +36,13 @@
+diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
+index fe8e003..378512c 100644
+--- a/Modules/Platform/Linux.cmake
++++ b/Modules/Platform/Linux.cmake
+@@ -36,13 +36,13 @@ else()
    # checking the platform every time.  This option is advanced enough
    # that only package maintainers should need to adjust it.  They are
    # capable of providing a setting on the command line.
--  IF(EXISTS "/etc/debian_version")
--    SET(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
+-  if(EXISTS "/etc/debian_version")
+-    set(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
 -      "Install .so files without execute permission.")
--  ELSE(EXISTS "/etc/debian_version")
-+  #IF(EXISTS "/etc/debian_version")
-+  #  SET(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
-+  #    "Install .so files without execute permission.")
-+  #ELSE(EXISTS "/etc/debian_version")
-     SET(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL
+-  else()
++  # if(EXISTS "/etc/debian_version")
++  #   set(CMAKE_INSTALL_SO_NO_EXE 1 CACHE INTERNAL
++  #     "Install .so files without execute permission.")
++  # else()
+     set(CMAKE_INSTALL_SO_NO_EXE 0 CACHE INTERNAL
        "Install .so files without execute permission.")
--  ENDIF(EXISTS "/etc/debian_version")
-+  #ENDIF(EXISTS "/etc/debian_version")
- ENDIF(DEFINED CMAKE_INSTALL_SO_NO_EXE)
+-  endif()
++  # endif()
+ endif()
  
  # Match multiarch library directory names.
-@@ -52,6 +52,6 @@
+@@ -52,6 +52,6 @@ include(Platform/UnixPaths)
  
  # Debian has lib64 paths only for compatibility so they should not be
  # searched.
--IF(EXISTS "/etc/debian_version")
--  SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
--ENDIF(EXISTS "/etc/debian_version")
-+#IF(EXISTS "/etc/debian_version")
-+#  SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
-+#ENDIF(EXISTS "/etc/debian_version")
-diff -ru -x '*~' cmake-2.8.5-orig/Modules/Platform/UnixPaths.cmake cmake-2.8.5/Modules/Platform/UnixPaths.cmake
---- cmake-2.8.5-orig/Modules/Platform/UnixPaths.cmake	2011-07-08 14:21:44.000000000 +0200
-+++ cmake-2.8.5/Modules/Platform/UnixPaths.cmake	2011-07-21 19:50:52.000000000 +0200
-@@ -33,55 +33,18 @@
+-if(EXISTS "/etc/debian_version")
+-  set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
+-endif()
++# if(EXISTS "/etc/debian_version")
++#  set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
++#endif()
+diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake
+index ccb2663..39834e6 100644
+--- a/Modules/Platform/UnixPaths.cmake
++++ b/Modules/Platform/UnixPaths.cmake
+@@ -33,55 +33,18 @@ get_filename_component(_CMAKE_INSTALL_DIR "${_CMAKE_INSTALL_DIR}" PATH)
  # search types.
- LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH
    # Standard
 -  /usr/local /usr /
 -
@@ -47,7 +49,7 @@ diff -ru -x '*~' cmake-2.8.5-orig/Modules/Platform/UnixPaths.cmake cmake-2.8.5/M
 -  )
 -
 -# List common include file locations not under the common prefixes.
--LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH
+-list(APPEND CMAKE_SYSTEM_INCLUDE_PATH
 -  # Windows API on Cygwin
 -  /usr/include/w32api
 -
@@ -56,11 +58,11 @@ diff -ru -x '*~' cmake-2.8.5-orig/Modules/Platform/UnixPaths.cmake cmake-2.8.5/M
 -
 -  # Other
 -  /usr/pkg/include
--  /opt/csw/include /opt/include  
+-  /opt/csw/include /opt/include
 -  /usr/openwin/include
 -  )
 -
--LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH
+-list(APPEND CMAKE_SYSTEM_LIBRARY_PATH
 -  # Windows API on Cygwin
 -  /usr/lib/w32api
 -
@@ -69,25 +71,25 @@ diff -ru -x '*~' cmake-2.8.5-orig/Modules/Platform/UnixPaths.cmake cmake-2.8.5/M
 -
 -  # Other
 -  /usr/pkg/lib
--  /opt/csw/lib /opt/lib 
+-  /opt/csw/lib /opt/lib
 -  /usr/openwin/lib
 -  )
 -
--LIST(APPEND CMAKE_SYSTEM_PROGRAM_PATH
+-list(APPEND CMAKE_SYSTEM_PROGRAM_PATH
 -  /usr/pkg/bin
 +  "@glibc@"
    )
  
- LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
+ list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
 -  /lib /usr/lib /usr/lib32 /usr/lib64
 +  "@glibc@/lib"
    )
  
- LIST(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
+ list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES
 -  /usr/include
 +  "@glibc@/include"
    )
- LIST(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
+ list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
 -  /usr/include
 +  "@glibc@/include"
    )
diff --git a/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/pkgs/development/tools/build-managers/cmake/setup-hook.sh
index 175e538e5193..abc0b070a764 100755
--- a/pkgs/development/tools/build-managers/cmake/setup-hook.sh
+++ b/pkgs/development/tools/build-managers/cmake/setup-hook.sh
@@ -56,3 +56,20 @@ if [ -n "$crossConfig" ]; then
 else
     envHooks+=(addCMakeParams)
 fi
+
+makeCmakeFindLibs(){
+  for flag in $NIX_CFLAGS_COMPILE $NIX_LDFLAGS; do
+    case $flag in
+      -I*)
+        export CMAKE_INCLUDE_PATH="$CMAKE_INCLUDE_PATH${CMAKE_INCLUDE_PATH:+:}${flag:2}"
+        ;;
+      -L*)
+        export CMAKE_LIBRARY_PATH="$CMAKE_LIBRARY_PATH${CMAKE_LIBRARY_PATH:+:}${flag:2}"
+        ;;
+    esac
+  done
+}
+
+# not using setupHook, because it could be a setupHook adding additional
+# include flags to NIX_CFLAGS_COMPILE
+postHooks+=(makeCmakeFindLibs)
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index 6b93240ba057..6db4abbf446b 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -1,10 +1,13 @@
 { stdenv, fetchurl, noSysDirs, zlib
-, cross ? null, gold ? false, bison ? null, flex2535 ? null, bc ? null, dejagnu ? null
-, deterministic ? false }:
+, cross ? null, gold ? true, bison ? null
+}:
 
 let basename = "binutils-2.23.1"; in
+
+with { inherit (stdenv.lib) optional optionals optionalString; };
+
 stdenv.mkDerivation rec {
-  name = basename + stdenv.lib.optionalString (cross != null) "-${cross.config}";
+  name = basename + optionalString (cross != null) "-${cross.config}";
 
   src = fetchurl {
     url = "mirror://gnu/binutils/${basename}.tar.bz2";
@@ -21,23 +24,26 @@ stdenv.mkDerivation rec {
     # That requires upstream changes for things to work. So we can patch it to
     # get the old behaviour by now.
     ./dtneeded.patch
-  ] ++ (stdenv.lib.optional deterministic ./deterministic.patch);
+
+    # Make binutils output deterministic by default.
+    ./deterministic.patch
+  ];
 
   buildInputs =
     [ zlib ]
-    ++ stdenv.lib.optional gold bison;
+    ++ optional gold bison;
 
   inherit noSysDirs;
 
   preConfigure = ''
     # Clear the default library search path.
     if test "$noSysDirs" = "1"; then
-	echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
+        echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
     fi
 
     # Use symlinks instead of hard links to save space ("strip" in the
     # fixup phase strips each hard link separately).
-    for i in binutils/Makefile.in gas/Makefile.in ld/Makefile.in; do
+    for i in binutils/Makefile.in gas/Makefile.in ld/Makefile.in gold/Makefile.in; do
         sed -i "$i" -e 's|ln |ln -s |'
     done
   '';
@@ -46,15 +52,15 @@ stdenv.mkDerivation rec {
   # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
   NIX_CFLAGS_COMPILE = "-static-libgcc";
 
-  configureFlags = "--disable-werror" # needed for dietlibc build
-      + stdenv.lib.optionalString (stdenv.system == "mips64el-linux")
-        " --enable-fix-loongson2f-nop"
-      + stdenv.lib.optionalString (cross != null) " --target=${cross.config}"
-      + stdenv.lib.optionalString gold " --enable-gold --enable-plugins"
-      + stdenv.lib.optionalString deterministic " --enable-deterministic-archives";
+  configureFlags =
+    [ "--enable-shared" "--enable-deterministic-archives" ]
+    ++ optional (stdenv.system == "mips64el-linux") "--enable-fix-loongson2f-nop"
+    ++ optional (cross != null) "--target=${cross.config}"
+    ++ optionals gold [ "--enable-gold" "--enable-plugins" ]
+    ++ optional (stdenv.system == "i686-linux") "--enable-targets=x86_64-linux-gnu";
 
   enableParallelBuilding = true;
-      
+
   meta = {
     description = "GNU Binutils, tools for manipulating binaries (linker, assembler, etc.)";
 
diff --git a/pkgs/development/tools/misc/elfutils/default.nix b/pkgs/development/tools/misc/elfutils/default.nix
index 526a66e02804..e2f6c6932987 100644
--- a/pkgs/development/tools/misc/elfutils/default.nix
+++ b/pkgs/development/tools/misc/elfutils/default.nix
@@ -3,20 +3,20 @@
 # TODO: Look at the hardcoded paths to kernel, modules etc.
 stdenv.mkDerivation rec {
   name = "elfutils-${version}";
-  version = "0.152";
-  
+  version = "0.155";
+
   src = fetchurl {
     urls = [
-      "https://fedorahosted.org/releases/e/l/elfutils/${version}/${name}.tar.bz2"
+      "http://fedorahosted.org/releases/e/l/elfutils/${version}/${name}.tar.bz2"
       "mirror://gentoo/distfiles/${name}.tar.bz2"
       ];
-    sha256 = "19mlgxyzcwiv64ynj2cibgkiw4qkm3n37kizvy6555dsmlaqfybq";
+    sha256 = "1n0fsg2q961i0lj355w2ad3cmp7d1jjcdhrfhmlgsvs14r2lli38";
   };
 
   patches = [
     (fetchurl {
-      url = https://fedorahosted.org/releases/e/l/elfutils/0.152/elfutils-portability.patch;
-      sha256 = "0q318w4cvvqv9ps4xcwphapj1gl31isgjyya4y9sm72qj68n61p0";
+      url = "http://fedorahosted.org/releases/e/l/elfutils/${version}/elfutils-portability.patch";
+      sha256 = "0w8i94x9hqirgs2lwcd1g36s77r5svh4j1fgcrd6lx5w18vch0di";
     }) ];
 
   # We need bzip2 in NativeInputs because otherwise we can't unpack the src,
diff --git a/pkgs/development/tools/misc/gnum4/default.nix b/pkgs/development/tools/misc/gnum4/default.nix
index d1b0d0e376ed..75e8e2dfe4fd 100644
--- a/pkgs/development/tools/misc/gnum4/default.nix
+++ b/pkgs/development/tools/misc/gnum4/default.nix
@@ -1,11 +1,11 @@
 {stdenv, fetchurl}:
 
-stdenv.mkDerivation {
-  name = "gnum4-1.4.16";
+stdenv.mkDerivation rec {
+  name = "gnum4-1.4.17";
 
   src = fetchurl {
-    url = mirror://gnu/m4/m4-1.4.16.tar.bz2;
-    sha256 = "035r7ma272j2cwni2961jp22k6bn3n9xwn3b3qbcn2yrvlghql22";
+    url = "mirror://gnu/m4/m4-1.4.17.tar.bz2";
+    sha256 = "0w0da1chh12mczxa5lnwzjk9czi3dq6gnnndbpa6w4rj76b1yklf";
   };
 
   doCheck = !stdenv.isDarwin
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
     && !stdenv.isSunOS;                    # XXX: `test-setlocale2.sh' fails
 
   # Upstream is aware of it; it may be in the next release.
-  patches = [ ./s_isdir.patch ./readlink-EINVAL.patch ./no-gets.patch ];
+  patches = [ ./s_isdir.patch ];
 
   meta = {
     homepage = http://www.gnu.org/software/m4/;
diff --git a/pkgs/development/tools/misc/gnum4/no-gets.patch b/pkgs/development/tools/misc/gnum4/no-gets.patch
deleted file mode 100644
index 456c08b56c34..000000000000
--- a/pkgs/development/tools/misc/gnum4/no-gets.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/m4/files/m4-1.4.16-no-gets.patch?revision=1.1
-
-https://bugs.gentoo.org/424978
-
-hack until m4 pulls a newer gnulib version
-
-From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001
-From: Eric Blake <eblake@redhat.com>
-Date: Thu, 29 Mar 2012 13:30:41 -0600
-Subject: [PATCH] stdio: don't assume gets any more
-
-Gnulib intentionally does not have a gets module, and now that C11
-and glibc have dropped it, we should be more proactive about warning
-any user on a platform that still has a declaration of this dangerous
-interface.
-
---- a/lib/stdio.in.h
-+++ b/lib/stdio.in.h
-@@ -125,7 +125,6 @@
-    so any use of gets warrants an unconditional warning.  Assume it is
-    always declared, since it is required by C89.  */
- #undef gets
--_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
- 
- #if @GNULIB_FOPEN@
- # if @REPLACE_FOPEN@
diff --git a/pkgs/development/tools/misc/gnum4/readlink-EINVAL.patch b/pkgs/development/tools/misc/gnum4/readlink-EINVAL.patch
deleted file mode 100644
index dd371584a798..000000000000
--- a/pkgs/development/tools/misc/gnum4/readlink-EINVAL.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Newer Linux kernels would return EINVAL instead of ENOENT.
-The patch below, taken from Gnulib, allows the test to pass when
-these Linux versions are in use:
-https://lists.gnu.org/archive/html/bug-gnulib/2011-03/msg00308.html .
-
-diff --git a/tests/test-readlink.h b/tests/test-readlink.h
-index 08d5662..7247fc4 100644
---- a/tests/test-readlink.h
-+++ b/tests/test-readlink.h
-@@ -38,7 +38,7 @@ test_readlink (ssize_t (*func) (char const *, char *, size_t), bool print)
-   ASSERT (errno == ENOENT);
-   errno = 0;
-   ASSERT (func ("", buf, sizeof buf) == -1);
--  ASSERT (errno == ENOENT);
-+  ASSERT (errno == ENOENT || errno == EINVAL);
-   errno = 0;
-   ASSERT (func (".", buf, sizeof buf) == -1);
-   ASSERT (errno == EINVAL);
diff --git a/pkgs/development/tools/misc/patchelf/default.nix b/pkgs/development/tools/misc/patchelf/default.nix
index 857aa1cabcf9..8626534c7db1 100644
--- a/pkgs/development/tools/misc/patchelf/default.nix
+++ b/pkgs/development/tools/misc/patchelf/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "patchelf-0.6";
+  name = "patchelf-0.7";
 
   src = fetchurl {
     url = "http://nixos.org/releases/patchelf/${name}/${name}.tar.bz2";
-    sha256 = "fc7e7fa95f282fc37a591a802629e0e1ed07bc2a8bf162228d9a69dd76127c01";
+    sha256 = "61b96f455e6ccd1c1d7d159df7199c85ff6e8f9622d795a5420e418acfb8b808";
   };
 
   meta = {
diff --git a/pkgs/development/tools/misc/patchelf/unstable.nix b/pkgs/development/tools/misc/patchelf/unstable.nix
deleted file mode 100644
index aa8418496eaa..000000000000
--- a/pkgs/development/tools/misc/patchelf/unstable.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{ stdenv, fetchurl }:
-
-stdenv.mkDerivation rec {
-  name = "patchelf-0.7pre160_1c057cd";
-
-  src = fetchurl {
-    url = http://hydra.nixos.org/build/2961500/download/2/patchelf-0.7pre160_1c057cd.tar.bz2;
-    sha256 = "bbc46169f6b6803410e0072cf57e631481e3d5f1dde234f4eacbccb6562c5f4f";
-  };
-
-  meta = {
-    homepage = http://nixos.org/patchelf.html;
-    license = "GPL";
-    description = "A small utility to modify the dynamic linker and RPATH of ELF executables";
-  };
-}
diff --git a/pkgs/development/tools/misc/texinfo/4.9.nix b/pkgs/development/tools/misc/texinfo/4.9.nix
deleted file mode 100644
index fd42093e561d..000000000000
--- a/pkgs/development/tools/misc/texinfo/4.9.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{stdenv, fetchurl, ncurses}:
-
-stdenv.mkDerivation {
-  name = "texinfo-4.9";
-  src = fetchurl {
-    url = mirror://gnu/texinfo/texinfo-4.9.tar.bz2;
-    sha256 = "0h7q9h405m88fjj067brzniiv8306ryl087pgjpmbpd2jci9h6g7";
-  };
-  buildInputs = [ncurses];
-}
diff --git a/pkgs/development/tools/misc/texinfo/5.1.nix b/pkgs/development/tools/misc/texinfo/5.2.nix
index 2f318f18d542..1bb8fca0ecff 100644
--- a/pkgs/development/tools/misc/texinfo/5.1.nix
+++ b/pkgs/development/tools/misc/texinfo/5.2.nix
@@ -1,14 +1,14 @@
-{ stdenv, fetchurl, ncurses, perl }:
+{ stdenv, fetchurl, ncurses, perl, xz }:
 
 stdenv.mkDerivation rec {
-  name = "texinfo-5.1";
+  name = "texinfo-5.2";
 
   src = fetchurl {
     url = "mirror://gnu/texinfo/${name}.tar.xz";
-    sha256 = "0864v5i488x3mb3v5p6nhy2kw0mqkzpa3b0453iibj81zlpq078q";
+    sha256 = "1njfwh2z34r2c4r0iqa7v24wmjzvsfyz4vplzry8ln3479lfywal";
   };
 
-  buildInputs = [ ncurses perl ];
+  buildInputs = [ ncurses perl xz ];
 
   preInstall = ''
     installFlags="TEXMF=$out/texmf-dist";
diff --git a/pkgs/development/tools/parsing/alex/2.3.1.nix b/pkgs/development/tools/parsing/alex/2.3.1.nix
index 7dc17cd4153a..b38979256c66 100644
--- a/pkgs/development/tools/parsing/alex/2.3.1.nix
+++ b/pkgs/development/tools/parsing/alex/2.3.1.nix
@@ -8,6 +8,7 @@ cabal.mkDerivation (self: {
   isExecutable = true;
   buildTools = [ perl ];
   doCheck = false;
+  patches = [ ./adapt-crazy-perl-regex-for-cpp-4.8.0.patch ];
   meta = {
     homepage = "http://www.haskell.org/alex/";
     description = "Alex is a tool for generating lexical analysers in Haskell";
diff --git a/pkgs/development/tools/parsing/alex/2.3.2.nix b/pkgs/development/tools/parsing/alex/2.3.2.nix
index 5d10dbd69951..dc4a0261c4a9 100644
--- a/pkgs/development/tools/parsing/alex/2.3.2.nix
+++ b/pkgs/development/tools/parsing/alex/2.3.2.nix
@@ -8,6 +8,7 @@ cabal.mkDerivation (self: {
   isExecutable = true;
   buildTools = [ perl ];
   doCheck = false;
+  patches = [ ./adapt-crazy-perl-regex-for-cpp-4.8.0.patch ];
   meta = {
     homepage = "http://www.haskell.org/alex/";
     description = "Alex is a tool for generating lexical analysers in Haskell";
diff --git a/pkgs/development/tools/parsing/alex/2.3.3.nix b/pkgs/development/tools/parsing/alex/2.3.3.nix
index bbe413d478ff..146f784463e4 100644
--- a/pkgs/development/tools/parsing/alex/2.3.3.nix
+++ b/pkgs/development/tools/parsing/alex/2.3.3.nix
@@ -8,6 +8,7 @@ cabal.mkDerivation (self: {
   isExecutable = true;
   buildTools = [ perl ];
   doCheck = false;
+  patches = [ ./adapt-crazy-perl-regex-for-cpp-4.8.0.patch ];
   meta = {
     homepage = "http://www.haskell.org/alex/";
     description = "Alex is a tool for generating lexical analysers in Haskell";
diff --git a/pkgs/development/tools/parsing/alex/2.3.5.nix b/pkgs/development/tools/parsing/alex/2.3.5.nix
index 3fb843e69557..65faf84aa2cb 100644
--- a/pkgs/development/tools/parsing/alex/2.3.5.nix
+++ b/pkgs/development/tools/parsing/alex/2.3.5.nix
@@ -8,6 +8,7 @@ cabal.mkDerivation (self: {
   isExecutable = true;
   buildTools = [ perl ];
   doCheck = false;
+  patches = [ ./adapt-crazy-perl-regex-for-cpp-4.8.0.patch ];
   meta = {
     homepage = "http://www.haskell.org/alex/";
     description = "Alex is a tool for generating lexical analysers in Haskell";
diff --git a/pkgs/development/tools/parsing/alex/adapt-crazy-perl-regex-for-cpp-4.8.0.patch b/pkgs/development/tools/parsing/alex/adapt-crazy-perl-regex-for-cpp-4.8.0.patch
new file mode 100644
index 000000000000..1e5942bfbefb
--- /dev/null
+++ b/pkgs/development/tools/parsing/alex/adapt-crazy-perl-regex-for-cpp-4.8.0.patch
@@ -0,0 +1,12 @@
+diff -ubr alex-2.3.5-orig/Setup.lhs alex-2.3.5/Setup.lhs
+--- alex-2.3.5-orig/Setup.lhs	2013-04-19 12:00:15.812606335 +0000
++++ alex-2.3.5/Setup.lhs	2013-04-19 12:05:41.635450321 +0000
+@@ -25,7 +25,7 @@
+ -- hack to turn cpp-style '# 27 "GenericTemplate.hs"' into 
+ -- '{-# LINE 27 "GenericTemplate.hs" #-}'.
+ crazy_perl_regexp =
+- "s/^#\\s+(\\d+)\\s+(\"[^\"]*\")/{-# LINE \\1 \\2 #-}/g;s/\\$(Id:.*)\\$/\\1/g"
++ "s/^#\\s+(\\d+)\\s+(\"[^\"]*\").*/{-# LINE \\1 \\2 #-}/g;s/\\$(Id:.*)\\$/\\1/g"
+ 
+ myPostBuild _ flags _ lbi = do
+   let runProgram p = rawSystemProgramConf (buildVerbose flags) p (withPrograms lbi)
diff --git a/pkgs/development/tools/parsing/bison/2.x.nix b/pkgs/development/tools/parsing/bison/2.x.nix
index 77ba164f07ae..5660d51f0606 100644
--- a/pkgs/development/tools/parsing/bison/2.x.nix
+++ b/pkgs/development/tools/parsing/bison/2.x.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, m4, perl }:
 
 stdenv.mkDerivation rec {
-  name = "bison-2.6.5";
+  name = "bison-2.7";
 
   src = fetchurl {
-    url = "mirror://gnu/bison/${name}.tar.xz";
-    sha256 = "8640d5b51aad462db6863711f333a9159836853e0b1e79fdef708c6efb5cd52b";
+    url = "mirror://gnu/bison/${name}.tar.gz";
+    sha256 = "0cd8s2g7zjshya7kwjc9rh3drsssl4hiq4sccnkgf0nn9wvygfqr";
   };
 
   nativeBuildInputs = [ m4 ] ++ stdenv.lib.optional doCheck perl;
diff --git a/pkgs/development/tools/parsing/bison/3.x.nix b/pkgs/development/tools/parsing/bison/3.x.nix
index e3bd4ac7a5a9..284223905f64 100644
--- a/pkgs/development/tools/parsing/bison/3.x.nix
+++ b/pkgs/development/tools/parsing/bison/3.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, m4, perl, flex }:
+{ stdenv, fetchurl, m4, perl }:
 
 stdenv.mkDerivation rec {
   name = "bison-3.0.2";
@@ -8,11 +8,9 @@ stdenv.mkDerivation rec {
     sha256 = "1vc17y6242jlwp0gdj7wsim3nvc1ws7q3j0v3065nz8g9hd9vwnd";
   };
 
-  nativeBuildInputs = [ m4 ] ++ stdenv.lib.optionals doCheck [perl flex];
+  nativeBuildInputs = [ m4 perl ];
   propagatedBuildInputs = [ m4 ];
 
-  doCheck = true;
-
   meta = {
     homepage = "http://www.gnu.org/software/bison/";
     description = "GNU Bison, a Yacc-compatible parser generator";
diff --git a/pkgs/development/tools/parsing/flex/flex-2.5.35.nix b/pkgs/development/tools/parsing/flex/default.nix
index 21180e7d185e..8047080a125d 100644
--- a/pkgs/development/tools/parsing/flex/flex-2.5.35.nix
+++ b/pkgs/development/tools/parsing/flex/default.nix
@@ -1,17 +1,16 @@
-# This should be moved to default.nix eventually (?)
-
-{stdenv, fetchurl, yacc, m4}:
-
-assert yacc != null && m4 != null;
+{ stdenv, fetchurl, bison, m4 }:
 
 stdenv.mkDerivation {
   name = "flex-2.5.35";
+
   src = fetchurl {
     url = mirror://sourceforge/flex/flex-2.5.35.tar.bz2;
     sha256 = "0ysff249mwhq0053bw3hxh58djc0gy7vjan2z1krrf9n5d5vvv0b";
   };
-  buildInputs = [yacc];
-  propagatedNativeBuildInputs = [m4];
+
+  buildInputs = [ bison ];
+
+  propagatedNativeBuildInputs = [ m4 ];
 
   crossAttrs = {
     preConfigure = ''
@@ -21,6 +20,7 @@ stdenv.mkDerivation {
   };
 
   meta = {
+    homepage = http://flex.sourceforge.net/;
     description = "A fast lexical analyser generator";
   };
 }
diff --git a/pkgs/development/tools/parsing/flex/flex-2.5.33.nix b/pkgs/development/tools/parsing/flex/flex-2.5.33.nix
deleted file mode 100644
index 9be98689aeaa..000000000000
--- a/pkgs/development/tools/parsing/flex/flex-2.5.33.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-# !!! this should be moved to default.nix eventually (but I delay
-# doing that since it would cause a rebuild of lots of stuff).
-
-{stdenv, fetchurl, yacc, m4}:
-
-assert yacc != null && m4 != null;
-
-stdenv.mkDerivation {
-  name = "flex-2.5.33";
-  src = fetchurl {
-    url = mirror://sourceforge/flex/flex-2.5.33.tar.bz2;
-    md5 = "343374a00b38d9e39d1158b71af37150";
-  };
-  buildInputs = [yacc];
-  propagatedBuildInputs = [m4];
-
-  meta = {
-    description = "A fast lexical analyser generator";
-  };
-}
diff --git a/pkgs/development/tools/parsing/flex/flex-2.5.34.nix b/pkgs/development/tools/parsing/flex/flex-2.5.34.nix
deleted file mode 100644
index d56cf0c88a2e..000000000000
--- a/pkgs/development/tools/parsing/flex/flex-2.5.34.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-# This should be moved to default.nix eventually (?)
-
-{stdenv, fetchurl, yacc, m4}:
-
-assert yacc != null && m4 != null;
-
-stdenv.mkDerivation {
-  name = "flex-2.5.34";
-  src = fetchurl {
-    url = mirror://sourceforge/flex/flex-2.5.34.tar.bz2;
-    sha256 = "1c8e64f32508841b0441ddfb139c4cfd25fee3728cadb63f5f351c6eb9b224a6";
-  };
-  buildInputs = [yacc];
-  propagatedBuildInputs = [m4];
-
-  meta = {
-    description = "A fast lexical analyser generator";
-  };
-}
diff --git a/pkgs/development/tools/parsing/flex/flex-2.5.4a.nix b/pkgs/development/tools/parsing/flex/flex-2.5.4a.nix
deleted file mode 100644
index 13bb68349790..000000000000
--- a/pkgs/development/tools/parsing/flex/flex-2.5.4a.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-{stdenv, fetchurl, yacc}:
-
-assert yacc != null;
-
-stdenv.mkDerivation {
-  name = "flex-2.5.4a";
-  src = fetchurl {
-    url = mirror://sourceforge/flex/flex-2.5.4a.tar.gz;
-    md5 = "bd8753d0b22e1f4ec87a553a73021adf";
-  };
-  buildInputs = [yacc];
-}
diff --git a/pkgs/development/tools/parsing/happy/1.18.4.nix b/pkgs/development/tools/parsing/happy/1.18.4.nix
index 401c4d1475ce..5ebac4303e75 100644
--- a/pkgs/development/tools/parsing/happy/1.18.4.nix
+++ b/pkgs/development/tools/parsing/happy/1.18.4.nix
@@ -8,6 +8,7 @@ cabal.mkDerivation (self: {
   isExecutable = true;
   buildDepends = [ mtl ];
   buildTools = [ perl ];
+  patches = [ ./adapt-crazy-perl-regex-for-cpp-4.8.0.patch ];
   meta = {
     homepage = "http://www.haskell.org/happy/";
     description = "Happy is a parser generator for Haskell";
diff --git a/pkgs/development/tools/parsing/happy/1.18.5.nix b/pkgs/development/tools/parsing/happy/1.18.5.nix
index d64d8983e9cb..7463a9f94a0a 100644
--- a/pkgs/development/tools/parsing/happy/1.18.5.nix
+++ b/pkgs/development/tools/parsing/happy/1.18.5.nix
@@ -8,6 +8,7 @@ cabal.mkDerivation (self: {
   isExecutable = true;
   buildDepends = [ mtl ];
   buildTools = [ perl ];
+  patches = [ ./adapt-crazy-perl-regex-for-cpp-4.8.0.patch ];
   meta = {
     homepage = "http://www.haskell.org/happy/";
     description = "Happy is a parser generator for Haskell";
diff --git a/pkgs/development/tools/parsing/happy/1.18.6.nix b/pkgs/development/tools/parsing/happy/1.18.6.nix
index fdc483fe5714..3a3795c90db6 100644
--- a/pkgs/development/tools/parsing/happy/1.18.6.nix
+++ b/pkgs/development/tools/parsing/happy/1.18.6.nix
@@ -8,6 +8,7 @@ cabal.mkDerivation (self: {
   isExecutable = true;
   buildDepends = [ mtl ];
   buildTools = [ perl ];
+  patches = [ ./adapt-crazy-perl-regex-for-cpp-4.8.0.patch ];
   meta = {
     homepage = "http://www.haskell.org/happy/";
     description = "Happy is a parser generator for Haskell";
diff --git a/pkgs/development/tools/parsing/happy/1.18.8.nix b/pkgs/development/tools/parsing/happy/1.18.8.nix
index decc992809a2..141205d19402 100644
--- a/pkgs/development/tools/parsing/happy/1.18.8.nix
+++ b/pkgs/development/tools/parsing/happy/1.18.8.nix
@@ -8,6 +8,7 @@ cabal.mkDerivation (self: {
   isExecutable = true;
   buildDepends = [ mtl ];
   buildTools = [ perl ];
+  patches = [ ./adapt-crazy-perl-regex-for-cpp-4.8.0.patch ];
   meta = {
     homepage = "http://www.haskell.org/happy/";
     description = "Happy is a parser generator for Haskell";
diff --git a/pkgs/development/tools/parsing/happy/adapt-crazy-perl-regex-for-cpp-4.8.0.patch b/pkgs/development/tools/parsing/happy/adapt-crazy-perl-regex-for-cpp-4.8.0.patch
new file mode 100644
index 000000000000..8bc4db0f405e
--- /dev/null
+++ b/pkgs/development/tools/parsing/happy/adapt-crazy-perl-regex-for-cpp-4.8.0.patch
@@ -0,0 +1,12 @@
+diff -ubr happy-1.18.6-orig/Setup.lhs happy-1.18.6/Setup.lhs
+--- happy-1.18.6-orig/Setup.lhs	2013-04-19 14:17:10.865999210 +0200
++++ happy-1.18.6/Setup.lhs	2013-04-19 14:17:15.285214809 +0200
+@@ -25,7 +25,7 @@
+ -- hack to turn cpp-style '# 27 "GenericTemplate.hs"' into 
+ -- '{-# LINE 27 "GenericTemplate.hs" #-}'.
+ crazy_perl_regexp =
+- "s/^#\\s+(\\d+)\\s+(\"[^\"]*\")/{-# LINE \\1 \\2 #-}/g;s/\\$(Id:.*)\\$/\\1/g"
++ "s/^#\\s+(\\d+)\\s+(\"[^\"]*\").*/{-# LINE \\1 \\2 #-}/g;s/\\$(Id:.*)\\$/\\1/g"
+ 
+ myPostBuild _ flags _ lbi = do
+   let runProgram p = rawSystemProgramConf (buildVerbose flags) p (withPrograms lbi)