summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nixos/modules/programs/venus.nix2
-rw-r--r--nixos/modules/security/ca.nix2
-rw-r--r--pkgs/applications/misc/redshift/default.nix4
-rw-r--r--pkgs/applications/misc/xlsfonts/default.nix23
-rw-r--r--pkgs/applications/networking/cluster/panamax/api/default.nix1
-rw-r--r--pkgs/applications/networking/instant-messengers/tkabber/default.nix2
-rw-r--r--pkgs/applications/networking/newsreaders/liferea/default.nix2
-rw-r--r--pkgs/applications/version-management/git-and-tools/git/cert-path.patch2
-rw-r--r--pkgs/applications/video/minitube/default.nix43
-rw-r--r--pkgs/applications/window-managers/xcompmgr/default.nix22
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix3
-rw-r--r--pkgs/build-support/cc-wrapper/setup-hook-stdinc.sh44
-rw-r--r--pkgs/build-support/cc-wrapper/setup-hook.sh2
-rw-r--r--pkgs/desktops/xfce/core/exo.nix4
-rw-r--r--pkgs/desktops/xfce/core/thunar.nix4
-rw-r--r--pkgs/desktops/xfce/core/xfdesktop.nix4
-rw-r--r--pkgs/desktops/xfce/core/xfwm4.nix4
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix2
-rw-r--r--pkgs/development/compilers/ghc/7.0.4-binary.nix2
-rw-r--r--pkgs/development/compilers/ghc/7.0.4.nix2
-rw-r--r--pkgs/development/compilers/ghc/7.2.2.nix2
-rw-r--r--pkgs/development/compilers/ghc/7.4.2-binary.nix2
-rw-r--r--pkgs/development/compilers/ghc/7.4.2.nix2
-rw-r--r--pkgs/development/compilers/ghc/7.6.3.nix2
-rwxr-xr-xpkgs/development/compilers/ghc/gcc-clang-wrapper.sh (renamed from pkgs/development/haskell-modules/gcc-clang-wrapper.sh)0
-rw-r--r--pkgs/development/compilers/llvm/3.6/llvm.nix2
-rw-r--r--pkgs/development/interpreters/perl/5.20/default.nix2
-rw-r--r--pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch127
-rw-r--r--pkgs/development/interpreters/perl/5.22/cpp-precomp.patch11
-rw-r--r--pkgs/development/interpreters/perl/5.22/default.nix105
-rw-r--r--pkgs/development/interpreters/perl/5.22/ld-shared.patch11
-rw-r--r--pkgs/development/interpreters/perl/5.22/no-libutil.patch12
-rw-r--r--pkgs/development/interpreters/perl/5.22/no-sys-dirs.patch250
-rw-r--r--pkgs/development/interpreters/perl/5.22/setup-hook.sh5
-rw-r--r--pkgs/development/interpreters/python/2.7/default.nix2
-rw-r--r--pkgs/development/interpreters/python/2.7/properly-detect-curses.patch116
-rw-r--r--pkgs/development/interpreters/spidermonkey/17.0.nix2
-rw-r--r--pkgs/development/libraries/SDL/default.nix21
-rw-r--r--pkgs/development/libraries/SDL2/default.nix2
-rw-r--r--pkgs/development/libraries/at-spi2-atk/default.nix6
-rw-r--r--pkgs/development/libraries/at-spi2-core/default.nix4
-rw-r--r--pkgs/development/libraries/db/generic.nix1
-rw-r--r--pkgs/development/libraries/dbus/default.nix4
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/default.nix4
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/setup-hook.sh26
-rw-r--r--pkgs/development/libraries/glib/default.nix4
-rw-r--r--pkgs/development/libraries/glib/setup-hook.sh6
-rw-r--r--pkgs/development/libraries/gmp/5.1.x.nix9
-rw-r--r--pkgs/development/libraries/gmp/6.x.nix9
-rw-r--r--pkgs/development/libraries/gnutls/generic.nix16
-rw-r--r--pkgs/development/libraries/gobject-introspection/default.nix4
-rw-r--r--pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix3
-rw-r--r--pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/gcc-4.9.patch38
-rw-r--r--pkgs/development/libraries/gtk+/2.x.nix4
-rw-r--r--pkgs/development/libraries/gtk+/3.x.nix4
-rw-r--r--pkgs/development/libraries/isl/default.nix24
-rw-r--r--pkgs/development/libraries/jsoncpp/default.nix10
-rw-r--r--pkgs/development/libraries/lame/default.nix2
-rw-r--r--pkgs/development/libraries/lame/gcc-4.9.patch33
-rw-r--r--pkgs/development/libraries/libarchive/CVE-2015-1197.patch143
-rw-r--r--pkgs/development/libraries/libarchive/default.nix1
-rw-r--r--pkgs/development/libraries/libclc/default.nix13
-rw-r--r--pkgs/development/libraries/libdrm/default.nix4
-rw-r--r--pkgs/development/libraries/libffi/default.nix6
-rw-r--r--pkgs/development/libraries/librsvg/default.nix9
-rw-r--r--pkgs/development/libraries/libtiff/default.nix22
-rw-r--r--pkgs/development/libraries/mesa/default.nix30
-rw-r--r--pkgs/development/libraries/ncurses/default.nix92
-rw-r--r--pkgs/development/libraries/ncurses/gcc-5.patch46
-rw-r--r--pkgs/development/libraries/openssl/1.0.2.x.nix25
-rw-r--r--pkgs/development/libraries/openssl/cert-file-path-max.patch34
-rw-r--r--pkgs/development/libraries/openssl/cert-file.patch39
-rw-r--r--pkgs/development/libraries/openssl/default.nix40
-rw-r--r--pkgs/development/libraries/openssl/gnu.patch25
-rw-r--r--pkgs/development/libraries/openssl/hurd-target.patch12
-rw-r--r--pkgs/development/libraries/openssl/kfreebsd-gnu.patch36
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/default.nix6
-rw-r--r--pkgs/development/libraries/wayland/default.nix4
-rw-r--r--pkgs/development/perl-modules/lwp-protocol-https-cert-file.patch6
-rw-r--r--pkgs/development/tools/build-managers/cmake/default.nix8
-rw-r--r--pkgs/development/tools/build-managers/gnumake/4.1/default.nix3
-rw-r--r--pkgs/development/tools/build-managers/gnumake/4.1/no-tty-name.patch53
-rw-r--r--pkgs/development/tools/misc/binutils/default.nix2
-rw-r--r--pkgs/development/tools/misc/help2man/default.nix4
-rw-r--r--pkgs/os-specific/linux/systemd/default.nix2
-rw-r--r--pkgs/os-specific/linux/usbutils/default.nix1
-rw-r--r--pkgs/os-specific/linux/wpa_supplicant/default.nix5
-rw-r--r--pkgs/servers/samba/4.x.nix2
-rw-r--r--pkgs/servers/x11/xorg/builder.sh2
-rw-r--r--pkgs/servers/x11/xorg/default.nix298
-rw-r--r--pkgs/servers/x11/xorg/extra.list1
-rw-r--r--pkgs/servers/x11/xorg/overrides.nix3
-rw-r--r--pkgs/servers/x11/xorg/tarballs-7.7.list76
-rw-r--r--pkgs/stdenv/darwin/default.nix2
-rw-r--r--pkgs/stdenv/generic/setup.sh78
-rw-r--r--pkgs/stdenv/linux/default.nix16
-rw-r--r--pkgs/stdenv/native/default.nix2
-rw-r--r--pkgs/tools/X11/xdg-utils/default.nix12
-rw-r--r--pkgs/tools/filesystems/bcache-tools/default.nix5
-rw-r--r--pkgs/tools/filesystems/bcache-tools/fix-static.patch22
-rw-r--r--pkgs/tools/misc/pipelight/default.nix4
-rw-r--r--pkgs/tools/text/groff/default.nix2
-rw-r--r--pkgs/top-level/all-packages.nix82
104 files changed, 1535 insertions, 806 deletions
diff --git a/nixos/modules/programs/venus.nix b/nixos/modules/programs/venus.nix
index 2b70a795f4fd..3b5ae07e82f7 100644
--- a/nixos/modules/programs/venus.nix
+++ b/nixos/modules/programs/venus.nix
@@ -166,7 +166,7 @@ in
         script = "exec venus-planet ${configFile}";
         serviceConfig.User = "${cfg.user}";
         serviceConfig.Group = "${cfg.group}";
-        environment.OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
+        environment.SSL_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
         startAt = cfg.dates;
       };
 
diff --git a/nixos/modules/security/ca.nix b/nixos/modules/security/ca.nix
index 88f53eab9b43..ddfad52d42ed 100644
--- a/nixos/modules/security/ca.nix
+++ b/nixos/modules/security/ca.nix
@@ -67,8 +67,6 @@ in
     environment.sessionVariables =
       { SSL_CERT_FILE          = "/etc/ssl/certs/ca-certificates.crt";
         # FIXME: unneeded - remove eventually.
-        OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt";
-        # FIXME: unneeded - remove eventually.
         GIT_SSL_CAINFO         = "/etc/ssl/certs/ca-certificates.crt";
       };
 
diff --git a/pkgs/applications/misc/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix
index 6070c560815d..c5095d9f9eea 100644
--- a/pkgs/applications/misc/redshift/default.nix
+++ b/pkgs/applications/misc/redshift/default.nix
@@ -23,11 +23,11 @@ stdenv.mkDerivation rec {
   preInstall = ''
     substituteInPlace src/redshift-gtk/redshift-gtk python --replace "/usr/bin/env python" "${python}/bin/${python.executable}"
   '';
-
+/*
   postInstall = ''
     wrapProgram "$out/bin/redshift-gtk" --prefix PYTHONPATH : $PYTHONPATH:${pygtk}/lib/${python.libPrefix}/site-packages/gtk-2.0:${pyxdg}/lib/${python.libPrefix}/site-packages/pyxdg:$out/lib/${python.libPrefix}/site-packages
   '';
-
+*/
   meta = with stdenv.lib; {
     description = "changes the color temperature of your screen gradually";
     longDescription = ''
diff --git a/pkgs/applications/misc/xlsfonts/default.nix b/pkgs/applications/misc/xlsfonts/default.nix
deleted file mode 100644
index 7584ebf72fb1..000000000000
--- a/pkgs/applications/misc/xlsfonts/default.nix
+++ /dev/null
@@ -1,23 +0,0 @@
-# This program used to come with xorg releases, but now I could only find it
-# at http://www.x.org/releases/individual/.
-# That is why this expression is not inside pkgs.xorg
-
-{stdenv, fetchurl, libX11, pkgconfig}:
-stdenv.mkDerivation rec {
-  name = "xlsfonts-1.0.4";
-
-  src = fetchurl {
-    url = "mirror://xorg/individual/app/${name}.tar.bz2";
-    sha256 = "1lhcx600z9v65nk93xaxfzi79bm4naynabb52gz1vy1bxj2r25r8";
-  };
-
-  buildInputs = [libX11 pkgconfig];
-
-  meta = {
-    homepage = http://www.x.org/;
-    description = "Lists the fonts available in the X server";
-    license = stdenv.lib.licenses.free;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
-  };
-}
diff --git a/pkgs/applications/networking/cluster/panamax/api/default.nix b/pkgs/applications/networking/cluster/panamax/api/default.nix
index a212ab5347c5..524433b45fbc 100644
--- a/pkgs/applications/networking/cluster/panamax/api/default.nix
+++ b/pkgs/applications/networking/cluster/panamax/api/default.nix
@@ -62,7 +62,6 @@ stdenv.mkDerivation rec {
       --prefix "PATH" : "$out/share/panamax-api/bin:${env.ruby}/bin:$PATH" \
       --prefix "HOME" : "$out/share/panamax-api" \
       --prefix "GEM_HOME" : "${env}/${env.ruby.gemPath}" \
-      --prefix "OPENSSL_X509_CERT_FILE" : "${cacert}/etc/ssl/certs/ca-bundle.crt" \
       --prefix "SSL_CERT_FILE" : "${cacert}/etc/ssl/certs/ca-bundle.crt" \
       --prefix "GEM_PATH" : "$out/share/panamax-api:${bundler}/${env.ruby.gemPath}"
   '';
diff --git a/pkgs/applications/networking/instant-messengers/tkabber/default.nix b/pkgs/applications/networking/instant-messengers/tkabber/default.nix
index 2b3703bc2799..d0cc333c71b6 100644
--- a/pkgs/applications/networking/instant-messengers/tkabber/default.nix
+++ b/pkgs/applications/networking/instant-messengers/tkabber/default.nix
@@ -43,7 +43,7 @@ in mkTkabber (main // {
   postPatch = ''
     substituteInPlace login.tcl --replace \
       "custom::defvar loginconf(sslcacertstore) \"\"" \
-      "custom::defvar loginconf(sslcacertstore) \$env(OPENSSL_X509_CERT_FILE)"
+      "custom::defvar loginconf(sslcacertstore) \$env(SSL_CERT_FILE)"
   '' + optionalString (theme != null) ''
     themePath="$out/share/doc/tkabber/examples/xrdb/${theme}.xrdb"
     sed -i '/^if.*load_default_xrdb/,/^}$/ {
diff --git a/pkgs/applications/networking/newsreaders/liferea/default.nix b/pkgs/applications/networking/newsreaders/liferea/default.nix
index 28baa2f7b67d..c2ee5cd83db2 100644
--- a/pkgs/applications/networking/newsreaders/liferea/default.nix
+++ b/pkgs/applications/networking/newsreaders/liferea/default.nix
@@ -28,8 +28,6 @@ stdenv.mkDerivation rec {
   ];
 
   preFixup = ''
-    rm $out/share/icons/hicolor/icon-theme.cache
-
     for f in "$out"/bin/*; do
       wrapProgram "$f" \
         --prefix PYTHONPATH : "$(toPythonPath $out):$(toPythonPath ${pygobject3})" \
diff --git a/pkgs/applications/version-management/git-and-tools/git/cert-path.patch b/pkgs/applications/version-management/git-and-tools/git/cert-path.patch
index 846752f5bfe3..7d5dca9abfeb 100644
--- a/pkgs/applications/version-management/git-and-tools/git/cert-path.patch
+++ b/pkgs/applications/version-management/git-and-tools/git/cert-path.patch
@@ -5,7 +5,7 @@ diff -ru -x '*~' git-1.9.2-orig/git-send-email.perl git-1.9.2/git-send-email.per
  		return;
  	}
  
-+	$smtp_ssl_cert_path //= $ENV{'OPENSSL_X509_CERT_FILE'};
++	$smtp_ssl_cert_path //= $ENV{'SSL_CERT_FILE'};
 +
  	if (!defined $smtp_ssl_cert_path) {
  		# use the OpenSSL defaults
diff --git a/pkgs/applications/video/minitube/default.nix b/pkgs/applications/video/minitube/default.nix
new file mode 100644
index 000000000000..b9c4de0811de
--- /dev/null
+++ b/pkgs/applications/video/minitube/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, makeWrapper, phonon, phonon_backend_vlc, qt4
+# "Free" API key generated by nckx <tobias.geerinckx.rice@gmail.com>
+, withAPIKey ? "AIzaSyBtFgbln3bu1swQC-naMxMtKh384D3xJZE" }:
+
+let version = "2.4"; in
+stdenv.mkDerivation {
+  name = "minitube-${version}";
+
+  src = fetchFromGitHub {
+    sha256 = "0mm8v2vpspwxh2fqaykb381v6r9apywc1b0x8jkcbp7s43w10lp5";
+    rev = version;
+    repo = "minitube";
+    owner = "flaviotordini";
+  };
+
+  meta = with stdenv.lib; {
+    inherit version;
+    description = "Stand-alone YouTube video player";
+    longDescription = ''
+      Watch YouTube videos in a new way: you type a keyword, Minitube gives
+      you an endless video stream. Minitube is not about cloning the YouTube
+      website, it aims to create a new TV-like experience.
+    '';
+    homepage = http://flavio.tordini.org/minitube;
+    license = licenses.gpl3Plus;
+    platforms = with platforms; linux;
+    maintainers = with maintainers; [ nckx ];
+  };
+
+  buildInputs = [ phonon phonon_backend_vlc qt4 ];
+  nativeBuildInputs = [ makeWrapper ];
+
+  configurePhase = ''
+    qmake PREFIX=$out "DEFINES += APP_GOOGLE_API_KEY=${withAPIKey}"
+  '';
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    wrapProgram $out/bin/minitube \
+      --prefix QT_PLUGIN_PATH : "${phonon_backend_vlc}/lib/kde4/plugins"
+  '';
+}
diff --git a/pkgs/applications/window-managers/xcompmgr/default.nix b/pkgs/applications/window-managers/xcompmgr/default.nix
deleted file mode 100644
index 930b612f6914..000000000000
--- a/pkgs/applications/window-managers/xcompmgr/default.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, libXcomposite, libXfixes, libXdamage
-, libXrender, libXext }:
-stdenv.mkDerivation rec {
-  name = "xcompmgr-1.1.6";
-  src = fetchurl {
-    url = "mirror://xorg/individual/app/${name}.tar.bz2";
-    sha256 = "c98949d36793b30ed1ed47495c87a05fa245ac0fc2857d2abc54979124687c02";
-  };
-  buildInputs = [ pkgconfig libXcomposite libXfixes libXdamage libXrender libXext ];
-  meta = {
-    homepage = http://www.x.org/;
-    description = "A sample compositing manager for X servers";
-    longDescription = ''
-      A sample compositing manager for X servers supporting the XFIXES,
-      DAMAGE, RENDER, and COMPOSITE extensions.  It enables basic eye-candy
-      effects.
-    '';
-    license = "bsd";
-    maintainers = with stdenv.lib.maintainers; [ astsmtl ];
-    platforms = with stdenv.lib.platforms; linux;
-  };
-}
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index c8af548a2ca4..ec024c72481d 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -9,7 +9,6 @@
 , cc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? stdenv.shell
 , zlib ? null, extraPackages ? []
 , dyld ? null # TODO: should this be a setup-hook on dyld?
-, setupHook ? ./setup-hook.sh
 , isGNU ? false, isClang ? false
 }:
 
@@ -227,7 +226,7 @@ stdenv.mkDerivation {
     ''
 
     + ''
-      substituteAll ${setupHook} $out/nix-support/setup-hook.tmp
+      substituteAll ${./setup-hook.sh} $out/nix-support/setup-hook.tmp
       cat $out/nix-support/setup-hook.tmp >> $out/nix-support/setup-hook
       rm $out/nix-support/setup-hook.tmp
 
diff --git a/pkgs/build-support/cc-wrapper/setup-hook-stdinc.sh b/pkgs/build-support/cc-wrapper/setup-hook-stdinc.sh
deleted file mode 100644
index 22e778b06904..000000000000
--- a/pkgs/build-support/cc-wrapper/setup-hook-stdinc.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-# This is an alternate setup hook for gcc-wrapper that uses the -I flag to
-# add include search paths instead of -isystem. We need this for some packages
-# because -isystem can change the search order specified by prior -I flags.
-# Changing the search order can point gcc to the wrong package's headers.
-# The -I flag will never change the order of prior flags.
-
-export NIX_CC=@out@
-
-addCVars () {
-    if [ -d $1/include ]; then
-        export NIX_CFLAGS_COMPILE+=" -I $1/include"
-    fi
-
-    if [ -d $1/lib64 -a ! -L $1/lib64 ]; then
-        export NIX_LDFLAGS+=" -L$1/lib64"
-    fi
-
-    if [ -d $1/lib ]; then
-        export NIX_LDFLAGS+=" -L$1/lib"
-    fi
-}
-
-envHooks+=(addCVars)
-
-# Note: these come *after* $out in the PATH (see setup.sh).
-
-if [ -n "@gcc@" ]; then
-    addToSearchPath PATH @gcc@/bin
-fi
-
-if [ -n "@binutils@" ]; then
-    addToSearchPath PATH @binutils@/bin
-fi
-
-if [ -n "@libc@" ]; then
-    addToSearchPath PATH @libc@/bin
-fi
-
-if [ -n "@coreutils@" ]; then
-    addToSearchPath PATH @coreutils@/bin
-fi
-
-export CC=gcc
-export CXX=g++
diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh
index 648afda6ebb9..3d0b2fdfe8ae 100644
--- a/pkgs/build-support/cc-wrapper/setup-hook.sh
+++ b/pkgs/build-support/cc-wrapper/setup-hook.sh
@@ -2,7 +2,7 @@ export NIX_CC=@out@
 
 addCVars () {
     if [ -d $1/include ]; then
-        export NIX_CFLAGS_COMPILE+=" -isystem $1/include"
+        export NIX_CFLAGS_COMPILE+=" ${ccIncludeFlag:--isystem} $1/include"
     fi
 
     if [ -d $1/lib64 -a ! -L $1/lib64 ]; then
diff --git a/pkgs/desktops/xfce/core/exo.nix b/pkgs/desktops/xfce/core/exo.nix
index e4c7c3183521..f48a3e3808bd 100644
--- a/pkgs/desktops/xfce/core/exo.nix
+++ b/pkgs/desktops/xfce/core/exo.nix
@@ -3,11 +3,11 @@
 stdenv.mkDerivation rec {
   p_name  = "exo";
   ver_maj = "0.10";
-  ver_min = "4";
+  ver_min = "6";
 
   src = fetchurl {
     url = "mirror://xfce/src/xfce/${p_name}/${ver_maj}/${name}.tar.bz2";
-    sha256 = "cced5fdbc0b61a5d976210ff71ecdd81b89fcd15e5860a44f50da7b83fb2deaa";
+    sha256 = "1cc0e5a432e050a5e5aa64d126b988f4440da4f27474aaf42a4d8e13651d0752";
   };
   name = "${p_name}-${ver_maj}.${ver_min}";
 
diff --git a/pkgs/desktops/xfce/core/thunar.nix b/pkgs/desktops/xfce/core/thunar.nix
index abcfd656c502..6e4794544596 100644
--- a/pkgs/desktops/xfce/core/thunar.nix
+++ b/pkgs/desktops/xfce/core/thunar.nix
@@ -6,11 +6,11 @@
 stdenv.mkDerivation rec {
   p_name  = "thunar";
   ver_maj = "1.6";
-  ver_min = "6";
+  ver_min = "10";
 
   src = fetchurl {
     url = "mirror://xfce/src/xfce/${p_name}/${ver_maj}/Thunar-${ver_maj}.${ver_min}.tar.bz2";
-    sha256 = "1cl9v3rdzipyyxml3pyrzspxfmmssz5h5snpj18irq4an42539dr";
+    sha256 = "7e9d24067268900e5e44d3325e60a1a2b2f8f556ec238ec12574fbea15fdee8a";
   };
   name = "${p_name}-${ver_maj}.${ver_min}";
 
diff --git a/pkgs/desktops/xfce/core/xfdesktop.nix b/pkgs/desktops/xfce/core/xfdesktop.nix
index 45a89b93748d..4402e61a2fb6 100644
--- a/pkgs/desktops/xfce/core/xfdesktop.nix
+++ b/pkgs/desktops/xfce/core/xfdesktop.nix
@@ -4,11 +4,11 @@
 stdenv.mkDerivation rec {
   p_name  = "xfdesktop";
   ver_maj = "4.12";
-  ver_min = "0";
+  ver_min = "2";
 
   src = fetchurl {
     url = "mirror://xfce/src/xfce/${p_name}/${ver_maj}/${name}.tar.bz2";
-    sha256 = "1ivzgg4792nid6wcgd1nq5vc3z0y5ip6ymq7ci5j2qkp663qnykf";
+    sha256 = "c9788883163b57bac39d12e5f8310c869d176454879defb78b67f8e9f1ad5225";
   };
   name = "${p_name}-${ver_maj}.${ver_min}";
 
diff --git a/pkgs/desktops/xfce/core/xfwm4.nix b/pkgs/desktops/xfce/core/xfwm4.nix
index cedf36d43ae1..dd18b1355f79 100644
--- a/pkgs/desktops/xfce/core/xfwm4.nix
+++ b/pkgs/desktops/xfce/core/xfwm4.nix
@@ -4,11 +4,11 @@
 stdenv.mkDerivation rec {
   p_name  = "xfwm4";
   ver_maj = "4.12";
-  ver_min = "2";
+  ver_min = "3";
 
   src = fetchurl {
     url = "mirror://xfce/src/xfce/${p_name}/${ver_maj}/${name}.tar.bz2";
-    sha256 = "5bb5f72b41060d10bd3823f8b69abcd462bbd8853fdf9c82041450ae68e7d75a";
+    sha256 = "f4a988fbc4e0df7e8583c781d271559e56fd28696092f94ae052e9e6edb09eac";
   };
   name = "${p_name}-${ver_maj}.${ver_min}";
 
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 6d5627c34d68..69f9a8df0257 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -209,6 +209,8 @@ stdenv.mkDerivation ({
 
   builder = ../builder.sh;
 
+  outputs = [ "out" "info" ];
+
   src = fetchurl {
     url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
     sha256 = "15c6gwm6dzsaagamxkak5smdkf1rdfbqqjs9jdbrp3lbg4ism02a";
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index 16737ffc8963..1cc894b9dcf3 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -208,6 +208,8 @@ stdenv.mkDerivation ({
 
   builder = ../builder.sh;
 
+  outputs = [ "out" "info" ];
+
   src = fetchurl {
     url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
     sha256 = "1pbjp4blk2ycaa6r3jmw4ky5f1s9ji3klbqgv8zs2sl5jn1cj810";
diff --git a/pkgs/development/compilers/ghc/7.0.4-binary.nix b/pkgs/development/compilers/ghc/7.0.4-binary.nix
index a1cdd6171eee..7a6f1b78fa49 100644
--- a/pkgs/development/compilers/ghc/7.0.4-binary.nix
+++ b/pkgs/development/compilers/ghc/7.0.4-binary.nix
@@ -90,7 +90,7 @@ stdenv.mkDerivation rec {
   configurePhase = ''
     ./configure --prefix=$out \
       --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include \
-      ${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"}
+      ${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"}
   '';
 
   # Stripping combined with patchelf breaks the executables (they die
diff --git a/pkgs/development/compilers/ghc/7.0.4.nix b/pkgs/development/compilers/ghc/7.0.4.nix
index c28359af16fa..281e5ca66a2c 100644
--- a/pkgs/development/compilers/ghc/7.0.4.nix
+++ b/pkgs/development/compilers/ghc/7.0.4.nix
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     export NIX_LDFLAGS+=" -no_dtrace_dof"
   '';
 
-  configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"
+  configureFlags = if stdenv.isDarwin then "--with-gcc=${./gcc-clang-wrapper.sh}"
                                       else "--with-gcc=${stdenv.cc}/bin/gcc";
 
   NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";
diff --git a/pkgs/development/compilers/ghc/7.2.2.nix b/pkgs/development/compilers/ghc/7.2.2.nix
index 651cf200a8d0..7276f413967f 100644
--- a/pkgs/development/compilers/ghc/7.2.2.nix
+++ b/pkgs/development/compilers/ghc/7.2.2.nix
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
     export NIX_LDFLAGS+=" -no_dtrace_dof"
   '';
 
-  configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"
+  configureFlags = if stdenv.isDarwin then "--with-gcc=${./gcc-clang-wrapper.sh}"
                                       else "--with-gcc=${stdenv.cc}/bin/gcc";
 
   NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";
diff --git a/pkgs/development/compilers/ghc/7.4.2-binary.nix b/pkgs/development/compilers/ghc/7.4.2-binary.nix
index 2b8d403701f6..25c9dd0a65a9 100644
--- a/pkgs/development/compilers/ghc/7.4.2-binary.nix
+++ b/pkgs/development/compilers/ghc/7.4.2-binary.nix
@@ -90,7 +90,7 @@ stdenv.mkDerivation rec {
   configurePhase = ''
     ./configure --prefix=$out \
       --with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include \
-      ${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"}
+      ${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"}
   '';
 
   # Stripping combined with patchelf breaks the executables (they die
diff --git a/pkgs/development/compilers/ghc/7.4.2.nix b/pkgs/development/compilers/ghc/7.4.2.nix
index 4e4a5f6024ea..b2abcb08ec3a 100644
--- a/pkgs/development/compilers/ghc/7.4.2.nix
+++ b/pkgs/development/compilers/ghc/7.4.2.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     export NIX_LDFLAGS+=" -no_dtrace_dof"
   '';
 
-  configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"
+  configureFlags = if stdenv.isDarwin then "--with-gcc=${./gcc-clang-wrapper.sh}"
                                       else "--with-gcc=${stdenv.cc}/bin/gcc";
 
   # required, because otherwise all symbols from HSffi.o are stripped, and
diff --git a/pkgs/development/compilers/ghc/7.6.3.nix b/pkgs/development/compilers/ghc/7.6.3.nix
index 4eb6e425f354..366c0044a67a 100644
--- a/pkgs/development/compilers/ghc/7.6.3.nix
+++ b/pkgs/development/compilers/ghc/7.6.3.nix
@@ -52,7 +52,7 @@ in stdenv.mkDerivation rec {
     export NIX_LDFLAGS+=" -no_dtrace_dof"
   '';
 
-  configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"
+  configureFlags = if stdenv.isDarwin then "--with-gcc=${./gcc-clang-wrapper.sh}"
                                       else "--with-gcc=${stdenv.cc}/bin/gcc";
 
   postInstall = ''
diff --git a/pkgs/development/haskell-modules/gcc-clang-wrapper.sh b/pkgs/development/compilers/ghc/gcc-clang-wrapper.sh
index d081be231a1c..d081be231a1c 100755
--- a/pkgs/development/haskell-modules/gcc-clang-wrapper.sh
+++ b/pkgs/development/compilers/ghc/gcc-clang-wrapper.sh
diff --git a/pkgs/development/compilers/llvm/3.6/llvm.nix b/pkgs/development/compilers/llvm/3.6/llvm.nix
index f23ac614b5cf..0cf5ef215a2f 100644
--- a/pkgs/development/compilers/llvm/3.6/llvm.nix
+++ b/pkgs/development/compilers/llvm/3.6/llvm.nix
@@ -27,7 +27,7 @@ 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 python libffi ] /* ++ stdenv.lib.optional stdenv.isLinux valgrind */;
 
   propagatedBuildInputs = [ ncurses zlib ];
 
diff --git a/pkgs/development/interpreters/perl/5.20/default.nix b/pkgs/development/interpreters/perl/5.20/default.nix
index 0ad955d03630..7651bc15f469 100644
--- a/pkgs/development/interpreters/perl/5.20/default.nix
+++ b/pkgs/development/interpreters/perl/5.20/default.nix
@@ -31,6 +31,8 @@ stdenv.mkDerivation rec {
   patches =
     [ # Do not look in /usr etc. for dependencies.
       ./no-sys-dirs.patch
+      # Remove in 5.20.3
+      ./perl-5.20.2-gcc5_fixes-1.patch
     ]
     ++ optional stdenv.isSunOS ./ld-shared.patch
     ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
diff --git a/pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch b/pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch
new file mode 100644
index 000000000000..21f3ca8d7a54
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch
@@ -0,0 +1,127 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2015-04-17
+Initial Package Version: 5.20.2
+Upstream Status: Committed
+Origin: Petr Pisař and Tony Cook
+Description: Fixes Errno.pm and h2ph with gcc-5.
+
+1. cherry-picked because the change to $version will not apply, from
+commit 816b056ffb99ae54642320e20dc30a59fd1effef
+Author: Petr Písař <ppisar@redhat.com>
+Date:   Wed Feb 11 15:46:37 2015 +0100
+
+    Fix Errno.pm generation for gcc-5.0
+    
+    gcc-5.0 -E interleaves now line numbers with expended macros, so that
+    the generated errno.c will be preprocessed to
+    
+    EBFONT => [[
+               59
+                    ]]
+    
+    which is hard to parse in in line-based reader.
+    
+    So use -P option with gcc >= 5.0. Global -P usage would break makedepend,
+    global -ftrack-macro-expansion=0 would break lib/h2ph.t.
+    
+    RT#123784
+
+diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
+index 3dadfce..c6bfa06 100644
+--- a/ext/Errno/Errno_pm.PL
++++ b/ext/Errno/Errno_pm.PL
+@@ -215,20 +215,31 @@ sub write_errno_pm {
+     {	# BeOS (support now removed) did not enter this block
+     # invoke CPP and read the output
+ 
++	my $inhibit_linemarkers = '';
++	if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
++	    # GCC 5.0 interleaves expanded macros with line numbers breaking
++	    # each line into multiple lines. RT#123784
++	    $inhibit_linemarkers = ' -P';
++	}
++
+ 	if ($^O eq 'VMS') {
+-	    my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
++	    my $cpp = "$Config{cppstdin} $Config{cppflags}" .
++		$inhibit_linemarkers . " $Config{cppminus}";
+ 	    $cpp =~ s/sys\$input//i;
+ 	    open(CPPO,"$cpp  errno.c |") or
+ 		die "Cannot exec $Config{cppstdin}";
+ 	} elsif ($IsMSWin32 || $^O eq 'NetWare') {
+-	    open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
+-		die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
++	    my $cpp = "$Config{cpprun} $Config{cppflags}" .
++		$inhibit_linemarkers;
++	    open(CPPO,"$cpp errno.c |") or
++		die "Cannot run '$cpp errno.c'";
+ 	} elsif ($IsSymbian) {
+-            my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc -";
++            my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc" .
++		$inhibit_linemarkers ." -";
+ 	    open(CPPO,"$cpp < errno.c |")
+ 		or die "Cannot exec $cpp";
+         } else {
+-	    my $cpp = default_cpp();
++	    my $cpp = default_cpp() . $inhibit_linemarkers;
+ 	    open(CPPO,"$cpp < errno.c |")
+ 		or die "Cannot exec $cpp";
+ 	}
+
+commit 3bea78d24634e630b610f59957e7a019205a67b2
+Author: Tony Cook <tony@develop-help.com>
+Date:   Mon Feb 16 15:57:00 2015 +1100
+
+    h2ph: correct handling of hex constants for the preamble
+    
+    Previously they were treated as identifiers resulting in code
+    generated like C< &0xFFF >.
+    
+    We also try to prevent compile-time warnings from large hex integers,
+    the user isn't responsible for the generated code, so we delay those
+    warnings to run-time.
+
+diff --git a/utils/h2ph.PL b/utils/h2ph.PL
+index 9a8b14d..d082f22 100644
+--- a/utils/h2ph.PL
++++ b/utils/h2ph.PL
+@@ -769,7 +769,7 @@ sub inc_dirs
+ sub build_preamble_if_necessary
+ {
+     # Increment $VERSION every time this function is modified:
+-    my $VERSION     = 3;
++    my $VERSION     = 4;
+     my $preamble    = "$Dest_dir/_h2ph_pre.ph";
+ 
+     # Can we skip building the preamble file?
+@@ -788,6 +788,11 @@ sub build_preamble_if_necessary
+ 
+     open  PREAMBLE, ">$preamble" or die "Cannot open $preamble:  $!";
+ 	print PREAMBLE "# This file was created by h2ph version $VERSION\n";
++        # Prevent non-portable hex constants from warning.
++        #
++        # We still produce an overflow warning if we can't represent
++        # a hex constant as an integer.
++        print PREAMBLE "no warnings qw(portable);\n";
+ 
+ 	foreach (sort keys %define) {
+ 	    if ($opt_D) {
+@@ -814,6 +819,18 @@ DEFINE
+ 		# integer:
+ 		print PREAMBLE
+ 		    "unless (defined &$_) { sub $_() { $1 } }\n\n";
++            } elsif ($define{$_} =~ /^([+-]?0x[\da-f]+)U?L{0,2}$/i) {
++                # hex integer
++                # Special cased, since perl warns on hex integers
++                # that can't be represented in a UV.
++                #
++                # This way we get the warning at time of use, so the user
++                # only gets the warning if they happen to use this
++                # platform-specific definition.
++                my $code = $1;
++                $code = "hex('$code')" if length $code > 10;
++                print PREAMBLE
++                    "unless (defined &$_) { sub $_() { $code } }\n\n";
+ 	    } elsif ($define{$_} =~ /^\w+$/) {
+ 		my $def = $define{$_};
+ 		if ($isatype{$def}) {
diff --git a/pkgs/development/interpreters/perl/5.22/cpp-precomp.patch b/pkgs/development/interpreters/perl/5.22/cpp-precomp.patch
new file mode 100644
index 000000000000..231853fe51a6
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/cpp-precomp.patch
@@ -0,0 +1,11 @@
+--- a/hints/darwin.sh	2013-05-08 11:13:45.000000000 -0600
++++ b/hints/darwin.sh	2013-05-08 11:15:04.000000000 -0600
+@@ -129,7 +129,7 @@
+ 
+ # Avoid Apple's cpp precompiler, better for extensions
+ if [ "X`echo | ${cc} -no-cpp-precomp -E - 2>&1 >/dev/null`" = "X" ]; then
+-    cppflags="${cppflags} -no-cpp-precomp"
++    #cppflags="${cppflags} -no-cpp-precomp"
+ 
+     # This is necessary because perl's build system doesn't
+     # apply cppflags to cc compile lines as it should.
diff --git a/pkgs/development/interpreters/perl/5.22/default.nix b/pkgs/development/interpreters/perl/5.22/default.nix
new file mode 100644
index 000000000000..f9068de1c2cf
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/default.nix
@@ -0,0 +1,105 @@
+{ stdenv, fetchurl, enableThreading ? stdenv ? glibc }:
+
+# 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
+
+  libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr";
+
+in
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "perl-5.22.0";
+
+  src = fetchurl {
+    url = "mirror://cpan/src/5.0/${name}.tar.gz";
+    sha256 = "0g5bl8sdpzx9gx2g5jq3py4bj07z2ylk7s1qn0fvsss2yl3hhs8c";
+  };
+
+  patches =
+    [ # Do not look in /usr etc. for dependencies.
+      ./no-sys-dirs.patch
+    ]
+    ++ optional stdenv.isSunOS ./ld-shared.patch
+    ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ];
+
+  # Build a thread-safe Perl with a dynamic libperls.o.  We need the
+  # "installstyle" option to ensure that modules are put under
+  # $out/lib/perl5 - this is the general default, but because $out
+  # contains the string "perl", Configure would select $out/lib.
+  # Miniperl needs -lm. perl needs -lrt.
+  configureFlags =
+    [ "-de"
+      "-Dcc=cc"
+      "-Uinstallusrbinperl"
+      "-Dinstallstyle=lib/perl5"
+      "-Duseshrplib"
+      "-Dlocincpth=${libc}/include"
+      "-Dloclibpth=${libc}/lib"
+    ]
+    ++ optional enableThreading "-Dusethreads";
+
+  configureScript = "${stdenv.shell} ./Configure";
+
+  dontAddPrefix = true;
+
+  enableParallelBuilding = true;
+
+  preConfigure =
+    ''
+
+      configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
+
+      ${optionalString stdenv.isArm ''
+        configureFlagsArray=(-Dldflags="-lm -lrt")
+      ''}
+    '' + optionalString stdenv.isDarwin ''
+      substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" ""
+    '' + optionalString (!enableThreading) ''
+      # We need to do this because the bootstrap doesn't have a static libpthread
+      sed -i 's,\(libswanted.*\)pthread,\1,g' Configure
+    '';
+
+  preBuild = optionalString (!(stdenv ? cc && stdenv.cc.nativeTools))
+    ''
+      # Make Cwd work on NixOS (where we don't have a /bin/pwd).
+      substituteInPlace dist/PathTools/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
+    '';
+
+  setupHook = ./setup-hook.sh;
+
+  passthru.libPrefix = "lib/perl5/site_perl";
+
+  preCheck = ''
+    # Try and setup a local hosts file
+    if [ -f "${libc}/lib/libnss_files.so" ]; then
+      mkdir $TMPDIR/fakelib
+      cp "${libc}/lib/libnss_files.so" $TMPDIR/fakelib
+      sed -i 's,/etc/hosts,/dev/fd/3,g' $TMPDIR/fakelib/libnss_files.so
+      export LD_LIBRARY_PATH=$TMPDIR/fakelib
+    fi
+  '';
+
+  postCheck = ''
+    unset LD_LIBRARY_PATH
+  '';
+
+  meta = {
+    homepage = https://www.perl.org/;
+    description = "The standard implementation of the Perl 5 programmming language";
+    maintainers = [ maintainers.eelco ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/development/interpreters/perl/5.22/ld-shared.patch b/pkgs/development/interpreters/perl/5.22/ld-shared.patch
new file mode 100644
index 000000000000..be45230c8a73
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/ld-shared.patch
@@ -0,0 +1,11 @@
+--- perl-5.16.2/hints/solaris_2.sh.orig	2013-02-14 19:29:49.453988140 +0000
++++ perl-5.16.2/hints/solaris_2.sh	2013-02-14 19:30:31.681631019 +0000
+@@ -568,7 +568,7 @@
+ #		    ccflags="$ccflags -Wa,`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
+ #		fi
+ 		ldflags="$ldflags -m64"
+-		lddlflags="$lddlflags -G -m64"
++		lddlflags="$lddlflags -shared -m64"
+ 		;;
+ 	    *)
+ 		getconfccflags="`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
diff --git a/pkgs/development/interpreters/perl/5.22/no-libutil.patch b/pkgs/development/interpreters/perl/5.22/no-libutil.patch
new file mode 100644
index 000000000000..68d44612bfe6
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/no-libutil.patch
@@ -0,0 +1,12 @@
+diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
+--- perl-5.14.2-orig/Configure	2011-09-26 11:44:34.000000000 +0200
++++ perl-5.14.2/Configure	2012-02-16 17:24:50.779839039 +0100
+@@ -1368,7 +1368,7 @@
+ : List of libraries we want.
+ : If anyone needs extra -lxxx, put those in a hint file.
+ libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
+-libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
++libswanted="$libswanted m crypt sec c cposix posix ucb bsd BSD"
+ : We probably want to search /usr/shlib before most other libraries.
+ : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
+ glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
diff --git a/pkgs/development/interpreters/perl/5.22/no-sys-dirs.patch b/pkgs/development/interpreters/perl/5.22/no-sys-dirs.patch
new file mode 100644
index 000000000000..1793273a76f9
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/no-sys-dirs.patch
@@ -0,0 +1,250 @@
+diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
+--- perl-5.20.0-orig/Configure	2014-05-26 15:34:18.000000000 +0200
++++ perl-5.20.0/Configure	2014-06-25 10:43:35.368285986 +0200
+@@ -106,15 +106,7 @@
+ fi
+ 
+ : Proper PATH setting
+-paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
+-paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
+-paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
+-paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
+-paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
+-paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
+-paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
+-paths="$paths /sbin /usr/sbin /usr/libexec"
+-paths="$paths /system/gnu_library/bin"
++paths=''
+ 
+ for p in $paths
+ do
+@@ -1337,8 +1329,7 @@
+ archname=''
+ : Possible local include directories to search.
+ : Set locincpth to "" in a hint file to defeat local include searches.
+-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
+-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
++locincpth=""
+ :
+ : no include file wanted by default
+ inclwanted=''
+@@ -1349,17 +1340,12 @@
+ 
+ libnames=''
+ : change the next line if compiling for Xenix/286 on Xenix/386
+-xlibpth='/usr/lib/386 /lib/386'
++xlibpth=''
+ : Possible local library directories to search.
+-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
+-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
++loclibpth=""
+ 
+ : general looking path for locating libraries
+-glibpth="/lib /usr/lib $xlibpth"
+-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
+-test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
+-test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
+-test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
++glibpth=""
+ 
+ : Private path used by Configure to find libraries.  Its value
+ : is prepended to libpth. This variable takes care of special
+@@ -1391,8 +1377,6 @@
+ libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
+ : We probably want to search /usr/shlib before most other libraries.
+ : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
+-glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
+-glibpth="/usr/shlib $glibpth"
+ : Do not use vfork unless overridden by a hint file.
+ usevfork=false
+ 
+@@ -2446,7 +2430,6 @@
+ zip
+ "
+ pth=`echo $PATH | sed -e "s/$p_/ /g"`
+-pth="$pth $sysroot/lib $sysroot/usr/lib"
+ for file in $loclist; do
+ 	eval xxx=\$$file
+ 	case "$xxx" in
+@@ -4936,7 +4919,7 @@
+ : Set private lib path
+ case "$plibpth" in
+ '') if ./mips; then
+-	plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
++	plibpth="$incpath/usr/lib"
+     fi;;
+ esac
+ case "$libpth" in
+@@ -8600,13 +8583,8 @@
+ echo " "
+ case "$sysman" in
+ '')
+-	syspath='/usr/share/man/man1 /usr/man/man1'
+-	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
+-	syspath="$syspath /usr/man/u_man/man1"
+-	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
+-	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
+-	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
+-	sysman=`./loc . /usr/man/man1 $syspath`
++	syspath=''
++	sysman=''
+ 	;;
+ esac
+ if $test -d "$sysman"; then
+@@ -19900,9 +19878,10 @@
+ case "$full_ar" in
+ '') full_ar=$ar ;;
+ esac
++full_ar=ar
+ 
+ : Store the full pathname to the sed program for use in the C program
+-full_sed=$sed
++full_sed=sed
+ 
+ : see what type gids are declared as in the kernel
+ echo " "
+Only in perl-5.20.0/: Configure.orig
+diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/ext/Errno/Errno_pm.PL perl-5.20.0/ext/Errno/Errno_pm.PL
+--- perl-5.20.0-orig/ext/Errno/Errno_pm.PL	2014-05-26 15:34:20.000000000 +0200
++++ perl-5.20.0/ext/Errno/Errno_pm.PL	2014-06-25 10:31:24.317970047 +0200
+@@ -126,11 +126,7 @@
+ 	if ($dep =~ /(\S+errno\.h)/) {
+ 	     $file{$1} = 1;
+ 	}
+-    } elsif ($^O eq 'linux' &&
+-	      $Config{gccversion} ne '' && 
+-	      $Config{gccversion} !~ /intel/i
+-	      # might be using, say, Intel's icc
+-	     ) {
++    } elsif (0) {
+     # When cross-compiling we may store a path for gcc's "sysroot" option:
+     my $sysroot = $Config{sysroot} || '';
+ 	# Some Linuxes have weird errno.hs which generate
+Only in perl-5.20.0/ext/Errno: Errno_pm.PL.orig
+diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/freebsd.sh perl-5.20.0/hints/freebsd.sh
+--- perl-5.20.0-orig/hints/freebsd.sh	2014-01-31 22:55:51.000000000 +0100
++++ perl-5.20.0/hints/freebsd.sh	2014-06-25 10:25:53.263964680 +0200
+@@ -119,21 +119,21 @@
+         objformat=`/usr/bin/objformat`
+         if [ x$objformat = xaout ]; then
+             if [ -e /usr/lib/aout ]; then
+-                libpth="/usr/lib/aout /usr/local/lib /usr/lib"
+-                glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
++                libpth=""
++                glibpth=""
+             fi
+             lddlflags='-Bshareable'
+         else
+-            libpth="/usr/lib /usr/local/lib"
+-            glibpth="/usr/lib /usr/local/lib"
++            libpth=""
++            glibpth=""
+             ldflags="-Wl,-E "
+             lddlflags="-shared "
+         fi
+         cccdlflags='-DPIC -fPIC'
+         ;;
+ *)
+-       libpth="/usr/lib /usr/local/lib"
+-       glibpth="/usr/lib /usr/local/lib"
++       libpth=""
++       glibpth=""
+        ldflags="-Wl,-E "
+         lddlflags="-shared "
+         cccdlflags='-DPIC -fPIC'
+diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/linux.sh
+--- perl-5.20.0-orig/hints/linux.sh	2014-05-26 15:34:20.000000000 +0200
++++ perl-5.20.0/hints/linux.sh	2014-06-25 10:33:47.354883843 +0200
+@@ -150,25 +150,6 @@
+     ;;
+ esac
+ 
+-# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
+-# (such as -lm) in /lib or /usr/lib.  So we have to ask gcc to tell us
+-# where to look.  We don't want gcc's own libraries, however, so we
+-# filter those out.
+-# This could be conditional on Unbuntu, but other distributions may
+-# follow suit, and this scheme seems to work even on rather old gcc's.
+-# This unconditionally uses gcc because even if the user is using another
+-# compiler, we still need to find the math library and friends, and I don't
+-# know how other compilers will cope with that situation.
+-# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
+-# we don't want its libraries. So we try to prefer the system gcc
+-# Still, as an escape hatch, allow Configure command line overrides to
+-# plibpth to bypass this check.
+-if [ -x /usr/bin/gcc ] ; then
+-    gcc=/usr/bin/gcc
+-else
+-    gcc=gcc
+-fi
+-
+ case "$plibpth" in
+ '') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
+ 	cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
+@@ -178,32 +159,6 @@
+     ;;
+ esac
+ 
+-case "$libc" in
+-'')
+-# If you have glibc, then report the version for ./myconfig bug reporting.
+-# (Configure doesn't need to know the specific version since it just uses
+-# gcc to load the library for all tests.)
+-# We don't use __GLIBC__ and  __GLIBC_MINOR__ because they
+-# are insufficiently precise to distinguish things like
+-# libc-2.0.6 and libc-2.0.7.
+-    for p in $plibpth
+-    do
+-        for trylib in libc.so.6 libc.so
+-        do
+-            if $test -e $p/$trylib; then
+-                libc=`ls -l $p/$trylib | awk '{print $NF}'`
+-                if $test "X$libc" != X; then
+-                    break
+-                fi
+-            fi
+-        done
+-        if $test "X$libc" != X; then
+-            break
+-        fi
+-    done
+-    ;;
+-esac
+-
+ # Are we using ELF?  Thanks to Kenneth Albanowski <kjahds@kjahds.com>
+ # for this test.
+ cat >try.c <<'EOM'
+@@ -367,33 +322,6 @@
+ 	;;
+ esac
+ 
+-# SuSE8.2 has /usr/lib/libndbm* which are ld scripts rather than
+-# true libraries. The scripts cause binding against static
+-# version of -lgdbm which is a bad idea. So if we have 'nm'
+-# make sure it can read the file
+-# NI-S 2003/08/07
+-case "$nm" in
+-    '') ;;
+-    *)
+-    for p in $plibpth
+-    do
+-        if $test -r $p/libndbm.so; then
+-            if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+-                echo 'Your shared -lndbm seems to be a real library.'
+-                _libndbm_real=1
+-                break
+-            fi
+-        fi
+-    done
+-    if $test "X$_libndbm_real" = X; then
+-        echo 'Your shared -lndbm is not a real library.'
+-        set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+-        shift
+-        libswanted="$*"
+-    fi
+-    ;;
+-esac
+-
+ # Linux on Synology.
+ if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+     # Tested on Synology DS213 and DS413
diff --git a/pkgs/development/interpreters/perl/5.22/setup-hook.sh b/pkgs/development/interpreters/perl/5.22/setup-hook.sh
new file mode 100644
index 000000000000..a8656b8531db
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/setup-hook.sh
@@ -0,0 +1,5 @@
+addPerlLibPath () {
+    addToSearchPath PERL5LIB $1/lib/perl5/site_perl
+}
+
+envHooks+=(addPerlLibPath)
diff --git a/pkgs/development/interpreters/python/2.7/default.nix b/pkgs/development/interpreters/python/2.7/default.nix
index 4ad4679bd6ea..813c10897e73 100644
--- a/pkgs/development/interpreters/python/2.7/default.nix
+++ b/pkgs/development/interpreters/python/2.7/default.nix
@@ -40,6 +40,8 @@ let
       # patch python to put zero timestamp into pyc
       # if DETERMINISTIC_BUILD env var is set
       ./deterministic-build.patch
+
+      ./properly-detect-curses.patch
     ] ++ optionals stdenv.isCygwin [
       ./2.5.2-ctypes-util-find_library.patch
       ./2.5.2-tkinter-x11.patch
diff --git a/pkgs/development/interpreters/python/2.7/properly-detect-curses.patch b/pkgs/development/interpreters/python/2.7/properly-detect-curses.patch
new file mode 100644
index 000000000000..e2640bab0e9a
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/properly-detect-curses.patch
@@ -0,0 +1,116 @@
+From 6dc83db69b5e29d25ba6d73646ea2e9a1097848a Mon Sep 17 00:00:00 2001
+From: Roumen Petrov <local@example.net>
+Date: Sun, 19 Feb 2012 16:13:24 +0200
+Subject: [PATCH] CROSS-properly detect WINDOW _flags for different ncurses versions
+
+---
+ Include/py_curses.h |    5 +++++
+ configure.ac        |   40 ++++++++++++++++++++++++++++++++++++++--
+ pyconfig.h.in       |    6 ++++++
+ 3 files changed, 49 insertions(+), 2 deletions(-)
+
+diff --git a/Include/py_curses.h b/Include/py_curses.h
+index f2c08f6..a9b5260 100644
+--- a/Include/py_curses.h
++++ b/Include/py_curses.h
+@@ -14,7 +14,9 @@
+ /* the following define is necessary for OS X 10.6; without it, the
+    Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
+    can't get at the WINDOW flags field. */
++/* NOTE configure check if ncurses require such definition
+ #define NCURSES_OPAQUE 0
++*/
+ #endif /* __APPLE__ */
+ 
+ #ifdef __FreeBSD__
+@@ -57,9 +59,12 @@
+ #ifdef HAVE_NCURSES_H
+ /* configure was checking <curses.h>, but we will
+    use <ncurses.h>, which has all these features. */
++/* NOTE configure check for existence of flags
++ * Also flags are visible only if WINDOW structure is not opaque
+ #ifndef WINDOW_HAS_FLAGS
+ #define WINDOW_HAS_FLAGS 1
+ #endif
++*/
+ #ifndef MVWDELCH_IS_EXPRESSION
+ #define MVWDELCH_IS_EXPRESSION 1
+ #endif
+diff --git a/configure.ac b/configure.ac
+index 0a3a186..75f5142 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4150,15 +4150,51 @@ then
+ fi
+ 
+ AC_MSG_CHECKING(whether WINDOW has _flags)
+-AC_CACHE_VAL(ac_cv_window_has_flags,
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
+   WINDOW *w;
+   w->_flags = 0;
+ ]])],
+ [ac_cv_window_has_flags=yes],
+-[ac_cv_window_has_flags=no]))
++[ac_cv_window_has_flags=no])
+ AC_MSG_RESULT($ac_cv_window_has_flags)
+ 
++py_curses_window_is_opaque=no
++if test no = $ac_cv_window_has_flags; then
++  AC_MSG_CHECKING([whether WINDOW has _flags in non-opaque structure])
++  AC_COMPILE_IFELSE([
++  AC_LANG_PROGRAM([[
++    #define NCURSES_OPAQUE 0
++    #include <curses.h>
++  ]],[[
++    WINDOW *w;
++    w->_flags = 0;
++  ]])],
++  [py_curses_window_is_opaque=yes])
++  AC_MSG_RESULT([$py_curses_window_is_opaque])
++fi
++if test yes = $py_curses_window_is_opaque; then
++  ac_cv_window_has_flags=yes
++  AC_DEFINE([NCURSES_OPAQUE], [0], [Define to 0 if you have WINDOW _flags in non-opaque structure.])
++fi
++
++py_curses_window_is_internal=no
++if test no = $ac_cv_window_has_flags; then
++  AC_MSG_CHECKING([whether WINDOW has _flags as internal structure])
++  AC_COMPILE_IFELSE([
++  AC_LANG_PROGRAM([[
++    #define NCURSES_INTERNALS 1
++    #include <curses.h>
++  ]],[[
++    WINDOW *w;
++    w->_flags = 0;
++  ]])],
++  [py_curses_window_is_internal=yes])
++  AC_MSG_RESULT([$py_curses_window_is_internal])
++fi
++if test yes = $py_curses_window_is_internal; then
++  ac_cv_window_has_flags=yes
++  AC_DEFINE([NCURSES_INTERNALS], [1], [Define to 1 if you have WINDOW _flags as internal structure.])
++fi
+ 
+ if test "$ac_cv_window_has_flags" = yes
+ then
+diff --git a/pyconfig.h.in b/pyconfig.h.in
+index 3ca3a4f..484c817 100644
+--- a/pyconfig.h.in
++++ b/pyconfig.h.in
+@@ -1130,6 +1130,12 @@
+ /* Define if mvwdelch in curses.h is an expression. */
+ #undef MVWDELCH_IS_EXPRESSION
+ 
++/* Define to 1 if you have WINDOW _flags as internal structure. */
++#undef NCURSES_INTERNALS
++
++/* Define to 0 if you have WINDOW _flags in non-opaque structure. */
++#undef NCURSES_OPAQUE
++
+ /* Define to the address where bug reports for this package should be sent. */
+ #undef PACKAGE_BUGREPORT
+ 
+-- 
+1.6.4
+
diff --git a/pkgs/development/interpreters/spidermonkey/17.0.nix b/pkgs/development/interpreters/spidermonkey/17.0.nix
index 74f0fe2b83a4..41757244c004 100644
--- a/pkgs/development/interpreters/spidermonkey/17.0.nix
+++ b/pkgs/development/interpreters/spidermonkey/17.0.nix
@@ -39,6 +39,8 @@ stdenv.mkDerivation rec {
     paxmark mr jsapi-tests/jsapi-tests
   '';
 
+  postInstall = ''rm "$out"/lib/*.a''; # halve the output size
+
   meta = with stdenv.lib; {
     description = "Mozilla's JavaScript engine written in C/C++";
     homepage = https://developer.mozilla.org/en/SpiderMonkey;
diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix
index 3e00b21ad43e..a62fc837dd0f 100644
--- a/pkgs/development/libraries/SDL/default.nix
+++ b/pkgs/development/libraries/SDL/default.nix
@@ -14,6 +14,9 @@ assert x11Support -> (x11 != null && libXrandr != null);
 assert alsaSupport -> alsaLib != null;
 assert pulseaudioSupport -> libpulseaudio != null;
 
+let
+  inherit (stdenv.lib) optional optionals;
+in
 stdenv.mkDerivation rec {
   version = "1.2.15";
   name    = "SDL-${version}";
@@ -23,19 +26,19 @@ stdenv.mkDerivation rec {
     sha256 = "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn";
   };
 
+  nativeBuildInputs = [ pkgconfig ];
+
   # Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
-  propagatedNativeBuildInputs =
-    stdenv.lib.optionals x11Support [ x11 libXrandr ] ++
-    stdenv.lib.optional alsaSupport alsaLib ++
-    stdenv.lib.optional pulseaudioSupport libpulseaudio;
+  propagatedBuildInputs =
+    optionals x11Support [ x11 libXrandr ] ++
+    optional alsaSupport alsaLib ++
+    optional stdenv.isLinux libcap ++
+    optional openglSupport mesa ++
+    optional pulseaudioSupport libpulseaudio;
 
   buildInputs = let
     notMingw = !(stdenv ? cross) || stdenv.cross.libc != "msvcrt";
-  in stdenv.lib.optional stdenv.isLinux libcap
-    ++ (stdenv.lib.optional notMingw audiofile);
-
-  nativeBuildInputs = [ pkgconfig ] ++
-    stdenv.lib.optional openglSupport [ mesa ];
+  in optional notMingw audiofile;
 
   # XXX: By default, SDL wants to dlopen() PulseAudio, in which case
   # we must arrange to add it to its RPATH; however, `patchelf' seems
diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix
index bfd5ff65563c..f5bd144a7172 100644
--- a/pkgs/development/libraries/SDL2/default.nix
+++ b/pkgs/development/libraries/SDL2/default.nix
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
     stdenv.lib.optional pulseaudioSupport libpulseaudio;
 
   buildInputs = [ pkgconfig audiofile ] ++
-    stdenv.lib.optional openglSupport [ mesa ] ++
+    stdenv.lib.optional openglSupport mesa ++
     stdenv.lib.optional alsaSupport alsaLib;
 
   # https://bugzilla.libsdl.org/show_bug.cgi?id=1431
diff --git a/pkgs/development/libraries/at-spi2-atk/default.nix b/pkgs/development/libraries/at-spi2-atk/default.nix
index b562a2e5d3d2..940fc2bb6cc6 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";
-  versionMinor = "1";
+  versionMajor = "2.16";
+  versionMinor = "0";
   moduleName   = "at-spi2-atk";
   name = "${moduleName}-${versionMajor}.${versionMinor}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/${moduleName}/${versionMajor}/${name}.tar.xz";
-    sha256 = "5fa9c527bdec028e06797563cd52d49bcf06f638549df983424d88db89bb1336";
+    sha256 = "1y9gfz1iz3wpja7s000f0bmyyvc6im5fcdl6bxwbz0v3qdgc9vvq";
   };
 
   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 7128e4d3f2b8..a3632bc13fdf 100644
--- a/pkgs/development/libraries/at-spi2-core/default.nix
+++ b/pkgs/development/libraries/at-spi2-core/default.nix
@@ -2,14 +2,14 @@
 , libX11, xextproto, libSM, libICE, libXtst, libXi, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
-  versionMajor = "2.12";
+  versionMajor = "2.16";
   versionMinor = "0";
   moduleName   = "at-spi2-core";
   name = "${moduleName}-${versionMajor}.${versionMinor}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/${moduleName}/${versionMajor}/${name}.tar.xz";
-    sha256 = "12gvsgdaxnxskndlhlmdkc50cfqgmzfc4n8la9944fz5k3fhwmfv";
+    sha256 = "1l3l39mw23zyjlcqidvkyqlr4gwbhplzw2hcv3qvn6p8ikxpf2qw";
   };
 
   buildInputs = [
diff --git a/pkgs/development/libraries/db/generic.nix b/pkgs/development/libraries/db/generic.nix
index 013a7fd35b9d..077bd4e03a32 100644
--- a/pkgs/development/libraries/db/generic.nix
+++ b/pkgs/development/libraries/db/generic.nix
@@ -22,6 +22,7 @@ stdenv.mkDerivation rec {
   configureFlags = [
     (if cxxSupport then "--enable-cxx" else "--disable-cxx")
     (if compat185 then "--enable-compat185" else "--disable-compat185")
+    "--enable-dbm"
   ];
 
   preConfigure = ''
diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix
index 84a18f2a0b54..d114cf17c4ef 100644
--- a/pkgs/development/libraries/dbus/default.nix
+++ b/pkgs/development/libraries/dbus/default.nix
@@ -7,8 +7,8 @@ assert x11Support -> libX11 != null
                   && libSM != null;
 
 let
-  version = "1.8.16";
-  sha256 = "01rba8mp8kqvmy6ibdmi806kjr3m14swnskqk02gyhykxxl54ybz";
+  version = "1.8.18";
+  sha256 = "1wn4k142m68d8yqd4i6dmx1ac0798yhkdnkk4mb72g3sfyffpwin";
 
   inherit (stdenv) lib;
 
diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix
index da6a3ad1dffc..1fa57b5adb58 100644
--- a/pkgs/development/libraries/gdk-pixbuf/default.nix
+++ b/pkgs/development/libraries/gdk-pixbuf/default.nix
@@ -3,14 +3,14 @@
 
 let
   ver_maj = "2.31";
-  ver_min = "3";
+  ver_min = "4";
 in
 stdenv.mkDerivation rec {
   name = "gdk-pixbuf-${ver_maj}.${ver_min}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/gdk-pixbuf/${ver_maj}/${name}.tar.xz";
-    sha256 = "ddd861747bb7c580acce7cfa3ce38c3f52a9516e66a6477988fd100c8fb9eabc";
+    sha256 = "05bslhk33qpssg66n2wys9khyzwkr4am0b23dym8n67qjds9gng5";
   };
 
   setupHook = ./setup-hook.sh;
diff --git a/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh b/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
index 06e820633b84..ba7ab82f50b4 100644
--- a/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
+++ b/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
@@ -1,23 +1,15 @@
 findGdkPixbufLoaders() {
 
-	if [ -n "$out" ] && [ -z "$IN_NIX_SHELL" ]; then
-
-		# set pixbuf loaders.cache for this package
-
-		local loadersDir="$out/lib/gdk-pixbuf-loaders-2.0/$name"
-		mkdir -p "$loadersDir"
-		
-		if [ -f "$1/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" ]; then
-			cat "$1/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" >> "$loadersDir/loaders.cache"
+	# choose the longest loaders.cache
+	local loadersCache="$1/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
+	if [ -f "$loadersCache" ]; then
+		if [ -f "$GDK_PIXBUF_MODULE_FILE" ]; then
+			if [ $(cat "$loadersCache"|wc -l) -gt $(cat "$GDK_PIXBUF_MODULE_FILE"|wc -l) ]; then
+				export GDK_PIXBUF_MODULE_FILE="$loadersCache"
+			fi
+		else
+			export GDK_PIXBUF_MODULE_FILE="$loadersCache"
 		fi
-	
-		if [ -f "$1/lib/gdk-pixbuf/loaders.cache" ]; then
-			cat "$1/lib/gdk-pixbuf/loaders.cache" >> "$loadersDir/loaders.cache"
-		fi
-		
-		# note, this is not a search path
-		export GDK_PIXBUF_MODULE_FILE=$(readlink -e "$loadersDir/loaders.cache")
-
 	fi
 
 }
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 7d61bea64e11..5c76bc3186ba 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -40,7 +40,7 @@ let
   '';
 
   ver_maj = "2.44";
-  ver_min = "0";
+  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 = "1fgmjv3yzxgbks31h42201x2izpw0sd84h8dfw0si3x00sqn5lzj";
+    sha256 = "01yabrfp64i11mrks3p1gcks99lw0zm7f5vhkc53sl4amyndw4c8";
   };
 
   patches = optional stdenv.isDarwin ./darwin-compilation.patch ++ optional doCheck ./skip-timer-test.patch;
diff --git a/pkgs/development/libraries/glib/setup-hook.sh b/pkgs/development/libraries/glib/setup-hook.sh
index f173744e5ca6..ca7e326bd02e 100644
--- a/pkgs/development/libraries/glib/setup-hook.sh
+++ b/pkgs/development/libraries/glib/setup-hook.sh
@@ -11,6 +11,12 @@ make_glib_find_gsettings_schemas() {
 envHooks+=(make_glib_find_gsettings_schemas)
 
 glibPreFixupPhase() {
+    # Move gschemas in case the install flag didn't help
+    if [ -d "$out/share/glib-2.0/schemas" ]; then
+        mkdir -p "$out/share/gsettings-schemas/$name/glib-2.0"
+        mv "$out/share/glib-2.0/schemas" "$out/share/gsettings-schemas/$name/glib-2.0/"
+    fi
+
     addToSearchPath GSETTINGS_SCHEMAS_PATH "$out/share/gsettings-schemas/$name"
 }
 
diff --git a/pkgs/development/libraries/gmp/5.1.x.nix b/pkgs/development/libraries/gmp/5.1.x.nix
index 0df1a4f8cd83..7b393067ff52 100644
--- a/pkgs/development/libraries/gmp/5.1.x.nix
+++ b/pkgs/development/libraries/gmp/5.1.x.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, m4, cxx ? true, withStatic ? true }:
 
-with { inherit (stdenv.lib) optional; };
+with { inherit (stdenv.lib) optional optionalString; };
 
 stdenv.mkDerivation rec {
   name = "gmp-5.1.3";
@@ -28,6 +28,13 @@ stdenv.mkDerivation rec {
     ++ optional stdenv.is64bit "--with-pic"
     ;
 
+  # The config.guess in GMP tries to runtime-detect various
+  # ARM optimization flags via /proc/cpuinfo (and is also
+  # broken on multicore CPUs). Avoid this impurity.
+  preConfigure = optionalString stdenv.isArm ''
+      configureFlagsArray+=("--build=$(./configfsf.guess)")
+    '';
+
   doCheck = true;
 
   dontDisableStatic = withStatic;
diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix
index b7350c19960a..171611e12498 100644
--- a/pkgs/development/libraries/gmp/6.x.nix
+++ b/pkgs/development/libraries/gmp/6.x.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, m4, cxx ? true, withStatic ? true }:
 
-with { inherit (stdenv.lib) optional; };
+with { inherit (stdenv.lib) optional optionalString; };
 
 stdenv.mkDerivation rec {
   name = "gmp-6.0.0a";
@@ -26,6 +26,13 @@ stdenv.mkDerivation rec {
     ++ optional stdenv.is64bit "--with-pic"
     ;
 
+  # The config.guess in GMP tries to runtime-detect various
+  # ARM optimization flags via /proc/cpuinfo (and is also
+  # broken on multicore CPUs). Avoid this impurity.
+  preConfigure = optionalString stdenv.isArm ''
+      configureFlagsArray+=("--build=$(./configfsf.guess)")
+    '';
+
   doCheck = true;
 
   dontDisableStatic = withStatic;
diff --git a/pkgs/development/libraries/gnutls/generic.nix b/pkgs/development/libraries/gnutls/generic.nix
index 6f2361f1658a..07760933935a 100644
--- a/pkgs/development/libraries/gnutls/generic.nix
+++ b/pkgs/development/libraries/gnutls/generic.nix
@@ -7,15 +7,21 @@
 
 assert guileBindings -> guile != null;
 
+let
+  inherit (stdenv.lib) optional optionals optionalString;
+in
 stdenv.mkDerivation rec {
   name = "gnutls-${version}";
 
   inherit src patches;
 
-  configureFlags = [
+  configureFlags =
+    # FIXME: perhaps use $SSL_CERT_FILE instead
+    optional stdenv.isLinux "--with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt"
+  ++ [
     "--disable-dependency-tracking"
     "--enable-fast-install"
-  ] ++ stdenv.lib.optional guileBindings
+  ] ++ optionals guileBindings
     [ "--enable-guile" "--with-guile-site-dir=\${out}/share/guile/site" ];
 
   # Build of the Guile bindings is not parallel-safe.  See
@@ -24,9 +30,9 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = !guileBindings;
 
   buildInputs = [ lzo lzip nettle libtasn1 libidn p11_kit zlib gmp ]
-    ++ stdenv.lib.optional stdenv.isLinux trousers
+    ++ optional stdenv.isLinux trousers
     ++ [ unbound ]
-    ++ stdenv.lib.optional guileBindings guile;
+    ++ optional guileBindings guile;
 
   nativeBuildInputs = [ perl pkgconfig autoreconfHook ];
 
@@ -35,7 +41,7 @@ stdenv.mkDerivation rec {
   doCheck = (!stdenv.isFreeBSD && !stdenv.isDarwin);
 
   # Fixup broken libtool and pkgconfig files
-  preFixup = stdenv.lib.optionalString (!stdenv.isDarwin) ''
+  preFixup = optionalString (!stdenv.isDarwin) ''
     sed -e 's,-ltspi,-L${trousers}/lib -ltspi,' \
         -e 's,-lz,-L${zlib}/lib -lz,' \
         -e 's,-lgmp,-L${gmp}/lib -lgmp,' \
diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix
index 200c0d4e01de..50fddd9da9fd 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.42";
+  ver_maj = "1.44";
   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 = "3ba2edfad4f71d4f0de16960b5d5f2511335fa646b2c49bbb93ce5942b3f95f7";
+    sha256 = "1b972qg2yb51sdavfvb6kc19akwc15c1bwnbg81vadxamql2q33g";
   };
 
   buildInputs = [ flex bison pkgconfig python ]
diff --git a/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix
index 59ee86da86d4..040cf20c4ea4 100644
--- a/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix
+++ b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/default.nix
@@ -18,9 +18,10 @@ stdenv.mkDerivation rec {
   };
 
   patchPhase = ''
-
     sed -i 's@/bin/echo@echo@g' configure
     sed -i -e 's/^   /\t/' docs/{libs,plugins}/Makefile.in
+
+    patch -p1 < ${./gcc-4.9.patch}
   '';
 
   # TODO : v4l, libvisual
diff --git a/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/gcc-4.9.patch b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/gcc-4.9.patch
new file mode 100644
index 000000000000..fd9f6ea240d2
--- /dev/null
+++ b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-base/gcc-4.9.patch
@@ -0,0 +1,38 @@
+https://bugzilla.gnome.org/show_bug.cgi?id=670690
+
+From 9bd5a7ae5435469c3557a3d70e762791cb3dc5c7 Mon Sep 17 00:00:00 2001
+From: Antoine Jacoutot <ajacoutot@gnome.org>
+Date: Mon, 20 Jan 2014 15:44:09 +0100
+Subject: [PATCH] audioresample: fix build on BSD
+
+On i386, EMMINTRIN is defined but not usable without sse so check for
+__SSE__ and __SSE2__ as well.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=670690
+---
+ gst/audioresample/resample.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gst/audioresample/resample.c b/gst/audioresample/resample.c
+index 98d006c..481fa01 100644
+--- a/gst/audioresample/resample.c
++++ b/gst/audioresample/resample.c
+@@ -77,13 +77,13 @@
+ #define EXPORT G_GNUC_INTERNAL
+ 
+ #ifdef _USE_SSE
+-#ifndef HAVE_XMMINTRIN_H
++#if !defined(__SSE__) || !defined(HAVE_XMMINTRIN_H)
+ #undef _USE_SSE
+ #endif
+ #endif
+ 
+ #ifdef _USE_SSE2
+-#ifndef HAVE_EMMINTRIN_H
++#if !defined(__SSE2__) || !defined(HAVE_XMMINTRIN_H)
+ #undef _USE_SSE2
+ #endif
+ #endif
+-- 
+1.8.5.3
+
diff --git a/pkgs/development/libraries/gtk+/2.x.nix b/pkgs/development/libraries/gtk+/2.x.nix
index 774193cc06c8..fec9d16cf959 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.27";
+  name = "gtk+-2.24.28";
 
   src = fetchurl {
     url = "mirror://gnome/sources/gtk+/2.24/${name}.tar.xz";
-    sha256 = "1x14rnjvqslpa1q19fp1qalz5sxds72amsgjk8m7769rwk511jr0";
+    sha256 = "0mj6xn40py9r9lvzg633fal81xfwfm89d9mvz7jk4lmwk0g49imj";
   };
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/libraries/gtk+/3.x.nix b/pkgs/development/libraries/gtk+/3.x.nix
index 252e52ee3b98..ac0fc53e755f 100644
--- a/pkgs/development/libraries/gtk+/3.x.nix
+++ b/pkgs/development/libraries/gtk+/3.x.nix
@@ -10,7 +10,7 @@ assert cupsSupport -> cups != null;
 
 let
   ver_maj = "3.16";
-  ver_min = "2";
+  ver_min = "4";
   version = "${ver_maj}.${ver_min}";
 in
 stdenv.mkDerivation rec {
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://gnome/sources/gtk+/${ver_maj}/gtk+-${version}.tar.xz";
-    sha256 = "1yhwg2l72l3khfkprydcjlpxjrg11ccqfc80sjl56llz3jk66fd0";
+    sha256 = "13pwj12m55mbhdaiar57q2ivdsm3lm5ycyhvm8gak0fblkbxpr8y";
   };
 
   nativeBuildInputs = [ pkgconfig gettext gobjectIntrospection perl ];
diff --git a/pkgs/development/libraries/isl/default.nix b/pkgs/development/libraries/isl/default.nix
deleted file mode 100644
index 5fa009277e15..000000000000
--- a/pkgs/development/libraries/isl/default.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-{ stdenv, fetchurl, gmp }:
-
-stdenv.mkDerivation rec {
-  name = "isl-0.14";
-
-  src = fetchurl {
-    url = "http://isl.gforge.inria.fr/${name}.tar.bz2";
-    sha256 = "0dlg4b85nw4w534525h0fvb7yhb8i4am8kskhmm0ym7qabzh4g3y";
-  };
-
-  buildInputs = [ gmp ];
-
-  enableParallelBuilding = true;
-
-  doCheck = true;
-
-  meta = {
-    homepage = http://www.kotnet.org/~skimo/isl/;
-    license = stdenv.lib.licenses.lgpl21;
-    description = "A library for manipulating sets and relations of integer points bounded by linear constraints";
-    maintainers = [ stdenv.lib.maintainers.shlevy ];
-    platforms = stdenv.lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/libraries/jsoncpp/default.nix b/pkgs/development/libraries/jsoncpp/default.nix
index c90a24816481..9e5ac7696167 100644
--- a/pkgs/development/libraries/jsoncpp/default.nix
+++ b/pkgs/development/libraries/jsoncpp/default.nix
@@ -20,18 +20,14 @@ stdenv.mkDerivation rec {
     export sourceRoot=${src.name}
   '';
 
-  nativeBuildInputs = [
-    # cmake can be built with the system jsoncpp, or its own bundled version.
-    # Obviously we cannot build it against the system jsoncpp that doesn't yet exist, so
-    # we make a bootstrapping build with the bundled version.
-    (cmake.override { jsoncpp = null; })
-    python
-  ];
+  nativeBuildInputs = [ cmake python ];
 
   cmakeFlags = [
     "-DJSONCPP_WITH_CMAKE_PACKAGE=1"
   ];
 
+  postInstall = "rm $out/lib/*.a";
+
   meta = {
     inherit version;
     homepage = https://github.com/open-source-parsers/jsoncpp;
diff --git a/pkgs/development/libraries/lame/default.nix b/pkgs/development/libraries/lame/default.nix
index 562e292791ab..f4ea47e633f9 100644
--- a/pkgs/development/libraries/lame/default.nix
+++ b/pkgs/development/libraries/lame/default.nix
@@ -30,6 +30,8 @@ stdenv.mkDerivation rec {
     sha256 = "1zr3kadv35ii6liia0bpfgxpag27xcivp571ybckpbz4b10nnd14";
   };
 
+  patches = [ ./gcc-4.9.patch ];
+
   nativeBuildInputs = [ ]
     ++ optional nasmSupport nasm;
 
diff --git a/pkgs/development/libraries/lame/gcc-4.9.patch b/pkgs/development/libraries/lame/gcc-4.9.patch
new file mode 100644
index 000000000000..59f8e00e4a8e
--- /dev/null
+++ b/pkgs/development/libraries/lame/gcc-4.9.patch
@@ -0,0 +1,33 @@
+fix sse optimizations build on 32-bit with gcc 4.9
+http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=351af417bae0d09bd5a3753d1237f03adf591933
+
+xmm_quantize_sub.c: In function 'init_xrpow_core_sse':
+xmm_quantize_sub.c:65:18: warning: SSE vector return without SSE enabled changes the ABI [-W
+psabi]
+     const __m128 vec_fabs_mask = _mm_loadu_ps(&fabs_mask._float[0]);
+                  ^
+In file included from xmm_quantize_sub.c:37:0:
+/usr/lib/gcc/i686-w64-mingw32/4.9.0/include/xmmintrin.h:933:1: error: inlining failed in call to always_inline '_mm_loadu_ps': target specific option mismatch
+ _mm_loadu_ps (float const *__P)
+ ^
+xmm_quantize_sub.c:65:18: error: called from here
+     const __m128 vec_fabs_mask = _mm_loadu_ps(&fabs_mask._float[0]);
+                  ^
+--- lame/libmp3lame/vector/xmm_quantize_sub.c.orig	2014-06-08 12:16:19.455468042 -0700
++++ lame/libmp3lame/vector/xmm_quantize_sub.c	2014-06-08 12:16:09.592356980 -0700
+@@ -35,6 +35,7 @@
+ #ifdef HAVE_XMMINTRIN_H
+ 
+ #include <xmmintrin.h>
++#pragma GCC target("sse")
+ 
+ typedef union {
+     int32_t _i_32[4]; /* unions are initialized by its first member */
+@@ -124,6 +125,7 @@
+ }
+ 
+ 
++#pragma GCC target("sse2")
+ void
+ fht_SSE2(FLOAT * fz, int n)
+ {
diff --git a/pkgs/development/libraries/libarchive/CVE-2015-1197.patch b/pkgs/development/libraries/libarchive/CVE-2015-1197.patch
new file mode 100644
index 000000000000..cb7be5f18cdb
--- /dev/null
+++ b/pkgs/development/libraries/libarchive/CVE-2015-1197.patch
@@ -0,0 +1,143 @@
+From 59357157706d47c365b2227739e17daba3607526 Mon Sep 17 00:00:00 2001
+From: Alessandro Ghedini <alessandro@ghedini.me>
+Date: Sun, 1 Mar 2015 12:07:45 +0100
+Subject: [PATCH] Add ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS option
+
+This fixes a directory traversal in the cpio tool.
+---
+ cpio/bsdcpio.1                           |  3 ++-
+ cpio/cpio.c                              |  2 ++
+ libarchive/archive.h                     |  2 ++
+ libarchive/archive_write_disk.3          |  3 +++
+ libarchive/archive_write_disk_posix.c    | 14 +++++++++++---
+ libarchive/test/test_write_disk_secure.c | 23 +++++++++++++++++++++++
+ 6 files changed, 43 insertions(+), 4 deletions(-)
+
+diff --git a/cpio/bsdcpio.1 b/cpio/bsdcpio.1
+index f966aa0..e52546e 100644
+--- a/cpio/bsdcpio.1
++++ b/cpio/bsdcpio.1
+@@ -156,7 +156,8 @@ See above for description.
+ .It Fl Fl insecure
+ (i and p mode only)
+ Disable security checks during extraction or copying.
+-This allows extraction via symbolic links and path names containing
++This allows extraction via symbolic links, absolute paths,
++and path names containing
+ .Sq ..
+ in the name.
+ .It Fl J , Fl Fl xz
+diff --git a/cpio/cpio.c b/cpio/cpio.c
+index 0acde11..b267e9b 100644
+--- a/cpio/cpio.c
++++ b/cpio/cpio.c
+@@ -171,6 +171,7 @@ main(int argc, char *argv[])
+ 	cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
+ 	cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
+ 	cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
++	cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
+ 	cpio->extract_flags |= ARCHIVE_EXTRACT_PERM;
+ 	cpio->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
+ 	cpio->extract_flags |= ARCHIVE_EXTRACT_ACL;
+@@ -256,6 +257,7 @@ main(int argc, char *argv[])
+ 		case OPTION_INSECURE:
+ 			cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS;
+ 			cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT;
++			cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS;
+ 			break;
+ 		case 'L': /* GNU cpio */
+ 			cpio->option_follow_links = 1;
+diff --git a/libarchive/archive.h b/libarchive/archive.h
+index 1f0fc38..ef635ac 100644
+--- a/libarchive/archive.h
++++ b/libarchive/archive.h
+@@ -649,6 +649,8 @@ __LA_DECL int archive_read_set_passphrase_callback(struct archive *,
+ /* Default: Do not use HFS+ compression if it was not compressed. */
+ /* This has no effect except on Mac OS v10.6 or later. */
+ #define	ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED	(0x8000)
++/* Default: Do not reject entries with absolute paths */
++#define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000)
+ 
+ __LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,
+ 		     int flags);
+diff --git a/libarchive/archive_write_disk.3 b/libarchive/archive_write_disk.3
+index fa925cc..a2e7afa 100644
+--- a/libarchive/archive_write_disk.3
++++ b/libarchive/archive_write_disk.3
+@@ -177,6 +177,9 @@ The default is to not refuse such paths.
+ Note that paths ending in
+ .Pa ..
+ always cause an error, regardless of this flag.
++.It Cm ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS
++Refuse to extract an absolute path.
++The default is to not refuse such paths.
+ .It Cm ARCHIVE_EXTRACT_SPARSE
+ Scan data for blocks of NUL bytes and try to recreate them with holes.
+ This results in sparse files, independent of whether the archive format
+diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c
+index ab3bdac..c1290eb 100644
+--- a/libarchive/archive_write_disk_posix.c
++++ b/libarchive/archive_write_disk_posix.c
+@@ -2509,8 +2509,9 @@ cleanup_pathname_win(struct archive_write_disk *a)
+ /*
+  * Canonicalize the pathname.  In particular, this strips duplicate
+  * '/' characters, '.' elements, and trailing '/'.  It also raises an
+- * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
+- * set) any '..' in the path.
++ * error for an empty path, a trailing '..', (if _SECURE_NODOTDOT is
++ * set) any '..' in the path or (if ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS
++ * is set) if the path is absolute.
+  */
+ static int
+ cleanup_pathname(struct archive_write_disk *a)
+@@ -2529,8 +2530,15 @@ cleanup_pathname(struct archive_write_disk *a)
+ 	cleanup_pathname_win(a);
+ #endif
+ 	/* Skip leading '/'. */
+-	if (*src == '/')
++	if (*src == '/') {
++		if (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) {
++			archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
++			                  "Path is absolute");
++			return (ARCHIVE_FAILED);
++		}
++
+ 		separator = *src++;
++	}
+ 
+ 	/* Scan the pathname one element at a time. */
+ 	for (;;) {
+diff --git a/libarchive/test/test_write_disk_secure.c b/libarchive/test/test_write_disk_secure.c
+index 31c5bfd..2c94206 100644
+--- a/libarchive/test/test_write_disk_secure.c
++++ b/libarchive/test/test_write_disk_secure.c
+@@ -178,6 +178,29 @@ DEFINE_TEST(test_write_disk_secure)
+ 	assert(S_ISDIR(st.st_mode));
+ 	archive_entry_free(ae);
+ 
++	/*
++	 * Without security checks, we should be able to
++	 * extract an absolute path.
++	 */
++	assert((ae = archive_entry_new()) != NULL);
++	archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp");
++	archive_entry_set_mode(ae, S_IFREG | 0777);
++	assert(0 == archive_write_header(a, ae));
++	assert(0 == archive_write_finish_entry(a));
++	assertFileExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp");
++	assert(0 == unlink("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"));
++
++	/* But with security checks enabled, this should fail. */
++	assert(archive_entry_clear(ae) != NULL);
++	archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp");
++	archive_entry_set_mode(ae, S_IFREG | 0777);
++	archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS);
++	failure("Extracting an absolute path should fail here.");
++	assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae));
++	archive_entry_free(ae);
++	assert(0 == archive_write_finish_entry(a));
++	assertFileNotExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp");
++
+ 	assertEqualInt(ARCHIVE_OK, archive_write_free(a));
+ 
+ 	/* Test the entries on disk. */
diff --git a/pkgs/development/libraries/libarchive/default.nix b/pkgs/development/libraries/libarchive/default.nix
index 076d22402772..60777614881d 100644
--- a/pkgs/development/libraries/libarchive/default.nix
+++ b/pkgs/development/libraries/libarchive/default.nix
@@ -14,6 +14,7 @@ stdenv.mkDerivation rec {
 
   patches = [
     ./CVE-2013-0211.patch # https://github.com/libarchive/libarchive/commit/22531545
+    ./CVE-2015-1197.patch # https://github.com/NixOS/nixpkgs/issues/6799
   ];
 
   buildInputs = [ sharutils libxml2 zlib bzip2 openssl xz ] ++
diff --git a/pkgs/development/libraries/libclc/default.nix b/pkgs/development/libraries/libclc/default.nix
index c41e2e0a70b5..16d9d8c75a46 100644
--- a/pkgs/development/libraries/libclc/default.nix
+++ b/pkgs/development/libraries/libclc/default.nix
@@ -1,12 +1,13 @@
-{ stdenv, fetchsvn, python, llvm, clang }:
+{ stdenv, fetchFromGitHub, python, llvm, clang }:
 
 stdenv.mkDerivation {
   name = "libclc-2015-03-27";
 
-  src = fetchsvn {
-    url = "http://llvm.org/svn/llvm-project/libclc/trunk";
-    rev = "233456";
-    sha256 = "0g56kgffc1qr9rzhcjr4w8kljcicg0q828s9b4bmfzjvywd7hhr0";
+  src = fetchFromGitHub {
+    owner = "llvm-mirror";
+    repo = "libclc";
+    rev = "0a2d1619921545b52303be5608b64dc46f381e97";
+    sha256 = "0hgm013c0vlfqfbbf4cdajl01hhk1mhsfk4h4bfza1san97l0vcc";
   };
 
   buildInputs = [ python llvm clang ];
@@ -22,7 +23,7 @@ stdenv.mkDerivation {
 
   meta = with stdenv.lib; {
     homepage = http://libclc.llvm.org/;
-    description = "implementation of the library requirements of the OpenCL C programming language";
+    description = "Implementation of the library requirements of the OpenCL C programming language";
     license = licenses.mit;
     platforms = platforms.all;
     maintainers = with maintainers; [ wkennington ];
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index 5ffdd9303e0c..b223bd962e7e 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.60";
+  name = "libdrm-2.4.61";
 
   src = fetchurl {
     url = "http://dri.freedesktop.org/libdrm/${name}.tar.bz2";
-    sha256 = "12cqnmssi6mbr93n29mm84k8wix5nx6zs82k7wcmj7z3r335ymwr";
+    sha256 = "8b549092c8961a393a7e1d9a1bccddcea8e2af67c0d7d7c67babb9fc3b47699c";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix
index 668ac138be83..824b909f1d91 100644
--- a/pkgs/development/libraries/libffi/default.nix
+++ b/pkgs/development/libraries/libffi/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, dejagnu }:
+{ fetchurl, stdenv }:
 
 stdenv.mkDerivation rec {
   name = "libffi-3.2.1";
@@ -10,15 +10,11 @@ stdenv.mkDerivation rec {
 
   patches = if stdenv.isCygwin then [ ./3.2.1-cygwin.patch ] else null;
 
-  buildInputs = stdenv.lib.optional doCheck dejagnu;
-
   configureFlags = [
     "--with-gcc-arch=generic" # no detection of -march= or -mtune=
     "--enable-pax_emutramp"
   ];
 
-  doCheck = stdenv.isLinux; # until we solve dejagnu problems on darwin and expect on BSD
-
   dontStrip = stdenv ? cross; # Don't run the native `strip' when cross-compiling.
 
   # Install headers in the right place.
diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix
index 9589298ecd50..4c22c988c790 100644
--- a/pkgs/development/libraries/librsvg/default.nix
+++ b/pkgs/development/libraries/librsvg/default.nix
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
   # The loaders.cache can be used by setting GDK_PIXBUF_MODULE_FILE to
   # point to this file in a wrapper.
   postConfigure = ''
-    GDK_PIXBUF=$out/lib/gdk-pixbuf
+    GDK_PIXBUF=$out/lib/gdk-pixbuf-2.0/2.10.0
     mkdir -p $GDK_PIXBUF/loaders
     sed -e "s#gdk_pixbuf_moduledir = .*#gdk_pixbuf_moduledir = $GDK_PIXBUF/loaders#" \
         -i gdk-pixbuf-loader/Makefile
@@ -43,4 +43,11 @@ stdenv.mkDerivation rec {
     sed -e "s#\$(GDK_PIXBUF_QUERYLOADERS)#GDK_PIXBUF_MODULEDIR=$GDK_PIXBUF/loaders \$(GDK_PIXBUF_QUERYLOADERS)#" \
          -i gdk-pixbuf-loader/Makefile
   '';
+
+  # Merge gdkpixbuf and librsvg loaders
+  postInstall = ''
+    mv $GDK_PIXBUF/loaders.cache $GDK_PIXBUF/loaders.cache.tmp
+    cat ${gdk_pixbuf}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache $GDK_PIXBUF/loaders.cache.tmp > $GDK_PIXBUF/loaders.cache
+    rm $GDK_PIXBUF/loaders.cache.tmp
+  '';
 }
diff --git a/pkgs/development/libraries/libtiff/default.nix b/pkgs/development/libraries/libtiff/default.nix
index 7ed9794011cd..739148cb9a69 100644
--- a/pkgs/development/libraries/libtiff/default.nix
+++ b/pkgs/development/libraries/libtiff/default.nix
@@ -1,12 +1,7 @@
-{ stdenv, fetchurl, fetchsvn, pkgconfig, zlib, libjpeg, xz }:
+{ stdenv, fetchurl, pkgconfig, zlib, libjpeg, xz }:
 
 let
-  version = "4.0.3";
-  patchDir = fetchsvn {
-    url = svn://svn.archlinux.org/packages/libtiff/trunk;
-    rev = "198247";
-    sha256 = "0a47l0zkc1zz7wxg64cyjv9z1djdvfyxgmwd03znlsac4zijkcy4";
-  };
+  version = "4.0.4beta";
 in
 stdenv.mkDerivation rec {
   name = "libtiff-${version}";
@@ -19,19 +14,6 @@ stdenv.mkDerivation rec {
     sha256 = "0wj8d1iwk9vnpax2h29xqc2hwknxg3s0ay2d5pxkg59ihbifn6pa";
   };
 
-  patchPhase = ''
-    for p in ${patchDir}/*-{2013-4244,2012-4447,2012-4564,2013-1960,2013-1961,libjpeg-turbo}.patch; do
-      patch -p1 < "$p"
-    done
-    (
-    cd tools
-    for p in ${patchDir}/*-CVE-{2013-4231,2013-4232}.patch; do
-      patch -p0 < "$p"
-    done
-    )
-    patch -p0 < ${patchDir}/${if stdenv.isDarwin then "tiff-4.0.3" else "*"}-tiff2pdf-colors.patch
-  ''; # ^ sh on darwin seems not to expand globs in redirects, and I don't want to rebuild all again elsewhere
-
   nativeBuildInputs = [ pkgconfig ];
 
   propagatedBuildInputs = [ zlib libjpeg xz ]; #TODO: opengl support (bogus configure detection)
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 8364cab7623c..f2b36dd8c3e3 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, fetchpatch, pkgconfig, intltool, flex, bison, autoreconfHook, substituteAll
 , python, libxml2Python, file, expat, makedepend, pythonPackages
 , libdrm, xorg, wayland, udev, llvmPackages, libffi, libomxil-bellagio
-, libvdpau, libelf, libva, libclc
+, libvdpau, libelf, libva
 , grsecEnabled
 , enableTextureFloats ? false # Texture floats are patented, see docs/patents.txt
 , enableExtraFeatures ? false # not maintained
@@ -26,7 +26,6 @@ let
   version = "10.5.6";
   # this is the default search path for DRI drivers
   driverLink = "/run/opengl-driver" + stdenv.lib.optionalString stdenv.isi686 "-32";
-  clang = if llvmPackages ? clang-unwrapped then llvmPackages.clang-unwrapped else llvmPackages.clang;
 in
 with { inherit (stdenv.lib) optional optionals optionalString; };
 
@@ -38,7 +37,7 @@ stdenv.mkDerivation {
       "https://launchpad.net/mesa/trunk/${version}/+download/mesa-${version}.tar.xz"
       "ftp://ftp.freedesktop.org/pub/mesa/${version}/mesa-${version}.tar.xz"
     ];
-    sha256 = "15d5icr7q0nq1a7718fsj4s1l29aa4qdxvmkgmjadxz5pm9ph0b6";
+    sha256 = "66017853bde5f7a6647db3eede30512a091a3491daa1708e0ad8027c328ba595";
   };
 
   prePatch = "patchShebangs .";
@@ -63,7 +62,6 @@ stdenv.mkDerivation {
   configureFlags = [
     "--sysconfdir=/etc"
     "--localstatedir=/var"
-    "--with-clang-libdir=${clang}/lib"
     "--with-dri-driverdir=$(drivers)/lib/dri"
     "--with-dri-searchpath=${driverLink}/lib/dri"
 
@@ -81,13 +79,11 @@ stdenv.mkDerivation {
     ++ [
     "--enable-xvmc"
     "--enable-vdpau"
-    "--enable-omx"
-    "--enable-va"
+    #"--enable-omx"
+    #"--enable-va"
 
     # TODO: Figure out how to enable opencl without having a runtime dependency on clang
     "--disable-opencl"
-    #"--enable-opencl"
-    #"--enable-opencl-icd"
 
     "--with-gallium-drivers=svga,i915,ilo,r300,r600,radeonsi,nouveau,freedreno,swrast"
     "--enable-shared-glapi"
@@ -111,8 +107,7 @@ stdenv.mkDerivation {
     autoreconfHook intltool expat libxml2Python llvmPackages.llvm
     glproto dri2proto dri3proto presentproto
     libX11 libXext libxcb libXt libXfixes libxshmfence
-    libffi wayland libvdpau libelf libXvMC libomxil-bellagio libva
-    libclc clang
+    libffi wayland libvdpau libelf libXvMC /* libomxil-bellagio libva */
   ] ++ optional stdenv.isLinux udev;
 
   enableParallelBuilding = true;
@@ -132,9 +127,6 @@ stdenv.mkDerivation {
       `#$out/lib/libXvMC*` \
       $out/lib/gbm $out/lib/libgbm* \
   '' + ''
-      $out/lib/gallium-pipe \
-      $out/lib/libdricore* \
-      $out/lib/libgallium* \
       $out/lib/vdpau \
       $out/lib/libxatracker*
 
@@ -149,18 +141,6 @@ stdenv.mkDerivation {
       $out/lib/pkgconfig/osmesa.pc
 
   '' + /* now fix references in .la files */ ''
-    sed "/^libdir=/s,$out,$drivers," -i \
-  '' + optionalString enableExtraFeatures ''
-      `#$drivers/lib/libXvMC*.la` \
-  '' + ''
-      $drivers/lib/gallium-pipe/*.la \
-      $drivers/lib/libgallium.la \
-      $drivers/lib/vdpau/*.la \
-      $drivers/lib/libdricore*.la
-
-    sed "s,$out\(/lib/\(libdricore[0-9\.]*\|libgallium\).la\),$drivers\1,g" \
-      -i $drivers/lib/*.la $drivers/lib/*/*.la
-
     sed "/^libdir=/s,$out,$osmesa," -i \
       $osmesa/lib/libOSMesa*.la
 
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index bea4754a1f53..0c789fc4460c 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -1,31 +1,14 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 
-# Optional Dependencies
-, gpm ? null
+, mouseSupport ? false
+, unicode ? true
+
+, gpm
 
 # Extra Options
 , abiVersion ? "5"
-, unicode ? true
 }:
 
-let
-  mkFlag = trueStr: falseStr: cond: name: val:
-    if cond == null then null else
-      "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
-  mkEnable = mkFlag "enable-" "disable-";
-  mkWith = mkFlag "with-" "without-";
-  mkOther = mkFlag "" "" true;
-
-  shouldUsePkg = pkg_: let
-    pkg = (builtins.tryEval pkg_).value;
-  in if stdenv.lib.any (x: x == stdenv.system) (pkg.meta.platforms or [])
-    then pkg
-    else null;
-
-  buildShared = !stdenv.isDarwin;
-
-  optGpm = shouldUsePkg gpm;
-in
 stdenv.mkDerivation rec {
   name = "ncurses-5.9";
 
@@ -34,43 +17,14 @@ stdenv.mkDerivation rec {
     sha256 = "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh";
   };
 
-  patches = [ ./clang.patch ];
-
-  buildInputs = [ optGpm ];
-
-  configureFlags = [
-    (mkWith   true        "abi-version" abiVersion)
-    (mkWith   true        "cxx"         null)
-    (mkWith   true        "cxx-binding" null)
-    (mkWith   false       "ada"         null)
-    (mkWith   true        "manpages"    null)
-    (mkWith   true        "progs"       null)
-    (mkWith   doCheck     "tests"       null)
-    (mkWith   true        "curses-h"    null)
-    (mkEnable true        "pc-files"    null)
-    (mkWith   buildShared "shared"      null)
-    (mkWith   true        "normal"      null)
-    (mkWith   false       "debug"       null)
-    (mkWith   false       "termlib"     null)
-    (mkWith   false       "ticlib"      null)
-    (mkWith   optGpm      "gpm"         null)
-    (mkEnable true        "overwrite"   null)
-    (mkEnable true        "database"    null)
-    (mkWith   true        "xterm-new"   null)
-    (mkEnable true        "symlinks"    null)
-    (mkEnable unicode     "widec"       null)
-    (mkEnable true        "ext-colors"  null)
-    (mkEnable true        "ext-mouse"   null)
-  ] ++ stdenv.lib.optionals stdenv.isCygwin [
-    "--enable-sp-funcs"
-    "--enable-term-driver"
-    "--enable-const"
-    "--enable-ext-colors"
-    "--enable-ext-mouse"
-    "--enable-reentrant"
-    "--enable-colorfgbg"
-    "--enable-tcap-names"
-  ];
+  # gcc-5.patch should be removed after 5.9
+  patches = [ ./clang.patch ./gcc-5.patch ];
+
+  configureFlags =
+    [ "--with-shared" "--without-debug" "--enable-pc-files" "--enable-symlinks" ]
+    ++ lib.optional unicode "--enable-widec";
+
+  buildInputs = lib.optional (mouseSupport && stdenv.isLinux) gpm;
 
   # PKG_CONFIG_LIBDIR is where the *.pc files will be installed. If this
   # directory doesn't exist, the configure script will disable installation of
@@ -81,7 +35,7 @@ stdenv.mkDerivation rec {
   preConfigure = ''
     export PKG_CONFIG_LIBDIR="$out/lib/pkgconfig"
     mkdir -p "$PKG_CONFIG_LIBDIR"
-  '' + stdenv.lib.optionalString stdenv.isCygwin ''
+  '' + lib.optionalString stdenv.isCygwin ''
     sed -i -e 's,LIB_SUFFIX="t,LIB_SUFFIX=",' configure
   '';
 
@@ -101,6 +55,8 @@ stdenv.mkDerivation rec {
     ln -svf $cfg $out/bin/ncurses-config
 
     # Allow for end users who #include <ncurses?w/*.h>
+    mv "$out"/include/ncursesw/* "$out"/include/
+    rmdir "$out"/include/ncursesw
     ln -svf . $out/include/ncursesw
     ln -svf . $out/include/ncurses
 
@@ -118,7 +74,7 @@ stdenv.mkDerivation rec {
     # Create curses compatability
     ln -svf libncursesw.so $out/lib/libcursesw.so
     ln -svf libncursesw.so $out/lib/libcurses.so
-  '' + stdenv.lib.optionalString stdenv.isCygwin ''
+  '' + lib.optionalString stdenv.isCygwin ''
     for lib in $libs; do
       if test -e $out/lib/lib''${lib}w.dll.a; then
           ln -svf lib''${lib}w.dll.a $out/lib/lib$lib.dll.a
@@ -130,13 +86,19 @@ stdenv.mkDerivation rec {
     ln -svf $cfg $out/bin/ncurses-config
 
     # Allow for end users who #include <ncurses/*.h>
+    mv "$out"/include/ncurses/* "$out"/include/
+    rmdir "$out"/include/ncurses
     ln -svf . $out/include/ncurses
 
     # Create curses compatability
     ln -svf libncurses.so $out/lib/libcurses.so
   '';
 
-  meta = with stdenv.lib; {
+  preFixup = ''
+    rm $out/lib/*.a
+  '';
+
+  meta = {
     description = "Free software emulation of curses in SVR4 and more";
 
     longDescription = ''
@@ -155,9 +117,9 @@ stdenv.mkDerivation rec {
 
     homepage = http://www.gnu.org/software/ncurses/;
 
-    license = licenses.mit;
-    platforms = platforms.all;
-    maintainers = with maintainers; [ wkennington ];
+    license = lib.licenses.mit;
+    platforms = lib.platforms.all;
+    maintainers = [ lib.maintainers.wkennington ];
   };
 
   passthru.ldflags = if unicode then "-lncursesw" else "-lncurses";
diff --git a/pkgs/development/libraries/ncurses/gcc-5.patch b/pkgs/development/libraries/ncurses/gcc-5.patch
new file mode 100644
index 000000000000..2448229b88e1
--- /dev/null
+++ b/pkgs/development/libraries/ncurses/gcc-5.patch
@@ -0,0 +1,46 @@
+https://bugs.gentoo.org/545114
+
+extracted from the upstream change (which had many unrelated commits in one)
+
+From 97bb4678dc03e753290b39bbff30ba2825df9517 Mon Sep 17 00:00:00 2001
+From: "Thomas E. Dickey" <dickey@invisible-island.net>
+Date: Sun, 7 Dec 2014 03:10:09 +0000
+Subject: [PATCH] ncurses 5.9 - patch 20141206
+
++ modify MKlib_gen.sh to work around change in development version of
+  gcc introduced here:
+	  https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02185.html
+	  https://gcc.gnu.org/ml/gcc-patches/2014-07/msg00236.html
+  (reports by Marcus Shawcroft, Maohui Lei).
+
+diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh
+index d8cc3c9..b91398c 100755
+--- a/ncurses/base/MKlib_gen.sh
++++ b/ncurses/base/MKlib_gen.sh
+@@ -474,11 +474,22 @@ sed -n -f $ED1 \
+ 	-e 's/gen_$//' \
+ 	-e 's/  / /g' >>$TMP
+ 
++cat >$ED1 <<EOF
++s/  / /g
++s/^ //
++s/ $//
++s/P_NCURSES_BOOL/NCURSES_BOOL/g
++EOF
++
++# A patch discussed here:
++#	https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02185.html
++# introduces spurious #line markers.  Work around that by ignoring the system's
++# attempt to define "bool" and using our own symbol here.
++sed -e 's/bool/P_NCURSES_BOOL/g' $TMP > $ED2
++cat $ED2 >$TMP
++
+ $preprocessor $TMP 2>/dev/null \
+-| sed \
+-	-e 's/  / /g' \
+-	-e 's/^ //' \
+-	-e 's/_Bool/NCURSES_BOOL/g' \
++| sed -f $ED1 \
+ | $AWK -f $AW2 \
+ | sed -f $ED3 \
+ | sed \
diff --git a/pkgs/development/libraries/openssl/1.0.2.x.nix b/pkgs/development/libraries/openssl/1.0.2.x.nix
index 18c533ea1886..a1645189161a 100644
--- a/pkgs/development/libraries/openssl/1.0.2.x.nix
+++ b/pkgs/development/libraries/openssl/1.0.2.x.nix
@@ -10,30 +10,7 @@ let
 
   patchesCross = isCross: let
     isDarwin = stdenv.isDarwin || (isCross && stdenv.cross.libc == "libSystem");
-  in
-    [ # Allow the location of the X509 certificate file (the CA
-      # bundle) to be set through the environment variable
-      # ‘OPENSSL_X509_CERT_FILE’.  This is necessary because the
-      # default location ($out/ssl/cert.pem) doesn't exist, and
-      # hardcoding something like /etc/ssl/cert.pem is impure and
-      # cannot be overriden per-process.  For security, the
-      # environment variable is ignored for setuid binaries.
-      # FIXME: drop this patch; it really isn't necessary, because
-      # OpenSSL already supports a ‘SSL_CERT_FILE’ variable.
-      ./cert-file.patch
-    ]
-
-    ++ stdenv.lib.optionals (isCross && opensslCrossSystem == "hurd-x86")
-         [ ./cert-file-path-max.patch # merge with `cert-file.patch' eventually
-           ./gnu.patch                # submitted upstream
-         ]
-
-    ++ stdenv.lib.optionals (stdenv.system == "x86_64-kfreebsd-gnu")
-        [ ./gnu.patch
-          ./kfreebsd-gnu.patch
-        ]
-
-    ++ stdenv.lib.optional isDarwin ./darwin-arch.patch;
+  in stdenv.lib.optional isDarwin ./darwin-arch.patch;
 
   extraPatches = stdenv.lib.optional stdenv.isCygwin ./1.0.1-cygwin64.patch;
 in
diff --git a/pkgs/development/libraries/openssl/cert-file-path-max.patch b/pkgs/development/libraries/openssl/cert-file-path-max.patch
deleted file mode 100644
index 50621c5cb820..000000000000
--- a/pkgs/development/libraries/openssl/cert-file-path-max.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-This patch, to be applied after `cert-file.patch', fixes compilation
-on GNU/Hurd where `PATH_MAX' is not defined.
-
-diff -ubB --show-c-function openssl-1.0.0e/crypto/x509/x509_def.c.orig openssl-1.0.0e/crypto/x509/x509_def.c
---- openssl-1.0.0e/crypto/x509/x509_def.c.orig	2012-01-06 00:08:48.000000000 +0100
-+++ openssl-1.0.0e/crypto/x509/x509_def.c	2012-01-06 00:11:29.000000000 +0100
-@@ -58,6 +58,7 @@
- 
- #include <stdio.h>
- #include <stdlib.h>
-+#include <string.h>
- #include <limits.h>
- #include <unistd.h>
- #include <sys/types.h>
-@@ -76,14 +77,16 @@ const char *X509_get_default_cert_dir(vo
- 
- const char *X509_get_default_cert_file(void)
- 	{
--	static char buf[PATH_MAX] = X509_CERT_FILE;
-+	static char *buf;
- 	static int init = 0;
- 	if (!init) {
- 	    init = 1;
- 	    char * s = getenv("OPENSSL_X509_CERT_FILE");
- 	    if (s && getuid() == geteuid()) {
--		strncpy(buf, s, sizeof(buf));
--		buf[sizeof(buf) - 1] = 0;
-+	         buf = strdup(s);
-+	    }
-+	    if (!s) {
-+	         buf = strdup(X509_CERT_FILE);
- 	    }
- 	}
- 	return buf;
diff --git a/pkgs/development/libraries/openssl/cert-file.patch b/pkgs/development/libraries/openssl/cert-file.patch
deleted file mode 100644
index e6e661112015..000000000000
--- a/pkgs/development/libraries/openssl/cert-file.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-diff -ru openssl-1.0.1m-orig/crypto/x509/x509_def.c openssl-1.0.1m/crypto/x509/x509_def.c
---- openssl-1.0.1m-orig/crypto/x509/x509_def.c	2015-03-19 14:19:00.000000000 +0100
-+++ openssl-1.0.1m/crypto/x509/x509_def.c	2015-03-19 15:50:44.676683616 +0100
-@@ -57,6 +57,10 @@
-  */
- 
- #include <stdio.h>
-+#include <stdlib.h>
-+#include <limits.h>
-+#include <unistd.h>
-+#include <sys/types.h>
- #include "cryptlib.h"
- #include <openssl/crypto.h>
- #include <openssl/x509.h>
-@@ -78,7 +82,23 @@
- 
- const char *X509_get_default_cert_file(void)
- {
--    return (X509_CERT_FILE);
-+    static char buf[PATH_MAX] = X509_CERT_FILE;
-+    static int init = 0;
-+    if (!init) {
-+        init = 1;
-+        char * s = getenv("OPENSSL_X509_CERT_FILE");
-+        if (s) {
-+#ifndef OPENSSL_SYS_WINDOWS
-+            if (getuid() == geteuid()) {
-+#endif
-+                strncpy(buf, s, sizeof(buf));
-+                buf[sizeof(buf) - 1] = 0;
-+#ifndef OPENSSL_SYS_WINDOWS
-+            }
-+#endif
-+        }
-+    }
-+    return buf;
- }
- 
- const char *X509_get_default_cert_dir_env(void)
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 7f428fd584b9..f0212aeabee2 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -2,7 +2,7 @@
 , withCryptodev ? false, cryptodevHeaders }:
 
 let
-  name = "openssl-1.0.1m";
+  name = "openssl-1.0.1o";
 
   opensslCrossSystem = stdenv.lib.attrByPath [ "openssl" "system" ]
     (throw "openssl needs its platform name cross building" null)
@@ -10,30 +10,7 @@ let
 
   patchesCross = isCross: let
     isDarwin = stdenv.isDarwin || (isCross && stdenv.cross.libc == "libSystem");
-  in
-    [ # Allow the location of the X509 certificate file (the CA
-      # bundle) to be set through the environment variable
-      # ‘OPENSSL_X509_CERT_FILE’.  This is necessary because the
-      # default location ($out/ssl/cert.pem) doesn't exist, and
-      # hardcoding something like /etc/ssl/cert.pem is impure and
-      # cannot be overriden per-process.  For security, the
-      # environment variable is ignored for setuid binaries.
-      # FIXME: drop this patch; it really isn't necessary, because
-      # OpenSSL already supports a ‘SSL_CERT_FILE’ variable.
-      ./cert-file.patch
-    ]
-
-    ++ stdenv.lib.optionals (isCross && opensslCrossSystem == "hurd-x86")
-         [ ./cert-file-path-max.patch # merge with `cert-file.patch' eventually
-           ./gnu.patch                # submitted upstream
-         ]
-
-    ++ stdenv.lib.optionals (stdenv.system == "x86_64-kfreebsd-gnu")
-        [ ./gnu.patch
-          ./kfreebsd-gnu.patch
-        ]
-
-    ++ stdenv.lib.optional isDarwin ./darwin-arch.patch;
+  in stdenv.lib.optional isDarwin ./darwin-arch.patch;
 
   extraPatches = stdenv.lib.optional stdenv.isCygwin ./1.0.1-cygwin64.patch;
 in
@@ -46,7 +23,7 @@ stdenv.mkDerivation {
       "http://www.openssl.org/source/${name}.tar.gz"
       "http://openssl.linux-mirror.org/source/${name}.tar.gz"
     ];
-    sha256 = "0x7gvyybmqm4lv62mlhlm80f1rn7il2qh8224rahqv0i15xhnpq9";
+    sha1 = "b003e3382607ef2c6d85b51e4ed7a4c0a76b8d5a";
   };
 
   patches = (patchesCross false) ++ extraPatches;
@@ -65,10 +42,6 @@ stdenv.mkDerivation {
   configureFlags = "shared --libdir=lib --openssldir=etc/ssl" +
     stdenv.lib.optionalString withCryptodev " -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS";
 
-  # CYGXXX: used to be set for cygwin with optionalString. Not needed
-  # anymore but kept to prevent rebuild.
-  preBuild = "";
-
   makeFlags = "MANDIR=$(out)/share/man";
 
   # Parallel building is broken in OpenSSL.
@@ -79,9 +52,12 @@ stdenv.mkDerivation {
       # If we're building dynamic libraries, then don't install static
       # libraries.
       if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib)" ]; then
-          rm $out/lib/*.a
+          rm "$out/lib/"*.a
       fi
-    ''; # */
+
+      # remove dependency on Perl at runtime
+      rm -rf $out/etc/ssl/misc
+    '';
 
   crossAttrs = {
     patches = patchesCross true;
diff --git a/pkgs/development/libraries/openssl/gnu.patch b/pkgs/development/libraries/openssl/gnu.patch
deleted file mode 100644
index 3cc6d049c944..000000000000
--- a/pkgs/development/libraries/openssl/gnu.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Patch to fix compilation on GNU/Hurd and GNU/kFreeBSD.
-
---- openssl-1.0.0e/Configure	2012-01-06 00:39:49.000000000 +0100
-+++ openssl-1.0.0e/Configure	2012-01-06 00:39:51.000000000 +0100
-@@ -563,7 +563,7 @@ my %table=(
- "newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
- 
- ##### GNU Hurd
--"hurd-x86",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
-+"hurd-x86",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
- 
- ##### OS/2 EMX
- "OS2-EMX", "gcc::::::::",
-
---- openssl-1.0.0e/crypto/dso/dso_dlfcn.c	2012-01-06 00:05:47.000000000 +0100
-+++ openssl-1.0.0e/crypto/dso/dso_dlfcn.c	2012-01-06 00:21:05.000000000 +0100
-@@ -60,7 +60,7 @@
-    that handle _GNU_SOURCE and other similar macros.  Defining it later
-    is simply too late, because those headers are protected from re-
-    inclusion.  */
--#ifdef __linux
-+#if defined __linux || defined __GNU__ || defined __GLIBC__
- # ifndef _GNU_SOURCE
- #  define _GNU_SOURCE	/* make sure dladdr is declared */
- # endif
diff --git a/pkgs/development/libraries/openssl/hurd-target.patch b/pkgs/development/libraries/openssl/hurd-target.patch
deleted file mode 100644
index 399a37a69ed9..000000000000
--- a/pkgs/development/libraries/openssl/hurd-target.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur openssl-1.0.0d-orig/Configure openssl-1.0.0d/Configure
---- openssl-1.0.0d-orig/Configure	2010-11-30 17:19:26.000000000 -0500
-+++ openssl-1.0.0d/Configure	2011-11-16 13:52:57.614416683 -0500
-@@ -563,7 +563,7 @@
- "newsos4-gcc","gcc:-O -DB_ENDIAN::(unknown):NEWS4:-lmld -liberty:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_RISC1 DES_UNROLL BF_PTR::::",
- 
- ##### GNU Hurd
--"hurd-x86",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
-+"hurd-x86","gcc:-DL_ENDIAN -DTERMIOS -O3 -Wa,--noexecstack -g -mtune=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
- 
- ##### OS/2 EMX
- "OS2-EMX", "gcc::::::::",
diff --git a/pkgs/development/libraries/openssl/kfreebsd-gnu.patch b/pkgs/development/libraries/openssl/kfreebsd-gnu.patch
deleted file mode 100644
index 66cedf746ba5..000000000000
--- a/pkgs/development/libraries/openssl/kfreebsd-gnu.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Allow compilation on GNU/kFreeBSD.  Ideally, there'd be a single way to process
-all glibc-based system, but the build system is soooo broken.
-
---- openssl-1.0.0i/config
-+++ openssl-1.0.0i/config
-@@ -170,6 +170,10 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${
- 	echo "${MACHINE}-whatever-linux1"; exit 0
- 	;;
- 
-+    GNU/kFreeBSD*)
-+    	echo "kfreebsd-gnu"; exit 0;
-+    	;;
-+
-     GNU*)
- 	echo "hurd-x86"; exit 0;
- 	;;
-@@ -810,6 +814,7 @@ case "$GUESSOS" in
-   beos-*) OUT="$GUESSOS" ;;
-   x86pc-*-qnx6) OUT="QNX6-i386" ;;
-   *-*-qnx6) OUT="QNX6" ;;
-+  kfreebsd-gnu) OUT="kfreebsd-gnu";;
-   *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
- esac
- 
-
---- openssl-1.0.0i/Configure
-+++ openssl-1.0.0i/Configure
-@@ -565,6 +565,9 @@ my %table=(
- ##### GNU Hurd
- "hurd-x86",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
- 
-+##### GNU/kFreeBSD on x86_64, copied from "linux-x86_64"
-+"kfreebsd-gnu",	"gcc:-m64 -DL_ENDIAN -DTERMIOS -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
-+
- ##### OS/2 EMX
- "OS2-EMX", "gcc::::::::",
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 a65cbeed3fd3..e4d1bae636cf 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -17,7 +17,7 @@ with stdenv.lib;
 
 let
   v_maj = "4.8";
-  v_min = "6";
+  v_min = "7";
   vers = "${v_maj}.${v_min}";
 in
 
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   src = fetchurl {
     url = "http://download.qt-project.org/official_releases/qt/"
       + "${v_maj}/${vers}/qt-everywhere-opensource-src-${vers}.tar.gz";
-    sha256 = "0b036iqgmbbv37dgwwfihw3mihjbnw3kb5kaisdy0qi8nn8xs54b";
+    sha256 = "183fca7n7439nlhxyg1z7aky0izgbyll3iwakw4gwivy16aj5272";
   };
 
   # The version property must be kept because it will be included into the QtSDK package name
@@ -126,8 +126,6 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ perl pkgconfig which ];
 
-  # occasional build problems if one has too many cores (like on Hydra)
-  # @vcunat has been unable to find a *reliable* fix
   enableParallelBuilding = false;
 
   NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin
diff --git a/pkgs/development/libraries/wayland/default.nix b/pkgs/development/libraries/wayland/default.nix
index 16d2298279b4..11cf77668d74 100644
--- a/pkgs/development/libraries/wayland/default.nix
+++ b/pkgs/development/libraries/wayland/default.nix
@@ -15,11 +15,11 @@ stdenv.mkDerivation rec {
     sha256 = "173w0pqzk2m7hjlg15bymrx7ynxgq1ciadg03hzybxwnvfi4gsmx";
   };
 
-  configureFlags = "--with-scanner";
+  configureFlags = "--with-scanner --disable-documentation";
 
   nativeBuildInputs = [ pkgconfig ];
 
-  buildInputs = [ libffi docbook_xsl doxygen graphviz libxslt xmlto expat ];
+  buildInputs = [ libffi /* docbook_xsl doxygen graphviz libxslt xmlto */ expat ];
 
   meta = {
     description = "Reference implementation of the wayland protocol";
diff --git a/pkgs/development/perl-modules/lwp-protocol-https-cert-file.patch b/pkgs/development/perl-modules/lwp-protocol-https-cert-file.patch
index c0fa85ecce87..4a4b49a829d2 100644
--- a/pkgs/development/perl-modules/lwp-protocol-https-cert-file.patch
+++ b/pkgs/development/perl-modules/lwp-protocol-https-cert-file.patch
@@ -1,4 +1,4 @@
-Use $OPENSSL_X509_CERT_FILE to get the CA certificates.
+Use $SSL_CERT_FILE to get the CA certificates.
 
 diff -ru -x '*~' LWP-Protocol-https-6.02-orig/lib/LWP/Protocol/https.pm LWP-Protocol-https-6.02/lib/LWP/Protocol/https.pm
 --- LWP-Protocol-https-6.02-orig/lib/LWP/Protocol/https.pm	2011-03-27 13:54:01.000000000 +0200
@@ -7,8 +7,8 @@ diff -ru -x '*~' LWP-Protocol-https-6.02-orig/lib/LWP/Protocol/https.pm LWP-Prot
      }
      if ($ssl_opts{SSL_verify_mode}) {
  	unless (exists $ssl_opts{SSL_ca_file} || exists $ssl_opts{SSL_ca_path}) {
-+            if (defined $ENV{'OPENSSL_X509_CERT_FILE'}) {
-+                $ssl_opts{SSL_ca_file} = $ENV{'OPENSSL_X509_CERT_FILE'};
++            if (defined $ENV{'SSL_CERT_FILE'}) {
++                $ssl_opts{SSL_ca_file} = $ENV{'SSL_CERT_FILE'};
 +            }
 +        }
 +	unless (exists $ssl_opts{SSL_ca_file} || exists $ssl_opts{SSL_ca_path}) {
diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix
index 8cdf231729f4..112950b690d6 100644
--- a/pkgs/development/tools/build-managers/cmake/default.nix
+++ b/pkgs/development/tools/build-managers/cmake/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl
-, bzip2, curl, expat, jsoncpp, libarchive, xz, zlib
+, bzip2, curl, expat, libarchive, xz, zlib
 , useNcurses ? false, ncurses, useQt4 ? false, qt4
 , wantPS ? false, ps ? null
 }:
@@ -40,7 +40,6 @@ stdenv.mkDerivation rec {
 
   buildInputs =
     [ bzip2 curl expat libarchive xz zlib ]
-    ++ optional (jsoncpp != null && !stdenv.isCygwin) jsoncpp
     ++ optional useNcurses ncurses
     ++ optional useQt4 qt4;
 
@@ -49,12 +48,11 @@ stdenv.mkDerivation rec {
   CMAKE_PREFIX_PATH = stdenv.lib.concatStringsSep ":" buildInputs;
 
   configureFlags =
-    [
-      "--docdir=/share/doc/${name}"
+    [ "--docdir=/share/doc/${name}"
       "--mandir=/share/man"
+      "--no-system-jsoncpp"
     ]
     ++ optional (!stdenv.isCygwin) "--system-libs"
-    ++ optional (jsoncpp == null || stdenv.isCygwin) "--no-system-jsoncpp"
     ++ optional useQt4 "--qt-gui"
     ++ ["--"]
     ++ optional (!useNcurses) "-DBUILD_CursesDialog=OFF";
diff --git a/pkgs/development/tools/build-managers/gnumake/4.1/default.nix b/pkgs/development/tools/build-managers/gnumake/4.1/default.nix
index 600f6f5759d9..9ac201070182 100644
--- a/pkgs/development/tools/build-managers/gnumake/4.1/default.nix
+++ b/pkgs/development/tools/build-managers/gnumake/4.1/default.nix
@@ -17,6 +17,9 @@ stdenv.mkDerivation {
     # and /usr/lib. It's a stupid feature anyway. Likewise, when searching for
     # included Makefiles, don't look in /usr/include and friends.
     ./impure-dirs.patch
+
+    # Don't segfault if we can't get a tty name.
+    ./no-tty-name.patch
   ];
 
   meta = {
diff --git a/pkgs/development/tools/build-managers/gnumake/4.1/no-tty-name.patch b/pkgs/development/tools/build-managers/gnumake/4.1/no-tty-name.patch
new file mode 100644
index 000000000000..a84d7ab49d04
--- /dev/null
+++ b/pkgs/development/tools/build-managers/gnumake/4.1/no-tty-name.patch
@@ -0,0 +1,53 @@
+From 292da6f6867b75a5af7ddbb639a1feae022f438f Mon Sep 17 00:00:00 2001
+From: Paul Smith <psmith@gnu.org>
+Date: Mon, 20 Oct 2014 05:54:56 +0000
+Subject: * main.c (main): [SV 43434] Handle NULL returns from ttyname().
+
+---
+diff --git main.c main.c
+index b2d169c..0cdb8a8 100644
+--- main.c
++++ main.c
+@@ -1429,13 +1429,18 @@ main (int argc, char **argv, char **envp)
+ #ifdef HAVE_ISATTY
+     if (isatty (fileno (stdout)))
+       if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMOUT")))
+-        define_variable_cname ("MAKE_TERMOUT", TTYNAME (fileno (stdout)),
+-                               o_default, 0)->export = v_export;
+-
++        {
++          const char *tty = TTYNAME (fileno (stdout));
++          define_variable_cname ("MAKE_TERMOUT", tty ? tty : DEFAULT_TTYNAME,
++                                 o_default, 0)->export = v_export;
++        }
+     if (isatty (fileno (stderr)))
+       if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMERR")))
+-        define_variable_cname ("MAKE_TERMERR", TTYNAME (fileno (stderr)),
+-                               o_default, 0)->export = v_export;
++        {
++          const char *tty = TTYNAME (fileno (stderr));
++          define_variable_cname ("MAKE_TERMERR", tty ? tty : DEFAULT_TTYNAME,
++                                 o_default, 0)->export = v_export;
++        }
+ #endif
+ 
+   /* Reset in case the switches changed our minds.  */
+diff --git makeint.h makeint.h
+index 6223936..2009f41 100644
+--- makeint.h
++++ makeint.h
+@@ -436,10 +436,11 @@ extern struct rlimit stack_limit;
+ /* The number of bytes needed to represent the largest integer as a string.  */
+ #define INTSTR_LENGTH         CSTRLEN ("18446744073709551616")
+ 
++#define DEFAULT_TTYNAME "true"
+ #ifdef HAVE_TTYNAME
+ # define TTYNAME(_f) ttyname (_f)
+ #else
+-# define TTYNAME(_f) "true"
++# define TTYNAME(_f) DEFAULT_TTYNAME
+ #endif
+ 
+ 
+--
+cgit v0.9.0.2
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index f740c60c4877..767edcd79842 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -59,7 +59,7 @@ stdenv.mkDerivation rec {
   NIX_CFLAGS_COMPILE = "-static-libgcc";
 
   configureFlags =
-    [ "--enable-shared" "--enable-deterministic-archives" ]
+    [ "--enable-shared" "--enable-deterministic-archives" "--disable-werror" ]
     ++ optional (stdenv.system == "mips64el-linux") "--enable-fix-loongson2f-nop"
     ++ optional (cross != null) "--target=${cross.config}"
     ++ optionals gold [ "--enable-gold" "--enable-plugins" ]
diff --git a/pkgs/development/tools/misc/help2man/default.nix b/pkgs/development/tools/misc/help2man/default.nix
index 79dbb533d034..2f811d9ae82f 100644
--- a/pkgs/development/tools/misc/help2man/default.nix
+++ b/pkgs/development/tools/misc/help2man/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, perl, gettext, LocaleGettext, makeWrapper }:
 
 stdenv.mkDerivation rec {
-  name = "help2man-1.46.6";
+  name = "help2man-1.47.1";
 
   src = fetchurl {
     url = "mirror://gnu/help2man/${name}.tar.xz";
-    sha256 = "1brccgnjf09f2zg70s6gv6gn68mi59kp3zf50wvxp79n72ngapv1";
+    sha256 = "01ib718afwc28bmh1n0p5h7245vs3rrfm7bj1sq4avmh1kv2d6y5";
   };
 
   buildInputs = [ makeWrapper perl gettext LocaleGettext ];
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index f18cc6fa6130..bde6686ff0a9 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -66,7 +66,7 @@ stdenv.mkDerivation rec {
     ''
       # FIXME: patch this in systemd properly (and send upstream).
       # FIXME: use sulogin from util-linux once updated.
-      for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c units/emergency.service.in units/rescue.service.m4.in src/journal/cat.c src/core/shutdown.c src/nspawn/nspawn.c; do
+      for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c units/emergency.service.in units/rescue.service.in src/journal/cat.c src/core/shutdown.c src/nspawn/nspawn.c; do
         test -e $i
         substituteInPlace $i \
           --replace /usr/bin/getent ${stdenv.glibc}/bin/getent \
diff --git a/pkgs/os-specific/linux/usbutils/default.nix b/pkgs/os-specific/linux/usbutils/default.nix
index 710a01ed03d2..158ff2299b18 100644
--- a/pkgs/os-specific/linux/usbutils/default.nix
+++ b/pkgs/os-specific/linux/usbutils/default.nix
@@ -12,7 +12,6 @@ stdenv.mkDerivation rec {
 
   postInstall =
     ''
-      rm $out/sbin/update-usbids.sh
       substituteInPlace $out/bin/lsusb.py \
         --replace /usr/share/usb.ids ${hwdata}/data/hwdata/usb.ids
     '';
diff --git a/pkgs/os-specific/linux/wpa_supplicant/default.nix b/pkgs/os-specific/linux/wpa_supplicant/default.nix
index c709880af2dc..baa0d1c6b549 100644
--- a/pkgs/os-specific/linux/wpa_supplicant/default.nix
+++ b/pkgs/os-specific/linux/wpa_supplicant/default.nix
@@ -87,10 +87,6 @@ stdenv.mkDerivation rec {
   ];
 
   postInstall = ''
-    # Copy the wpa_priv binary which is not installed
-    mkdir -p $out/bin
-    cp -v wpa_priv $out/bin
-
     mkdir -p $out/share/man/man5 $out/share/man/man8
     cp -v "doc/docbook/"*.5 $out/share/man/man5/
     cp -v "doc/docbook/"*.8 $out/share/man/man8/
@@ -99,6 +95,7 @@ stdenv.mkDerivation rec {
     sed -e "s@/sbin/wpa_supplicant@$out&@" -i "$out/share/dbus-1/system-services/"*
     cp -v dbus/dbus-wpa_supplicant.conf $out/etc/dbus-1/system.d
     cp -v "systemd/"*.service $out/etc/systemd/system
+    rm $out/share/man/man8/wpa_priv.8
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix
index 269ba2ec186f..aa28a3fca787 100644
--- a/pkgs/servers/samba/4.x.nix
+++ b/pkgs/servers/samba/4.x.nix
@@ -75,7 +75,7 @@ stdenv.mkDerivation rec {
 
   postFixup = ''
     export SAMBA_LIBS="$(find $out -type f -name \*.so -exec dirname {} \; | sort | uniq)"
-    read -r -d "" SCRIPT << EOF
+    read -r -d "" SCRIPT << EOF || true
     [ -z "\$SAMBA_LIBS" ] && exit 1;
     BIN='{}';
     OLD_LIBS="\$(patchelf --print-rpath "\$BIN" 2>/dev/null | tr ':' '\n')";
diff --git a/pkgs/servers/x11/xorg/builder.sh b/pkgs/servers/x11/xorg/builder.sh
index 6ba50d245075..f5b8803a98a3 100644
--- a/pkgs/servers/x11/xorg/builder.sh
+++ b/pkgs/servers/x11/xorg/builder.sh
@@ -9,8 +9,10 @@ postInstall() {
     if test -n "$origPostInstall"; then eval "$origPostInstall"; fi
 
     local r p requires
+    set +o pipefail
     requires=$(grep "Requires:" $out/lib/pkgconfig/*.pc | \
         sed "s/Requires://" | sed "s/,/ /g")
+    set -o pipefail
 
     echo "propagating requisites $requires"
 
diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index b7e5eef6d56b..f0fdb67f30e2 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -545,11 +545,11 @@ let
   }) // {inherit ;};
 
   kbproto = (mkDerivation "kbproto" {
-    name = "kbproto-1.0.6";
+    name = "kbproto-1.0.7";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/kbproto-1.0.6.tar.bz2;
-      sha256 = "0yal11hhpiisy3w8wmacsdzzzcnc3xwnswxz8k7zri40xc5aqz03";
+      url = mirror://xorg/individual/proto/kbproto-1.0.7.tar.bz2;
+      sha256 = "0mxqj1pzhjpz9495vrjnpi10kv2n1s4vs7di0sh3yvipfq5j30pq";
     };
     buildInputs = [pkgconfig ];
   }) // {inherit ;};
@@ -565,11 +565,11 @@ let
   }) // {inherit applewmproto libX11 libXext xextproto ;};
 
   libFS = (mkDerivation "libFS" {
-    name = "libFS-1.0.6";
+    name = "libFS-1.0.7";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/lib/libFS-1.0.6.tar.bz2;
-      sha256 = "1mxfsvj9m3pn8cdkcn4kg190zp665mf4pv0083g6xykvsgxzq1wh";
+      url = mirror://xorg/individual/lib/libFS-1.0.7.tar.bz2;
+      sha256 = "1wy4km3qwwajbyl8y9pka0zwizn7d9pfiyjgzba02x3a083lr79f";
     };
     buildInputs = [pkgconfig fontsproto xproto xtrans ];
   }) // {inherit fontsproto xproto xtrans ;};
@@ -635,11 +635,11 @@ let
   }) // {inherit xproto ;};
 
   libXaw = (mkDerivation "libXaw" {
-    name = "libXaw-1.0.12";
+    name = "libXaw-1.0.13";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/lib/libXaw-1.0.12.tar.bz2;
-      sha256 = "1xnv7jy86j9vhmw74frkzcraynqbw1p1s79jasargsgwfi433z4n";
+      url = mirror://xorg/individual/lib/libXaw-1.0.13.tar.bz2;
+      sha256 = "1kdhxplwrn43d9jp3v54llp05kwx210lrsdvqb6944jp29rhdy4f";
     };
     buildInputs = [pkgconfig libX11 libXext xextproto libXmu libXpm xproto libXt ];
   }) // {inherit libX11 libXext xextproto libXmu libXpm xproto libXt ;};
@@ -774,22 +774,32 @@ let
     buildInputs = [pkgconfig libX11 libXext xextproto xproto libXt ];
   }) // {inherit libX11 libXext xextproto xproto libXt ;};
 
+  libXpresent = (mkDerivation "libXpresent" {
+    name = "libXpresent-1.0.0";
+    builder = ./builder.sh;
+    src = fetchurl {
+      url = mirror://xorg/individual/lib/libXpresent-1.0.0.tar.bz2;
+      sha256 = "12kvvar3ihf6sw49h6ywfdiwmb8i1gh8wasg1zhzp6hs2hay06n1";
+    };
+    buildInputs = [pkgconfig presentproto libX11 xextproto xproto ];
+  }) // {inherit presentproto libX11 xextproto xproto ;};
+
   libXrandr = (mkDerivation "libXrandr" {
-    name = "libXrandr-1.4.2";
+    name = "libXrandr-1.5.0";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/lib/libXrandr-1.4.2.tar.bz2;
-      sha256 = "1b95p3l84ppv6j7dbbmg0zrz6k8xdwvnag1l6ajm3gk9qwdb79ya";
+      url = mirror://xorg/individual/lib/libXrandr-1.5.0.tar.bz2;
+      sha256 = "0n6ycs1arf4wb1cal9il6v7vbxbf21qhs9sbfl8xndgwnxclk1kg";
     };
     buildInputs = [pkgconfig randrproto renderproto libX11 libXext xextproto xproto libXrender ];
   }) // {inherit randrproto renderproto libX11 libXext xextproto xproto libXrender ;};
 
   libXrender = (mkDerivation "libXrender" {
-    name = "libXrender-0.9.8";
+    name = "libXrender-0.9.9";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/lib/libXrender-0.9.8.tar.bz2;
-      sha256 = "0qpwyjhbpp734vnhca992pjh4w7ijslidkzx1pcwbbk000pv050x";
+      url = mirror://xorg/individual/lib/libXrender-0.9.9.tar.bz2;
+      sha256 = "06myx7044qqdswxndsmd82fpp670klnizkgzdm194h51h1wyabzw";
     };
     buildInputs = [pkgconfig renderproto libX11 xproto ];
   }) // {inherit renderproto libX11 xproto ;};
@@ -805,11 +815,11 @@ let
   }) // {inherit resourceproto libX11 libXext xextproto xproto ;};
 
   libXt = (mkDerivation "libXt" {
-    name = "libXt-1.1.4";
+    name = "libXt-1.1.5";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/lib/libXt-1.1.4.tar.bz2;
-      sha256 = "0myxwbx9ylam5x3ia5b5f4x8azcqdm420h9ad1r4hrgmi2lrffl4";
+      url = mirror://xorg/individual/lib/libXt-1.1.5.tar.bz2;
+      sha256 = "06lz6i7rbrp19kgikpaz4c97fw7n31k2h2aiikczs482g2zbdvj6";
     };
     buildInputs = [pkgconfig libICE kbproto libSM libX11 xproto ];
   }) // {inherit libICE kbproto libSM libX11 xproto ;};
@@ -885,21 +895,21 @@ let
   }) // {inherit dmxproto libX11 libXext xextproto ;};
 
   libfontenc = (mkDerivation "libfontenc" {
-    name = "libfontenc-1.1.2";
+    name = "libfontenc-1.1.3";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/lib/libfontenc-1.1.2.tar.bz2;
-      sha256 = "0qign0ivqk166l9yfd51gw9lbhgs718bcrmvc40yicjr6gnyz959";
+      url = mirror://xorg/individual/lib/libfontenc-1.1.3.tar.bz2;
+      sha256 = "08gxmrhgw97mv0pvkfmd46zzxrn6zdw4g27073zl55gwwqq8jn3h";
     };
     buildInputs = [pkgconfig xproto zlib ];
   }) // {inherit xproto zlib ;};
 
   libpciaccess = (mkDerivation "libpciaccess" {
-    name = "libpciaccess-0.13.3";
+    name = "libpciaccess-0.13.4";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/lib/libpciaccess-0.13.3.tar.bz2;
-      sha256 = "1qy2i776jb7912dxqylv59p41sa0hw8lmn7asd3ywvp0wk56rmvc";
+      url = mirror://xorg/individual/lib/libpciaccess-0.13.4.tar.bz2;
+      sha256 = "1krgryi9ngjr66242v0v5mczihgv0y7rrvx0563arr318mjn9y07";
     };
     buildInputs = [pkgconfig zlib ];
   }) // {inherit zlib ;};
@@ -925,11 +935,11 @@ let
   }) // {inherit libxslt libpthreadstubs python libXau xcbproto libXdmcp ;};
 
   libxkbfile = (mkDerivation "libxkbfile" {
-    name = "libxkbfile-1.0.8";
+    name = "libxkbfile-1.0.9";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/libxkbfile-1.0.8.tar.bz2;
-      sha256 = "0flg5arw6n3njagmsi4i4l0zl5bfx866a1h9ydc3bi1pqlclxaca";
+      url = mirror://xorg/individual/lib/libxkbfile-1.0.9.tar.bz2;
+      sha256 = "0smimr14zvail7ar68n7spvpblpdnih3jxrva7cpa6cn602px0ai";
     };
     buildInputs = [pkgconfig kbproto libX11 ];
   }) // {inherit kbproto libX11 ;};
@@ -1015,11 +1025,11 @@ let
   }) // {inherit libXau ;};
 
   randrproto = (mkDerivation "randrproto" {
-    name = "randrproto-1.4.1";
+    name = "randrproto-1.5.0";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/proto/randrproto-1.4.1.tar.bz2;
-      sha256 = "1p7155hsp48b0sjm4rc67wz6y1nxqrq69vyw0sjxh8h6pcpcngal";
+      url = mirror://xorg/individual/proto/randrproto-1.5.0.tar.bz2;
+      sha256 = "0s4496z61y5q45q20gldwpf788b9nsa8hb13gnck1mwwwwrmarsc";
     };
     buildInputs = [pkgconfig ];
   }) // {inherit ;};
@@ -1075,31 +1085,31 @@ let
   }) // {inherit xproto ;};
 
   setxkbmap = (mkDerivation "setxkbmap" {
-    name = "setxkbmap-1.3.0";
+    name = "setxkbmap-1.3.1";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/setxkbmap-1.3.0.tar.bz2;
-      sha256 = "1inygpvlgc6vr5h9laxw9lnvafnccl3fy0g5n9ll28iq3yfmqc1x";
+      url = mirror://xorg/individual/app/setxkbmap-1.3.1.tar.bz2;
+      sha256 = "1qfk097vjysqb72pq89h0la3462kbb2dh1d11qzs2fr67ybb7pd9";
     };
     buildInputs = [pkgconfig libX11 libxkbfile ];
   }) // {inherit libX11 libxkbfile ;};
 
   smproxy = (mkDerivation "smproxy" {
-    name = "smproxy-1.0.5";
+    name = "smproxy-1.0.6";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/smproxy-1.0.5.tar.bz2;
-      sha256 = "02fn5wa1gs2jap6sr9j9yk6zsvz82j8l61pf74iyqwa99q4wnb67";
+      url = mirror://xorg/individual/app/smproxy-1.0.6.tar.bz2;
+      sha256 = "0rkjyzmsdqmlrkx8gy2j4q6iksk58hcc92xzdprkf8kml9ar3wbc";
     };
     buildInputs = [pkgconfig libICE libSM libXmu libXt ];
   }) // {inherit libICE libSM libXmu libXt ;};
 
   twm = (mkDerivation "twm" {
-    name = "twm-1.0.8";
+    name = "twm-1.0.9";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/app/twm-1.0.8.tar.bz2;
-      sha256 = "0i1ff8h2gh1ab311da5dlhl0nrma0qbrk403ymzi4cnnacikaq3n";
+      url = mirror://xorg/individual/app/twm-1.0.9.tar.bz2;
+      sha256 = "02iicvhkp3i7q5rliyymiq9bppjr0pzfs6rgb78kppryqdx1cxf5";
     };
     buildInputs = [pkgconfig libICE libSM libX11 libXext libXmu xproto libXt ];
   }) // {inherit libICE libSM libX11 libXext libXmu xproto libXt ;};
@@ -1135,14 +1145,14 @@ let
   }) // {inherit ;};
 
   x11perf = (mkDerivation "x11perf" {
-    name = "x11perf-1.5.4";
+    name = "x11perf-1.6.0";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/x11perf-1.5.4.tar.bz2;
-      sha256 = "111iwpxhnxjiq44w96zf0kszg5zpgv1g3ayx18v4nhdzl9bqivi4";
+      url = mirror://xorg/individual/app/x11perf-1.6.0.tar.bz2;
+      sha256 = "0lb716yfdb8f11h4cz93d1bapqdxf1xplsb21kbp4xclq7g9hw78";
     };
-    buildInputs = [pkgconfig libX11 libXext libXft libXmu libXrender ];
-  }) // {inherit libX11 libXext libXft libXmu libXrender ;};
+    buildInputs = [pkgconfig libX11 libXext libXft libXmu xproto libXrender ];
+  }) // {inherit libX11 libXext libXft libXmu xproto libXrender ;};
 
   xauth = (mkDerivation "xauth" {
     name = "xauth-1.0.9";
@@ -1204,6 +1214,16 @@ let
     buildInputs = [pkgconfig gperf m4 libxcb xcbutilimage xcbutilrenderutil xproto ];
   }) // {inherit gperf m4 libxcb xcbutilimage xcbutilrenderutil xproto ;};
 
+  xcbutilerrors = (mkDerivation "xcbutilerrors" {
+    name = "xcb-util-errors-1.0";
+    builder = ./builder.sh;
+    src = fetchurl {
+      url = http://xcb.freedesktop.org/dist/xcb-util-errors-1.0.tar.bz2;
+      sha256 = "158rm913dg3hxrrhyvvxr8bcm0pjy5jws70dhy2s12w1krv829k8";
+    };
+    buildInputs = [pkgconfig gperf m4 libxcb xcbproto xproto ];
+  }) // {inherit gperf m4 libxcb xcbproto xproto ;};
+
   xcbutilimage = (mkDerivation "xcbutilimage" {
     name = "xcb-util-image-0.4.0";
     builder = ./builder.sh;
@@ -1265,15 +1285,25 @@ let
   }) // {inherit ;};
 
   xcmsdb = (mkDerivation "xcmsdb" {
-    name = "xcmsdb-1.0.4";
+    name = "xcmsdb-1.0.5";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/xcmsdb-1.0.4.tar.bz2;
-      sha256 = "03ms731l3kvaldq7ycbd30j6134b61i3gbll4b2gl022wyzbjq74";
+      url = mirror://xorg/individual/app/xcmsdb-1.0.5.tar.bz2;
+      sha256 = "1ik7gzlp2igz183x70883000ygp99r20x3aah6xhaslbpdhm6n75";
     };
     buildInputs = [pkgconfig libX11 ];
   }) // {inherit libX11 ;};
 
+  xcompmgr = (mkDerivation "xcompmgr" {
+    name = "xcompmgr-1.1.7";
+    builder = ./builder.sh;
+    src = fetchurl {
+      url = mirror://xorg/individual/app/xcompmgr-1.1.7.tar.bz2;
+      sha256 = "14k89mz13jxgp4h2pz0yq0fbkw1lsfcb3acv8vkknc9i4ld9n168";
+    };
+    buildInputs = [pkgconfig libXcomposite libXdamage libXext libXfixes libXrender ];
+  }) // {inherit libXcomposite libXdamage libXext libXfixes libXrender ;};
+
   xcursorgen = (mkDerivation "xcursorgen" {
     name = "xcursorgen-1.0.6";
     builder = ./builder.sh;
@@ -1305,31 +1335,31 @@ let
   }) // {inherit libX11 libXau libXaw libXdmcp libXext libXft libXinerama libXmu libXpm libXt ;};
 
   xdpyinfo = (mkDerivation "xdpyinfo" {
-    name = "xdpyinfo-1.3.1";
+    name = "xdpyinfo-1.3.2";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/app/xdpyinfo-1.3.1.tar.bz2;
-      sha256 = "154b29zlrq33lmni883jgwyrb2kx7z8h52jx1s3ys5x5d582iydf";
+      url = mirror://xorg/individual/app/xdpyinfo-1.3.2.tar.bz2;
+      sha256 = "0ldgrj4w2fa8jng4b3f3biaj0wyn8zvya88pnk70d7k12pcqw8rh";
     };
     buildInputs = [pkgconfig libdmx libX11 libxcb libXcomposite libXext libXi libXinerama xproto libXrender libXtst libXxf86dga libXxf86misc libXxf86vm ];
   }) // {inherit libdmx libX11 libxcb libXcomposite libXext libXi libXinerama xproto libXrender libXtst libXxf86dga libXxf86misc libXxf86vm ;};
 
   xdriinfo = (mkDerivation "xdriinfo" {
-    name = "xdriinfo-1.0.4";
+    name = "xdriinfo-1.0.5";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/xdriinfo-1.0.4.tar.bz2;
-      sha256 = "076bjix941znyjmh3j5jjsnhp2gv2iq53d0ks29mvvv87cyy9iim";
+      url = mirror://xorg/individual/app/xdriinfo-1.0.5.tar.bz2;
+      sha256 = "0681d0y8liqakkpz7mmsf689jcxrvs5291r20qi78mc9xxk3gfjc";
     };
     buildInputs = [pkgconfig glproto libX11 ];
   }) // {inherit glproto libX11 ;};
 
   xev = (mkDerivation "xev" {
-    name = "xev-1.2.1";
+    name = "xev-1.2.2";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/app/xev-1.2.1.tar.bz2;
-      sha256 = "0hv296mysglcgkx6lj1wxc23kshb2kix1a8yqppxj5vz16mpzw8i";
+      url = mirror://xorg/individual/app/xev-1.2.2.tar.bz2;
+      sha256 = "0krivhrxpq6719103r541xpi3i3a0y15f7ypc4lnrx8sdhmfcjnr";
     };
     buildInputs = [pkgconfig libX11 xproto libXrandr ];
   }) // {inherit libX11 xproto libXrandr ;};
@@ -1405,21 +1435,21 @@ let
   }) // {inherit inputproto kbproto xorgserver xproto ;};
 
   xf86inputkeyboard = (mkDerivation "xf86inputkeyboard" {
-    name = "xf86-input-keyboard-1.8.0";
+    name = "xf86-input-keyboard-1.8.1";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-input-keyboard-1.8.0.tar.bz2;
-      sha256 = "0nyb61w30z32djrllgr2s1i13di3vsl6hg4pqjhxdal71971ria1";
+      url = mirror://xorg/individual/driver/xf86-input-keyboard-1.8.1.tar.bz2;
+      sha256 = "04d27kwqq03fc26an6051hs3i0bff8albhnngzyd59wxpwwzzj0s";
     };
     buildInputs = [pkgconfig inputproto xorgserver xproto ];
   }) // {inherit inputproto xorgserver xproto ;};
 
   xf86inputlibinput = (mkDerivation "xf86inputlibinput" {
-    name = "xf86-input-libinput-0.8.0";
+    name = "xf86-input-libinput-0.10.0";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-input-libinput-0.8.0.tar.bz2;
-      sha256 = "0fm4vrkw7azipbnwvc2l18g65z77pllsznaajd8q3zpg9ycb0li1";
+      url = mirror://xorg/individual/driver/xf86-input-libinput-0.10.0.tar.bz2;
+      sha256 = "1w1v83qlr7n4iqgd7grmhx0gbz1fhsnpk88j4a136dk4xmc069x4";
     };
     buildInputs = [pkgconfig inputproto xorgserver xproto ];
   }) // {inherit inputproto xorgserver xproto ;};
@@ -1455,11 +1485,11 @@ let
   }) // {inherit inputproto randrproto xorgserver xproto ;};
 
   xf86inputvoid = (mkDerivation "xf86inputvoid" {
-    name = "xf86-input-void-1.4.0";
+    name = "xf86-input-void-1.4.1";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-input-void-1.4.0.tar.bz2;
-      sha256 = "01bmk324fq48wydvy1qrnxbw6qz0fjd0i80g0n4cqr1c4mjmif9a";
+      url = mirror://xorg/individual/driver/xf86-input-void-1.4.1.tar.bz2;
+      sha256 = "171k8b8s42s3w73l7ln9jqwk88w4l7r1km2blx1vy898c854yvpr";
     };
     buildInputs = [pkgconfig xorgserver xproto ];
   }) // {inherit xorgserver xproto ;};
@@ -1505,11 +1535,11 @@ let
   }) // {inherit fontsproto glamoregl libdrm udev libpciaccess randrproto renderproto videoproto xextproto xf86driproto xorgserver xproto ;};
 
   xf86videocirrus = (mkDerivation "xf86videocirrus" {
-    name = "xf86-video-cirrus-1.5.2";
+    name = "xf86-video-cirrus-1.5.3";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-video-cirrus-1.5.2.tar.bz2;
-      sha256 = "1mycqgjp18b6adqj2h90vp324xh8ysyi5migfmjc914vbnkf2q9k";
+      url = mirror://xorg/individual/driver/xf86-video-cirrus-1.5.3.tar.bz2;
+      sha256 = "1asifc6ld2g9kap15vfhvsvyl69lj7pw3d9ra9mi4najllh7pj7d";
     };
     buildInputs = [pkgconfig fontsproto libpciaccess randrproto renderproto videoproto xextproto xorgserver xproto ];
   }) // {inherit fontsproto libpciaccess randrproto renderproto videoproto xextproto xorgserver xproto ;};
@@ -1535,11 +1565,11 @@ let
   }) // {inherit fontsproto libpciaccess randrproto renderproto videoproto xorgserver xproto ;};
 
   xf86videogeode = (mkDerivation "xf86videogeode" {
-    name = "xf86-video-geode-2.11.16";
+    name = "xf86-video-geode-2.11.17";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-video-geode-2.11.16.tar.bz2;
-      sha256 = "19y13xl7yfrgyis92rmxi0ld95ajgr5il0n9j1dridwzw9aizz1q";
+      url = mirror://xorg/individual/driver/xf86-video-geode-2.11.17.tar.bz2;
+      sha256 = "0h9w6cfj7s86rg72c6qci8f733hg4g7paan5fwmmj7p74ckd9d07";
     };
     buildInputs = [pkgconfig fontsproto libpciaccess randrproto renderproto videoproto xextproto xorgserver xproto ];
   }) // {inherit fontsproto libpciaccess randrproto renderproto videoproto xextproto xorgserver xproto ;};
@@ -1595,11 +1625,11 @@ let
   }) // {inherit dri2proto dri3proto fontsproto libdrm libpng udev libpciaccess presentproto randrproto renderproto libX11 xcbutil libxcb libXcursor libXdamage libXext xextproto xf86driproto libXfixes xorgserver xproto libXrandr libXrender libxshmfence libXtst libXvMC ;};
 
   xf86videomach64 = (mkDerivation "xf86videomach64" {
-    name = "xf86-video-mach64-6.9.4";
+    name = "xf86-video-mach64-6.9.5";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-video-mach64-6.9.4.tar.bz2;
-      sha256 = "0pl582vnc6hdxqhf5c0qdyanjqxb4crnhqlmxxml5a60syw0iwcp";
+      url = mirror://xorg/individual/driver/xf86-video-mach64-6.9.5.tar.bz2;
+      sha256 = "07xlf5nsjm0x18ij5gyy4lf8hwpl10i8chi3skpqjh84drdri61y";
     };
     buildInputs = [pkgconfig fontsproto libdrm libpciaccess randrproto renderproto videoproto xextproto xf86driproto xorgserver xproto ];
   }) // {inherit fontsproto libdrm libpciaccess randrproto renderproto videoproto xextproto xf86driproto xorgserver xproto ;};
@@ -1625,11 +1655,11 @@ let
   }) // {inherit fontsproto libdrm udev libpciaccess randrproto libX11 xextproto xorgserver xproto ;};
 
   xf86videoneomagic = (mkDerivation "xf86videoneomagic" {
-    name = "xf86-video-neomagic-1.2.8";
+    name = "xf86-video-neomagic-1.2.9";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-video-neomagic-1.2.8.tar.bz2;
-      sha256 = "0x48sxs1p3kmwk3pq1j7vl93y59gdmgkq1x5xbnh0yal0angdash";
+      url = mirror://xorg/individual/driver/xf86-video-neomagic-1.2.9.tar.bz2;
+      sha256 = "1whb2kgyqaxdjim27ya404acz50izgmafwnb6y9m89q5n6b97y3j";
     };
     buildInputs = [pkgconfig fontsproto libpciaccess xorgserver xproto ];
   }) // {inherit fontsproto libpciaccess xorgserver xproto ;};
@@ -1685,31 +1715,31 @@ let
   }) // {inherit fontsproto libdrm udev libpciaccess randrproto renderproto videoproto xf86dgaproto xorgserver xproto ;};
 
   xf86videor128 = (mkDerivation "xf86videor128" {
-    name = "xf86-video-r128-6.9.2";
+    name = "xf86-video-r128-6.10.0";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-video-r128-6.9.2.tar.bz2;
-      sha256 = "1q3fsc603k2yinphx5rrcl5356qkpywwz8axlw277l2231gjjbcb";
+      url = mirror://xorg/individual/driver/xf86-video-r128-6.10.0.tar.bz2;
+      sha256 = "0g9m1n5184h05mq14vb6k288zm6g81a9m048id00l8v8f6h33mc0";
     };
     buildInputs = [pkgconfig fontsproto libdrm libpciaccess randrproto renderproto videoproto xextproto xf86driproto xf86miscproto xorgserver xproto ];
   }) // {inherit fontsproto libdrm libpciaccess randrproto renderproto videoproto xextproto xf86driproto xf86miscproto xorgserver xproto ;};
 
   xf86videosavage = (mkDerivation "xf86videosavage" {
-    name = "xf86-video-savage-2.3.7";
+    name = "xf86-video-savage-2.3.8";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-video-savage-2.3.7.tar.bz2;
-      sha256 = "0i2aqp68rfkrz9c1p6d7ny9x7bjrlnby7q56zf01fb12r42l4784";
+      url = mirror://xorg/individual/driver/xf86-video-savage-2.3.8.tar.bz2;
+      sha256 = "0qzshncynjdmyhavhqw4x5ha3gwbygi0zbsy158fpg1jcnla9kpx";
     };
     buildInputs = [pkgconfig fontsproto libdrm libpciaccess randrproto renderproto videoproto xextproto xf86driproto xorgserver xproto ];
   }) // {inherit fontsproto libdrm libpciaccess randrproto renderproto videoproto xextproto xf86driproto xorgserver xproto ;};
 
   xf86videosiliconmotion = (mkDerivation "xf86videosiliconmotion" {
-    name = "xf86-video-siliconmotion-1.7.7";
+    name = "xf86-video-siliconmotion-1.7.8";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-video-siliconmotion-1.7.7.tar.bz2;
-      sha256 = "1an321kqvsxq0z35acwl99lc8hpdkayw0q180744ypcl8ffvbf47";
+      url = mirror://xorg/individual/driver/xf86-video-siliconmotion-1.7.8.tar.bz2;
+      sha256 = "1sqv0y31mi4zmh9yaxqpzg7p8y2z01j6qys433hb8n4yznllkm79";
     };
     buildInputs = [pkgconfig fontsproto libpciaccess videoproto xextproto xorgserver xproto ];
   }) // {inherit fontsproto libpciaccess videoproto xextproto xorgserver xproto ;};
@@ -1845,21 +1875,31 @@ let
   }) // {inherit libXfont xproto xtrans ;};
 
   xgamma = (mkDerivation "xgamma" {
-    name = "xgamma-1.0.5";
+    name = "xgamma-1.0.6";
+    builder = ./builder.sh;
+    src = fetchurl {
+      url = mirror://xorg/individual/app/xgamma-1.0.6.tar.bz2;
+      sha256 = "1lr2nb1fhg5fk2fchqxdxyl739602ggwhmgl2wiv5c8qbidw7w8f";
+    };
+    buildInputs = [pkgconfig libX11 xproto libXxf86vm ];
+  }) // {inherit libX11 xproto libXxf86vm ;};
+
+  xgc = (mkDerivation "xgc" {
+    name = "xgc-1.0.5";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/xgamma-1.0.5.tar.bz2;
-      sha256 = "0463sawps86jnxn121ramsz4sicy3az5wa5wsq4rqm8dm3za48p3";
+      url = mirror://xorg/individual/app/xgc-1.0.5.tar.bz2;
+      sha256 = "0pigvjd3i9fchmj1inqy151aafz3dr0vq1h2zizdb2imvadqv0hl";
     };
-    buildInputs = [pkgconfig libX11 libXxf86vm ];
-  }) // {inherit libX11 libXxf86vm ;};
+    buildInputs = [pkgconfig libXaw libXt ];
+  }) // {inherit libXaw libXt ;};
 
   xhost = (mkDerivation "xhost" {
-    name = "xhost-1.0.6";
+    name = "xhost-1.0.7";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/app/xhost-1.0.6.tar.bz2;
-      sha256 = "1hlxm0is9nks1cx033s1733kkib9ivx2bxa3pb9yayqavwibkxd6";
+      url = mirror://xorg/individual/app/xhost-1.0.7.tar.bz2;
+      sha256 = "16n26xw6l01zq31d4qvsaz50misvizhn7iihzdn5f7s72pp1krlk";
     };
     buildInputs = [pkgconfig libX11 libXau libXmu xproto ];
   }) // {inherit libX11 libXau libXmu xproto ;};
@@ -1905,24 +1945,24 @@ let
   }) // {inherit libX11 libxkbfile xproto ;};
 
   xkbevd = (mkDerivation "xkbevd" {
-    name = "xkbevd-1.1.3";
+    name = "xkbevd-1.1.4";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/xkbevd-1.1.3.tar.bz2;
-      sha256 = "05h1xcnbalndbrryyqs8wzy9h3wz655vc0ymhlk2q4aik17licjm";
+      url = mirror://xorg/individual/app/xkbevd-1.1.4.tar.bz2;
+      sha256 = "0sprjx8i86ljk0l7ldzbz2xlk8916z5zh78cafjv8k1a63js4c14";
     };
     buildInputs = [pkgconfig libX11 libxkbfile ];
   }) // {inherit libX11 libxkbfile ;};
 
   xkbprint = (mkDerivation "xkbprint" {
-    name = "xkbprint-1.0.3";
+    name = "xkbprint-1.0.4";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/app/xkbprint-1.0.3.tar.bz2;
-      sha256 = "1h4jb3gjrbjp79h5gcgkjvdxykcy2bmq03smpls820c8wnw6v17s";
+      url = mirror://xorg/individual/app/xkbprint-1.0.4.tar.bz2;
+      sha256 = "04iyv5z8aqhabv7wcpvbvq0ji0jrz1666vw6gvxkvl7szswalgqb";
     };
-    buildInputs = [pkgconfig libX11 libxkbfile ];
-  }) // {inherit libX11 libxkbfile ;};
+    buildInputs = [pkgconfig libX11 libxkbfile xproto ];
+  }) // {inherit libX11 libxkbfile xproto ;};
 
   xkbutils = (mkDerivation "xkbutils" {
     name = "xkbutils-1.0.4";
@@ -1955,11 +1995,11 @@ let
   }) // {inherit libX11 libXmu xproto ;};
 
   xlsatoms = (mkDerivation "xlsatoms" {
-    name = "xlsatoms-1.1.1";
+    name = "xlsatoms-1.1.2";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/xlsatoms-1.1.1.tar.bz2;
-      sha256 = "1y9nfl8s7njxbnci8c20j986xixharasgg40vdw92y593j6dk2rv";
+      url = mirror://xorg/individual/app/xlsatoms-1.1.2.tar.bz2;
+      sha256 = "196yjik910xsr7dwy8daa0amr0r22ynfs360z0ndp9mx7mydrra7";
     };
     buildInputs = [pkgconfig libxcb ];
   }) // {inherit libxcb ;};
@@ -1974,6 +2014,26 @@ let
     buildInputs = [pkgconfig libxcb ];
   }) // {inherit libxcb ;};
 
+  xlsfonts = (mkDerivation "xlsfonts" {
+    name = "xlsfonts-1.0.5";
+    builder = ./builder.sh;
+    src = fetchurl {
+      url = mirror://xorg/individual/app/xlsfonts-1.0.5.tar.bz2;
+      sha256 = "1yi774g6r1kafsbnxbkrwyndd3i60362ck1fps9ywz076pn5naa0";
+    };
+    buildInputs = [pkgconfig libX11 xproto ];
+  }) // {inherit libX11 xproto ;};
+
+  xmag = (mkDerivation "xmag" {
+    name = "xmag-1.0.6";
+    builder = ./builder.sh;
+    src = fetchurl {
+      url = mirror://xorg/individual/app/xmag-1.0.6.tar.bz2;
+      sha256 = "0qg12ifbbk9n8fh4jmyb625cknn8ssj86chd6zwdiqjin8ivr8l7";
+    };
+    buildInputs = [pkgconfig libX11 libXaw libXmu libXt ];
+  }) // {inherit libX11 libXaw libXmu libXt ;};
+
   xmessage = (mkDerivation "xmessage" {
     name = "xmessage-1.0.4";
     builder = ./builder.sh;
@@ -1985,11 +2045,11 @@ let
   }) // {inherit libXaw libXt ;};
 
   xmodmap = (mkDerivation "xmodmap" {
-    name = "xmodmap-1.0.8";
+    name = "xmodmap-1.0.9";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/app/xmodmap-1.0.8.tar.bz2;
-      sha256 = "1hwzm54m4ng09ls9i4bq0x84zbyhamgzasgrvhxxp8jqk34f7qpg";
+      url = mirror://xorg/individual/app/xmodmap-1.0.9.tar.bz2;
+      sha256 = "0y649an3jqfq9klkp9y5gj20xb78fw6g193f5mnzpl0hbz6fbc5p";
     };
     buildInputs = [pkgconfig libX11 xproto ];
   }) // {inherit libX11 xproto ;};
@@ -2005,24 +2065,24 @@ let
   }) // {inherit ;};
 
   xorgdocs = (mkDerivation "xorgdocs" {
-    name = "xorg-docs-1.7";
+    name = "xorg-docs-1.7.1";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/xorg-docs-1.7.tar.bz2;
-      sha256 = "0prphdba6kgr1bxk7r07wxxx6x6pqjw6prr5qclypsb5sf5r3cdr";
+      url = mirror://xorg/individual/doc/xorg-docs-1.7.1.tar.bz2;
+      sha256 = "0jrc4jmb4raqawx0j9jmhgasr0k6sxv0bm2hrxjh9hb26iy6gf14";
     };
     buildInputs = [pkgconfig ];
   }) // {inherit ;};
 
   xorgserver = (mkDerivation "xorgserver" {
-    name = "xorg-server-1.16.4";
+    name = "xorg-server-1.17.2";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/xserver/xorg-server-1.16.4.tar.bz2;
-      sha256 = "0wf8xykcjhvpk9ppjcixvf60p6kkyrpmfj0z29d93a8kjb6f3dmb";
+      url = mirror://xorg/individual/xserver/xorg-server-1.17.2.tar.bz2;
+      sha256 = "14vr4mm0x94a9bd3sfx9mdh8qhvk48zcml3i8q1wbwi84xhj04gn";
     };
-    buildInputs = [pkgconfig dri2proto dri3proto renderproto libdrm openssl libX11 libXau libXaw libxcb xcbutil xcbutilwm xcbutilimage xcbutilkeysyms libXdmcp libXfixes libxkbfile libXmu libXpm libXrender libXres libxshmfence libXt ];
-  }) // {inherit dri2proto dri3proto renderproto libdrm openssl libX11 libXau libXaw libxcb xcbutil xcbutilwm xcbutilimage xcbutilkeysyms libXdmcp libXfixes libxkbfile libXmu libXpm libXrender libXres libxshmfence libXt ;};
+    buildInputs = [pkgconfig dri2proto dri3proto renderproto libdrm openssl libX11 libXau libXaw libxcb xcbutil xcbutilwm xcbutilimage xcbutilkeysyms libXdmcp libXfixes libxkbfile libXmu libXpm libXrender libXres libxshmfence libXt xcbutilrenderutil];
+  }) // {inherit dri2proto dri3proto renderproto libdrm openssl libX11 libXau libXaw libxcb xcbutil xcbutilwm xcbutilimage xcbutilkeysyms libXdmcp libXfixes libxkbfile libXmu libXpm libXrender libXres libxshmfence libXt xcbutilrenderutil;};
 
   xorgsgmldoctools = (mkDerivation "xorgsgmldoctools" {
     name = "xorg-sgml-doctools-1.11";
@@ -2125,11 +2185,11 @@ let
   }) // {inherit ;};
 
   xvinfo = (mkDerivation "xvinfo" {
-    name = "xvinfo-1.1.2";
+    name = "xvinfo-1.1.3";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/app/xvinfo-1.1.2.tar.bz2;
-      sha256 = "1qsh7fszi727l3vwlaf9pb7bpikdv15smrx5qhlgg3kqzl7xklzf";
+      url = mirror://xorg/individual/app/xvinfo-1.1.3.tar.bz2;
+      sha256 = "1sz5wqhxd1fqsfi1w5advdlwzkizf2fgl12hdpk66f7mv9l8pflz";
     };
     buildInputs = [pkgconfig libX11 xproto libXv ];
   }) // {inherit libX11 xproto libXv ;};
diff --git a/pkgs/servers/x11/xorg/extra.list b/pkgs/servers/x11/xorg/extra.list
index f0bf8bf73782..8a445a69c69c 100644
--- a/pkgs/servers/x11/xorg/extra.list
+++ b/pkgs/servers/x11/xorg/extra.list
@@ -7,3 +7,4 @@ http://xcb.freedesktop.org/dist/xcb-util-image-0.4.0.tar.bz2
 http://xcb.freedesktop.org/dist/xcb-util-keysyms-0.4.0.tar.bz2
 http://xcb.freedesktop.org/dist/xcb-util-renderutil-0.3.9.tar.bz2
 http://xcb.freedesktop.org/dist/xcb-util-wm-0.4.1.tar.bz2
+http://xcb.freedesktop.org/dist/xcb-util-errors-1.0.tar.bz2
diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix
index b5b58ab320c4..0fc70fb6e172 100644
--- a/pkgs/servers/x11/xorg/overrides.nix
+++ b/pkgs/servers/x11/xorg/overrides.nix
@@ -173,6 +173,9 @@ in
     patchPhase = "sed -i '/USE_GETTEXT_TRUE/d' sxpm/Makefile.in cxpm/Makefile.in";
   };
 
+  libXpresent = attrs: attrs
+    // { buildInputs = with xorg; attrs.buildInputs ++ [ libXext libXfixes libXrandr ]; };
+
   setxkbmap = attrs: attrs // {
     postInstall =
       ''
diff --git a/pkgs/servers/x11/xorg/tarballs-7.7.list b/pkgs/servers/x11/xorg/tarballs-7.7.list
index f02dd1e89f03..932d4f1236f2 100644
--- a/pkgs/servers/x11/xorg/tarballs-7.7.list
+++ b/pkgs/servers/x11/xorg/tarballs-7.7.list
@@ -49,19 +49,19 @@ mirror://xorg/X11R7.7/src/everything/font-xfree86-type1-1.0.4.tar.bz2
 mirror://xorg/individual/proto/glproto-1.4.17.tar.bz2
 mirror://xorg/individual/app/iceauth-1.0.7.tar.bz2
 mirror://xorg/individual/proto/inputproto-2.3.1.tar.bz2
-mirror://xorg/X11R7.7/src/everything/kbproto-1.0.6.tar.bz2
+mirror://xorg/individual/proto/kbproto-1.0.7.tar.bz2
 mirror://xorg/X11R7.7/src/everything/libAppleWM-1.4.1.tar.bz2
 mirror://xorg/individual/lib/libdmx-1.1.3.tar.bz2
 mirror://xorg/individual/lib/libxshmfence-1.2.tar.bz2
-mirror://xorg/individual/lib/libfontenc-1.1.2.tar.bz2
-mirror://xorg/individual/lib/libFS-1.0.6.tar.bz2
+mirror://xorg/individual/lib/libfontenc-1.1.3.tar.bz2
+mirror://xorg/individual/lib/libFS-1.0.7.tar.bz2
 mirror://xorg/individual/lib/libICE-1.0.9.tar.bz2
-mirror://xorg/individual/lib/libpciaccess-0.13.3.tar.bz2
+mirror://xorg/individual/lib/libpciaccess-0.13.4.tar.bz2
 mirror://xorg/individual/lib/libSM-1.2.2.tar.bz2
 mirror://xorg/X11R7.7/src/everything/libWindowsWM-1.0.1.tar.bz2
 mirror://xorg/individual/lib/libX11-1.6.3.tar.bz2
 mirror://xorg/individual/lib/libXau-1.0.8.tar.bz2
-mirror://xorg/individual/lib/libXaw-1.0.12.tar.bz2
+mirror://xorg/individual/lib/libXaw-1.0.13.tar.bz2
 mirror://xorg/individual/lib/libXcomposite-0.4.4.tar.bz2
 mirror://xorg/individual/lib/libXcursor-1.1.14.tar.bz2
 mirror://xorg/individual/lib/libXdamage-1.1.4.tar.bz2
@@ -72,14 +72,15 @@ mirror://xorg/individual/lib/libXfont-1.5.1.tar.bz2
 mirror://xorg/individual/lib/libXft-2.3.2.tar.bz2
 mirror://xorg/individual/lib/libXi-1.7.4.tar.bz2
 mirror://xorg/individual/lib/libXinerama-1.1.3.tar.bz2
-mirror://xorg/X11R7.7/src/everything/libxkbfile-1.0.8.tar.bz2
+mirror://xorg/individual/lib/libxkbfile-1.0.9.tar.bz2
 mirror://xorg/individual/lib/libXmu-1.1.2.tar.bz2
 mirror://xorg/individual/lib/libXpm-3.5.11.tar.bz2
-mirror://xorg/individual/lib/libXrandr-1.4.2.tar.bz2
-mirror://xorg/individual/lib/libXrender-0.9.8.tar.bz2
+mirror://xorg/individual/lib/libXpresent-1.0.0.tar.bz2
+mirror://xorg/individual/lib/libXrandr-1.5.0.tar.bz2
+mirror://xorg/individual/lib/libXrender-0.9.9.tar.bz2
 mirror://xorg/individual/lib/libXres-1.0.7.tar.bz2
 mirror://xorg/X11R7.7/src/everything/libXScrnSaver-1.2.2.tar.bz2
-mirror://xorg/individual/lib/libXt-1.1.4.tar.bz2
+mirror://xorg/individual/lib/libXt-1.1.5.tar.bz2
 mirror://xorg/individual/lib/libXtst-1.2.2.tar.bz2
 mirror://xorg/individual/lib/libXv-1.0.10.tar.bz2
 mirror://xorg/individual/lib/libXvMC-1.0.9.tar.bz2
@@ -89,65 +90,67 @@ mirror://xorg/X11R7.7/src/everything/luit-1.1.1.tar.bz2
 mirror://xorg/individual/util/makedepend-1.0.5.tar.bz2
 mirror://xorg/X11R7.7/src/everything/mkfontdir-1.0.7.tar.bz2
 mirror://xorg/individual/app/mkfontscale-1.1.2.tar.bz2
-mirror://xorg/individual/proto/randrproto-1.4.1.tar.bz2
+mirror://xorg/individual/proto/randrproto-1.5.0.tar.bz2
 mirror://xorg/X11R7.7/src/everything/recordproto-1.14.2.tar.bz2
 mirror://xorg/X11R7.7/src/everything/renderproto-0.11.1.tar.bz2
 mirror://xorg/X11R7.7/src/everything/resourceproto-1.2.0.tar.bz2
 mirror://xorg/X11R7.7/src/everything/scrnsaverproto-1.2.2.tar.bz2
 mirror://xorg/individual/app/sessreg-1.1.0.tar.bz2
-mirror://xorg/X11R7.7/src/everything/setxkbmap-1.3.0.tar.bz2
-mirror://xorg/X11R7.7/src/everything/smproxy-1.0.5.tar.bz2
+mirror://xorg/individual/app/setxkbmap-1.3.1.tar.bz2
+mirror://xorg/individual/app/smproxy-1.0.6.tar.bz2
+mirror://xorg/individual/app/twm-1.0.9.tar.bz2
 mirror://xorg/individual/util/util-macros-1.19.0.tar.bz2
 mirror://xorg/individual/proto/videoproto-2.3.2.tar.bz2
 mirror://xorg/X11R7.7/src/everything/windowswmproto-1.0.4.tar.bz2
-mirror://xorg/X11R7.7/src/everything/x11perf-1.5.4.tar.bz2
+mirror://xorg/individual/app/x11perf-1.6.0.tar.bz2
 mirror://xorg/individual/app/xauth-1.0.9.tar.bz2
 mirror://xorg/individual/app/xbacklight-1.2.1.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xbitmaps-1.1.1.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xcmiscproto-1.2.2.tar.bz2
-mirror://xorg/X11R7.7/src/everything/xcmsdb-1.0.4.tar.bz2
+mirror://xorg/individual/app/xcmsdb-1.0.5.tar.bz2
+mirror://xorg/individual/app/xcompmgr-1.1.7.tar.bz2
 mirror://xorg/individual/app/xcursorgen-1.0.6.tar.bz2
 mirror://xorg/individual/data/xcursor-themes-1.0.4.tar.bz2
-mirror://xorg/individual/app/xdpyinfo-1.3.1.tar.bz2
-mirror://xorg/X11R7.7/src/everything/xdriinfo-1.0.4.tar.bz2
-mirror://xorg/individual/app/xev-1.2.1.tar.bz2
+mirror://xorg/individual/app/xdpyinfo-1.3.2.tar.bz2
+mirror://xorg/individual/app/xdriinfo-1.0.5.tar.bz2
+mirror://xorg/individual/app/xev-1.2.2.tar.bz2
 mirror://xorg/individual/proto/xextproto-7.3.0.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xf86bigfontproto-1.2.0.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xf86dgaproto-2.1.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xf86driproto-2.1.1.tar.bz2
 mirror://xorg/individual/driver/xf86-input-evdev-2.9.2.tar.bz2
 mirror://xorg/individual/driver/xf86-input-joystick-1.6.2.tar.bz2
-mirror://xorg/individual/driver/xf86-input-keyboard-1.8.0.tar.bz2
-mirror://xorg/individual/driver/xf86-input-libinput-0.8.0.tar.bz2
+mirror://xorg/individual/driver/xf86-input-keyboard-1.8.1.tar.bz2
+mirror://xorg/individual/driver/xf86-input-libinput-0.10.0.tar.bz2
 mirror://xorg/individual/driver/xf86-input-mouse-1.9.1.tar.bz2
 mirror://xorg/individual/driver/xf86-input-synaptics-1.8.2.tar.bz2
 mirror://xorg/individual/driver/xf86-input-vmmouse-13.0.0.tar.bz2
-mirror://xorg/individual/driver/xf86-input-void-1.4.0.tar.bz2
+mirror://xorg/individual/driver/xf86-input-void-1.4.1.tar.bz2
 mirror://xorg/individual/driver/xf86-video-ark-0.7.5.tar.bz2
 mirror://xorg/individual/driver/xf86-video-ast-0.98.0.tar.bz2
 mirror://xorg/individual/driver/xf86-video-ati-7.5.0.tar.bz2
 mirror://xorg/individual/driver/glamor-egl-0.6.0.tar.bz2
 mirror://xorg/individual/driver/xf86-video-nouveau-1.0.11.tar.bz2
-mirror://xorg/individual/driver/xf86-video-cirrus-1.5.2.tar.bz2
+mirror://xorg/individual/driver/xf86-video-cirrus-1.5.3.tar.bz2
 mirror://xorg/individual/driver/xf86-video-dummy-0.3.7.tar.bz2
 mirror://xorg/individual/driver/xf86-video-fbdev-0.4.4.tar.bz2
-mirror://xorg/individual/driver/xf86-video-geode-2.11.16.tar.bz2
+mirror://xorg/individual/driver/xf86-video-geode-2.11.17.tar.bz2
 mirror://xorg/individual/driver/xf86-video-glide-1.2.2.tar.bz2
 mirror://xorg/individual/driver/xf86-video-glint-1.2.8.tar.bz2
 mirror://xorg/individual/driver/xf86-video-i128-1.3.6.tar.bz2
 mirror://xorg/individual/driver/xf86-video-i740-1.3.5.tar.bz2
 mirror://xorg/individual/driver/xf86-video-intel-2.99.917.tar.bz2
-mirror://xorg/individual/driver/xf86-video-mach64-6.9.4.tar.bz2
+mirror://xorg/individual/driver/xf86-video-mach64-6.9.5.tar.bz2
 mirror://xorg/individual/driver/xf86-video-mga-1.6.4.tar.bz2
 mirror://xorg/individual/driver/xf86-video-modesetting-0.9.0.tar.bz2
 mirror://xorg/individual/driver/xf86-video-qxl-0.1.3.tar.bz2
-mirror://xorg/individual/driver/xf86-video-neomagic-1.2.8.tar.bz2
+mirror://xorg/individual/driver/xf86-video-neomagic-1.2.9.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xf86-video-newport-0.2.4.tar.bz2
 mirror://xorg/individual/driver/xf86-video-nv-2.1.20.tar.bz2
 mirror://xorg/individual/driver/xf86-video-openchrome-0.3.3.tar.bz2
-mirror://xorg/individual/driver/xf86-video-r128-6.9.2.tar.bz2
-mirror://xorg/individual/driver/xf86-video-savage-2.3.7.tar.bz2
-mirror://xorg/individual/driver/xf86-video-siliconmotion-1.7.7.tar.bz2
+mirror://xorg/individual/driver/xf86-video-r128-6.10.0.tar.bz2
+mirror://xorg/individual/driver/xf86-video-savage-2.3.8.tar.bz2
+mirror://xorg/individual/driver/xf86-video-siliconmotion-1.7.8.tar.bz2
 mirror://xorg/individual/driver/xf86-video-sis-0.10.7.tar.bz2
 mirror://xorg/individual/driver/xf86-video-suncg6-1.1.2.tar.bz2
 mirror://xorg/individual/driver/xf86-video-sunffb-1.2.2.tar.bz2
@@ -160,19 +163,22 @@ mirror://xorg/individual/driver/xf86-video-vmware-13.1.0.tar.bz2
 mirror://xorg/individual/driver/xf86-video-voodoo-1.2.5.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xf86-video-wsfb-0.4.0.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xf86vidmodeproto-2.3.1.tar.bz2
-mirror://xorg/X11R7.7/src/everything/xgamma-1.0.5.tar.bz2
-mirror://xorg/individual/app/xhost-1.0.6.tar.bz2
+mirror://xorg/individual/app/xgamma-1.0.6.tar.bz2
+mirror://xorg/individual/app/xgc-1.0.5.tar.bz2
+mirror://xorg/individual/app/xhost-1.0.7.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xineramaproto-1.2.1.tar.bz2
 mirror://xorg/individual/app/xinput-1.6.1.tar.bz2
 mirror://xorg/individual/app/xkbcomp-1.3.0.tar.bz2
-mirror://xorg/X11R7.7/src/everything/xkbevd-1.1.3.tar.bz2
+mirror://xorg/individual/app/xkbevd-1.1.4.tar.bz2
 mirror://xorg/individual/app/xkbutils-1.0.4.tar.bz2
 mirror://xorg/individual/data/xkeyboard-config/xkeyboard-config-2.11.tar.bz2
 mirror://xorg/individual/app/xkill-1.0.4.tar.bz2
-mirror://xorg/X11R7.7/src/everything/xlsatoms-1.1.1.tar.bz2
+mirror://xorg/individual/app/xlsatoms-1.1.2.tar.bz2
 mirror://xorg/individual/app/xlsclients-1.1.3.tar.bz2
-mirror://xorg/individual/app/xmodmap-1.0.8.tar.bz2
-mirror://xorg/X11R7.7/src/everything/xorg-docs-1.7.tar.bz2
+mirror://xorg/individual/app/xlsfonts-1.0.5.tar.bz2
+mirror://xorg/individual/app/xmag-1.0.6.tar.bz2
+mirror://xorg/individual/app/xmodmap-1.0.9.tar.bz2
+mirror://xorg/individual/doc/xorg-docs-1.7.1.tar.bz2
 mirror://xorg/individual/xserver/xorg-server-1.16.4.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xorg-sgml-doctools-1.11.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xpr-1.0.4.tar.bz2
@@ -184,8 +190,8 @@ mirror://xorg/individual/app/xrefresh-1.0.5.tar.bz2
 mirror://xorg/individual/app/xset-1.2.3.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xsetroot-1.1.0.tar.bz2
 mirror://xorg/individual/lib/xtrans-1.3.5.tar.bz2
-mirror://xorg/individual/app/xvinfo-1.1.2.tar.bz2
+mirror://xorg/individual/app/xvinfo-1.1.3.tar.bz2
 mirror://xorg/individual/app/xwd-1.0.6.tar.bz2
 mirror://xorg/individual/app/xwininfo-1.1.3.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xwud-1.0.4.tar.bz2
-mirror://xorg/individual/app/xkbprint-1.0.3.tar.bz2
+mirror://xorg/individual/app/xkbprint-1.0.4.tar.bz2
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index ac396ecdf12b..98fc35074c2e 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -31,7 +31,7 @@ rec {
       shell        = "/bin/bash";
       initialPath  = [ bootstrapTools ];
       fetchurlBoot = fetchurl;
-      cc           = "/no-such-path";
+      cc           = null;
     };
   };
 
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 75be719c2b95..75cc86934806 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -19,7 +19,7 @@ runHook() {
     if [[ "$hookName" =~ Hook$ ]]; then var+=s; else var+=Hooks; fi
     eval "local -a dummy=(\"\${$var[@]}\")"
     for hook in "_callImplicitHook 0 $hookName" "${dummy[@]}"; do
-        if ! _eval "$hook" "$@"; then return 1; fi
+        _eval "$hook" "$@"
     done
     return 0
 }
@@ -73,6 +73,35 @@ _eval() {
 
 
 ######################################################################
+# Logging.
+
+nestingLevel=0
+
+startNest() {
+    nestingLevel=$(($nestingLevel + 1))
+    echo -en "\033[$1p"
+}
+
+stopNest() {
+    nestingLevel=$(($nestingLevel - 1))
+    echo -en "\033[q"
+}
+
+header() {
+    startNest "$2"
+    echo "$1"
+}
+
+# Make sure that even when we exit abnormally, the original nesting
+# level is properly restored.
+closeNest() {
+    while [ $nestingLevel -gt 0 ]; do
+        stopNest
+    done
+}
+
+
+######################################################################
 # Error handling.
 
 exitHandler() {
@@ -193,7 +222,7 @@ runHook addInputsHook
 
 # Recursively find all build inputs.
 findInputs() {
-    local pkg=$1
+    local pkg="$1"
     local var=$2
     local propagatedBuildInputsFile=$3
 
@@ -205,17 +234,22 @@ findInputs() {
 
     eval $var="'${!var} $pkg '"
 
-    if [ -f $pkg ]; then
-        source $pkg
+    if ! [ -e "$pkg" ]; then
+        echo "build input $pkg does not exist" >&2
+        exit 1
+    fi
+
+    if [ -f "$pkg" ]; then
+        source "$pkg"
     fi
 
-    if [ -f $pkg/nix-support/setup-hook ]; then
-        source $pkg/nix-support/setup-hook
+    if [ -f "$pkg/nix-support/setup-hook" ]; then
+        source "$pkg/nix-support/setup-hook"
     fi
 
-    if [ -f $pkg/nix-support/$propagatedBuildInputsFile ]; then
-        for i in $(cat $pkg/nix-support/$propagatedBuildInputsFile); do
-            findInputs $i $var $propagatedBuildInputsFile
+    if [ -f "$pkg/nix-support/$propagatedBuildInputsFile" ]; then
+        for i in $(cat "$pkg/nix-support/$propagatedBuildInputsFile"); do
+            findInputs "$i" $var $propagatedBuildInputsFile
         done
     fi
 }
@@ -409,32 +443,6 @@ substituteAllInPlace() {
 # What follows is the generic builder.
 
 
-nestingLevel=0
-
-startNest() {
-    nestingLevel=$(($nestingLevel + 1))
-    echo -en "\033[$1p"
-}
-
-stopNest() {
-    nestingLevel=$(($nestingLevel - 1))
-    echo -en "\033[q"
-}
-
-header() {
-    startNest "$2"
-    echo "$1"
-}
-
-# Make sure that even when we exit abnormally, the original nesting
-# level is properly restored.
-closeNest() {
-    while [ $nestingLevel -gt 0 ]; do
-        stopNest
-    done
-}
-
-
 # This function is useful for debugging broken Nix builds.  It dumps
 # all environment variables to a file `env-vars' in the build
 # directory.  If the build fails and the `-K' option is used, you can
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 722d40bf7fbe..12fc3fed5a5a 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -86,7 +86,7 @@ rec {
         };
 
         cc = if isNull gccPlain
-             then "/no-such-path"
+             then null
              else lib.makeOverridable (import ../../build-support/cc-wrapper) {
           nativeTools = false;
           nativeLibc = false;
@@ -202,7 +202,7 @@ rec {
     coreutils = bootstrapTools;
     name = "bootstrap-gcc-wrapper";
 
-    overrides = pkgs: {
+    overrides = pkgs: rec {
       inherit (stage2.pkgs) binutils glibc perl patchelf linuxHeaders;
       # Link GCC statically against GMP etc.  This makes sense because
       # these builds of the libraries are only used by GCC, so it
@@ -210,9 +210,15 @@ rec {
       gmp = pkgs.gmp.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
       mpfr = pkgs.mpfr.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
       libmpc = pkgs.libmpc.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
-      isl = pkgs.isl.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
-      cloog = pkgs.cloog.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
-      gccPlain = pkgs.gcc.cc;
+      isl_0_11 = pkgs.isl_0_11.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
+      cloog_0_18_0 = pkgs.cloog_0_18_0.override {
+        stdenv = pkgs.makeStaticLibraries pkgs.stdenv;
+        isl = isl_0_11;
+      };
+      gccPlain = pkgs.gcc.cc.override {
+        isl = isl_0_11;
+        cloog = cloog_0_18_0;
+      };
     };
     extraBuildInputs = [ stage2.pkgs.patchelf stage2.pkgs.paxctl ];
   };
diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix
index 5390907928de..bd90d580d3f5 100644
--- a/pkgs/stdenv/native/default.nix
+++ b/pkgs/stdenv/native/default.nix
@@ -98,7 +98,7 @@ rec {
 
 
   stdenvBoot0 = makeStdenv {
-    cc = "/no-such-path";
+    cc = null;
     fetchurl = null;
   };
 
diff --git a/pkgs/tools/X11/xdg-utils/default.nix b/pkgs/tools/X11/xdg-utils/default.nix
index 53b3531b685c..4d7ead019ce6 100644
--- a/pkgs/tools/X11/xdg-utils/default.nix
+++ b/pkgs/tools/X11/xdg-utils/default.nix
@@ -1,12 +1,14 @@
-{ stdenv, fetchgit, file, libxslt, docbook_xml_dtd_412, docbook_xsl, xmlto, w3m }:
+{ stdenv, fetchzip, file, libxslt, docbook_xml_dtd_412, docbook_xsl, xmlto, w3m }:
+
+let rev = "e8ee3b18d16e41b95148111b920a0c8beed3ac6c"; in
 
 stdenv.mkDerivation rec {
   name = "xdg-utils-1.1.0-rc3p7";
 
-  src = fetchgit {
-    url = "http://anongit.freedesktop.org/git/xdg/xdg-utils.git";
-    rev = "e8ee3b18d16e41b95148111b920a0c8beed3ac6c";
-    sha256 = "0qy9h7vh6sw7wmadjvasw4sdhb9fvv7bn32ifgasdx7ag3r3939w";
+  src = fetchzip {
+    name = "xdg-utils-${rev}.tar.gz";
+    url = "http://cgit.freedesktop.org/xdg/xdg-utils/snapshot/${rev}.tar.gz";
+    sha256 = "1hz6rv45blcii1a8n1j45rg8vzm98vh4fvlca3zmay1kp57yr4jl";
   };
 
   # just needed when built from git
diff --git a/pkgs/tools/filesystems/bcache-tools/default.nix b/pkgs/tools/filesystems/bcache-tools/default.nix
index a4b1363d841d..14d8d282c81c 100644
--- a/pkgs/tools/filesystems/bcache-tools/default.nix
+++ b/pkgs/tools/filesystems/bcache-tools/default.nix
@@ -21,7 +21,10 @@ stdenv.mkDerivation rec {
         -i Makefile
   '';
 
-  patches = [ ./bcache-udev-modern.patch ];
+  patches = [
+    ./bcache-udev-modern.patch
+    ./fix-static.patch
+  ];
 
   preBuild = ''
     export makeFlags="$makeFlags PREFIX=\"$out\" UDEVLIBDIR=\"$out/lib/udev/\"";
diff --git a/pkgs/tools/filesystems/bcache-tools/fix-static.patch b/pkgs/tools/filesystems/bcache-tools/fix-static.patch
new file mode 100644
index 000000000000..e5dd2df5299d
--- /dev/null
+++ b/pkgs/tools/filesystems/bcache-tools/fix-static.patch
@@ -0,0 +1,22 @@
+diff --git a/bcache.c b/bcache.c
+index 8f37445..79806d8 100644
+--- a/bcache.c
++++ b/bcache.c
+@@ -26,7 +26,7 @@
+  * x^7 + x^4 + x + 1
+ */
+ 
+-static const uint64_t crc_table[256] = {
++const uint64_t crc_table[256] = {
+ 	0x0000000000000000ULL, 0x42F0E1EBA9EA3693ULL, 0x85E1C3D753D46D26ULL,
+ 	0xC711223CFA3E5BB5ULL, 0x493366450E42ECDFULL, 0x0BC387AEA7A8DA4CULL,
+ 	0xCCD2A5925D9681F9ULL, 0x8E224479F47CB76AULL, 0x9266CC8A1C85D9BEULL,
+@@ -115,7 +115,7 @@ static const uint64_t crc_table[256] = {
+ 	0x9AFCE626CE85B507ULL
+ };
+ 
+-inline uint64_t crc64(const void *_data, size_t len)
++uint64_t crc64(const void *_data, size_t len)
+ {
+ 	uint64_t crc = 0xFFFFFFFFFFFFFFFFULL;
+ 	const unsigned char *data = _data;
diff --git a/pkgs/tools/misc/pipelight/default.nix b/pkgs/tools/misc/pipelight/default.nix
index cb130c8e9178..89459eb281bc 100644
--- a/pkgs/tools/misc/pipelight/default.nix
+++ b/pkgs/tools/misc/pipelight/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, fetchgit, autoconf, automake, wineStaging, perl, xlibs
-  , gnupg, gcc48_multi, mesa, curl, bash, cacert, cabextract, utillinux, attr
+  , gnupg, gcc_multi, mesa, curl, bash, cacert, cabextract, utillinux, attr
   }:
 
 let
@@ -19,7 +19,7 @@ in stdenv.mkDerivation rec {
     sha256 = "1i440rf22fmd2w86dlm1mpi3nb7410rfczc0yldnhgsvp5p3sm5f";
   };
 
-  buildInputs = [ wine_custom xlibs.libX11 gcc48_multi mesa curl ];
+  buildInputs = [ wine_custom xlibs.libX11 gcc_multi mesa curl ];
   propagatedbuildInputs = [ curl cabextract ];
 
   patches = [ ./pipelight.patch ];
diff --git a/pkgs/tools/text/groff/default.nix b/pkgs/tools/text/groff/default.nix
index 90beca862c03..b0421a8ed0d4 100644
--- a/pkgs/tools/text/groff/default.nix
+++ b/pkgs/tools/text/groff/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "1998v2kcs288d3y7kfxpvl369nqi06zbbvjzafyvyl3pr7bajj1s";
   };
 
+  enableParallelBuilding = false;
+
   buildInputs = [ ghostscript ];
   nativeBuildInputs = [ perl ];
 
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 59090e1ced93..cf480f98520e 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -239,7 +239,7 @@ let
   # just the plain stdenv.
   stdenv_32bit = lowPrio (
     if system == "x86_64-linux" then
-      overrideCC stdenv gcc48_multi
+      overrideCC stdenv gcc_multi
     else
       stdenv);
 
@@ -1852,7 +1852,7 @@ let
 
   ised = callPackage ../tools/misc/ised {};
 
-  isl = callPackage ../development/libraries/isl { };
+  isl = isl_0_14;
   isl_0_11 = callPackage ../development/libraries/isl/0.11.1.nix { };
   isl_0_12 = callPackage ../development/libraries/isl/0.12.2.nix { };
   isl_0_14 = callPackage ../development/libraries/isl/0.14.1.nix { };
@@ -3582,8 +3582,20 @@ let
 
   gambit = callPackage ../development/compilers/gambit { };
 
-  gcc       = gcc48;
-  gcc_multi = gcc48_multi;
+  gcc = gcc49;
+
+  gcc_multi =
+    if system == "x86_64-linux" then lowPrio (
+      wrapCCWith (import ../build-support/cc-wrapper) glibc_multi (gcc.cc.override {
+        stdenv = overrideCC stdenv (wrapCCWith (import ../build-support/cc-wrapper) glibc_multi gcc.cc);
+        profiledCompiler = false;
+        enableMultilib = true;
+      }))
+    else throw "Multilib gcc not supported on ‘${system}’";
+
+  gcc_debug = lowPrio (wrapCC (gcc.cc.override {
+    stripped = false;
+  }));
 
   gccApple = throw "gccApple is no longer supported";
 
@@ -3714,24 +3726,6 @@ let
       else null;
   }));
 
-  gcc48_multi =
-    if system == "x86_64-linux" then lowPrio (
-      wrapCCWith (import ../build-support/cc-wrapper) glibc_multi (gcc48.cc.override {
-        stdenv = overrideCC stdenv (wrapCCWith (import ../build-support/cc-wrapper) glibc_multi gcc.cc);
-        profiledCompiler = false;
-        enableMultilib = true;
-      }))
-    else throw "Multilib gcc not supported on ‘${system}’";
-
-  gcc48_debug = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.8 {
-    stripped = false;
-
-    inherit noSysDirs;
-    cross = null;
-    libcCross = null;
-    binutilsCross = null;
-  }));
-
   gcc49 = lowPrio (wrapCC (callPackage ../development/compilers/gcc/4.9 {
     inherit noSysDirs;
 
@@ -4695,28 +4689,6 @@ let
       inherit stdenv gcc binutils libc shell name cross;
     });
 
-  /* Alternative GCC wrapper that uses the standard -I include flag instead of
-   * -isystem. The -isystem flag can change the search order specified by prior
-   * -I flags. For KDE 5 packages, we don't want to interfere with the include
-   * search path order specified by the build system. Some packages depend on
-   * Qt 4 and Qt 5 simultaneously; because the two Qt versions provide headers
-   * with the same filenames, we must respect the search order specified by the
-   * build system so that the Qt 4 components find the Qt 4 headers and the Qt 5
-   * components find the Qt 5 headers.
-   */
-  wrapGCCStdInc = glibc: baseGCC: (import ../build-support/cc-wrapper) {
-    nativeTools = stdenv.cc.nativeTools or false;
-    nativeLibc = stdenv.cc.nativeLibc or false;
-    nativePrefix = stdenv.cc.nativePrefix or "";
-    cc = baseGCC;
-    libc = glibc;
-    isGNU = true;
-    inherit stdenv binutils coreutils zlib;
-    setupHook = ../build-support/cc-wrapper/setup-hook-stdinc.sh;
-  };
-
-  gccStdInc = wrapGCCStdInc glibc gcc.cc;
-
   # prolog
   yap = callPackage ../development/compilers/yap { };
 
@@ -4880,6 +4852,11 @@ let
     fetchurl = fetchurlBoot;
   };
 
+  perl522 = callPackage ../development/interpreters/perl/5.22 {
+    fetchurl = fetchurlBoot;
+  };
+
+  # Make perl522 the default once gnulib is updated to support it.
   perl = perl520;
 
   php = php56;
@@ -7388,7 +7365,6 @@ let
     # makes it slower, but during runtime we link against just mesa_drivers
     # through /run/opengl-driver*, which is overriden according to config.grsecurity
     grsecEnabled = true;
-    libva = libva.override { mesa = null; };
     llvmPackages = llvmPackages_36;
   });
   mesa_glu =  mesaDarwinOr (callPackage ../development/libraries/mesa-glu { });
@@ -7882,9 +7858,9 @@ let
 
   SDL = callPackage ../development/libraries/SDL {
     openglSupport = mesaSupported;
-    alsaSupport = (!stdenv.isDarwin);
-    x11Support = true;
-    pulseaudioSupport = (!stdenv.isDarwin);
+    alsaSupport = stdenv.isLinux;
+    x11Support = !stdenv.isCygwin;
+    pulseaudioSupport = stdenv.isLinux;
   };
 
   SDL_gfx = callPackage ../development/libraries/SDL_gfx { };
@@ -7903,8 +7879,8 @@ let
 
   SDL2 = callPackage ../development/libraries/SDL2 {
     openglSupport = mesaSupported;
-    alsaSupport = (!stdenv.isDarwin);
-    x11Support = (!stdenv.isDarwin);
+    alsaSupport = stdenv.isLinux;
+    x11Support = !stdenv.isCygwin;
     pulseaudioSupport = false; # better go through ALSA
   };
 
@@ -11231,7 +11207,7 @@ let
   freepv = callPackage ../applications/graphics/freepv { };
 
   xfontsel = callPackage ../applications/misc/xfontsel { };
-  xlsfonts = callPackage ../applications/misc/xlsfonts { };
+  inherit (xorg) xlsfonts;
 
   freerdp = callPackage ../applications/networking/remote/freerdp {
     ffmpeg = ffmpeg_1;
@@ -11807,6 +11783,8 @@ let
 
   minidjvu = callPackage ../applications/graphics/minidjvu { };
 
+  minitube = callPackage ../applications/video/minitube { };
+
   mimms = callPackage ../applications/audio/mimms {};
 
   mirage = callPackage ../applications/graphics/mirage {};
@@ -13024,7 +13002,7 @@ let
 
   xchm = callPackage ../applications/misc/xchm { };
 
-  xcompmgr = callPackage ../applications/window-managers/xcompmgr { };
+  inherit (xorg) xcompmgr;
 
   compton = callPackage ../applications/window-managers/compton { };