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-apple64/default.nix1
-rw-r--r--pkgs/development/compilers/gcc/4.6/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix3
-rw-r--r--pkgs/development/compilers/ghc/7.4.2-binary.nix3
-rw-r--r--pkgs/development/compilers/ghc/7.8.3-binary.nix93
-rw-r--r--pkgs/development/compilers/ghc/7.8.3.nix2
-rw-r--r--pkgs/development/compilers/llvm/3.4/clang.nix4
-rw-r--r--pkgs/development/compilers/llvm/3.4/llvm.nix6
-rw-r--r--pkgs/development/compilers/ocaml/4.01.0.nix2
-rw-r--r--pkgs/development/compilers/ocaml/fix-clang-build-on-osx.diff20
-rw-r--r--pkgs/development/interpreters/guile/clang.patch14
-rw-r--r--pkgs/development/interpreters/guile/default.nix2
-rw-r--r--pkgs/development/interpreters/guile/setup-hook-2.0.sh2
-rw-r--r--pkgs/development/interpreters/guile/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/lua-5/5.1.nix2
-rw-r--r--pkgs/development/interpreters/perl/5.14/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/perl/5.16/default.nix22
-rw-r--r--pkgs/development/interpreters/perl/5.16/fixed-man-page-date.patch11
-rw-r--r--pkgs/development/interpreters/perl/5.16/no-date-in-perl-binary.patch11
-rw-r--r--pkgs/development/interpreters/perl/5.16/no-impure-config-time.patch11
-rw-r--r--pkgs/development/interpreters/perl/5.16/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/perl/5.20/default.nix16
-rw-r--r--pkgs/development/interpreters/perl/5.20/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/perl/sys-perl/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/pypy/2.4/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/python/2.6/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/python/2.7/default.nix1
-rw-r--r--pkgs/development/interpreters/python/2.7/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/python/3.2/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/python/3.3/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/python/3.4/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/ruby/ruby-1.9.3.nix8
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.0.0.nix6
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.1.0.nix6
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.1.1.nix6
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.1.2.nix6
-rw-r--r--pkgs/development/libraries/apr-util/default.nix3
-rw-r--r--pkgs/development/libraries/aspell/clang.patch18
-rw-r--r--pkgs/development/libraries/aspell/default.nix4
-rw-r--r--pkgs/development/libraries/at-spi2-atk/default.nix4
-rw-r--r--pkgs/development/libraries/at-spi2-core/default.nix12
-rw-r--r--pkgs/development/libraries/atk/default.nix4
-rw-r--r--pkgs/development/libraries/boost/boost-155-clang.patch90
-rw-r--r--pkgs/development/libraries/boost/generic.nix6
-rw-r--r--pkgs/development/libraries/cairo/default.nix4
-rw-r--r--pkgs/development/libraries/cyrus-sasl/default.nix9
-rw-r--r--pkgs/development/libraries/db/generic.nix4
-rw-r--r--pkgs/development/libraries/db/osx.patch20
-rw-r--r--pkgs/development/libraries/dbus/default.nix4
-rw-r--r--pkgs/development/libraries/fontconfig/2.10.nix61
-rw-r--r--pkgs/development/libraries/fontconfig/builder.sh5
-rw-r--r--pkgs/development/libraries/fontconfig/config-compat.patch28
-rw-r--r--pkgs/development/libraries/fontconfig/default.nix53
-rw-r--r--pkgs/development/libraries/fontconfig/make-fonts-conf.nix6
-rw-r--r--pkgs/development/libraries/fontconfig/make-fonts-conf.xsl24
-rw-r--r--pkgs/development/libraries/glib/default.nix7
-rw-r--r--pkgs/development/libraries/glibc/2.19/common.nix21
-rw-r--r--pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch12
-rw-r--r--pkgs/development/libraries/glibc/2.19/glibc-remove-datetime-from-nscd.patch11
-rw-r--r--pkgs/development/libraries/gmp/5.1.x.nix3
-rw-r--r--pkgs/development/libraries/gobject-introspection/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/bad/default.nix9
-rw-r--r--pkgs/development/libraries/gstreamer/base/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/core/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/core/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/gstreamer/ges/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/gnonlin/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/good/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix2
-rw-r--r--pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/linux-headers-3.9.patch27
-rw-r--r--pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/gstreamer/libav/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/python/default.nix8
-rw-r--r--pkgs/development/libraries/gstreamer/ugly/default.nix4
-rw-r--r--pkgs/development/libraries/gtk+/2.x.nix4
-rw-r--r--pkgs/development/libraries/libav/default.nix2
-rw-r--r--pkgs/development/libraries/libc++/darwin.patch30
-rw-r--r--pkgs/development/libraries/libc++/default.nix30
-rw-r--r--pkgs/development/libraries/libc++/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/libc++abi/darwin.patch17
-rw-r--r--pkgs/development/libraries/libc++abi/default.nix55
-rw-r--r--pkgs/development/libraries/libc++abi/no-stdc++.patch12
-rw-r--r--pkgs/development/libraries/libdevil/default.nix9
-rw-r--r--pkgs/development/libraries/libdrm/default.nix4
-rw-r--r--pkgs/development/libraries/libedit/default.nix2
-rw-r--r--pkgs/development/libraries/libevdev/default.nix2
-rw-r--r--pkgs/development/libraries/libffi/default.nix5
-rw-r--r--pkgs/development/libraries/libgcrypt/default.nix4
-rw-r--r--pkgs/development/libraries/libgcrypt/no-build-timestamp.patch12
-rw-r--r--pkgs/development/libraries/libgpg-error/default.nix27
-rw-r--r--pkgs/development/libraries/libiconv/default.nix4
-rw-r--r--pkgs/development/libraries/libpng/default.nix6
-rw-r--r--pkgs/development/libraries/libunistring/clang.patch14
-rw-r--r--pkgs/development/libraries/libunistring/default.nix2
-rw-r--r--pkgs/development/libraries/libxml2/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/mesa-darwin/default.nix2
-rw-r--r--pkgs/development/libraries/mesa/default.nix12
-rw-r--r--pkgs/development/libraries/mpc/default.nix2
-rw-r--r--pkgs/development/libraries/mpfr/default.nix2
-rw-r--r--pkgs/development/libraries/ncurses/clang.patch42
-rw-r--r--pkgs/development/libraries/ncurses/default.nix4
-rw-r--r--pkgs/development/libraries/openssl/default.nix2
-rw-r--r--pkgs/development/libraries/openssl/no-date-in-library.patch12
-rw-r--r--pkgs/development/libraries/p11-kit/default.nix4
-rw-r--r--pkgs/development/libraries/pango/default.nix25
-rw-r--r--pkgs/development/libraries/pcre/default.nix4
-rw-r--r--pkgs/development/libraries/polkit/default.nix4
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/default.nix13
-rw-r--r--pkgs/development/libraries/readline/6.2.nix1
-rw-r--r--pkgs/development/libraries/readline/clang.patch13
-rw-r--r--pkgs/development/libraries/serf/default.nix14
-rw-r--r--pkgs/development/libraries/slib/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/ucommon/default.nix6
-rw-r--r--pkgs/development/libraries/v8/default.nix2
-rw-r--r--pkgs/development/libraries/webkitgtk/2.4.6.nix62
-rw-r--r--pkgs/development/libraries/webkitgtk/default.nix50
-rw-r--r--pkgs/development/libraries/webkitgtk/finding-harfbuzz-icu.patch52
-rw-r--r--pkgs/development/lisp-modules/clwrapper/setup-hook.sh2
-rw-r--r--pkgs/development/ocaml-modules/ocaml-text/default.nix13
-rw-r--r--pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh2
-rw-r--r--pkgs/development/tools/misc/automake/setup-hook.sh2
-rw-r--r--pkgs/development/tools/misc/ccache/default.nix2
-rw-r--r--pkgs/development/tools/misc/distcc/masq.nix4
-rw-r--r--pkgs/development/tools/misc/patchelf/default.nix2
-rw-r--r--pkgs/development/tools/misc/patchelf/setup-hook.sh16
-rw-r--r--pkgs/development/tools/misc/pkgconfig/setup-hook.sh4
-rw-r--r--pkgs/development/tools/misc/sloccount/default.nix1
-rw-r--r--pkgs/development/tools/ocaml/findlib/default.nix4
-rw-r--r--pkgs/development/tools/vagrant/default.nix4
-rw-r--r--pkgs/development/web/nodejs/setup-hook.sh2
131 files changed, 1120 insertions, 292 deletions
diff --git a/pkgs/development/compilers/gcc/4.2-apple64/default.nix b/pkgs/development/compilers/gcc/4.2-apple64/default.nix
index b2444ebb9bff..42d9f29e2b5b 100644
--- a/pkgs/development/compilers/gcc/4.2-apple64/default.nix
+++ b/pkgs/development/compilers/gcc/4.2-apple64/default.nix
@@ -4,6 +4,7 @@
 , gmp ? null, mpfr ? null, bison ? null, flex ? null
 }:
 
+assert false;
 assert stdenv.isDarwin;
 assert langF77 -> gmp != null;
 
diff --git a/pkgs/development/compilers/gcc/4.6/default.nix b/pkgs/development/compilers/gcc/4.6/default.nix
index 8528be077295..0f08a908bfd4 100644
--- a/pkgs/development/compilers/gcc/4.6/default.nix
+++ b/pkgs/development/compilers/gcc/4.6/default.nix
@@ -474,6 +474,8 @@ stdenv.mkDerivation ({
 # Strip kills static libs of other archs (hence cross != null)
 // optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
 
+// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
+
 // optionalAttrs langVhdl rec {
   name = "ghdl-0.29";
 
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 7166d325b31c..c240acb5e897 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -526,4 +526,6 @@ stdenv.mkDerivation ({
 
 # Strip kills static libs of other archs (hence cross != null)
 // optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
+
+// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
 )
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index d38040a48b38..1cda4535efcd 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -153,7 +153,6 @@ let version = "4.9.1";
           " --disable-libssp --disable-nls" +
           " --without-headers" +
           " --disable-threads " +
-          " --disable-libmudflap " +
           " --disable-libgomp " +
           " --disable-libquadmath" +
           " --disable-shared" +
@@ -513,4 +512,6 @@ stdenv.mkDerivation ({
 
 # Strip kills static libs of other archs (hence cross != null)
 // optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
+
+// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
 )
diff --git a/pkgs/development/compilers/ghc/7.4.2-binary.nix b/pkgs/development/compilers/ghc/7.4.2-binary.nix
index 7000081e5dbe..f6dc974227cc 100644
--- a/pkgs/development/compilers/ghc/7.4.2-binary.nix
+++ b/pkgs/development/compilers/ghc/7.4.2-binary.nix
@@ -62,7 +62,8 @@ stdenv.mkDerivation rec {
      '' else "");
 
   configurePhase = ''
-    ./configure --prefix=$out --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include
+    ./configure --prefix=$out --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include \
+      --with-clang
   '';
 
   # Stripping combined with patchelf breaks the executables (they die
diff --git a/pkgs/development/compilers/ghc/7.8.3-binary.nix b/pkgs/development/compilers/ghc/7.8.3-binary.nix
new file mode 100644
index 000000000000..f2c65c6ad053
--- /dev/null
+++ b/pkgs/development/compilers/ghc/7.8.3-binary.nix
@@ -0,0 +1,93 @@
+{stdenv, fetchurl, perl, ncurses, gmp}:
+
+stdenv.mkDerivation rec {
+  version = "7.8.3";
+
+  name = "ghc-${version}-binary";
+
+  src =
+    if stdenv.system == "i686-linux" then
+      fetchurl {
+        url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
+        sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi";
+      }
+    else if stdenv.system == "x86_64-linux" then
+      fetchurl {
+        url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
+        sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns";
+      }
+    else if stdenv.system == "i686-darwin" then
+      fetchurl {
+        url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
+        sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0";
+      }
+    else if stdenv.system == "x86_64-darwin" then
+      fetchurl {
+        url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
+        sha256 = "1ja0cq5xyjcvjpvjmm4nzhkpmwfs2kjlldbc48lxcs9rmqi7rnay";
+      }
+    else throw "cannot bootstrap GHC on this platform";
+
+  buildInputs = [perl];
+
+  postUnpack =
+    # Strip is harmful, see also below. It's important that this happens
+    # first. The GHC Cabal build system makes use of strip by default and
+    # has hardcoded paths to /usr/bin/strip in many places. We replace
+    # those below, making them point to our dummy script.
+     ''
+      mkdir "$TMP/bin"
+      for i in strip; do
+        echo '#! ${stdenv.shell}' > "$TMP/bin/$i"
+        chmod +x "$TMP/bin/$i"
+      done
+      PATH="$TMP/bin:$PATH"
+     '' +
+    # We have to patch the GMP paths for the integer-gmp package.
+     ''
+      find . -name integer-gmp.buildinfo \
+          -exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp}/lib@" {} \;
+     '' +
+    # On Linux, use patchelf to modify the executables so that they can
+    # find editline/gmp.
+    (if stdenv.isLinux then ''
+      find . -type f -perm +100 \
+          -exec patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
+          --set-rpath "${ncurses}/lib:${gmp}/lib" {} \;
+      sed -i "s|/usr/bin/perl|perl\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
+      sed -i "s|/usr/bin/gcc|gcc\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
+      for prog in ld ar gcc strip ranlib; do
+        find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
+      done
+     '' else "");
+
+  configurePhase = ''
+    ./configure --prefix=$out --with-gmp-libraries=${gmp}/lib \
+      --with-gmp-includes=${gmp}/include
+  '';
+
+  # Stripping combined with patchelf breaks the executables (they die
+  # with a segfault or the kernel even refuses the execve). (NIXPKGS-85)
+  dontStrip = true;
+
+  # No building is necessary, but calling make without flags ironically
+  # calls install-strip ...
+  buildPhase = "true";
+
+  postInstall =
+      ''
+        # Sanity check, can ghc create executables?
+        cd $TMP
+        mkdir test-ghc; cd test-ghc
+        cat > main.hs << EOF
+          module Main where
+          main = putStrLn "yes"
+        EOF
+        $out/bin/ghc --make main.hs
+        echo compilation ok
+        [ $(./main) == "yes" ]
+      '';
+
+  meta.license = stdenv.lib.licenses.bsd3;
+  meta.platforms = ["x86_64-linux" "i686-linux" "i686-darwin" "x86_64-darwin"];
+}
diff --git a/pkgs/development/compilers/ghc/7.8.3.nix b/pkgs/development/compilers/ghc/7.8.3.nix
index 0c142883e65a..9f5fc4b4e50d 100644
--- a/pkgs/development/compilers/ghc/7.8.3.nix
+++ b/pkgs/development/compilers/ghc/7.8.3.nix
@@ -26,8 +26,6 @@ stdenv.mkDerivation rec {
     export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}"
   '';
 
-  configureFlags = "--with-gcc=${stdenv.gcc}/bin/gcc";
-
   # required, because otherwise all symbols from HSffi.o are stripped, and
   # that in turn causes GHCi to abort
   stripDebugFlags = [ "-S" "--keep-file-symbols" ];
diff --git a/pkgs/development/compilers/llvm/3.4/clang.nix b/pkgs/development/compilers/llvm/3.4/clang.nix
index 6ec3f7bf44a3..fc33a7809a6c 100644
--- a/pkgs/development/compilers/llvm/3.4/clang.nix
+++ b/pkgs/development/compilers/llvm/3.4/clang.nix
@@ -1,5 +1,9 @@
 { stdenv, fetch, cmake, libxml2, libedit, llvm, version, clang-tools-extra_src }:
 
+# be sure not to rebuild clang on darwin; some packages request it specifically
+# we need to fix those
+assert stdenv.isDarwin -> stdenv.gcc.nativeTools;
+
 stdenv.mkDerivation {
   name = "clang-${version}";
 
diff --git a/pkgs/development/compilers/llvm/3.4/llvm.nix b/pkgs/development/compilers/llvm/3.4/llvm.nix
index fbc881fc8e02..d3beb2e7461c 100644
--- a/pkgs/development/compilers/llvm/3.4/llvm.nix
+++ b/pkgs/development/compilers/llvm/3.4/llvm.nix
@@ -27,7 +27,10 @@ in stdenv.mkDerivation rec {
     mv compiler-rt-* $sourceRoot/projects/compiler-rt
   '';
 
-  buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind;
+  buildInputs =
+    [ perl groff cmake libxml2 libffi ]
+    ++ stdenv.lib.optional (!stdenv.isDarwin) python /*
+    ++ stdenv.lib.optional stdenv.isLinux valgrind */;
 
   propagatedBuildInputs = [ ncurses zlib ];
 
@@ -65,6 +68,5 @@ in stdenv.mkDerivation rec {
     license     = stdenv.lib.licenses.bsd3;
     maintainers = with stdenv.lib.maintainers; [ shlevy lovek323 raskin viric ];
     platforms   = stdenv.lib.platforms.all;
-    broken      = stdenv.isDarwin;
   };
 }
diff --git a/pkgs/development/compilers/ocaml/4.01.0.nix b/pkgs/development/compilers/ocaml/4.01.0.nix
index ea3e8d49a4e3..d178285834ff 100644
--- a/pkgs/development/compilers/ocaml/4.01.0.nix
+++ b/pkgs/development/compilers/ocaml/4.01.0.nix
@@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
     sha256 = "b1ca708994180236917ae79e17606da5bd334ca6acd6873a550027e1c0ec874a";
   };
 
+  patches = [ ./fix-clang-build-on-osx.diff ];
+
   prefixKey = "-prefix ";
   configureFlags = ["-no-tk"] ++ optionals useX11 [ "-x11lib" x11lib
                                                     "-x11include" x11inc ];
diff --git a/pkgs/development/compilers/ocaml/fix-clang-build-on-osx.diff b/pkgs/development/compilers/ocaml/fix-clang-build-on-osx.diff
new file mode 100644
index 000000000000..d7d9c863858f
--- /dev/null
+++ b/pkgs/development/compilers/ocaml/fix-clang-build-on-osx.diff
@@ -0,0 +1,20 @@
+diff --git a/configure b/configure
+index d45e88f..25d872b 100755
+--- a/configure
++++ b/configure
+@@ -322,7 +322,14 @@ case "$bytecc,$target" in
+     bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
+     mathlib="";;
+   *,*-*-darwin*)
+-    bytecccompopts="-fno-defer-pop $gcc_warnings"
++    # On recent version of OSX, gcc is a symlink to clang
++    if $bytecc --version | grep -q clang; then
++        # -fno-defer-pop is not supported by clang, and make recent
++        # versions of clang to fail
++        bytecccompopts="$gcc_warnings"
++    else
++        bytecccompopts="-fno-defer-pop $gcc_warnings"
++    fi
+     mathlib=""
+     mkexe="$mkexe -Wl,-no_compact_unwind"
+     # Tell gcc that we can use 32-bit code addresses for threaded code
diff --git a/pkgs/development/interpreters/guile/clang.patch b/pkgs/development/interpreters/guile/clang.patch
new file mode 100644
index 000000000000..4d0f342b211f
--- /dev/null
+++ b/pkgs/development/interpreters/guile/clang.patch
@@ -0,0 +1,14 @@
+diff --git a/lib/stdint.in.h b/lib/stdint.in.h
+index 889bca7..15d39b0 100644
+--- a/lib/stdint.in.h
++++ b/lib/stdint.in.h
+@@ -74,7 +74,8 @@
+      in <inttypes.h> would reinclude us, skipping our contents because
+      _@GUARD_PREFIX@_STDINT_H is defined.
+      The include_next requires a split double-inclusion guard.  */
+-# @INCLUDE_NEXT@ @NEXT_STDINT_H@
++# include <inttypes.h>
++// # @INCLUDE_NEXT@ @NEXT_STDINT_H@
+ #endif
+ 
+ #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix
index fcec8dc0398f..c4634de5d3f2 100644
--- a/pkgs/development/interpreters/guile/default.nix
+++ b/pkgs/development/interpreters/guile/default.nix
@@ -31,7 +31,7 @@
   # libguile/vm-i-system.i is not created in time
   enableParallelBuilding = false;
 
-  patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ] ++
+  patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ./clang.patch ] ++
     (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch);
 
   # Explicitly link against libgcc_s, to work around the infamous
diff --git a/pkgs/development/interpreters/guile/setup-hook-2.0.sh b/pkgs/development/interpreters/guile/setup-hook-2.0.sh
index 6994c4cd8dc6..fd1dc944ed44 100644
--- a/pkgs/development/interpreters/guile/setup-hook-2.0.sh
+++ b/pkgs/development/interpreters/guile/setup-hook-2.0.sh
@@ -10,4 +10,4 @@ addGuileLibPath () {
     fi
 }
 
-envHooks=(${envHooks[@]} addGuileLibPath)
+envHooks+=(addGuileLibPath)
diff --git a/pkgs/development/interpreters/guile/setup-hook.sh b/pkgs/development/interpreters/guile/setup-hook.sh
index 87cb5118506d..c1d19e579ed5 100644
--- a/pkgs/development/interpreters/guile/setup-hook.sh
+++ b/pkgs/development/interpreters/guile/setup-hook.sh
@@ -5,4 +5,4 @@ addGuileLibPath () {
     fi
 }
 
-envHooks=(${envHooks[@]} addGuileLibPath)
+envHooks+=(addGuileLibPath)
diff --git a/pkgs/development/interpreters/lua-5/5.1.nix b/pkgs/development/interpreters/lua-5/5.1.nix
index 444ecbc787af..adeaa9fae7bb 100644
--- a/pkgs/development/interpreters/lua-5/5.1.nix
+++ b/pkgs/development/interpreters/lua-5/5.1.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   configurePhase =
     if stdenv.isDarwin
     then ''
-    makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2" LDFLAGS="" )
+    makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2" LDFLAGS="" CC="$CC" )
     installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.5.1.5.dylib" INSTALL_DATA='cp -d' )
   '' else ''
     makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=linux CFLAGS="-DLUA_USE_LINUX -O2 -fPIC" LDFLAGS="-fPIC" )
diff --git a/pkgs/development/interpreters/perl/5.14/setup-hook.sh b/pkgs/development/interpreters/perl/5.14/setup-hook.sh
index 6a144a7f7804..a8656b8531db 100644
--- a/pkgs/development/interpreters/perl/5.14/setup-hook.sh
+++ b/pkgs/development/interpreters/perl/5.14/setup-hook.sh
@@ -2,4 +2,4 @@ addPerlLibPath () {
     addToSearchPath PERL5LIB $1/lib/perl5/site_perl
 }
 
-envHooks=(${envHooks[@]} addPerlLibPath)
+envHooks+=(addPerlLibPath)
diff --git a/pkgs/development/interpreters/perl/5.16/default.nix b/pkgs/development/interpreters/perl/5.16/default.nix
index c1a5374c92ea..db9b821b8883 100644
--- a/pkgs/development/interpreters/perl/5.16/default.nix
+++ b/pkgs/development/interpreters/perl/5.16/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ lib, stdenv, fetchurl, enableThreading ? true }:
 
 let
 
@@ -6,10 +6,6 @@ let
 
 in
 
-with {
-  inherit (stdenv.lib) optional optionalString;
-};
-
 stdenv.mkDerivation rec {
   name = "perl-5.16.3";
 
@@ -21,9 +17,12 @@ stdenv.mkDerivation rec {
   patches =
     [ # Do not look in /usr etc. for dependencies.
       ./no-sys-dirs.patch
+      ./no-impure-config-time.patch
+      ./fixed-man-page-date.patch
+      ./no-date-in-perl-binary.patch
     ]
-    ++ optional stdenv.isSunOS  ./ld-shared.patch
-    ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
+    ++ lib.optional stdenv.isSunOS  ./ld-shared.patch
+    ++ 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
@@ -32,14 +31,13 @@ stdenv.mkDerivation rec {
   # Miniperl needs -lm. perl needs -lrt.
   configureFlags =
     [ "-de"
-      "-Dcc=gcc"
       "-Uinstallusrbinperl"
       "-Dinstallstyle=lib/perl5"
       "-Duseshrplib"
       "-Dlocincpth=${libc}/include"
       "-Dloclibpth=${libc}/lib"
     ]
-    ++ optional (stdenv ? glibc) "-Dusethreads";
+    ++ lib.optional enableThreading "-Dusethreads";
 
   configureScript = "${stdenv.shell} ./Configure";
 
@@ -51,18 +49,18 @@ stdenv.mkDerivation rec {
     ''
       configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
 
-      ${optionalString stdenv.isArm ''
+      ${lib.optionalString stdenv.isArm ''
         configureFlagsArray=(-Dldflags="-lm -lrt")
       ''}
 
-      ${optionalString stdenv.isCygwin ''
+      ${lib.optionalString stdenv.isCygwin ''
         cp cygwin/cygwin.c{,.bak}
         echo "#define PERLIO_NOT_STDIO 0" > tmp
         cat tmp cygwin/cygwin.c.bak > cygwin/cygwin.c
       ''}
     '';
 
-  preBuild = optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
+  preBuild = lib.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)'"
diff --git a/pkgs/development/interpreters/perl/5.16/fixed-man-page-date.patch b/pkgs/development/interpreters/perl/5.16/fixed-man-page-date.patch
new file mode 100644
index 000000000000..79f9bc3658e3
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.16/fixed-man-page-date.patch
@@ -0,0 +1,11 @@
+--- a/cpan/podlators/lib/Pod/Man.pm	2014-04-07 06:25:23.730505243 +0200
++++ b/cpan/podlators/lib/Pod/Man.pm	2014-04-07 06:26:40.816552603 +0200
+@@ -768,7 +768,7 @@
+     } else {
+         ($name, $section) = $self->devise_title;
+     }
+-    my $date = $$self{date} || $self->devise_date;
++    my $date = "1970-01-01"; # Fixed date for NixOS, orig: $$self{date} || $self->devise_date;
+     $self->preamble ($name, $section, $date)
+         unless $self->bare_output or DEBUG > 9;
+ 
diff --git a/pkgs/development/interpreters/perl/5.16/no-date-in-perl-binary.patch b/pkgs/development/interpreters/perl/5.16/no-date-in-perl-binary.patch
new file mode 100644
index 000000000000..00ea47ae45f6
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.16/no-date-in-perl-binary.patch
@@ -0,0 +1,11 @@
+--- a/perl.c	2014-04-07 07:58:01.402831615 +0200
++++ b/perl.c	2014-04-07 07:59:38.556945298 +0200
+@@ -1754,7 +1754,7 @@
+     PUSHs(Perl_newSVpvn_flags(aTHX_ non_bincompat_options,
+ 			      sizeof(non_bincompat_options) - 1, SVs_TEMP));
+ 
+-#ifdef __DATE__
++#if 0
+ #  ifdef __TIME__
+     PUSHs(Perl_newSVpvn_flags(aTHX_
+ 			      STR_WITH_LEN("Compiled at " __DATE__ " " __TIME__),
diff --git a/pkgs/development/interpreters/perl/5.16/no-impure-config-time.patch b/pkgs/development/interpreters/perl/5.16/no-impure-config-time.patch
new file mode 100644
index 000000000000..2bf1841e9dd2
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.16/no-impure-config-time.patch
@@ -0,0 +1,11 @@
+--- a/Configure	2014-04-05 20:21:33.714635700 +0200
++++ b/Configure	2014-04-05 20:23:23.377441026 +0200
+@@ -3609,6 +3609,8 @@
+ 
+ : who configured the system
+ cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
++cf_time='Thu Jan  1 00:00:00 UTC 1970'
++
+ case "$cf_by" in
+ "")
+ 	cf_by=`(logname) 2>/dev/null`
diff --git a/pkgs/development/interpreters/perl/5.16/setup-hook.sh b/pkgs/development/interpreters/perl/5.16/setup-hook.sh
index 6a144a7f7804..a8656b8531db 100644
--- a/pkgs/development/interpreters/perl/5.16/setup-hook.sh
+++ b/pkgs/development/interpreters/perl/5.16/setup-hook.sh
@@ -2,4 +2,4 @@ addPerlLibPath () {
     addToSearchPath PERL5LIB $1/lib/perl5/site_perl
 }
 
-envHooks=(${envHooks[@]} addPerlLibPath)
+envHooks+=(addPerlLibPath)
diff --git a/pkgs/development/interpreters/perl/5.20/default.nix b/pkgs/development/interpreters/perl/5.20/default.nix
index 2bcfb2787df6..66a9ca597a40 100644
--- a/pkgs/development/interpreters/perl/5.20/default.nix
+++ b/pkgs/development/interpreters/perl/5.20/default.nix
@@ -1,4 +1,16 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, enableThreading ? true }:
+
+# We can only compile perl with threading on platforms where we have a
+# real glibc in the stdenv.
+#
+# Instead of silently building an unthreaded perl if this is not the
+# case, we force callers to disableThreading explicitly, therefore
+# documenting the platforms where the perl is not threaded.
+#
+# In the case of stdenv linux boot stage1 it's not possible to use
+# threading because of the simpleness of the bootstrap glibc, so we
+# use enableThreading = false there.
+assert enableThreading -> (stdenv ? glibc);
 
 let
 
@@ -39,7 +51,7 @@ stdenv.mkDerivation rec {
       "-Dlocincpth=${libc}/include"
       "-Dloclibpth=${libc}/lib"
     ]
-    ++ optional (stdenv ? glibc) "-Dusethreads";
+    ++ optional enableThreading "-Dusethreads";
 
   configureScript = "${stdenv.shell} ./Configure";
 
diff --git a/pkgs/development/interpreters/perl/5.20/setup-hook.sh b/pkgs/development/interpreters/perl/5.20/setup-hook.sh
index 6a144a7f7804..a8656b8531db 100644
--- a/pkgs/development/interpreters/perl/5.20/setup-hook.sh
+++ b/pkgs/development/interpreters/perl/5.20/setup-hook.sh
@@ -2,4 +2,4 @@ addPerlLibPath () {
     addToSearchPath PERL5LIB $1/lib/perl5/site_perl
 }
 
-envHooks=(${envHooks[@]} addPerlLibPath)
+envHooks+=(addPerlLibPath)
diff --git a/pkgs/development/interpreters/perl/sys-perl/setup-hook.sh b/pkgs/development/interpreters/perl/sys-perl/setup-hook.sh
index a46a19602e7a..7b03c15ec5ad 100644
--- a/pkgs/development/interpreters/perl/sys-perl/setup-hook.sh
+++ b/pkgs/development/interpreters/perl/sys-perl/setup-hook.sh
@@ -2,4 +2,4 @@ addPerlLibPath () {
     addToSearchPath PERL5LIB $1/@libPrefix@
 }
 
-envHooks=(${envHooks[@]} addPerlLibPath)
+envHooks+=(addPerlLibPath)
diff --git a/pkgs/development/interpreters/pypy/2.4/setup-hook.sh b/pkgs/development/interpreters/pypy/2.4/setup-hook.sh
index 4cf7247fb9e7..b9f5a38dcc64 100644
--- a/pkgs/development/interpreters/pypy/2.4/setup-hook.sh
+++ b/pkgs/development/interpreters/pypy/2.4/setup-hook.sh
@@ -12,4 +12,4 @@ toPythonPath() {
     echo $result
 }
 
-envHooks=(${envHooks[@]} addPythonPath)
+envHooks+=(addPythonPath)
diff --git a/pkgs/development/interpreters/python/2.6/setup-hook.sh b/pkgs/development/interpreters/python/2.6/setup-hook.sh
index 290525c35713..4caff9c9d846 100644
--- a/pkgs/development/interpreters/python/2.6/setup-hook.sh
+++ b/pkgs/development/interpreters/python/2.6/setup-hook.sh
@@ -12,4 +12,4 @@ toPythonPath() {
     echo $result
 }
 
-envHooks=(${envHooks[@]} addPythonPath)
+envHooks+=(addPythonPath)
diff --git a/pkgs/development/interpreters/python/2.7/default.nix b/pkgs/development/interpreters/python/2.7/default.nix
index 8588cd812fc7..3201d7520d13 100644
--- a/pkgs/development/interpreters/python/2.7/default.nix
+++ b/pkgs/development/interpreters/python/2.7/default.nix
@@ -68,6 +68,7 @@ let
     configureFlags = "--enable-shared --with-threads --enable-unicode";
 
     NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2";
+    DETERMINISTIC_BUILD = 1;
 
     setupHook = ./setup-hook.sh;
 
diff --git a/pkgs/development/interpreters/python/2.7/setup-hook.sh b/pkgs/development/interpreters/python/2.7/setup-hook.sh
index a393b70afe10..4770eea886f6 100644
--- a/pkgs/development/interpreters/python/2.7/setup-hook.sh
+++ b/pkgs/development/interpreters/python/2.7/setup-hook.sh
@@ -12,4 +12,4 @@ toPythonPath() {
     echo $result
 }
 
-envHooks=(${envHooks[@]} addPythonPath)
+envHooks+=(addPythonPath)
diff --git a/pkgs/development/interpreters/python/3.2/setup-hook.sh b/pkgs/development/interpreters/python/3.2/setup-hook.sh
index e6fa34bf54ba..e8215ef9877c 100644
--- a/pkgs/development/interpreters/python/3.2/setup-hook.sh
+++ b/pkgs/development/interpreters/python/3.2/setup-hook.sh
@@ -12,4 +12,4 @@ toPythonPath() {
     echo $result
 }
 
-envHooks=(${envHooks[@]} addPythonPath)
+envHooks+=(addPythonPath)
diff --git a/pkgs/development/interpreters/python/3.3/setup-hook.sh b/pkgs/development/interpreters/python/3.3/setup-hook.sh
index c272c87daf1c..82a8c0abd32f 100644
--- a/pkgs/development/interpreters/python/3.3/setup-hook.sh
+++ b/pkgs/development/interpreters/python/3.3/setup-hook.sh
@@ -12,4 +12,4 @@ toPythonPath() {
     echo $result
 }
 
-envHooks=(${envHooks[@]} addPythonPath)
+envHooks+=(addPythonPath)
diff --git a/pkgs/development/interpreters/python/3.4/setup-hook.sh b/pkgs/development/interpreters/python/3.4/setup-hook.sh
index ae71b4147ab7..fddcc0b73fe8 100644
--- a/pkgs/development/interpreters/python/3.4/setup-hook.sh
+++ b/pkgs/development/interpreters/python/3.4/setup-hook.sh
@@ -12,4 +12,4 @@ toPythonPath() {
     echo $result
 }
 
-envHooks=(${envHooks[@]} addPythonPath)
+envHooks+=(addPythonPath)
diff --git a/pkgs/development/interpreters/ruby/ruby-1.9.3.nix b/pkgs/development/interpreters/ruby/ruby-1.9.3.nix
index 77880870dd95..c812abc70fe5 100644
--- a/pkgs/development/interpreters/ruby/ruby-1.9.3.nix
+++ b/pkgs/development/interpreters/ruby/ruby-1.9.3.nix
@@ -48,12 +48,6 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  # Fix a build failure on systems with nix store optimisation.
-  # (The build process attempted to copy file a overwriting file b, where a and
-  # b are hard-linked, which results in cp returning a non-zero exit code.)
-  # https://github.com/NixOS/nixpkgs/issues/4266
-  postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
-
   patches = [
     ./ruby19-parallel-install.patch
     ./bitperfect-rdoc.patch
@@ -86,6 +80,8 @@ stdenv.mkDerivation rec {
 
   installFlags = stdenv.lib.optionalString docSupport "install-doc";
 
+  CFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-mmacosx-version-min=10.7";
+
   postInstall = ''
     # Bundler tries to create this directory
     mkdir -pv $out/${passthru.gemPath}
diff --git a/pkgs/development/interpreters/ruby/ruby-2.0.0.nix b/pkgs/development/interpreters/ruby/ruby-2.0.0.nix
index 6e85d6c0330f..1e886b0219a1 100644
--- a/pkgs/development/interpreters/ruby/ruby-2.0.0.nix
+++ b/pkgs/development/interpreters/ruby/ruby-2.0.0.nix
@@ -50,12 +50,6 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  # Fix a build failure on systems with nix store optimisation.
-  # (The build process attempted to copy file a overwriting file b, where a and
-  # b are hard-linked, which results in cp returning a non-zero exit code.)
-  # https://github.com/NixOS/nixpkgs/issues/4266
-  postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
-
   patches = ops useRailsExpress [
     "${patchSet}/patches/ruby/2.0.0/p481/01-zero-broken-tests.patch"
     "${patchSet}/patches/ruby/2.0.0/p481/02-railsexpress-gc.patch"
diff --git a/pkgs/development/interpreters/ruby/ruby-2.1.0.nix b/pkgs/development/interpreters/ruby/ruby-2.1.0.nix
index 39884745635a..8467bc4eb38d 100644
--- a/pkgs/development/interpreters/ruby/ruby-2.1.0.nix
+++ b/pkgs/development/interpreters/ruby/ruby-2.1.0.nix
@@ -51,12 +51,6 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  # Fix a build failure on systems with nix store optimisation.
-  # (The build process attempted to copy file a overwriting file b, where a and
-  # b are hard-linked, which results in cp returning a non-zero exit code.)
-  # https://github.com/NixOS/nixpkgs/issues/4266
-  postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
-
   patches = ops useRailsExpress [
     "${patchSet}/patches/ruby/2.1.0/railsexpress/01-current-2.1.1-fixes.patch"
     "${patchSet}/patches/ruby/2.1.0/railsexpress/02-zero-broken-tests.patch"
diff --git a/pkgs/development/interpreters/ruby/ruby-2.1.1.nix b/pkgs/development/interpreters/ruby/ruby-2.1.1.nix
index eb8239086ea9..e26cdd5b3154 100644
--- a/pkgs/development/interpreters/ruby/ruby-2.1.1.nix
+++ b/pkgs/development/interpreters/ruby/ruby-2.1.1.nix
@@ -51,12 +51,6 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  # Fix a build failure on systems with nix store optimisation.
-  # (The build process attempted to copy file a overwriting file b, where a and
-  # b are hard-linked, which results in cp returning a non-zero exit code.)
-  # https://github.com/NixOS/nixpkgs/issues/4266
-  postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
-
   patches = ops useRailsExpress [
     "${patchSet}/patches/ruby/2.1.0/railsexpress/01-zero-broken-tests.patch"
     "${patchSet}/patches/ruby/2.1.0/railsexpress/02-improve-gc-stats.patch"
diff --git a/pkgs/development/interpreters/ruby/ruby-2.1.2.nix b/pkgs/development/interpreters/ruby/ruby-2.1.2.nix
index 2cefa6b002a6..fe03b86d86db 100644
--- a/pkgs/development/interpreters/ruby/ruby-2.1.2.nix
+++ b/pkgs/development/interpreters/ruby/ruby-2.1.2.nix
@@ -51,12 +51,6 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  # Fix a build failure on systems with nix store optimisation.
-  # (The build process attempted to copy file a overwriting file b, where a and
-  # b are hard-linked, which results in cp returning a non-zero exit code.)
-  # https://github.com/NixOS/nixpkgs/issues/4266
-  postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
-
   patches = ops useRailsExpress [
     "${patchSet}/patches/ruby/2.1.2/railsexpress/01-zero-broken-tests.patch"
     "${patchSet}/patches/ruby/2.1.2/railsexpress/02-improve-gc-stats.patch"
diff --git a/pkgs/development/libraries/apr-util/default.nix b/pkgs/development/libraries/apr-util/default.nix
index 6932f389b844..76477d38b6d5 100644
--- a/pkgs/development/libraries/apr-util/default.nix
+++ b/pkgs/development/libraries/apr-util/default.nix
@@ -2,6 +2,7 @@
 , sslSupport ? true, openssl
 , bdbSupport ? false, db
 , ldapSupport ? true, openldap
+, libiconvOrNull
 }:
 
 assert sslSupport -> openssl != null;
@@ -28,7 +29,7 @@ stdenv.mkDerivation rec {
     ${stdenv.lib.optionalString ldapSupport "--with-ldap"}
   '';
 
-  propagatedBuildInputs = [ makeWrapper apr expat ]
+  propagatedBuildInputs = [ makeWrapper apr expat libiconvOrNull ]
     ++ optional sslSupport openssl
     ++ optional bdbSupport db
     ++ optional ldapSupport openldap;
diff --git a/pkgs/development/libraries/aspell/clang.patch b/pkgs/development/libraries/aspell/clang.patch
new file mode 100644
index 000000000000..c4cfa426588c
--- /dev/null
+++ b/pkgs/development/libraries/aspell/clang.patch
@@ -0,0 +1,18 @@
+--- interfaces/cc/aspell.h	2013-10-13 20:29:33.000000000 +0200
++++ interfaces/cc/aspell.h	2013-10-13 20:30:01.000000000 +0200
+@@ -237,6 +237,7 @@
+ /******************************** errors ********************************/
+ 
+ 
++#ifndef __cplusplus
+ extern const struct AspellErrorInfo * const aerror_other;
+ extern const struct AspellErrorInfo * const aerror_operation_not_supported;
+ extern const struct AspellErrorInfo * const   aerror_cant_copy;
+@@ -322,6 +323,7 @@
+ extern const struct AspellErrorInfo * const   aerror_bad_magic;
+ extern const struct AspellErrorInfo * const aerror_expression;
+ extern const struct AspellErrorInfo * const   aerror_invalid_expression;
++#endif
+ 
+ 
+ /******************************* speller *******************************/
diff --git a/pkgs/development/libraries/aspell/default.nix b/pkgs/development/libraries/aspell/default.nix
index 4ac6dc58ba93..38d734e902c3 100644
--- a/pkgs/development/libraries/aspell/default.nix
+++ b/pkgs/development/libraries/aspell/default.nix
@@ -8,6 +8,10 @@ stdenv.mkDerivation rec {
     sha256 = "1qgn5psfyhbrnap275xjfrzppf5a83fb67gpql0kfqv37al869gm";
   };
 
+  patchPhase = ''
+    patch interfaces/cc/aspell.h < ${./clang.patch}
+  '';
+
   buildInputs = [ perl ];
 
   doCheck = true;
diff --git a/pkgs/development/libraries/at-spi2-atk/default.nix b/pkgs/development/libraries/at-spi2-atk/default.nix
index 416a33b09a24..959e2c8db0a9 100644
--- a/pkgs/development/libraries/at-spi2-atk/default.nix
+++ b/pkgs/development/libraries/at-spi2-atk/default.nix
@@ -2,14 +2,14 @@
 , intltool, dbus_glib, at_spi2_core, libSM }:
 
 stdenv.mkDerivation rec {
-  versionMajor = "2.12";
+  versionMajor = "2.14";
   versionMinor = "1";
   moduleName   = "at-spi2-atk";
   name = "${moduleName}-${versionMajor}.${versionMinor}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/${moduleName}/${versionMajor}/${name}.tar.xz";
-    sha256 = "5fa9c527bdec028e06797563cd52d49bcf06f638549df983424d88db89bb1336";
+    sha256 = "1jvvs5bb63xa8ip4cvmpmyyc35gyh39bvwn967wabw7dc3m393q5";
   };
 
   buildInputs = [ python pkgconfig popt atk libX11 libICE xlibs.libXtst libXi
diff --git a/pkgs/development/libraries/at-spi2-core/default.nix b/pkgs/development/libraries/at-spi2-core/default.nix
index d60a0ff7480c..7d2710ee8bb7 100644
--- a/pkgs/development/libraries/at-spi2-core/default.nix
+++ b/pkgs/development/libraries/at-spi2-core/default.nix
@@ -1,15 +1,15 @@
 { stdenv, fetchurl, python, pkgconfig, popt, intltool, dbus_glib
 , libX11, xextproto, libSM, libICE, libXtst, libXi, gobjectIntrospection }:
 
-stdenv.mkDerivation (rec {
-  versionMajor = "2.12";
+stdenv.mkDerivation rec {
+  versionMajor = "2.14";
   versionMinor = "0";
   moduleName   = "at-spi2-core";
   name = "${moduleName}-${versionMajor}.${versionMinor}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/${moduleName}/${versionMajor}/${name}.tar.xz";
-    sha256 = "12gvsgdaxnxskndlhlmdkc50cfqgmzfc4n8la9944fz5k3fhwmfv";
+    sha256 = "1j0l4l4qx0i4s9zzwhiwvw3hfjnrbmknvwkzvqpvb5gndqpb01sq";
   };
 
   buildInputs = [
@@ -21,12 +21,10 @@ stdenv.mkDerivation (rec {
   # ToDo: on non-NixOS we create a symlink from there?
   configureFlags = "--with-dbus-daemondir=/run/current-system/sw/bin/";
 
+  NIX_LDFLAGS = with stdenv; lib.optionalString isDarwin "-lintl";
+
   meta = with stdenv.lib; {
     platforms = platforms.linux;
   };
 }
-  // stdenv.lib.optionalAttrs stdenv.isDarwin {
-    NIX_LDFLAGS = "-lintl";
-  }
-)
 
diff --git a/pkgs/development/libraries/atk/default.nix b/pkgs/development/libraries/atk/default.nix
index ce7f92a20354..5b67659ad61c 100644
--- a/pkgs/development/libraries/atk/default.nix
+++ b/pkgs/development/libraries/atk/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, pkgconfig, perl, glib, libintlOrEmpty, gobjectIntrospection }:
 
 let
-  ver_maj = "2.12";
+  ver_maj = "2.14";
   ver_min = "0";
 in
 stdenv.mkDerivation rec {
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://gnome/sources/atk/${ver_maj}/${name}.tar.xz";
-    sha256 = "13zijfcmx7sda83qkryzsmr9hw0r3b73xkagq9cmm733fhcl7a28";
+    sha256 = "1bgvp0isbmf0vb282pncsachqgkrg5zk6an2cv077cdz685wqx98";
   };
 
   buildInputs = libintlOrEmpty;
diff --git a/pkgs/development/libraries/boost/boost-155-clang.patch b/pkgs/development/libraries/boost/boost-155-clang.patch
new file mode 100644
index 000000000000..9c4e3a74cd25
--- /dev/null
+++ b/pkgs/development/libraries/boost/boost-155-clang.patch
@@ -0,0 +1,90 @@
+diff --git a/boost/atomic/detail/cas128strong.hpp b/boost/atomic/detail/cas128strong.hpp
+index 906c13e..dcb4d7d 100644
+--- a/boost/atomic/detail/cas128strong.hpp
++++ b/boost/atomic/detail/cas128strong.hpp
+@@ -196,15 +196,17 @@ class base_atomic<T, void, 16, Sign>
+ 
+ public:
+     BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
+-    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
++    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
+     {
++        memset(&v_, 0, sizeof(v_));
+         memcpy(&v_, &v, sizeof(value_type));
+     }
+ 
+     void
+     store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
+     {
+-        storage_type value_s = 0;
++        storage_type value_s;
++        memset(&value_s, 0, sizeof(value_s));
+         memcpy(&value_s, &value, sizeof(value_type));
+         platform_fence_before_store(order);
+         platform_store128(value_s, &v_);
+@@ -247,7 +249,9 @@ class base_atomic<T, void, 16, Sign>
+         memory_order success_order,
+         memory_order failure_order) volatile BOOST_NOEXCEPT
+     {
+-        storage_type expected_s = 0, desired_s = 0;
++        storage_type expected_s, desired_s;
++        memset(&expected_s, 0, sizeof(expected_s));
++        memset(&desired_s, 0, sizeof(desired_s));
+         memcpy(&expected_s, &expected, sizeof(value_type));
+         memcpy(&desired_s, &desired, sizeof(value_type));
+
+diff --git a/boost/atomic/detail/gcc-atomic.hpp b/boost/atomic/detail/gcc-atomic.hpp
+index a130590..4af99a1 100644
+--- a/boost/atomic/detail/gcc-atomic.hpp
++++ b/boost/atomic/detail/gcc-atomic.hpp
+@@ -958,14 +958,16 @@ class base_atomic<T, void, 16, Sign>
+ 
+ public:
+     BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
+-    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
++    explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
+     {
++        memset(&v_, 0, sizeof(v_));
+         memcpy(&v_, &v, sizeof(value_type));
+     }
+ 
+     void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
+     {
+-        storage_type tmp = 0;
++        storage_type tmp;
++        memset(&tmp, 0, sizeof(tmp));
+         memcpy(&tmp, &v, sizeof(value_type));
+         __atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
+     }
+@@ -980,7 +982,8 @@ class base_atomic<T, void, 16, Sign>
+ 
+     value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
+     {
+-        storage_type tmp = 0;
++        storage_type tmp;
++        memset(&tmp, 0, sizeof(tmp));
+         memcpy(&tmp, &v, sizeof(value_type));
+         tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
+         value_type res;
+@@ -994,7 +997,9 @@ class base_atomic<T, void, 16, Sign>
+         memory_order success_order,
+         memory_order failure_order) volatile BOOST_NOEXCEPT
+     {
+-        storage_type expected_s = 0, desired_s = 0;
++        storage_type expected_s, desired_s;
++        memset(&expected_s, 0, sizeof(expected_s));
++        memset(&desired_s, 0, sizeof(desired_s));
+         memcpy(&expected_s, &expected, sizeof(value_type));
+         memcpy(&desired_s, &desired, sizeof(value_type));
+         const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false,
+@@ -1010,7 +1015,9 @@ class base_atomic<T, void, 16, Sign>
+         memory_order success_order,
+         memory_order failure_order) volatile BOOST_NOEXCEPT
+     {
+-        storage_type expected_s = 0, desired_s = 0;
++        storage_type expected_s, desired_s;
++        memset(&expected_s, 0, sizeof(expected_s));
++        memset(&desired_s, 0, sizeof(desired_s));
+         memcpy(&expected_s, &expected, sizeof(value_type));
+         memcpy(&desired_s, &desired, sizeof(value_type));
+         const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true,
diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix
index c53bb39717e2..2a9cb598f6ea 100644
--- a/pkgs/development/libraries/boost/generic.nix
+++ b/pkgs/development/libraries/boost/generic.nix
@@ -1,5 +1,5 @@
 { stdenv, icu, expat, zlib, bzip2, python, fixDarwinDylibNames
-, toolset ? null
+, toolset ? if stdenv.isDarwin then "clang" else null
 , enableRelease ? true
 , enableDebug ? false
 , enableSingleThreaded ? false
@@ -144,9 +144,7 @@ stdenv.mkDerivation {
     "--with-python=${python}/bin/python"
   ] ++ optional (toolset != null) "--with-toolset=${toolset}";
 
-  buildPhase = ''
-    ${stdenv.lib.optionalString (toolset == "clang") "unset NIX_ENFORCE_PURITY"}
-  '' + builder nativeB2Args;
+  buildPhase = builder nativeB2Args;
 
   installPhase = installer nativeB2Args;
 
diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix
index 6c73b17e6f4e..dd73858c3fc2 100644
--- a/pkgs/development/libraries/cairo/default.nix
+++ b/pkgs/development/libraries/cairo/default.nix
@@ -11,11 +11,11 @@ assert glSupport -> mesa_noglu != null;
 with { inherit (stdenv.lib) optional optionals; };
 
 stdenv.mkDerivation rec {
-  name = "cairo-1.12.16";
+  name = "cairo-1.14.0";
 
   src = fetchurl {
     url = "http://cairographics.org/releases/${name}.tar.xz";
-    sha256 = "0inqwsylqkrzcjivdirkjx5nhdgxbdc62fq284c3xppinfg9a195";
+    sha1 = "53cf589b983412ea7f78feee2e1ba9cea6e3ebae";
   };
 
   nativeBuildInputs = [ pkgconfig ] ++ libintlOrEmpty ++ libiconvOrEmpty;
diff --git a/pkgs/development/libraries/cyrus-sasl/default.nix b/pkgs/development/libraries/cyrus-sasl/default.nix
index 712f05b8d651..391638548fb7 100644
--- a/pkgs/development/libraries/cyrus-sasl/default.nix
+++ b/pkgs/development/libraries/cyrus-sasl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, openssl, db, gettext, pam }:
+{ lib, stdenv, fetchurl, openssl, db, gettext, pam, fixDarwinDylibNames }:
 
 stdenv.mkDerivation rec {
   name = "cyrus-sasl-2.1.26";
@@ -8,7 +8,10 @@ stdenv.mkDerivation rec {
     sha256 = "1hvvbcsg21nlncbgs0cgn3iwlnb3vannzwsp6rwvnn9ba4v53g4g";
   };
 
-  buildInputs = [ openssl db gettext ] ++ stdenv.lib.optional stdenv.isLinux pam;
+  buildInputs =
+    [ openssl db gettext ]
+    ++ lib.optional stdenv.isLinux pam
+    ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
   patches = [ ./missing-size_t.patch ]; # https://bugzilla.redhat.com/show_bug.cgi?id=906519
   patchFlags = "-p0";
@@ -22,7 +25,7 @@ stdenv.mkDerivation rec {
                         )
   '';
 
-  installFlags = if stdenv.isDarwin then [ "framedir=$(out)/Library/Frameworks/SASL2.framework" ] else null;
+  installFlags = lib.optional stdenv.isDarwin [ "framedir=$(out)/Library/Frameworks/SASL2.framework" ];
 
   meta = {
     homepage = "http://cyrusimap.web.cmu.edu/";
diff --git a/pkgs/development/libraries/db/generic.nix b/pkgs/development/libraries/db/generic.nix
index 6217bc461249..9d3f87ad5cb6 100644
--- a/pkgs/development/libraries/db/generic.nix
+++ b/pkgs/development/libraries/db/generic.nix
@@ -18,6 +18,10 @@ stdenv.mkDerivation rec {
 
   patches = extraPatches;
 
+  patchPhase = ''
+    patch src/dbinc/atomic.h < ${./osx.patch}
+  '';
+
   configureFlags = [
     (if cxxSupport then "--enable-cxx" else "--disable-cxx")
     (if compat185 then "--enable-compat185" else "--disable-compat185")
diff --git a/pkgs/development/libraries/db/osx.patch b/pkgs/development/libraries/db/osx.patch
new file mode 100644
index 000000000000..398aa1d37002
--- /dev/null
+++ b/pkgs/development/libraries/db/osx.patch
@@ -0,0 +1,20 @@
+--- src/dbinc/atomic.h	2013-03-12 14:07:22.000000000 -0400
++++ src/dbinc/atomic.h.change	2013-03-12 14:06:35.000000000 -0400
+@@ -144,7 +144,7 @@
+ #define	atomic_inc(env, p)	__atomic_inc(p)
+ #define	atomic_dec(env, p)	__atomic_dec(p)
+ #define	atomic_compare_exchange(env, p, o, n)	\
+-	__atomic_compare_exchange((p), (o), (n))
++	__atomic_compare_exchange_db((p), (o), (n))
+ static inline int __atomic_inc(db_atomic_t *p)
+ {
+ 	int	temp;
+@@ -176,7 +176,7 @@
+  * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
+  * which configure could be changed to use.
+  */
+-static inline int __atomic_compare_exchange(
++static inline int __atomic_compare_exchange_db(
+ 	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
+ {
+ 	atomic_value_t was;
diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix
index a4505c5ae544..31e271277841 100644
--- a/pkgs/development/libraries/dbus/default.nix
+++ b/pkgs/development/libraries/dbus/default.nix
@@ -3,8 +3,8 @@
 , libX11, libICE, libSM, useX11 ? (stdenv.isLinux || stdenv.isDarwin) }:
 
 let
-  version = "1.8.6";
-  sha256 = "0gyjxd0gfpjs3fq5bx6aljb5f3zxky5zsq0yfqr9ywbv03587vgd";
+  version = "1.8.10";
+  sha256 = "13mgvwigm931r8n9363imnn0vn6dvc0m322k3p8fs5c8nvyqggqh";
 
   inherit (stdenv) lib;
 
diff --git a/pkgs/development/libraries/fontconfig/2.10.nix b/pkgs/development/libraries/fontconfig/2.10.nix
new file mode 100644
index 000000000000..2951dbb44d4f
--- /dev/null
+++ b/pkgs/development/libraries/fontconfig/2.10.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchurl, pkgconfig, freetype, expat }:
+
+stdenv.mkDerivation rec {
+  name = "fontconfig-2.10.2";
+
+  src = fetchurl {
+    url = "http://fontconfig.org/release/${name}.tar.bz2";
+    sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
+  };
+
+  infinality_patch =
+    let subvers = "1";
+      in fetchurl {
+        url = http://www.infinality.net/fedora/linux/zips/fontconfig-infinality-1-20130104_1.tar.bz2;
+        sha256 = "1fm5xx0mx2243jrq5rxk4v0ajw2nawpj23399h710bx6hd1rviq7";
+      }
+    ;
+
+  propagatedBuildInputs = [ freetype ];
+  buildInputs = [ pkgconfig expat ];
+
+  configureFlags = [
+    "--sysconfdir=/etc"
+    "--with-cache-dir=/var/cache/fontconfig"
+    "--disable-docs"
+    "--with-default-fonts="
+  ];
+
+  # We should find a better way to access the arch reliably.
+  crossArch = stdenv.cross.arch or null;
+
+  preConfigure = ''
+    if test -n "$crossConfig"; then
+      configureFlags="$configureFlags --with-arch=$crossArch";
+    fi
+  '';
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  # Don't try to write to /var/cache/fontconfig at install time.
+  installFlags = "sysconfdir=$(out)/etc fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
+
+  postInstall = ''
+    cd "$out/etc/fonts" && tar xvf ${infinality_patch}
+  '';
+
+  passthru = {
+    # Empty for backward compatibility, there was no versioning before 2.11
+    configVersion = "";
+  };
+
+  meta = with stdenv.lib; {
+    description = "A library for font customization and configuration";
+    homepage = http://fontconfig.org/;
+    license = licenses.bsd2; # custom but very bsd-like
+    platforms = platforms.all;
+    maintainers = [ maintainers.vcunat ];
+  };
+}
diff --git a/pkgs/development/libraries/fontconfig/builder.sh b/pkgs/development/libraries/fontconfig/builder.sh
deleted file mode 100644
index d755bca64e32..000000000000
--- a/pkgs/development/libraries/fontconfig/builder.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-source $stdenv/setup
-
-configureFlags="--with-confdir=$out/etc/fonts --disable-docs"
-
-genericBuild
diff --git a/pkgs/development/libraries/fontconfig/config-compat.patch b/pkgs/development/libraries/fontconfig/config-compat.patch
new file mode 100644
index 000000000000..e86f08fb553c
--- /dev/null
+++ b/pkgs/development/libraries/fontconfig/config-compat.patch
@@ -0,0 +1,28 @@
+commit 05c6adf8104b4321d3a3716a7b9feb6bf223ed0c (HEAD, nixpkgs)
+Author: Vladimír Čunát <vcunat@gmail.com>
+Date:   Tue Nov 4 12:24:25 2014 +0100
+
+    add check for /etc/fonts/@configVersion@/fonts.conf
+    
+    It's checked between FONTCONFIG_FILE and the usual /etc/fonts/fonts.conf.
+    Also, hardcode /etc/fonts/fonts.conf to prevent accidental override.
+
+diff --git a/src/fccfg.c b/src/fccfg.c
+index 6377fd7..e9eb10a 100644
+--- a/src/fccfg.c
++++ b/src/fccfg.c
+@@ -2070,8 +2070,13 @@ FcConfigFilename (const FcChar8 *url)
+     if (!url || !*url)
+     {
+ 	url = (FcChar8 *) getenv ("FONTCONFIG_FILE");
++	if (!url) {
++	    static const FcChar8 *cfPath = "/etc/fonts/@configVersion@/fonts.conf";
++	    if (access (cfPath, R_OK) == 0)
++		url = cfPath;
++	}
+ 	if (!url)
+-	    url = (FcChar8 *) FONTCONFIG_FILE;
++	    url = (FcChar8 *) "/etc/fonts/fonts.conf";
+     }
+     file = 0;
+ 
diff --git a/pkgs/development/libraries/fontconfig/default.nix b/pkgs/development/libraries/fontconfig/default.nix
index f0c4da755673..72906232eff9 100644
--- a/pkgs/development/libraries/fontconfig/default.nix
+++ b/pkgs/development/libraries/fontconfig/default.nix
@@ -1,11 +1,26 @@
-{ stdenv, fetchurl, pkgconfig, freetype, expat }:
+{ stdenv, fetchurl, fetchpatch, pkgconfig, freetype, expat, libxslt, fontbhttf
+, substituteAll }:
 
+/** Font configuration scheme
+ - ./config-compat.patch makes fontconfig try the following root configs, in order:
+    $FONTCONFIG_FILE, /etc/fonts/${configVersion}/fonts.conf, /etc/fonts/fonts.conf
+    This is done not to override config of pre-2.11 versions (which just blow up)
+    and still use *global* font configuration at both NixOS or non-NixOS.
+ - NixOS creates /etc/fonts/${configVersion}/fonts.conf link to $out/etc/fonts/fonts.conf,
+    and other modifications should go to /etc/fonts/${configVersion}/conf.d
+ - See ./make-fonts-conf.xsl for config details.
+
+*/
+
+let
+  configVersion = "2.11"; # bump whenever fontconfig breaks compatibility with older configurations
+in
 stdenv.mkDerivation rec {
-  name = "fontconfig-2.10.2";
+  name = "fontconfig-2.11.1";
 
   src = fetchurl {
     url = "http://fontconfig.org/release/${name}.tar.bz2";
-    sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
+    sha256 = "16baa4g5lswkyjlyf1h5lwc0zjap7c4d8grw79349a5w6dsl8qnw";
   };
 
   infinality_patch =
@@ -16,14 +31,25 @@ stdenv.mkDerivation rec {
       }
     ;
 
+  patches = [
+    (fetchpatch {
+      url = "http://cgit.freedesktop.org/fontconfig/patch/?id=f44157c809d280e2a0ce87fb078fc4b278d24a67";
+      sha256 = "19s5irclg4irj2yxd7xw9yikbazs9263px8qbv4r21asw06nfalv";
+    })
+    (substituteAll {
+      src = ./config-compat.patch;
+      inherit configVersion;
+    })
+  ];
+
   propagatedBuildInputs = [ freetype ];
   buildInputs = [ pkgconfig expat ];
 
   configureFlags = [
-    "--sysconfdir=/etc"
-    "--with-cache-dir=/var/cache/fontconfig"
+    "--with-cache-dir=/var/cache/fontconfig" # otherwise the fallback is in $out/
     "--disable-docs"
-    "--with-default-fonts="
+    # just ~1MB; this is what you get when loading config fails for some reason
+    "--with-default-fonts=${fontbhttf}"
   ];
 
   # We should find a better way to access the arch reliably.
@@ -40,12 +66,24 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   # Don't try to write to /var/cache/fontconfig at install time.
-  installFlags = "sysconfdir=$(out)/etc fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
+  installFlags = "fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
 
   postInstall = ''
     cd "$out/etc/fonts" && tar xvf ${infinality_patch}
+    rm conf.d/{50-user,51-local}.conf
+    "${libxslt}/bin/xsltproc" --stringparam fontDirectories "${fontbhttf}" \
+      --stringparam fontconfig "$out" \
+      --stringparam fontconfigConfigVersion "${configVersion}" \
+      --path $out/share/xml/fontconfig \
+      ${./make-fonts-conf.xsl} $out/etc/fonts/fonts.conf \
+      > fonts.conf.tmp
+    mv fonts.conf.tmp $out/etc/fonts/fonts.conf
   '';
 
+  passthru = {
+    inherit configVersion;
+  };
+
   meta = with stdenv.lib; {
     description = "A library for font customization and configuration";
     homepage = http://fontconfig.org/;
@@ -54,3 +92,4 @@ stdenv.mkDerivation rec {
     maintainers = [ maintainers.vcunat ];
   };
 }
+
diff --git a/pkgs/development/libraries/fontconfig/make-fonts-conf.nix b/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
index f9cd096f559b..2b02e0df7a04 100644
--- a/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
+++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.nix
@@ -1,13 +1,15 @@
-{ runCommand, libxslt, fontconfig, fontDirectories }:
+{ runCommand, libxslt, fontconfig, fontbhttf, fontDirectories }:
 
 runCommand "fonts.conf"
   {
     buildInputs = [ libxslt fontconfig ];
-    inherit fontDirectories;
+    # Add a default font for non-nixos systems. fontbhttf is only about 1mb.
+    fontDirectories = fontDirectories ++ [ fontbhttf ];
   }
   ''
     xsltproc --stringparam fontDirectories "$fontDirectories" \
       --stringparam fontconfig "${fontconfig}" \
+      --stringparam fontconfigConfigVersion "${fontconfig.configVersion}" \
       --path ${fontconfig}/share/xml/fontconfig \
       ${./make-fonts-conf.xsl} ${fontconfig}/etc/fonts/fonts.conf \
       > $out
diff --git a/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
index e3938663c9b4..03f7815e38ad 100644
--- a/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
+++ b/pkgs/development/libraries/fontconfig/make-fonts-conf.xsl
@@ -16,25 +16,37 @@
 
   <xsl:param name="fontDirectories" />
   <xsl:param name="fontconfig" />
+  <xsl:param name="fontconfigConfigVersion" />
 
   <xsl:template match="/fontconfig">
 
     <fontconfig>
       <xsl:apply-templates select="child::node()[name() != 'dir' and name() != 'cachedir' and name() != 'include']" />
 
-      <include ignore_missing="yes">/etc/fonts/conf.d</include>
+      <!-- fontconfig distribution conf.d -->
       <include><xsl:value-of select="$fontconfig" />/etc/fonts/conf.d</include>
-
+      <!-- versioned system-wide config -->
+      <include ignore_missing="yes">/etc/fonts/<xsl:value-of select="$fontconfigConfigVersion" />/conf.d</include>
+      <!-- look into user config -->
+      <include prefix="xdg" ignore_missing="yes">fontconfig/conf.d</include>
+
+      <!-- the first cachedir will be used to store the cache -->
+      <cachedir prefix="xdg">fontconfig</cachedir>
+      <!-- /var/cache/fontconfig is useful for non-nixos systems -->
       <cachedir>/var/cache/fontconfig</cachedir>
-      <cachedir>~/.fontconfig</cachedir>
 
+      <dir prefix="xdg">fonts</dir>
       <xsl:for-each select="str:tokenize($fontDirectories)">
         <dir><xsl:value-of select="." /></dir>
         <xsl:text>&#0010;</xsl:text>
       </xsl:for-each>
-      <dir prefix="xdg">fonts</dir>
-      <!-- the following element will be removed in the future -->
-      <dir>~/.fonts</dir>
+
+      <!-- nix user profile -->
+      <dir>~/.nix-profile/lib/X11/fonts</dir>
+      <dir>~/.nix-profile/share/fonts</dir>
+      <!-- nix default profile -->
+      <dir>/nix/var/nix/profiles/default/lib/X11/fonts</dir>
+      <dir>/nix/var/nix/profiles/default/share/fonts</dir>
 
     </fontconfig>
 
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 839ba7cfa951..4df07c8f6b86 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -39,8 +39,8 @@ let
     ln -sr -t "$out/include/" "$out"/lib/*/include/* 2>/dev/null || true
   '';
 
-  ver_maj = "2.40";
-  ver_min = "0";
+  ver_maj = "2.42";
+  ver_min = "1";
 in
 
 stdenv.mkDerivation rec {
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://gnome/sources/glib/${ver_maj}/${name}.tar.xz";
-    sha256 = "1d98mbqjmc34s8095lkw1j1bwvnnkw9581yfvjaikjvfjsaz29qd";
+    sha256 = "16pqvikrps1fvwwqvk0qi4a13mfg7gw6w5qfhk7bhi8f51jhhgwg";
   };
 
   patches = optional stdenv.isDarwin ./darwin-compilation.patch ++ optional doCheck ./skip-timer-test.patch;
@@ -77,6 +77,7 @@ stdenv.mkDerivation rec {
     '';
 
   enableParallelBuilding = true;
+  DETERMINISTIC_BUILD = 1;
 
   inherit doCheck;
   preCheck = optionalString doCheck
diff --git a/pkgs/development/libraries/glibc/2.19/common.nix b/pkgs/development/libraries/glibc/2.19/common.nix
index a828148c3d5f..23efc01a3975 100644
--- a/pkgs/development/libraries/glibc/2.19/common.nix
+++ b/pkgs/development/libraries/glibc/2.19/common.nix
@@ -61,17 +61,28 @@ stdenv.mkDerivation ({
 
       ./cve-2014-0475.patch
       ./cve-2014-5119.patch
+
+      /* Remove references to the compilation date.  */
+      ./glibc-remove-date-from-compilation-banner.patch
     ];
 
-  postPatch = ''
+  postPatch =
     # Needed for glibc to build with the gnumake 3.82
     # http://comments.gmane.org/gmane.linux.lfs.support/31227
-    sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile
-
+    ''
+      sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile
+    ''
     # nscd needs libgcc, and we don't want it dynamically linked
     # because we don't want it to depend on bootstrap-tools libs.
-    echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
-  '';
+    + ''
+      echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
+    ''
+    # Replace the date and time in nscd by $out.
+    #  It is used as a protocol compatibility check.
+    + ''
+      cat ${./glibc-remove-datetime-from-nscd.patch} \
+        | sed "s,@out@,$out," | patch -p1
+    '';
 
   configureFlags =
     [ "-C"
diff --git a/pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch b/pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch
new file mode 100644
index 000000000000..5d0b1a51762e
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch
@@ -0,0 +1,12 @@
+diff -ur glibc-2.17.orig/csu/Makefile glibc-2.17/csu/Makefile
+--- glibc-2.17.orig/csu/Makefile	2012-12-25 04:02:13.000000000 +0100
++++ glibc-2.17/csu/Makefile	2013-08-19 16:01:57.132378550 +0200
+@@ -172,7 +172,7 @@
+ 		     os=Linux; \
+ 		   fi; \
+ 		   printf '"Compiled on a %s %s system on %s.\\n"\n' \
+-			  "$$os" "$$version" "`date +%Y-%m-%d`";; \
++			  "$$os" "$$version";; \
+ 	   *) ;; \
+ 	 esac; \
+ 	 files="$(all-Banner-files)";				\
diff --git a/pkgs/development/libraries/glibc/2.19/glibc-remove-datetime-from-nscd.patch b/pkgs/development/libraries/glibc/2.19/glibc-remove-datetime-from-nscd.patch
new file mode 100644
index 000000000000..0a5456ea5c42
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.19/glibc-remove-datetime-from-nscd.patch
@@ -0,0 +1,11 @@
+--- a/nscd/nscd_stat.c
++++ b/nscd/nscd_stat.c
+@@ -37,7 +37,7 @@
+ 
+ 
+ /* We use this to make sure the receiver is the same.  */
+-static const char compilation[21] = __DATE__ " " __TIME__;
++static const char compilation[21] = "@out@";
+ 
+ /* Statistic data for one database.  */
+ struct dbstat
diff --git a/pkgs/development/libraries/gmp/5.1.x.nix b/pkgs/development/libraries/gmp/5.1.x.nix
index 14a6d34d932b..e9495b796dd2 100644
--- a/pkgs/development/libraries/gmp/5.1.x.nix
+++ b/pkgs/development/libraries/gmp/5.1.x.nix
@@ -16,10 +16,13 @@ stdenv.mkDerivation (rec {
     # Build a "fat binary", with routines for several sub-architectures
     # (x86), except on Solaris where some tests crash with "Memory fault".
     # See <http://hydra.nixos.org/build/2760931>, for instance.
+    #
+    # no darwin because gmp uses ASM that clang doesn't like
     optional (!stdenv.isSunOS) "--enable-fat"
     ++ (if cxx then [ "--enable-cxx"  ]
                else [ "--disable-cxx" ])
     ++ optional (cxx && stdenv.isDarwin) "CPPFLAGS=-fexceptions"
+    ++ optional stdenv.isDarwin "ABI=64"
     ++ optional stdenv.is64bit "--with-pic"
     ;
 
diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix
index 4b7ec1f41163..0d4103640ad0 100644
--- a/pkgs/development/libraries/gobject-introspection/default.nix
+++ b/pkgs/development/libraries/gobject-introspection/default.nix
@@ -5,7 +5,7 @@
 # In that case its about 6MB which could be separated
 
 let
-  ver_maj = "1.40";
+  ver_maj = "1.42";
   ver_min = "0";
 in
 stdenv.mkDerivation rec {
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://gnome/sources/gobject-introspection/${ver_maj}/${name}.tar.xz";
-    sha256 = "162flbzwzz0b8axab2gimc4dglpaw88fh1d177zfg0whczlpbsln";
+    sha256 = "1xwm7wmr9r9wp6xljb3bckx3a4siybavaq39w46ly7gpskxfv8iv";
   };
 
   buildInputs = [ flex bison glib pkgconfig python ]
diff --git a/pkgs/development/libraries/gstreamer/bad/default.nix b/pkgs/development/libraries/gstreamer/bad/default.nix
index a02af7f0cd75..a573dc561fdc 100644
--- a/pkgs/development/libraries/gstreamer/bad/default.nix
+++ b/pkgs/development/libraries/gstreamer/bad/default.nix
@@ -5,12 +5,13 @@
 , openjpeg, libopus, librsvg
 , wildmidi, fluidsynth, libvdpau, wayland
 , libwebp, xvidcore, gnutls
+, mesa
 }:
 
 assert faacSupport -> faac != null;
 
 stdenv.mkDerivation rec {
-  name = "gst-plugins-bad-1.4.1";
+  name = "gst-plugins-bad-1.4.3";
 
   meta = with stdenv.lib; {
     description = "Gstreamer Bad Plugins";
@@ -28,7 +29,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}/src/gst-plugins-bad/${name}.tar.xz";
-    sha256 = "0268db2faaf0bb22e5b709a11633abbca4f3d289b1f513bb262d0bf3f53e19ae";
+    sha256 = "a6840080c469d0db51d6d4d0f7c42c97b3c8c01942f24401c61b1ad36726b97c";
   };
 
   nativeBuildInputs = [ pkgconfig python ];
@@ -36,9 +37,9 @@ stdenv.mkDerivation rec {
   buildInputs = [
     gst-plugins-base orc
     faad2 libass libkate libmms
-    libmodplug mpeg2dec mpg123 
+    libmodplug mpeg2dec mpg123
     openjpeg libopus librsvg
     wildmidi fluidsynth libvdpau wayland
-    libwebp xvidcore gnutls
+    libwebp xvidcore gnutls mesa
   ] ++ stdenv.lib.optional faacSupport faac;
 }
diff --git a/pkgs/development/libraries/gstreamer/base/default.nix b/pkgs/development/libraries/gstreamer/base/default.nix
index 3b9e94f4c658..854fa8f0c349 100644
--- a/pkgs/development/libraries/gstreamer/base/default.nix
+++ b/pkgs/development/libraries/gstreamer/base/default.nix
@@ -4,7 +4,7 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "gst-plugins-base-1.4.1";
+  name = "gst-plugins-base-1.4.3";
 
   meta = {
     description = "Base plugins and helper libraries";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}/src/gst-plugins-base/${name}.tar.xz";
-    sha256 = "aea9e25be6691bd3cc0785d005b2b5d70ce313a2c897901680a3f7e7cab5a499";
+    sha256 = "f7b4d2b3ba2bcac485896e2c1c36459cb091ebe8b49e91635c27d40f66792d9d";
   };
 
   nativeBuildInputs = [
diff --git a/pkgs/development/libraries/gstreamer/core/default.nix b/pkgs/development/libraries/gstreamer/core/default.nix
index 8e9a2b87a017..5ab1ec6a31f5 100644
--- a/pkgs/development/libraries/gstreamer/core/default.nix
+++ b/pkgs/development/libraries/gstreamer/core/default.nix
@@ -3,7 +3,7 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "gstreamer-1.4.1";
+  name = "gstreamer-1.4.3";
 
   meta = {
     description = "Open source multimedia framework";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}/src/gstreamer/${name}.tar.xz";
-    sha256 = "5638f75003282135815c0077d491da11e9a884ad91d4ba6ab3cc78bae0fb452e";
+    sha256 = "11f155784d28b85a12b50d2fc8f91c6b75d9ca325cc76aaffba1a58d4c9549c9";
   };
 
   nativeBuildInputs = [
diff --git a/pkgs/development/libraries/gstreamer/core/setup-hook.sh b/pkgs/development/libraries/gstreamer/core/setup-hook.sh
index 04863ab3b612..3dd7812ece6d 100644
--- a/pkgs/development/libraries/gstreamer/core/setup-hook.sh
+++ b/pkgs/development/libraries/gstreamer/core/setup-hook.sh
@@ -5,5 +5,5 @@ addGstreamer1LibPath () {
     fi
 }
 
-envHooks=(${envHooks[@]} addGstreamer1LibPath)
+envHooks+=(addGstreamer1LibPath)
 
diff --git a/pkgs/development/libraries/gstreamer/ges/default.nix b/pkgs/development/libraries/gstreamer/ges/default.nix
index daf2ba59a406..df7078a1365a 100644
--- a/pkgs/development/libraries/gstreamer/ges/default.nix
+++ b/pkgs/development/libraries/gstreamer/ges/default.nix
@@ -3,7 +3,7 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "gstreamer-editing-services-1.2.1";
+  name = "gstreamer-editing-services-1.4.0";
 
   meta = with stdenv.lib; {
     description = "Library for creation of audio/video non-linear editors";
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}/src/gstreamer-editing-services/${name}.tar.xz";
-    sha256 = "1c20zg272wgzqw4f93f1prkv9a9gdqxmf3kal29l0r2wmwhqnxpy";
+    sha256 = "1cwbh244an6zsxsscvg6xjnb34ylci34g9zx59xjbv5wnw7vj86c";
   };
 
   nativeBuildInputs = [ pkgconfig python gobjectIntrospection ];
diff --git a/pkgs/development/libraries/gstreamer/gnonlin/default.nix b/pkgs/development/libraries/gstreamer/gnonlin/default.nix
index 44bb1c48c81d..05113973a9d1 100644
--- a/pkgs/development/libraries/gstreamer/gnonlin/default.nix
+++ b/pkgs/development/libraries/gstreamer/gnonlin/default.nix
@@ -3,7 +3,7 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "gnonlin-1.2.1";
+  name = "gnonlin-1.4.0";
 
   meta = with stdenv.lib; {
     description = "Gstreamer Non-Linear Multimedia Editing Plugins";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}/src/gnonlin/${name}.tar.xz";
-    sha256 = "14zb3bz3xn40a2kns719amrr77cp6wyxddml621kyxc424ihcw3q";
+    sha256 = "0zv60rq2h736a6fivd3a3wp59dj1jar7b2vwzykahvl168b7wrid";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/development/libraries/gstreamer/good/default.nix b/pkgs/development/libraries/gstreamer/good/default.nix
index 176814c5ecd1..72a14b50606c 100644
--- a/pkgs/development/libraries/gstreamer/good/default.nix
+++ b/pkgs/development/libraries/gstreamer/good/default.nix
@@ -7,7 +7,7 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "gst-plugins-good-1.4.1";
+  name = "gst-plugins-good-1.4.3";
 
   meta = with stdenv.lib; {
     description = "Gstreamer Good Plugins";
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}/src/gst-plugins-good/${name}.tar.xz";
-    sha256 = "8559d4270065b30ed5c49b826e1b7a3a2bd5ee9a340ae745a2ae3f9718e4c637";
+    sha256 = "5876a74402f2a24d1d3ae9163c32466bdc7a565696dddeef65e6a9a93efc5537";
   };
 
   nativeBuildInputs = [ pkgconfig python ];
diff --git a/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix
index c3d2d7016daf..3382ae783f28 100644
--- a/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix
+++ b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     sha256 = "1ijswgcrdp243mfsyza31fpzq6plz40p4b83vkr2x4x7807889vy";
   };
 
-  patches = [ ./v4l.patch ];
+  patches = [ ./v4l.patch ./linux-headers-3.9.patch ];
 
   configureFlags = "--disable-oss";
 
diff --git a/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/linux-headers-3.9.patch b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/linux-headers-3.9.patch
new file mode 100644
index 000000000000..f13d3a166714
--- /dev/null
+++ b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/linux-headers-3.9.patch
@@ -0,0 +1,27 @@
+http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-plugins/gst-plugins-v4l2/files/gst-plugins-v4l2-0.10.31-linux-headers-3.9.patch
+
+From 8e633d2059cb835448021cf79becb487aff10975 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess@hadess.net>
+Date: Mon, 18 Mar 2013 14:59:35 +0000
+Subject: v4l2: fix compilation against newer kernel headers as on FC19
+
+---
+diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c
+index 07d390a..4c10f4f 100644
+--- a/sys/v4l2/v4l2_calls.c
++++ b/sys/v4l2/v4l2_calls.c
+@@ -291,8 +291,12 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
+         break;
+       case V4L2_CID_HFLIP:
+       case V4L2_CID_VFLIP:
++#ifndef V4L2_CID_PAN_RESET
+       case V4L2_CID_HCENTER:
++#endif
++#ifndef V4L2_CID_TILT_RESET
+       case V4L2_CID_VCENTER:
++#endif
+ #ifdef V4L2_CID_PAN_RESET
+       case V4L2_CID_PAN_RESET:
+ #endif
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh b/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
index 10671f9d227c..e89aeda5bc1c 100644
--- a/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
+++ b/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
@@ -5,4 +5,4 @@ addGstreamerLibPath () {
     fi
 }
 
-envHooks=(${envHooks[@]} addGstreamerLibPath)
+envHooks+=(addGstreamerLibPath)
diff --git a/pkgs/development/libraries/gstreamer/libav/default.nix b/pkgs/development/libraries/gstreamer/libav/default.nix
index e25492c1d13b..0e8f0684f7be 100644
--- a/pkgs/development/libraries/gstreamer/libav/default.nix
+++ b/pkgs/development/libraries/gstreamer/libav/default.nix
@@ -6,7 +6,7 @@
 assert withSystemLibav -> libav != null;
 
 stdenv.mkDerivation rec {
-  name = "gst-libav-1.4.1";
+  name = "gst-libav-1.4.3";
 
   meta = {
     homepage = "http://gstreamer.freedesktop.org";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}/src/gst-libav/${name}.tar.xz";
-    sha256 = "fc125521187fa84f3210269a0eecc51f8a856802f1ca4bb251f118dab90c5a9d";
+    sha256 = "833229d2b1aad6549ad0297435516508cc3ac47b166d6393ecdffc34c31a01d3";
   };
 
   configureFlags = stdenv.lib.optionalString withSystemLibav
diff --git a/pkgs/development/libraries/gstreamer/python/default.nix b/pkgs/development/libraries/gstreamer/python/default.nix
index fad8308703b3..a91b5d81bb32 100644
--- a/pkgs/development/libraries/gstreamer/python/default.nix
+++ b/pkgs/development/libraries/gstreamer/python/default.nix
@@ -3,14 +3,14 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "gst-python-1.2.1";
+  name = "gst-python-1.4.0";
 
   src = fetchurl {
     urls = [
-      "${meta.homepage}/src/gst-python/${name}.tar.bz2"
-      "mirror://gentoo/distfiles/${name}.tar.bz2"
+      "${meta.homepage}/src/gst-python/${name}.tar.xz"
+      "mirror://gentoo/distfiles/${name}.tar.xz"
       ];
-    sha256 = "1m7gh017f70i5pg6k9sx54ihwaizvi2dlli687gi44n5zylya8w8";
+    sha256 = "0gixsp46mv7fvhk669q60wfk9w2lc02sdb1qipq066xlrqlhrr5i";
   };
 
   patches = [ ./different-path-with-pygobject.patch ];
diff --git a/pkgs/development/libraries/gstreamer/ugly/default.nix b/pkgs/development/libraries/gstreamer/ugly/default.nix
index 6a80514e8a1c..b04c62021e4a 100644
--- a/pkgs/development/libraries/gstreamer/ugly/default.nix
+++ b/pkgs/development/libraries/gstreamer/ugly/default.nix
@@ -5,7 +5,7 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "gst-plugins-ugly-1.4.1";
+  name = "gst-plugins-ugly-1.4.3";
 
   meta = with stdenv.lib; {
     description = "Gstreamer Ugly Plugins";
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${meta.homepage}/src/gst-plugins-ugly/${name}.tar.xz";
-    sha256 = "25440435ac4ed795d213f2420a0e7355e4a2e2e76d1f9d020b2073f815e8b071";
+    sha256 = "d581592a82cf3930361430d38436c30a58d8b6c249cad18f7f213b203e206d46";
   };
 
   nativeBuildInputs = [ pkgconfig python ];
diff --git a/pkgs/development/libraries/gtk+/2.x.nix b/pkgs/development/libraries/gtk+/2.x.nix
index ff4d6ca67336..b95de7105be4 100644
--- a/pkgs/development/libraries/gtk+/2.x.nix
+++ b/pkgs/development/libraries/gtk+/2.x.nix
@@ -8,11 +8,11 @@ assert xineramaSupport -> xlibs.libXinerama != null;
 assert cupsSupport -> cups != null;
 
 stdenv.mkDerivation rec {
-  name = "gtk+-2.24.24";
+  name = "gtk+-2.24.25";
 
   src = fetchurl {
     url = "mirror://gnome/sources/gtk+/2.24/${name}.tar.xz";
-    sha256 = "0v9xxpkypizy9k866rvqc36zvj4kj9p8nd1nxf9znay8k3hv5khj";
+    sha256 = "38af1020cb8ff3d10dda2c8807f11e92af9d2fa4045de61c62eedb7fbc7ea5b3";
   };
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/libraries/libav/default.nix b/pkgs/development/libraries/libav/default.nix
index ce0b0d5d755f..1313bc3feebc 100644
--- a/pkgs/development/libraries/libav/default.nix
+++ b/pkgs/development/libraries/libav/default.nix
@@ -28,7 +28,7 @@ let
   result = {
     libav_0_8 = libavFun "0.8.16" "df88b8f7d04d47edea8b19d80814227f0c058e57";
     libav_9   = libavFun   "9.17" "5899d51947b62f6b0cf9795ec2330d5ed59a3273";
-    libav_10  = libavFun  "10.5"  "925a45d2700a436c28e0b663510fc8df5bb7e861";
+    libav_11  = libavFun  "11"    "21f3c7c2154c0ad703872f2faa65ef20d6b7a14f";
   };
 
   libavFun = version : sha1 : stdenv.mkDerivation rec {
diff --git a/pkgs/development/libraries/libc++/darwin.patch b/pkgs/development/libraries/libc++/darwin.patch
new file mode 100644
index 000000000000..bf83f169cfc3
--- /dev/null
+++ b/pkgs/development/libraries/libc++/darwin.patch
@@ -0,0 +1,30 @@
+diff -ru -x '*~' libcxx-3.4.2.src-orig/lib/CMakeLists.txt libcxx-3.4.2.src/lib/CMakeLists.txt
+--- libcxx-3.4.2.src-orig/lib/CMakeLists.txt	2013-11-15 18:18:57.000000000 +0100
++++ libcxx-3.4.2.src/lib/CMakeLists.txt	2014-09-24 14:04:01.000000000 +0200
+@@ -56,7 +56,7 @@
+       "-compatibility_version 1"
+       "-current_version ${LIBCXX_VERSION}"
+       "-install_name /usr/lib/libc++.1.dylib"
+-      "-Wl,-reexport_library,/usr/lib/libc++abi.dylib"
++      "-Wl,-reexport_library,${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib"
+       "-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
+       "/usr/lib/libSystem.B.dylib")
+   else()
+@@ -64,14 +64,14 @@
+       list(FIND ${CMAKE_OSX_ARCHITECTURES} "armv7" OSX_HAS_ARMV7)
+       if (OSX_HAS_ARMV7)
+         set(OSX_RE_EXPORT_LINE
+-          "${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"
++          "${CMAKE_OSX_SYSROOT}${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib"
+           "-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp")
+       else()
+         set(OSX_RE_EXPORT_LINE
+-          "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib")
++          "-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib")
+       endif()
+     else()
+-      set (OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
++      set (OSX_RE_EXPORT_LINE "${LIBCXX_LIBCXXABI_LIB_PATH}/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
+     endif()
+ 
+     list(APPEND link_flags
diff --git a/pkgs/development/libraries/libc++/default.nix b/pkgs/development/libraries/libc++/default.nix
index 21a07d6f7d4b..99e9bfe1de2e 100644
--- a/pkgs/development/libraries/libc++/default.nix
+++ b/pkgs/development/libraries/libc++/default.nix
@@ -1,9 +1,8 @@
-{ stdenv, fetchurl, fetchsvn, cmake, libcxxabi, python }:
+{ lib, stdenv, fetchurl, cmake, libcxxabi, fixDarwinDylibNames }:
 
-let
-  version = "3.4.2";
+let version = "3.4.2"; in
 
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "libc++-${version}";
 
   src = fetchurl {
@@ -11,21 +10,32 @@ in stdenv.mkDerivation rec {
     sha256 = "0z3jdvgcq995khkpis5c5vaxhbmvbqjlalbhn09k6pgb5zp46rc2";
   };
 
-  buildInputs = [ cmake libcxxabi python ];
+  patches = [ ./darwin.patch ];
 
-  cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release"
-                 "-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=${libcxxabi}/include"
-                 "-DLIBCXX_CXX_ABI=libcxxabi" ];
+  buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  cmakeFlags =
+    [ "-DCMAKE_BUILD_TYPE=Release"
+      "-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=${libcxxabi}/include"
+      "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
+      "-DLIBCXX_LIBCPPABI_VERSION=2"
+      "-DLIBCXX_CXX_ABI=libcxxabi"
+    ];
 
   enableParallelBuilding = true;
 
-  passthru.abi = libcxxabi;
+  inherit libcxxabi;
+
+  # Remove a Makefile that causes many retained dependencies.
+  postInstall = "rm $out/include/c++/v1/Makefile";
+
+  setupHook = ./setup-hook.sh;
 
   meta = {
     homepage = http://libcxx.llvm.org/;
     description = "A new implementation of the C++ standard library, targeting C++11";
     license = "BSD";
     maintainers = [ stdenv.lib.maintainers.shlevy ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libc++/setup-hook.sh b/pkgs/development/libraries/libc++/setup-hook.sh
new file mode 100644
index 000000000000..8543d09d8f52
--- /dev/null
+++ b/pkgs/development/libraries/libc++/setup-hook.sh
@@ -0,0 +1,2 @@
+export NIX_CFLAGS_COMPILE+=" -isystem @out@/include/c++/v1 -stdlib=libc++"
+export NIX_CFLAGS_LINK+=" -stdlib=libc++ -Wl,-rpath,@libcxxabi@/lib"
diff --git a/pkgs/development/libraries/libc++abi/darwin.patch b/pkgs/development/libraries/libc++abi/darwin.patch
new file mode 100644
index 000000000000..53ea8783f7a8
--- /dev/null
+++ b/pkgs/development/libraries/libc++abi/darwin.patch
@@ -0,0 +1,17 @@
+diff -ru -x '*~' libcxxabi-orig/lib/buildit libcxxabi/lib/buildit
+--- libcxxabi-orig/lib/buildit	2014-09-18 16:54:14.000000000 +0200
++++ libcxxabi/lib/buildit	2014-09-24 13:22:27.000000000 +0200
+@@ -51,12 +51,8 @@
+         -dynamiclib -nodefaultlibs  \
+         -current_version ${RC_ProjectSourceVersion} \
+         -compatibility_version 1 \
+-        -install_name /usr/lib/libc++abi.dylib \
++        -install_name $out/lib/libc++abi.dylib \
+         -lSystem"
+-	if [ -f "${SDKROOT}/usr/local/lib/libCrashReporterClient.a" ]
+-	then
+-		LDSHARED_FLAGS+=" -lCrashReporterClient"
+-	fi
+     ;;
+   *-*-mingw*)
+     # FIXME: removing libgcc and libsupc++ dependencies means porting libcxxrt and LLVM/compiler-rt
diff --git a/pkgs/development/libraries/libc++abi/default.nix b/pkgs/development/libraries/libc++abi/default.nix
index dd1f46a9ab38..68db6a5dc6c1 100644
--- a/pkgs/development/libraries/libc++abi/default.nix
+++ b/pkgs/development/libraries/libc++abi/default.nix
@@ -1,31 +1,42 @@
-{ stdenv, fetchsvn, libcxx, libunwind }:
-let
-  rev = "199626";
-in stdenv.mkDerivation {
-  name = "libcxxabi-pre-${rev}";
-
-  src = fetchsvn {
-    url = http://llvm.org/svn/llvm-project/libcxxabi/trunk;
-    rev = "199626";
-    sha256 = "0h1x1s40x5r65ar53rv34lmgcfil3zxaknqr64dka1mz29xhhrxy";
+{ lib, stdenv, fetchurl, libcxx, coreutils, gnused }:
+
+let rev = "199626"; in
+
+stdenv.mkDerivation {
+  name = "libc++abi-${rev}";
+
+  src = fetchurl {
+    url = "http://tarballs.nixos.org/libcxxabi-${rev}.tar.bz2";
+    sha256 = "09wr6qwgmdzbmgfkdzfhph9giy0zd6fp3s017fcfy4g0prjn5s4c";
   };
 
-  NIX_CFLAGS_LINK="-L${libunwind}/lib -lunwind";
+  patches = [ ./no-stdc++.patch ./darwin.patch ];
+
+  buildInputs = [ coreutils ];
 
   postUnpack = ''
     unpackFile ${libcxx.src}
-    export NIX_CFLAGS_COMPILE="-I${libunwind}/include -I$PWD/include -I$(readlink -f libcxx-*)/include"
-  '';
-
-  installPhase = ''
-    install -d -m 755 $out/include $out/lib
-    install -m 644 lib/libc++abi.so.1.0 $out/lib
-    install -m 644 include/cxxabi.h $out/include
-    ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
-    ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
+  '' + lib.optionalString stdenv.isDarwin ''
+    export TRIPLE=x86_64-apple-darwin
+    # Hack: NIX_CFLAGS_COMPILE doesn't work here because clang++ isn't
+    # wrapped at this point.
+    export CXX="clang++ -D_LIBCXX_DYNAMIC_FALLBACK=1"
+    unset SDKROOT
   '';
 
-  patchPhase = "sed -e s,-lstdc++,, -i lib/buildit";
+  installPhase = if stdenv.isDarwin
+    then ''
+      install -d -m 755 $out/include $out/lib
+      install -m 644 lib/libc++abi.dylib $out/lib
+      install -m 644 include/cxxabi.h $out/include
+    ''
+    else ''
+      install -d -m 755 $out/include $out/lib
+      install -m 644 lib/libc++abi.so.1.0 $out/lib
+      install -m 644 include/cxxabi.h $out/include
+      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
+      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
+    '';
 
   buildPhase = "(cd lib; ./buildit)";
 
@@ -34,6 +45,6 @@ in stdenv.mkDerivation {
     description = "A new implementation of low level support for a standard C++ library";
     license = "BSD";
     maintainers = [ stdenv.lib.maintainers.shlevy ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libc++abi/no-stdc++.patch b/pkgs/development/libraries/libc++abi/no-stdc++.patch
new file mode 100644
index 000000000000..ddc9778a486e
--- /dev/null
+++ b/pkgs/development/libraries/libc++abi/no-stdc++.patch
@@ -0,0 +1,12 @@
+diff -ru -x '*~' libcxxabi-orig/lib/buildit libcxxabi/lib/buildit
+--- libcxxabi-orig/lib/buildit	2014-09-18 16:54:14.000000000 +0200
++++ libcxxabi/lib/buildit	2014-09-24 13:22:27.000000000 +0200
+@@ -70,7 +66,7 @@
+     SOEXT=so
+     LDSHARED_FLAGS="-o libc++abi.so.1.0 \
+         -shared -nodefaultlibs -Wl,-soname,libc++abi.so.1 \
+-        -lpthread -lrt -lc -lstdc++"
++        -lpthread -lrt -lc"
+     ;;
+ esac
+ 
diff --git a/pkgs/development/libraries/libdevil/default.nix b/pkgs/development/libraries/libdevil/default.nix
index d3053b4d2a5f..6cbbddfdba83 100644
--- a/pkgs/development/libraries/libdevil/default.nix
+++ b/pkgs/development/libraries/libdevil/default.nix
@@ -16,6 +16,15 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--enable-ILU" "--enable-ILUT" ];
 
+  preConfigure = ''
+    sed -i 's, -std=gnu99,,g' configure
+    sed -i 's,malloc.h,stdlib.h,g' src-ILU/ilur/ilur.c
+  '';
+
+  postConfigure = ''
+    sed -i '/RESTRICT_KEYWORD/d' include/IL/config.h
+  '';
+
   patches =
     [ ( fetchurl {
         url = http://patch-tracker.debian.org/patch/series/dl/devil/1.7.8-6.1/03_CVE-2009-3994.diff;
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index d7a6f8d54430..12e25b03a7b0 100644
--- a/pkgs/development/libraries/libdrm/default.nix
+++ b/pkgs/development/libraries/libdrm/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, pkgconfig, libpthreadstubs, libpciaccess, udev }:
 
 stdenv.mkDerivation rec {
-  name = "libdrm-2.4.56";
+  name = "libdrm-2.4.58";
 
   src = fetchurl {
     url = "http://dri.freedesktop.org/libdrm/${name}.tar.bz2";
-    sha256 = "0c20wpfa94d8kww0f2xinmm4axsl4nhq921xj4i88yhpjbhbn3z2";
+    sha256 = "b155fae6b9c9a3b02ef8b77f58c7c219194c996a4018dc55ba66c03996a365dd";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/development/libraries/libedit/default.nix b/pkgs/development/libraries/libedit/default.nix
index 27c803fd81e0..f913ab8e4938 100644
--- a/pkgs/development/libraries/libedit/default.nix
+++ b/pkgs/development/libraries/libedit/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   NROFF = "${groff}/bin/nroff";
 
   postInstall = ''
-    sed -i s/-lncurses/-lncursesw/g $out/lib/pkgconfig/libedit.pc
+    sed -i ${stdenv.lib.optionalString (stdenv.isDarwin && stdenv.gcc.nativeTools) "''"} s/-lncurses/-lncursesw/g $out/lib/pkgconfig/libedit.pc
   '';
 
   configureFlags = [ "--enable-widec" ];
diff --git a/pkgs/development/libraries/libevdev/default.nix b/pkgs/development/libraries/libevdev/default.nix
index 89b276102192..5dac8f888959 100644
--- a/pkgs/development/libraries/libevdev/default.nix
+++ b/pkgs/development/libraries/libevdev/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     description = "Wrapper library for evdev devices";
-    homepage = http://www.freedesktop.org/software/libevdev/doc/latest/index.html; 
+    homepage = http://www.freedesktop.org/software/libevdev/doc/latest/index.html;
     license = licenses.mit;
     platforms = platforms.linux;
     maintainers = [ maintainers.amorsillo ];
diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix
index 6810c8665a77..ded6dbf25c81 100644
--- a/pkgs/development/libraries/libffi/default.nix
+++ b/pkgs/development/libraries/libffi/default.nix
@@ -16,13 +16,14 @@ stdenv.mkDerivation rec {
     "--with-gcc-arch=generic" # no detection of -march= or -mtune=
   ] ++ stdenv.lib.optional (stdenv.needsPax) "--enable-pax_emutramp";
 
-  doCheck = stdenv.isLinux; # until we solve dejagnu problems on darwin and expect on BSD
+  #doCheck = stdenv.isLinux; # until we solve dejagnu problems on darwin and expect on BSD
+  doCheck = false;
 
   dontStrip = stdenv ? cross; # Don't run the native `strip' when cross-compiling.
 
   postInstall =
     # Install headers in the right place.
-    '' ln -s${if stdenv.isFreeBSD then "" else "r"}v "$out/lib/"libffi*/include "$out/include"
+    '' ln -s${if stdenv.isBSD then "" else "r"}v "$out/lib/"libffi*/include "$out/include"
     '';
 
   meta = {
diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix
index ed267e23c87b..af2316320229 100644
--- a/pkgs/development/libraries/libgcrypt/default.nix
+++ b/pkgs/development/libraries/libgcrypt/default.nix
@@ -10,6 +10,8 @@ stdenv.mkDerivation (rec {
 
   propagatedBuildInputs = [ libgpgerror ];
 
+  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-asm";
+
   doCheck = stdenv.system != "i686-linux"; # "basic" test fails after stdenv+glibc-2.18
 
   # For some reason the tests don't find `libgpg-error.so'.
@@ -18,6 +20,8 @@ stdenv.mkDerivation (rec {
     make check
   '';
 
+  patches = [ ./no-build-timestamp.patch ];
+
   meta = {
     description = "General-pupose cryptographic library";
 
diff --git a/pkgs/development/libraries/libgcrypt/no-build-timestamp.patch b/pkgs/development/libraries/libgcrypt/no-build-timestamp.patch
new file mode 100644
index 000000000000..6ae708f059d7
--- /dev/null
+++ b/pkgs/development/libraries/libgcrypt/no-build-timestamp.patch
@@ -0,0 +1,12 @@
+diff -ur libgcrypt-1.5.3.orig/configure libgcrypt-1.5.3/configure
+--- libgcrypt-1.5.3.orig/configure	2013-07-25 11:22:47.000000000 +0200
++++ libgcrypt-1.5.3/configure	2014-04-09 00:17:58.659147199 +0200
+@@ -16520,6 +16520,7 @@
+ 
+ 
+ BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
++BUILD_TIMESTAMP=1970-01-01T00:00+0000
+ 
+ 
+ cat >>confdefs.h <<_ACEOF
+Only in libgcrypt-1.5.3: out
diff --git a/pkgs/development/libraries/libgpg-error/default.nix b/pkgs/development/libraries/libgpg-error/default.nix
index 143c8c739853..ecea33275fe6 100644
--- a/pkgs/development/libraries/libgpg-error/default.nix
+++ b/pkgs/development/libraries/libgpg-error/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, bash, gettext }:
+{ stdenv, fetchurl, gettext }:
 
-stdenv.mkDerivation (rec {
+stdenv.mkDerivation rec {
   name = "libgpg-error-1.17";
 
   src = fetchurl {
@@ -8,10 +8,21 @@ stdenv.mkDerivation (rec {
     sha256 = "1dapxzxl1naghf342fwfc2w2f2c5hb9gr1a1s4n8dsqn26kybx1z";
   };
 
+  postPatch = "sed '/BUILD_TIMESTAMP=/s/=.*/=1970-01-01T00:00+0000/' -i ./configure";
+
   # If architecture-dependent MO files aren't available, they're generated
   # during build, so we need gettext for cross-builds.
   crossAttrs.buildInputs = [ gettext ];
 
+  postConfigure =
+    stdenv.lib.optionalString stdenv.isSunOS
+    # For some reason, /bin/sh on OpenIndiana leads to this at the end of the
+    # `config.status' run:
+    #   ./config.status[1401]: shift: (null): bad number
+    # (See <http://hydra.nixos.org/build/2931046/nixlog/1/raw>.)
+    # Thus, re-run it with Bash.
+      "${stdenv.shell} config.status";
+
   doCheck = true;
 
   meta = {
@@ -31,15 +42,3 @@ stdenv.mkDerivation (rec {
   };
 }
 
-//
-
-(stdenv.lib.optionalAttrs stdenv.isSunOS {
-  # For some reason, /bin/sh on OpenIndiana leads to this at the end of the
-  # `config.status' run:
-  #   ./config.status[1401]: shift: (null): bad number
-  # (See <http://hydra.nixos.org/build/2931046/nixlog/1/raw>.)
-  # Thus, re-run it with Bash.
-  postConfigure =
-    '' ${bash}/bin/sh config.status
-    '';
-}))
diff --git a/pkgs/development/libraries/libiconv/default.nix b/pkgs/development/libraries/libiconv/default.nix
index 3bdb85a78ebd..76f7ed31d00a 100644
--- a/pkgs/development/libraries/libiconv/default.nix
+++ b/pkgs/development/libraries/libiconv/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv }:
 
 stdenv.mkDerivation rec {
-  name = "libiconv-1.13.1";
+  name = "libiconv-1.14";
 
   src = fetchurl {
     url = "mirror://gnu/libiconv/${name}.tar.gz";
-    sha256 = "0jcsjk2g28bq20yh7rvbn8xgq6q42g8dkkac0nfh12b061l638sm";
+    sha256 = "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj";
   };
 
   # On Cygwin, Libtool produces a `.dll.a', which is not a "real" DLL
diff --git a/pkgs/development/libraries/libpng/default.nix b/pkgs/development/libraries/libpng/default.nix
index 06fff495f541..001d8094a271 100644
--- a/pkgs/development/libraries/libpng/default.nix
+++ b/pkgs/development/libraries/libpng/default.nix
@@ -3,11 +3,11 @@
 assert zlib != null;
 
 let
-  version = "1.6.13";
-  sha256 = "09g631h1f1xvrdiy36mh1034r9w46damp9jcg7nm507wlmacxj6r";
+  version = "1.6.14";
+  sha256 = "0i5lwh9xnqj490c3mcx7rxaq4zr3wj27ba7vzfls45aqa2jl714n";
   patch_src = fetchurl {
     url = "mirror://sourceforge/libpng-apng/libpng-${version}-apng.patch.gz";
-    sha256 = "017pnxp3zhhlh6mg2yqn5xrb6dcxc5p3dp1kr46p8xx052i0hzqb";
+    sha256 = "1gwpm9kb57dknicy9j4mf8g9q5zz4ikhbznlk32jhw2b3l0mn446";
   };
   whenPatched = stdenv.lib.optionalString apngSupport;
 
diff --git a/pkgs/development/libraries/libunistring/clang.patch b/pkgs/development/libraries/libunistring/clang.patch
new file mode 100644
index 000000000000..fdcbc0d528d0
--- /dev/null
+++ b/pkgs/development/libraries/libunistring/clang.patch
@@ -0,0 +1,14 @@
+diff --git a/lib/stdint.in.h b/lib/stdint.in.h
+index 997e406..e0827f5 100644
+--- a/lib/stdint.in.h
++++ b/lib/stdint.in.h
+@@ -53,7 +53,8 @@
+      in <inttypes.h> would reinclude us, skipping our contents because
+      _GL_STDINT_H is defined.
+      The include_next requires a split double-inclusion guard.  */
+-# @INCLUDE_NEXT@ @NEXT_STDINT_H@
++# include <inttypes.h>
++// # @INCLUDE_NEXT@ @NEXT_STDINT_H@
+ #endif
+ 
+ #if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
diff --git a/pkgs/development/libraries/libunistring/default.nix b/pkgs/development/libraries/libunistring/default.nix
index 2a87d7a32490..9470240fc146 100644
--- a/pkgs/development/libraries/libunistring/default.nix
+++ b/pkgs/development/libraries/libunistring/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation (rec {
     sha256 = "18q620269xzpw39dwvr9zpilnl2dkw5z5kz3mxaadnpv4k3kw3b1";
   };
 
+  patches = stdenv.lib.optional stdenv.isDarwin [ ./clang.patch ];
+
   propagatedBuildInputs =
     stdenv.lib.optional ((! (stdenv ? glibc))
                          || (stdenv ? cross &&
diff --git a/pkgs/development/libraries/libxml2/setup-hook.sh b/pkgs/development/libraries/libxml2/setup-hook.sh
index 4ab0dadd8b29..4acdd25a6b28 100644
--- a/pkgs/development/libraries/libxml2/setup-hook.sh
+++ b/pkgs/development/libraries/libxml2/setup-hook.sh
@@ -15,5 +15,5 @@ if test -z "$libxmlHookDone"; then
     # xmllint and xsltproc from looking in /etc/xml/catalog.
     export XML_CATALOG_FILES
     if test -z "$XML_CATALOG_FILES"; then XML_CATALOG_FILES=" "; fi
-    envHooks=(${envHooks[@]} addXMLCatalogs)
+    envHooks+=(addXMLCatalogs)
 fi
diff --git a/pkgs/development/libraries/mesa-darwin/default.nix b/pkgs/development/libraries/mesa-darwin/default.nix
index 98936904be59..f259a397c847 100644
--- a/pkgs/development/libraries/mesa-darwin/default.nix
+++ b/pkgs/development/libraries/mesa-darwin/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, stdenvAdapters, gccApple, fetchurl, pkgconfig, intltool, flex, bison
+{ stdenv, stdenvAdapters, fetchurl, pkgconfig, intltool, flex, bison
 , python, libxml2Python, file, expat, makedepend, xorg, llvm, libffi, libvdpau
 , enableTextureFloats ? false # Texture floats are patented, see docs/patents.txt
 , enableExtraFeatures ? false # not maintained
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 54fd8d3810e3..842f3dc7d9b8 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -24,7 +24,7 @@ else
 */
 
 let
-  version = "10.2.6";
+  version = "10.2.9";
   # this is the default search path for DRI drivers
   driverLink = "/run/opengl-driver" + stdenv.lib.optionalString stdenv.isi686 "-32";
 in
@@ -35,7 +35,7 @@ stdenv.mkDerivation {
 
   src =  fetchurl {
     url = "ftp://ftp.freedesktop.org/pub/mesa/${version}/MesaLib-${version}.tar.bz2";
-    sha256 = "01n8ib190s12m8hiiyi4wfm9jhkbqjd769npjwvf965smp918cqr";
+    sha256 = "f6031f8b7113a92325b60635c504c510490eebb2e707119bbff7bd86aa34657d";
   };
 
   prePatch = "patchShebangs .";
@@ -78,7 +78,7 @@ stdenv.mkDerivation {
 
     "--with-dri-drivers=i965,r200,radeon"
     "--with-gallium-drivers=i915,nouveau,r300,r600,svga,swrast,radeonsi"
-    "--with-egl-platforms=x11,wayland,drm" "--enable-gbm"
+    "--with-egl-platforms=x11,drm" "--enable-gbm"
   ]
     ++ optional enableTextureFloats "--enable-texture-float"
     ++ optionals enableExtraFeatures [
@@ -97,7 +97,7 @@ stdenv.mkDerivation {
     autoreconfHook intltool expat libxml2Python llvm
     glproto dri2proto dri3proto presentproto
     libX11 libXext libxcb libXt libXfixes libxshmfence
-    libffi wayland libvdpau libelf
+    libffi /* wayland */ libvdpau libelf
   ] ++ optionals enableExtraFeatures [ /*libXvMC*/ ]
     ++ optional stdenv.isLinux udev
     ;
@@ -113,8 +113,8 @@ stdenv.mkDerivation {
   '' + optionalString enableExtraFeatures ''
       `#$out/lib/libXvMC*` \
       $out/lib/gbm $out/lib/libgbm* \
-      $out/lib/gallium-pipe \
   '' + ''
+      $out/lib/gallium-pipe \
       $out/lib/libdricore* \
       $out/lib/libgallium* \
       $out/lib/vdpau \
@@ -134,8 +134,8 @@ stdenv.mkDerivation {
     sed "/^libdir=/s,$out,$drivers," -i \
   '' + optionalString enableExtraFeatures ''
       `#$drivers/lib/libXvMC*.la` \
-      $drivers/lib/gallium-pipe/*.la \
   '' + ''
+      $drivers/lib/gallium-pipe/*.la \
       $drivers/lib/libgallium.la \
       $drivers/lib/vdpau/*.la \
       $drivers/lib/libdricore*.la
diff --git a/pkgs/development/libraries/mpc/default.nix b/pkgs/development/libraries/mpc/default.nix
index 3d05fa2e0405..dd132cfb5b7b 100644
--- a/pkgs/development/libraries/mpc/default.nix
+++ b/pkgs/development/libraries/mpc/default.nix
@@ -10,6 +10,8 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ gmp mpfr ];
 
+  CFLAGS = "-I${gmp}/include";
+
   doCheck = true;
 
   meta = {
diff --git a/pkgs/development/libraries/mpfr/default.nix b/pkgs/development/libraries/mpfr/default.nix
index 653481aeccd6..d999ba0cda5c 100644
--- a/pkgs/development/libraries/mpfr/default.nix
+++ b/pkgs/development/libraries/mpfr/default.nix
@@ -10,6 +10,8 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ gmp ];
 
+  CFLAGS = "-I${gmp}/include";
+
   configureFlags =
     /* Work around a FreeBSD bug that otherwise leads to segfaults in the test suite:
           http://hydra.bordeaux.inria.fr/build/34862
diff --git a/pkgs/development/libraries/ncurses/clang.patch b/pkgs/development/libraries/ncurses/clang.patch
new file mode 100644
index 000000000000..ce33049bf405
--- /dev/null
+++ b/pkgs/development/libraries/ncurses/clang.patch
@@ -0,0 +1,42 @@
+diff -ruNp ncurses-5.8.orig/c++/cursesf.h ncurses-5.8/c++/cursesf.h
+--- ncurses-5.8.orig/c++/cursesf.h	2005-08-13 21:08:24.000000000 +0300
++++ ncurses-5.8/c++/cursesf.h	2011-04-03 18:29:29.000000000 +0300
+@@ -681,7 +681,7 @@ public:
+ 		   const T* p_UserData = STATIC_CAST(T*)(0),
+ 		   bool with_frame=FALSE,
+ 		   bool autoDelete_Fields=FALSE)
+-    : NCursesForm (Fields, with_frame, autoDelete_Fields) {
++    : NCursesForm (&Fields, with_frame, autoDelete_Fields) {
+       if (form)
+ 	set_user (const_cast<void *>(p_UserData));
+   };
+@@ -694,7 +694,7 @@ public:
+ 		   const T* p_UserData = STATIC_CAST(T*)(0),
+ 		   bool with_frame=FALSE,
+ 		   bool autoDelete_Fields=FALSE)
+-    : NCursesForm (Fields, nlines, ncols, begin_y, begin_x,
++    : NCursesForm (&Fields, nlines, ncols, begin_y, begin_x,
+ 		   with_frame, autoDelete_Fields) {
+       if (form)
+ 	set_user (const_cast<void *>(p_UserData));
+diff -ruNp ncurses-5.8.orig/c++/cursesm.h ncurses-5.8/c++/cursesm.h
+--- ncurses-5.8.orig/c++/cursesm.h	2005-08-13 21:10:36.000000000 +0300
++++ ncurses-5.8/c++/cursesm.h	2011-04-03 18:31:42.000000000 +0300
+@@ -639,7 +639,7 @@ public:
+ 		   const T* p_UserData = STATIC_CAST(T*)(0),
+ 		   bool with_frame=FALSE,
+ 		   bool autoDelete_Items=FALSE)
+-    : NCursesMenu (Items, with_frame, autoDelete_Items) {
++    : NCursesMenu (&Items, with_frame, autoDelete_Items) {
+       if (menu)
+ 	set_user (const_cast<void *>(p_UserData));
+   };
+@@ -651,7 +651,7 @@ public:
+ 		   int begin_x = 0,
+ 		   const T* p_UserData = STATIC_CAST(T*)(0),
+ 		   bool with_frame=FALSE)
+-    : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) {
++    : NCursesMenu (&Items, nlines, ncols, begin_y, begin_x, with_frame) {
+       if (menu)
+ 	set_user (const_cast<void *>(p_UserData));
+   };
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index 631199bf87c3..3aa27480a0f5 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     sha256 = "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh";
   };
 
-  patches = [ ./patch-ac ];
+  patches = [ ./patch-ac ./clang.patch ];
 
   configureFlags = ''
     --with-shared --without-debug --enable-pc-files --enable-symlinks
@@ -35,8 +35,6 @@ stdenv.mkDerivation rec {
     export configureFlags="$configureFlags --includedir=$out/include"
     export PKG_CONFIG_LIBDIR="$out/lib/pkgconfig"
     mkdir -p "$PKG_CONFIG_LIBDIR"
-  '' + lib.optionalString stdenv.isDarwin ''
-    substituteInPlace configure --replace -no-cpp-precomp ""
   '';
 
   selfNativeBuildInput = true;
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 2ea94ef50453..29656f7ef888 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -19,6 +19,8 @@ let
       # cannot be overriden per-process.  For security, the
       # environment variable is ignored for setuid binaries.
       ./cert-file.patch
+      # Remove the compilation time from the library
+      ./no-date-in-library.patch
     ]
 
     ++ stdenv.lib.optionals (isCross && opensslCrossSystem == "hurd-x86")
diff --git a/pkgs/development/libraries/openssl/no-date-in-library.patch b/pkgs/development/libraries/openssl/no-date-in-library.patch
new file mode 100644
index 000000000000..3eb501dfa020
--- /dev/null
+++ b/pkgs/development/libraries/openssl/no-date-in-library.patch
@@ -0,0 +1,12 @@
+diff -ur openssl-1.0.1f.orig/crypto/Makefile openssl-1.0.1f/crypto/Makefile
+--- openssl-1.0.1f.orig/crypto/Makefile	2014-01-06 15:35:56.000000000 +0100
++++ openssl-1.0.1f/crypto/Makefile	2014-04-09 13:05:28.071346204 +0200
+@@ -57,7 +57,7 @@
+ 	echo '  /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
+ 	echo '  #define CFLAGS "$(CC) $(CFLAG)"'; \
+ 	echo '  #define PLATFORM "$(PLATFORM)"'; \
+-	echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
++	echo "  #define DATE \"Thu Jan  1 00:00:01 UTC 1970\""; \
+ 	echo '#endif' ) >buildinf.h
+ 
+ x86cpuid.s:	x86cpuid.pl perlasm/x86asm.pl
diff --git a/pkgs/development/libraries/p11-kit/default.nix b/pkgs/development/libraries/p11-kit/default.nix
index be6216b758c9..d1778093868c 100644
--- a/pkgs/development/libraries/p11-kit/default.nix
+++ b/pkgs/development/libraries/p11-kit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libiconv, pkgconfig, libffi, libtasn1 }:
+{ stdenv, fetchurl, libiconvOrEmpty, pkgconfig, libffi, libtasn1 }:
 
 stdenv.mkDerivation rec {
   name = "p11-kit-0.20.2";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = "--without-libtasn1";
 
-  buildInputs = [ libiconv pkgconfig libffi libtasn1 ];
+  buildInputs = [ pkgconfig libffi libtasn1 ] ++ libiconvOrEmpty;
 
   meta = {
     homepage = http://p11-glue.freedesktop.org/;
diff --git a/pkgs/development/libraries/pango/default.nix b/pkgs/development/libraries/pango/default.nix
index 40b02c2afbb2..45ca9cb98e8d 100644
--- a/pkgs/development/libraries/pango/default.nix
+++ b/pkgs/development/libraries/pango/default.nix
@@ -1,30 +1,35 @@
-{ stdenv, fetchurl, pkgconfig, gettext, x11, glib, cairo, libpng, harfbuzz, fontconfig
-, libintlOrEmpty, gobjectIntrospection }:
-
+{ stdenv, fetchurl, pkgconfig, x11, glib, cairo, libpng, harfbuzz
+, fontconfig, freetype, libintlOrEmpty, gobjectIntrospection
+}:
+
+let
+  ver_maj = "1.36";
+  ver_min = "8";
+in
 stdenv.mkDerivation rec {
-  name = "pango-1.32.5"; #.6 and higher need fontconfig-2.11.* which is troublesome
+  name = "pango-${ver_maj}.${ver_min}";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/pango/1.32/${name}.tar.xz";
-    sha256 = "08aqis6j8nd1lb4f2h4h9d9kjvp54iwf8zvqzss0qn4v7nfcjyvx";
+    url = "mirror://gnome/sources/pango/${ver_maj}/${name}.tar.xz";
+    sha256 = "01rdzjh68w8l5zn0648yibyarj8p6g7yfn59nw5awaz1i8dvbnqq";
   };
 
   buildInputs = with stdenv.lib;
     optional (!stdenv.isDarwin) gobjectIntrospection # build problems of itself and flex
-    ++ optionals stdenv.isDarwin [ gettext fontconfig ];
-
+    ++ optionals stdenv.isDarwin [ fontconfig ];
   nativeBuildInputs = [ pkgconfig ];
 
-  propagatedBuildInputs = [ x11 glib cairo libpng harfbuzz ] ++ libintlOrEmpty;
+  propagatedBuildInputs = [ x11 glib cairo libpng fontconfig freetype harfbuzz ] ++ libintlOrEmpty;
 
   enableParallelBuilding = true;
 
+  doCheck = false; # test-layout fails on 1.36.8
   # jww (2014-05-05): The tests currently fail on Darwin:
   #
   # ERROR:testiter.c:139:iter_char_test: assertion failed: (extents.width == x1 - x0)
   # .../bin/sh: line 5: 14823 Abort trap: 6 srcdir=. PANGO_RC_FILE=./pangorc ${dir}$tst
   # FAIL: testiter
-  doCheck = !stdenv.isDarwin;
+
   postInstall = "rm -rf $out/share/gtk-doc";
 
   meta = {
diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix
index 930d7b86f063..768e87f5ad29 100644
--- a/pkgs/development/libraries/pcre/default.nix
+++ b/pkgs/development/libraries/pcre/default.nix
@@ -5,11 +5,11 @@
 with stdenv.lib;
 
 stdenv.mkDerivation rec {
-  name = "pcre-8.35";
+  name = "pcre-8.36";
 
   src = fetchurl {
     url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${name}.tar.bz2";
-    sha256 = "0nw66r92dr24vy9k4lw17bkv8x5nlzn6wx9hq4y2dvzgig3w2qd9";
+    sha256 = "1fs5p1z67m9f4xnyil3s4lhgyld78f7m4d1yawpyhh0cvrbk90zg";
   };
 
   # The compiler on Darwin crashes with an internal error while building the
diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix
index 6da928a6a23e..7fe16cec56b9 100644
--- a/pkgs/development/libraries/polkit/default.nix
+++ b/pkgs/development/libraries/polkit/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, glib, expat, pam, intltool, spidermonkey
-, gobjectIntrospection, libxslt, docbook_xsl
+, gobjectIntrospection, libxslt, docbook_xsl, docbook_xml_dtd_412
 , useSystemd ? stdenv.isLinux, systemd }:
 
 let
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
 
   buildInputs =
     [ pkgconfig glib expat pam intltool spidermonkey gobjectIntrospection ]
-    ++ [ libxslt docbook_xsl ] # man pages
+    ++ [ libxslt docbook_xsl docbook_xml_dtd_412 ] # man pages
     ++ stdenv.lib.optional useSystemd systemd;
 
   # Ugly hack to overwrite hardcoded directories
diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix
index 1679b4953e77..943d780473ac 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, substituteAll, libXrender, libXinerama, libXcursor, libXmu, libXv, libXext
+{ stdenv, fetchurl, fetchpatch, substituteAll
+, libXrender, libXinerama, libXcursor, libXmu, libXv, libXext
 , libXfixes, libXrandr, libSM, freetype, fontconfig, zlib, libjpeg, libpng
 , libmng, which, mesaSupported, mesa, mesa_glu, openssl, dbus, cups, pkgconfig
 , libtiff, glib, icu, mysql, postgresql, sqlite, perl, coreutils, libXi
@@ -64,7 +65,13 @@ stdenv.mkDerivation rec {
     ++ stdenv.lib.optional flashplayerFix (substituteAll {
         src = ./dlopen-webkit-nsplugin.diff;
         inherit gtk gdk_pixbuf;
-      });
+      })
+    ++ [(fetchpatch {
+        name = "fix-medium-font.patch";
+        url = "http://anonscm.debian.org/cgit/pkg-kde/qt/qt4-x11.git/plain/debian/patches/"
+          + "kubuntu_39_fix_medium_font.diff?id=21b342d71c19e6d68b649947f913410fe6129ea4";
+        sha256 = "0bli44chn03c2y70w1n8l7ss4ya0b40jqqav8yxrykayi01yf95j";
+      })];
 
   preConfigure = ''
     export LD_LIBRARY_PATH="`pwd`/lib:$LD_LIBRARY_PATH"
@@ -78,8 +85,6 @@ stdenv.mkDerivation rec {
       -translationdir $out/share/${name}/translations
     "
   '' + optionalString stdenv.isDarwin ''
-    export CXX=clang++
-    export CC=clang
     sed -i 's/QMAKE_CC = gcc/QMAKE_CC = clang/' mkspecs/common/g++-base.conf
     sed -i 's/QMAKE_CXX = g++/QMAKE_CXX = clang++/' mkspecs/common/g++-base.conf
   '';
diff --git a/pkgs/development/libraries/readline/6.2.nix b/pkgs/development/libraries/readline/6.2.nix
index d72d6566bbc9..1555f255c51b 100644
--- a/pkgs/development/libraries/readline/6.2.nix
+++ b/pkgs/development/libraries/readline/6.2.nix
@@ -14,6 +14,7 @@ stdenv.mkDerivation (rec {
   patches =
     [ ./link-against-ncurses.patch
       ./no-arch_only.patch
+      ./clang.patch
     ]
     ++
     (let
diff --git a/pkgs/development/libraries/readline/clang.patch b/pkgs/development/libraries/readline/clang.patch
new file mode 100644
index 000000000000..42bb0be09c39
--- /dev/null
+++ b/pkgs/development/libraries/readline/clang.patch
@@ -0,0 +1,13 @@
+diff --git a/support/shobj-conf b/support/shobj-conf
+index 5a63e80..4b2a741 100644
+--- support/shobj-conf
++++ support/shobj-conf
+@@ -189,7 +189,7 @@ darwin*|macosx*)
+ 	darwin[789]*|darwin10*)	SHOBJ_LDFLAGS=''
+ 			SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+ 			;;
+-	*)		SHOBJ_LDFLAGS='-dynamic'
++	*)		SHOBJ_LDFLAGS='-dynamiclib'
+ 			SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
+ 			;;
+ 	esac
diff --git a/pkgs/development/libraries/serf/default.nix b/pkgs/development/libraries/serf/default.nix
index 1e8eec6ae452..49d7cec95901 100644
--- a/pkgs/development/libraries/serf/default.nix
+++ b/pkgs/development/libraries/serf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, apr, scons, openssl, aprutil, zlib, krb5, pkgconfig }:
+{ stdenv, fetchurl, apr, scons, openssl, aprutil, zlib, krb5, pkgconfig, gnused }:
 
 stdenv.mkDerivation rec {
   name = "serf-1.3.7";
@@ -11,16 +11,20 @@ stdenv.mkDerivation rec {
   buildInputs = [ apr scons openssl aprutil zlib krb5 pkgconfig ];
 
   configurePhase = ''
-    sed -e '/^env[.]Append(BUILDERS/ienv.Append(ENV={"PATH":os.environ["PATH"]})' -i SConstruct
-    sed -e '/^env[.]Append(BUILDERS/ienv.Append(ENV={"NIX_CFLAGS_COMPILE":os.environ["NIX_CFLAGS_COMPILE"]})' -i SConstruct
-    sed -e '/^env[.]Append(BUILDERS/ienv.Append(ENV={"NIX_LDFLAGS":os.environ["NIX_LDFLAGS"]})' -i SConstruct
+    ${gnused}/bin/sed -e '/^env[.]Append(BUILDERS/ienv.Append(ENV={"PATH":os.environ["PATH"]})' -i SConstruct
+    ${gnused}/bin/sed -e '/^env[.]Append(BUILDERS/ienv.Append(ENV={"NIX_CFLAGS_COMPILE":os.environ["NIX_CFLAGS_COMPILE"]})' -i SConstruct
+    ${gnused}/bin/sed -e '/^env[.]Append(BUILDERS/ienv.Append(ENV={"NIX_LDFLAGS":os.environ["NIX_LDFLAGS"]})' -i SConstruct
   '';
 
   buildPhase = ''
     scons PREFIX="$out" OPENSSL="${openssl}" ZLIB="${zlib}" APR="$(echo "${apr}"/bin/*-config)" \
-        APU="$(echo "${aprutil}"/bin/*-config)" GSSAPI="${krb5}" CC="${stdenv.gcc}/bin/gcc"
+        APU="$(echo "${aprutil}"/bin/*-config)" GSSAPI="${krb5}" CC="${
+          if stdenv.isDarwin then "clang" else "${stdenv.gcc}/bin/gcc"
+        }"
   '';
 
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-L/usr/lib";
+
   installPhase = ''
     scons install
   '';
diff --git a/pkgs/development/libraries/slib/setup-hook.sh b/pkgs/development/libraries/slib/setup-hook.sh
index 32dde7d1f7a2..62b72d6dc0ab 100644
--- a/pkgs/development/libraries/slib/setup-hook.sh
+++ b/pkgs/development/libraries/slib/setup-hook.sh
@@ -10,4 +10,4 @@ addSlibPath () {
     fi
 }
 
-envHooks=(${envHooks[@]} addSlibPath)
+envHooks+=(addSlibPath)
diff --git a/pkgs/development/libraries/ucommon/default.nix b/pkgs/development/libraries/ucommon/default.nix
index 0e8a95d5ac16..0fc325137179 100644
--- a/pkgs/development/libraries/ucommon/default.nix
+++ b/pkgs/development/libraries/ucommon/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv, gnutls, pkgconfig, zlib, libgcrypt }:
 
 stdenv.mkDerivation rec {
-  name = "ucommon-6.0.7";
+  name = "ucommon-6.1.11";
 
   src = fetchurl {
-    url = mirror://gnu/commoncpp/ucommon-6.0.7.tar.gz;
-    sha256 = "1rlvchmg6qq8jq79qjgv0l0wqi1dqhmm4ng1qj9f012dbhwcap3x";
+    url = "mirror://gnu/commoncpp/${name}.tar.gz";
+    sha256 = "0hpwxiyd7c3qnzksk6vw94cdig1v8yy6khgcaa87a7hb3zbkv4zg";
   };
 
   buildInputs = [ pkgconfig gnutls zlib ];
diff --git a/pkgs/development/libraries/v8/default.nix b/pkgs/development/libraries/v8/default.nix
index fda32a7ddbd3..3abac0feab38 100644
--- a/pkgs/development/libraries/v8/default.nix
+++ b/pkgs/development/libraries/v8/default.nix
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     description = "Google's open source JavaScript engine";
-    platforms = with platforms; linux ++ darwin;
+    platforms = with platforms; linux;
     license = licenses.bsd3;
   };
 }
diff --git a/pkgs/development/libraries/webkitgtk/2.4.6.nix b/pkgs/development/libraries/webkitgtk/2.4.6.nix
new file mode 100644
index 000000000000..a2344f71f882
--- /dev/null
+++ b/pkgs/development/libraries/webkitgtk/2.4.6.nix
@@ -0,0 +1,62 @@
+{ stdenv, fetchurl, perl, python, ruby, bison, gperf, flex
+, pkgconfig, which, gettext, gobjectIntrospection
+, gtk2, gtk3, wayland, libwebp, enchant
+, libxml2, libsoup, libsecret, libxslt, harfbuzz
+, gst-plugins-base
+, withGtk2 ? false
+, enableIntrospection ? true
+}:
+
+stdenv.mkDerivation rec {
+  name = "webkitgtk-${version}";
+  version = "2.4.6";
+
+  meta = with stdenv.lib; {
+    description = "Web content rendering engine, GTK+ port";
+    homepage = "http://webkitgtk.org/";
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.iyzsong ];
+  };
+
+  src = fetchurl {
+    url = "http://webkitgtk.org/releases/${name}.tar.xz";
+    sha256 = "0mqlq4ivh921k92xjsp5pdvbg9vf75qjliqmx81qwrm2sjl4mvvg";
+  };
+
+  patches = [ ./webcore-svg-libxml-cflags.patch ];
+
+  CC = "cc";
+
+  prePatch = ''
+    patchShebangs Tools/gtk
+  '';
+
+  configureFlags = with stdenv.lib; [
+    "--disable-geolocation"
+    (optionalString enableIntrospection "--enable-introspection")
+  ] ++ stdenv.lib.optional withGtk2 [
+    "--with-gtk=2.0"
+    "--disable-webkit2"
+  ];
+
+  dontAddDisableDepTrack = true;
+
+  nativeBuildInputs = [
+    perl python ruby bison gperf flex
+    pkgconfig which gettext gobjectIntrospection
+  ];
+
+  buildInputs = [
+    gtk2 wayland libwebp enchant
+    libxml2 libsecret libxslt harfbuzz
+    gst-plugins-base
+  ];
+
+  propagatedBuildInputs = [
+    libsoup
+    (if withGtk2 then gtk2 else gtk3)
+  ];
+
+  #enableParallelBuilding = true; # build problems on Hydra
+}
diff --git a/pkgs/development/libraries/webkitgtk/default.nix b/pkgs/development/libraries/webkitgtk/default.nix
index fa3cdc82c41f..08576c2ebc36 100644
--- a/pkgs/development/libraries/webkitgtk/default.nix
+++ b/pkgs/development/libraries/webkitgtk/default.nix
@@ -1,61 +1,45 @@
-{ stdenv, fetchurl, perl, python, ruby, bison, gperf, flex
-, pkgconfig, which, gettext, gobjectIntrospection
+{ stdenv, fetchurl, perl, python, ruby, bison, gperf, cmake
+, pkgconfig, gettext, gobjectIntrospection
 , gtk2, gtk3, wayland, libwebp, enchant
-, libxml2, libsoup, libsecret, libxslt, harfbuzz
+, libxml2, libsoup, libsecret, libxslt, harfbuzz, libpthreadstubs
 , gst-plugins-base
-, withGtk2 ? false
-, enableIntrospection ? true
 }:
 
 stdenv.mkDerivation rec {
-  name = "webkitgtk-2.4.6";
+  name = "webkitgtk-${version}";
+  version = "2.6.2";
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Web content rendering engine, GTK+ port";
     homepage = "http://webkitgtk.org/";
-    license = stdenv.lib.licenses.bsd2;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = with stdenv.lib.maintainers; [ iyzsong ];
+    license = licenses.bsd2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ iyzsong koral ];
   };
 
   src = fetchurl {
     url = "http://webkitgtk.org/releases/${name}.tar.xz";
-    sha256 = "0mqlq4ivh921k92xjsp5pdvbg9vf75qjliqmx81qwrm2sjl4mvvg";
+    sha256 = "1f9qm5g1mbjm2hrnlzymas99piws4h4y3yxz4p6f6gavnsvfjwji";
   };
 
-  patches = [ ./webcore-svg-libxml-cflags.patch ];
+  patches = [ ./finding-harfbuzz-icu.patch ];
 
-  CC = "cc";
-
-  prePatch = ''
-    patchShebangs Tools/gtk
-  '';
-
-  configureFlags = with stdenv.lib; [
-    "--disable-geolocation"
-    (optionalString enableIntrospection "--enable-introspection")
-  ] ++ stdenv.lib.optional withGtk2 [
-    "--with-gtk=2.0"
-    "--disable-webkit2"
-  ];
-
-  dontAddDisableDepTrack = true;
+  cmakeFlags = [ "-DPORT=GTK" ];
 
   nativeBuildInputs = [
-    perl python ruby bison gperf flex
-    pkgconfig which gettext gobjectIntrospection
+    cmake perl python ruby bison gperf
+    pkgconfig gettext gobjectIntrospection
   ];
 
   buildInputs = [
     gtk2 wayland libwebp enchant
-    libxml2 libsecret libxslt harfbuzz
+    libxml2 libsecret libxslt harfbuzz libpthreadstubs
     gst-plugins-base
   ];
 
   propagatedBuildInputs = [
-    libsoup
-    (if withGtk2 then gtk2 else gtk3)
+    libsoup gtk3
   ];
 
-  #enableParallelBuilding = true; # build problems on Hydra
+  # enableParallelBuilding = true; # build problems on Hydra
 }
diff --git a/pkgs/development/libraries/webkitgtk/finding-harfbuzz-icu.patch b/pkgs/development/libraries/webkitgtk/finding-harfbuzz-icu.patch
new file mode 100644
index 000000000000..14d58ef04f68
--- /dev/null
+++ b/pkgs/development/libraries/webkitgtk/finding-harfbuzz-icu.patch
@@ -0,0 +1,52 @@
+--- webkitgtk-2.6.1.orig/Source/cmake/FindHarfBuzz.cmake	2014-10-09 01:54:38.000000000 +0800
++++ webkitgtk-2.6.1/Source/cmake/FindHarfBuzz.cmake	2014-10-15 13:41:29.832290412 +0800
+@@ -34,21 +34,39 @@
+ 
+ pkg_check_modules(PC_HARFBUZZ harfbuzz>=0.9.7)
+ 
+-find_path(HARFBUZZ_INCLUDE_DIRS NAMES hb.h
+-    HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR}
+-)
+-
+-find_library(HARFBUZZ_LIBRARIES NAMES harfbuzz
+-    HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR}
+-)
+-
+ # HarfBuzz 0.9.18 split ICU support into a separate harfbuzz-icu library.
+ if ("${PC_HARFBUZZ_VERSION}" VERSION_GREATER "0.9.17")
+     pkg_check_modules(PC_HARFBUZZ_ICU harfbuzz-icu>=0.9.18 REQUIRED)
+-    find_library(HARFBUZZ_ICU_LIBRARIES NAMES harfbuzz-icu
++
++    find_path(HARFBUZZ_ICU_INCLUDEDIR NAMES hb-icu.h
++        HINTS ${PC_HARFBUZZ_ICU_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR}
++    )
++
++    find_library(HARFBUZZ_ICU_LIBRARY NAMES harfbuzz-icu
+         HINTS ${PC_HARFBUZZ_ICU_LIBRARY_DIRS} ${PC_HARFBUZZ_ICU_LIBDIR}
+     )
+-    list(APPEND HARFBUZZ_LIBRARIES "${HARFBUZZ_ICU_LIBRARIES}")
++
++    find_library(HARFBUZZ_LIBRARY NAMES harfbuzz
++        HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR}
++    )
++
++    set(HARFBUZZ_INCLUDE_DIRS
++        ${PC_HARFBUZZ_INCLUDE_DIRS} ${HARFBUZZ_ICU_INCLUDEDIR}
++        CACHE INTERNAL ""
++    )
++
++    set(HARFBUZZ_LIBRARIES
++        ${HARFBUZZ_LIBRARY} ${HARFBUZZ_ICU_LIBRARY}
++        CACHE INTERNAL ""
++    )
++else ()
++    find_path(HARFBUZZ_INCLUDE_DIRS NAMES hb.h
++        HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR}
++    )
++
++    find_library(HARFBUZZ_LIBRARIES NAMES harfbuzz
++        HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR}
++    )
+ endif ()
+ 
+ include(FindPackageHandleStandardArgs)
diff --git a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh
index b9f7eee3ba24..b48f916ac7a0 100644
--- a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh
+++ b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh
@@ -33,7 +33,7 @@ collectNixLispLDLP () {
 
 export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF
 
-envHooks=(${envHooks[@]} addASDFPaths setLisp collectNixLispLDLP)
+envHooks+=(addASDFPaths setLisp collectNixLispLDLP)
 
 mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home"
 mkdir -p "$HOME"/.cache/common-lisp
diff --git a/pkgs/development/ocaml-modules/ocaml-text/default.nix b/pkgs/development/ocaml-modules/ocaml-text/default.nix
index 08136dd2b100..387c5cef19ad 100644
--- a/pkgs/development/ocaml-modules/ocaml-text/default.nix
+++ b/pkgs/development/ocaml-modules/ocaml-text/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, libiconv, ocaml, findlib, ncurses}:
+{stdenv, fetchurl, libiconvOrNull, ocaml, findlib, ncurses}:
 
 stdenv.mkDerivation {
   name = "ocaml-text-0.6";
@@ -8,9 +8,12 @@ stdenv.mkDerivation {
     sha256 = "0j8gaak0ajnlmn8knvfygqwwzs7awjv5rfn5cbj6qxqbxhjd5m6g";
   };
 
-  buildInputs = [ocaml findlib libiconv ncurses];
+  buildInputs = [ocaml findlib ncurses]
+    ++ stdenv.lib.optional (libiconvOrNull != null) libiconvOrNull;
 
-  configurePhase = "iconv_prefix=${libiconv} ocaml setup.ml -configure";
+  configurePhase =
+    (stdenv.lib.optionalString (libiconvOrNull != null) "iconv_prefix=${libiconvOrNull} ")
+    + "ocaml setup.ml -configure";
 
   createFindlibDestdir = true;
 
@@ -18,9 +21,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://ocaml-text.forge.ocamlcore.org/";
     description = "OCaml-Text is a library for dealing with ``text'', i.e. sequence of unicode characters, in a convenient way. ";
-    license = "BSD";
+    license = stdenv.lib.licenses.bsd3;
     platforms = ocaml.meta.platforms;
-    maintainers = [
-    ];
   };
 }
diff --git a/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh b/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh
index 876556a7b922..a93a7250bebb 100644
--- a/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh
+++ b/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh
@@ -2,4 +2,4 @@ addOcamlMakefile () {
     export OCAMLMAKEFILE="@out@/include/OCamlMakefile"
 }
 
-envHooks=(${envHooks[@]} addOcamlMakefile)
+envHooks+=(addOcamlMakefile)
diff --git a/pkgs/development/tools/misc/automake/setup-hook.sh b/pkgs/development/tools/misc/automake/setup-hook.sh
index 6f34f0d0ae17..5cd8c6229f68 100644
--- a/pkgs/development/tools/misc/automake/setup-hook.sh
+++ b/pkgs/development/tools/misc/automake/setup-hook.sh
@@ -2,4 +2,4 @@ addAclocals () {
     addToSearchPathWithCustomDelimiter : ACLOCAL_PATH $1/share/aclocal
 }
 
-envHooks=(${envHooks[@]} addAclocals)
+envHooks+=(addAclocals)
diff --git a/pkgs/development/tools/misc/ccache/default.nix b/pkgs/development/tools/misc/ccache/default.nix
index 56f8cefe07ca..066087fcd13b 100644
--- a/pkgs/development/tools/misc/ccache/default.nix
+++ b/pkgs/development/tools/misc/ccache/default.nix
@@ -1,5 +1,7 @@
 {stdenv, fetchurl, runCommand, gcc, zlib}:
 
+assert stdenv.isLinux;
+
 let
   ccache =
 stdenv.mkDerivation {
diff --git a/pkgs/development/tools/misc/distcc/masq.nix b/pkgs/development/tools/misc/distcc/masq.nix
index 753c35b5d3a2..28b31cbb48d5 100644
--- a/pkgs/development/tools/misc/distcc/masq.nix
+++ b/pkgs/development/tools/misc/distcc/masq.nix
@@ -3,6 +3,10 @@
 stdenv.mkDerivation {
   name = "distcc-masq-${gccRaw.name}";
 
+  meta = {
+    platforms = stdenv.lib.platforms.linux;
+  };
+
   phases = [ "installPhase" ];
   installPhase = ''
     mkdir -p $out/bin
diff --git a/pkgs/development/tools/misc/patchelf/default.nix b/pkgs/development/tools/misc/patchelf/default.nix
index 06b5c2ef516d..5aa81e46bed1 100644
--- a/pkgs/development/tools/misc/patchelf/default.nix
+++ b/pkgs/development/tools/misc/patchelf/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "c99f84d124347340c36707089ec8f70530abd56e7827c54d506eb4cc097a17e7";
   };
 
+  setupHook = [ ./setup-hook.sh ];
+
   meta = {
     homepage = http://nixos.org/patchelf.html;
     license = "GPL";
diff --git a/pkgs/development/tools/misc/patchelf/setup-hook.sh b/pkgs/development/tools/misc/patchelf/setup-hook.sh
new file mode 100644
index 000000000000..b0d37b73e2b6
--- /dev/null
+++ b/pkgs/development/tools/misc/patchelf/setup-hook.sh
@@ -0,0 +1,16 @@
+# This setup hook calls patchelf to automatically remove unneeded
+# directories from the RPATH of every library or executable in every
+# output.
+
+fixupOutputHooks+=('if [ -z "$dontPatchELF" ]; then patchELF "$prefix"; fi')
+
+patchELF() {
+    header "patching ELF executables and libraries in $prefix"
+    if [ -e "$prefix" ]; then
+        find "$prefix" \( \
+            \( -type f -a -name "*.so*" \) -o \
+            \( -type f -a -perm +0100 \) \
+            \) -print -exec patchelf --shrink-rpath '{}' \;
+    fi
+    stopNest
+}
diff --git a/pkgs/development/tools/misc/pkgconfig/setup-hook.sh b/pkgs/development/tools/misc/pkgconfig/setup-hook.sh
index 77a69fb18781..1c153976a343 100644
--- a/pkgs/development/tools/misc/pkgconfig/setup-hook.sh
+++ b/pkgs/development/tools/misc/pkgconfig/setup-hook.sh
@@ -4,7 +4,7 @@ addPkgConfigPath () {
 }
 
 if test -n "$crossConfig"; then
-    crossEnvHooks=(${crossEnvHooks[@]} addPkgConfigPath)
+    crossEnvHooks+=(addPkgConfigPath)
 else
-    envHooks=(${envHooks[@]} addPkgConfigPath)
+    envHooks+=(addPkgConfigPath)
 fi
diff --git a/pkgs/development/tools/misc/sloccount/default.nix b/pkgs/development/tools/misc/sloccount/default.nix
index 1aa9a2c058d6..fffb80747482 100644
--- a/pkgs/development/tools/misc/sloccount/default.nix
+++ b/pkgs/development/tools/misc/sloccount/default.nix
@@ -31,6 +31,7 @@ stdenv.mkDerivation rec {
 
   configurePhase = ''
     sed -i "makefile" -"es|PREFIX[[:blank:]]*=.*$|PREFIX = $out|g"
+    sed -i "makefile" -"es|gcc|$CC|g"
   '';
 
   doCheck = true;
diff --git a/pkgs/development/tools/ocaml/findlib/default.nix b/pkgs/development/tools/ocaml/findlib/default.nix
index 4afb8bfdbdfd..a9673be26ee3 100644
--- a/pkgs/development/tools/ocaml/findlib/default.nix
+++ b/pkgs/development/tools/ocaml/findlib/default.nix
@@ -42,8 +42,8 @@ stdenv.mkDerivation {
           mkdir -p $OCAMLFIND_DESTDIR
         fi
     }
-    
-    envHooks=(''${envHooks[@]} addOCamlPath)
+
+    envHooks+=(addOCamlPath)
   '';
 
   meta = {
diff --git a/pkgs/development/tools/vagrant/default.nix b/pkgs/development/tools/vagrant/default.nix
index bd9ccf4947ba..5e15ef64cb2f 100644
--- a/pkgs/development/tools/vagrant/default.nix
+++ b/pkgs/development/tools/vagrant/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, dpkg, curl, libarchive, openssl, ruby, rubyLibs, libiconv
+{ stdenv, fetchurl, dpkg, curl, libarchive, openssl, ruby, rubyLibs, libiconvOrLibc
 , libxml2, libxslt }:
 
 assert stdenv.system == "x86_64-linux" || stdenv.system == "i686-linux";
@@ -66,7 +66,7 @@ stdenv.mkDerivation rec {
 
     # libiconv: iconv
     rm opt/vagrant/embedded/bin/iconv
-    ln -s ${libiconv}/bin/iconv opt/vagrant/embedded/bin
+    ln -s ${libiconvOrLibc}/bin/iconv opt/vagrant/embedded/bin
 
     # libxml: xml2-config, xmlcatalog, xmllint
     rm opt/vagrant/embedded/bin/{xml2-config,xmlcatalog,xmllint}
diff --git a/pkgs/development/web/nodejs/setup-hook.sh b/pkgs/development/web/nodejs/setup-hook.sh
index 41a9746ba424..e1f4d9089f38 100644
--- a/pkgs/development/web/nodejs/setup-hook.sh
+++ b/pkgs/development/web/nodejs/setup-hook.sh
@@ -2,4 +2,4 @@ addNodePath () {
     addToSearchPath NODE_PATH $1/lib/node_modules
 }
 
-envHooks=(${envHooks[@]} addNodePath)
+envHooks+=(addNodePath)