about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--maintainers/scripts/nix-generate-from-cpan.nix4
-rwxr-xr-xmaintainers/scripts/nix-generate-from-cpan.pl2
-rw-r--r--pkgs/applications/audio/flac/default.nix4
-rw-r--r--pkgs/applications/graphics/ImageMagick/default.nix4
-rw-r--r--pkgs/applications/misc/cool-old-term/default.nix6
-rw-r--r--pkgs/applications/misc/monero/default.nix3
-rw-r--r--pkgs/applications/misc/slic3r/default.nix1
-rw-r--r--pkgs/applications/networking/browsers/mozilla-plugins/fribid/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/netsurf/libsvgtiny.nix2
-rw-r--r--pkgs/applications/networking/browsers/netsurf/libwapcaplet.nix2
-rw-r--r--pkgs/applications/networking/irc/weechat/devel.nix1
-rw-r--r--pkgs/applications/video/vlc/default.nix15
-rw-r--r--pkgs/build-support/setup-hooks/find-xml-catalogs.sh22
-rw-r--r--pkgs/build-support/setup-hooks/move-lib64.sh3
-rw-r--r--pkgs/data/sgml+xml/schemas/docbook-5.0/builder.sh17
-rw-r--r--pkgs/data/sgml+xml/schemas/docbook-5.0/default.nix28
-rw-r--r--pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl-ns/default.nix15
-rw-r--r--pkgs/desktops/kde-4.14/kdebindings/pykde4.nix4
-rw-r--r--pkgs/desktops/kde-4.14/kdelibs/kdelibs.nix4
-rw-r--r--pkgs/development/compilers/gcc/4.8/bug-61801.patch15
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix2
-rw-r--r--pkgs/development/compilers/go/1.1.nix2
-rw-r--r--pkgs/development/compilers/go/1.2.nix2
-rw-r--r--pkgs/development/compilers/go/default.nix2
-rw-r--r--pkgs/development/compilers/sdcc/default.nix2
-rw-r--r--pkgs/development/interpreters/perl/5.14/default.nix64
-rw-r--r--pkgs/development/interpreters/perl/5.14/ld-shared.patch11
-rw-r--r--pkgs/development/interpreters/perl/5.14/no-libutil.patch12
-rw-r--r--pkgs/development/interpreters/perl/5.14/no-sys-dirs.patch152
-rw-r--r--pkgs/development/interpreters/perl/5.14/setup-hook.sh5
-rw-r--r--pkgs/development/interpreters/perl/5.20/default.nix2
-rw-r--r--pkgs/development/interpreters/racket/default.nix1
-rw-r--r--pkgs/development/libraries/aterm/2.5.nix2
-rw-r--r--pkgs/development/libraries/cairo/default.nix8
-rw-r--r--pkgs/development/libraries/cairomm/default.nix6
-rw-r--r--pkgs/development/libraries/dbus/default.nix4
-rw-r--r--pkgs/development/libraries/fontconfig/default.nix10
-rw-r--r--pkgs/development/libraries/glibc/2.19/cve-2014-0475.patch170
-rw-r--r--pkgs/development/libraries/glibc/2.19/cve-2014-5119.patch206
-rw-r--r--pkgs/development/libraries/glibc/2.19/fix-math.patch336
-rw-r--r--pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch12
-rw-r--r--pkgs/development/libraries/glibc/builder.sh (renamed from pkgs/development/libraries/glibc/2.19/builder.sh)4
-rw-r--r--pkgs/development/libraries/glibc/common.nix (renamed from pkgs/development/libraries/glibc/2.19/common.nix)19
-rw-r--r--pkgs/development/libraries/glibc/default.nix (renamed from pkgs/development/libraries/glibc/2.19/default.nix)2
-rw-r--r--pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch (renamed from pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-cache.patch)0
-rw-r--r--pkgs/development/libraries/glibc/dont-use-system-ld-so-preload.patch (renamed from pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-preload.patch)10
-rw-r--r--pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch (renamed from pkgs/development/libraries/glibc/2.19/fix_path_attribute_in_getconf.patch)0
-rw-r--r--pkgs/development/libraries/glibc/glibc-crypt-blowfish.patch (renamed from pkgs/development/libraries/glibc/2.19/glibc-crypt-blowfish.patch)0
-rw-r--r--pkgs/development/libraries/glibc/glibc-remove-datetime-from-nscd.patch (renamed from pkgs/development/libraries/glibc/2.19/glibc-remove-datetime-from-nscd.patch)2
-rw-r--r--pkgs/development/libraries/glibc/info.nix (renamed from pkgs/development/libraries/glibc/2.19/info.nix)0
-rw-r--r--pkgs/development/libraries/glibc/locales-builder.sh (renamed from pkgs/development/libraries/glibc/2.19/locales-builder.sh)0
-rw-r--r--pkgs/development/libraries/glibc/locales.nix (renamed from pkgs/development/libraries/glibc/2.19/locales.nix)4
-rw-r--r--pkgs/development/libraries/glibc/multi.nix (renamed from pkgs/development/libraries/glibc/2.19/multi.nix)0
-rw-r--r--pkgs/development/libraries/glibc/nix-locale-archive.patch (renamed from pkgs/development/libraries/glibc/2.19/nix-locale-archive.patch)0
-rw-r--r--pkgs/development/libraries/glibc/rpcgen-path.patch (renamed from pkgs/development/libraries/glibc/2.19/rpcgen-path.patch)0
-rw-r--r--pkgs/development/libraries/glibmm/default.nix6
-rw-r--r--pkgs/development/libraries/gnutls/3.1.nix67
-rw-r--r--pkgs/development/libraries/gnutls/3.2.nix4
-rw-r--r--pkgs/development/libraries/gtkmm/3.x.nix7
-rw-r--r--pkgs/development/libraries/harfbuzz/default.nix4
-rw-r--r--pkgs/development/libraries/libevdev/default.nix4
-rw-r--r--pkgs/development/libraries/libxml2/default.nix6
-rw-r--r--pkgs/development/libraries/libxml2/setup-hook.sh19
-rw-r--r--pkgs/development/libraries/libxslt/default.nix9
-rw-r--r--pkgs/development/libraries/mesa/default.nix14
-rw-r--r--pkgs/development/libraries/phonon-backend-gstreamer/default.nix29
-rw-r--r--pkgs/development/libraries/phonon-backend-vlc/default.nix27
-rw-r--r--pkgs/development/libraries/phonon/default.nix20
-rw-r--r--pkgs/development/libraries/polkit-qt-1/default.nix20
-rw-r--r--pkgs/development/libraries/polkit-qt-1/polkit-install.patch12
-rw-r--r--pkgs/development/libraries/poppler/default.nix11
-rw-r--r--pkgs/development/libraries/qt-5/0001-dlopen-gtkstyle.patch (renamed from pkgs/development/libraries/qt-5/dlopen-gtkstyle.patch)39
-rw-r--r--pkgs/development/libraries/qt-5/0002-dlopen-webkit-nsplugin.patch53
-rw-r--r--pkgs/development/libraries/qt-5/0003-glib-2.32.patch25
-rw-r--r--pkgs/development/libraries/qt-5/0004-dlopen-resolv.patch39
-rw-r--r--pkgs/development/libraries/qt-5/0005-dlopen-gl.patch25
-rw-r--r--pkgs/development/libraries/qt-5/0006-tzdir.patch52
-rw-r--r--pkgs/development/libraries/qt-5/0007-dlopen-webkit-gtk.patch25
-rw-r--r--pkgs/development/libraries/qt-5/0008-dlopen-webkit-udev.patch31
-rw-r--r--pkgs/development/libraries/qt-5/0009-dlopen-serialport-udev.patch28
-rw-r--r--pkgs/development/libraries/qt-5/0010-dlopen-libXcursor.patch29
-rw-r--r--pkgs/development/libraries/qt-5/0011-dlopen-openssl.patch38
-rw-r--r--pkgs/development/libraries/qt-5/0012-dlopen-dbus.patch25
-rw-r--r--pkgs/development/libraries/qt-5/default.nix52
-rw-r--r--pkgs/development/libraries/qt-5/dlopen-webkit-nsplugin.patch36
-rw-r--r--pkgs/development/libraries/qt-5/glib-2.32.patch12
-rw-r--r--pkgs/development/libraries/qt-5/qt-5.2-dlopen-absolute-paths.patch36
-rw-r--r--pkgs/development/libraries/qt-5/qt-5.3-dlopen-absolute-paths.patch24
-rw-r--r--pkgs/development/libraries/qt-5/qt-5.3.nix165
-rw-r--r--pkgs/development/libraries/stlport/default.nix1
-rw-r--r--pkgs/development/tools/misc/tcptrack/default.nix2
-rw-r--r--pkgs/os-specific/linux/busybox/busybox-in-store.patch16
-rw-r--r--pkgs/os-specific/linux/busybox/default.nix53
-rw-r--r--pkgs/os-specific/linux/busybox/include-missing-sys-resource-header.patch12
-rw-r--r--pkgs/os-specific/linux/disk-indicator/default.nix2
-rw-r--r--pkgs/os-specific/linux/e3cfsprogs/default.nix12
-rw-r--r--pkgs/os-specific/linux/kernel-headers/3.12.nix (renamed from pkgs/os-specific/linux/kernel-headers/3.7.nix)6
-rw-r--r--pkgs/os-specific/linux/kernel/perf.nix2
-rw-r--r--pkgs/os-specific/linux/module-init-tools/default.nix4
-rw-r--r--pkgs/os-specific/linux/uclibc/default.nix16
-rw-r--r--pkgs/servers/monitoring/seyren/default.nix2
-rw-r--r--pkgs/servers/restund/default.nix1
-rw-r--r--pkgs/servers/sip/freeswitch/default.nix2
-rw-r--r--pkgs/servers/sql/mariadb/default.nix2
-rw-r--r--pkgs/servers/x11/xorg/default.nix24
-rw-r--r--pkgs/servers/x11/xorg/overrides.nix11
-rw-r--r--pkgs/servers/x11/xorg/tarballs-7.7.list10
-rw-r--r--pkgs/shells/bash/bash-4.2-patches.nix57
-rw-r--r--pkgs/shells/bash/bash-4.3-patches.nix34
-rw-r--r--pkgs/shells/bash/default.nix8
-rw-r--r--pkgs/stdenv/adapters.nix57
-rw-r--r--pkgs/stdenv/generic/setup.sh5
-rw-r--r--pkgs/stdenv/linux/bootstrap/i686.nix41
-rw-r--r--pkgs/stdenv/linux/bootstrap/x86_64.nix9
-rw-r--r--pkgs/stdenv/linux/default.nix11
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools.nix169
-rw-r--r--pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh55
-rw-r--r--pkgs/tools/compression/bzip2/default.nix2
-rw-r--r--pkgs/tools/filesystems/squashfs/default.nix2
-rw-r--r--pkgs/tools/misc/grub/2.0x.nix2
-rw-r--r--pkgs/tools/misc/grub/glibc-2.20.patch29
-rw-r--r--pkgs/tools/networking/curl/7.15.nix7
-rw-r--r--pkgs/tools/networking/curl/default.nix22
-rw-r--r--pkgs/tools/networking/inadyn/default.nix2
-rw-r--r--pkgs/tools/networking/openssh/default.nix1
-rw-r--r--pkgs/tools/security/polkit-kde-agent/default.nix4
-rw-r--r--pkgs/tools/system/collectd/default.nix4
-rw-r--r--pkgs/top-level/all-packages.nix102
-rw-r--r--pkgs/top-level/perl-packages.nix209
129 files changed, 1170 insertions, 2039 deletions
diff --git a/maintainers/scripts/nix-generate-from-cpan.nix b/maintainers/scripts/nix-generate-from-cpan.nix
index fffe11f1a5fc..056cd994ba22 100644
--- a/maintainers/scripts/nix-generate-from-cpan.nix
+++ b/maintainers/scripts/nix-generate-from-cpan.nix
@@ -3,7 +3,7 @@
 stdenv.mkDerivation {
   name = "nix-generate-from-cpan-1";
 
-  buildInputs = [ makeWrapper perl perlPackages.YAMLLibYAML perlPackages.JSON ];
+  buildInputs = [ makeWrapper perl perlPackages.YAMLLibYAML perlPackages.JSON perlPackages.CPANPLUS ];
 
   unpackPhase = "true";
   buildPhase = "true";
@@ -19,4 +19,4 @@ stdenv.mkDerivation {
     maintainers = [ stdenv.lib.maintainers.eelco ];
     description = "Utility to generate a Nix expression for a Perl package from CPAN";
   };
-}
\ No newline at end of file
+}
diff --git a/maintainers/scripts/nix-generate-from-cpan.pl b/maintainers/scripts/nix-generate-from-cpan.pl
index 1d9f926ec556..56709ca8000b 100755
--- a/maintainers/scripts/nix-generate-from-cpan.pl
+++ b/maintainers/scripts/nix-generate-from-cpan.pl
@@ -100,7 +100,7 @@ sub get_deps {
     foreach my $n (keys %{$deps}) {
         next if $n eq "perl";
         # Hacky way to figure out if this module is part of Perl.
-        if ($n !~ /^JSON/ && $n !~ /^YAML/) {
+        if ($n !~ /^JSON/ && $n !~ /^YAML/ && $n !~ /^Module::Pluggable/) {
             eval "use $n;";
             if (!$@) {
                 print STDERR "skipping Perl-builtin module $n\n";
diff --git a/pkgs/applications/audio/flac/default.nix b/pkgs/applications/audio/flac/default.nix
index cb3ec1da97cf..5dd706735216 100644
--- a/pkgs/applications/audio/flac/default.nix
+++ b/pkgs/applications/audio/flac/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, libogg }:
 
 stdenv.mkDerivation rec {
-  name = "flac-1.3.0";
+  name = "flac-1.3.1";
 
   src = fetchurl {
     url = "http://downloads.xiph.org/releases/flac/${name}.tar.xz";
-    sha256 = "1p0hh190kqvpkbk1bbajd81jfbmkyl4fn2i7pggk2zppq6m68bgs";
+    sha256 = "4773c0099dba767d963fd92143263be338c48702172e8754b9bc5103efe1c56c";
   };
 
   buildInputs = [ libogg ];
diff --git a/pkgs/applications/graphics/ImageMagick/default.nix b/pkgs/applications/graphics/ImageMagick/default.nix
index 69bc2006666c..8ae4bc2dd1b1 100644
--- a/pkgs/applications/graphics/ImageMagick/default.nix
+++ b/pkgs/applications/graphics/ImageMagick/default.nix
@@ -20,7 +20,7 @@
 
 let
 
-  version = "6.8.9-8";
+  version = "6.9.0-0";
 
   arch =
     if stdenv.system == "i686-linux" then "i686"
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://imagemagick/releases/${name}.tar.xz";
-    sha256 = "1c792hbwi308lm9xkml319xaa4w3bz6hwy6i92jwrm7kqr4h8di7";
+    sha256 = "1dmrl5x63msdnxsf4cmhz5v4ard2z3jrgp2zhqlb27399j81qcqj";
   };
 
   enableParallelBuilding = true;
diff --git a/pkgs/applications/misc/cool-old-term/default.nix b/pkgs/applications/misc/cool-old-term/default.nix
index 76d78f004024..c56393a1be83 100644
--- a/pkgs/applications/misc/cool-old-term/default.nix
+++ b/pkgs/applications/misc/cool-old-term/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qt53 }:
+{ stdenv, fetchFromGitHub, qt5 }:
 
 stdenv.mkDerivation rec {
   version = "0.9";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "8462f3eded7b2219acc143258544b0dfac32d81e10cac61ff14276d426704c93";
   };
 
-  buildInputs = [ qt53 ];
+  buildInputs = [ qt5 ];
 
   buildPhase = ''
     pushd ./konsole-qml-plugin
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
 
     cat > $out/bin/cool-old-term <<EOF
     #!${stdenv.shell}
-    ${qt53}/bin/qmlscene -I $out/lib/cool-old-term/imports $out/share/cool-old-term/app/main.qml
+    ${qt5}/bin/qmlscene -I $out/lib/cool-old-term/imports $out/share/cool-old-term/app/main.qml
     EOF
     chmod a+x $out/bin/cool-old-term
   '';
diff --git a/pkgs/applications/misc/monero/default.nix b/pkgs/applications/misc/monero/default.nix
index 1fe5406384f8..6af9b7dc267d 100644
--- a/pkgs/applications/misc/monero/default.nix
+++ b/pkgs/applications/misc/monero/default.nix
@@ -16,6 +16,9 @@ stdenv.mkDerivation {
   # these tests take a long time and don't
   # always complete in the build environment
   postPatch = "sed -i '/add_subdirectory(tests)/d' CMakeLists.txt";
+
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   doCheck = false;
   checkTarget = "test-release"; # this would be the target
 
diff --git a/pkgs/applications/misc/slic3r/default.nix b/pkgs/applications/misc/slic3r/default.nix
index a057197a92de..727bb0486053 100644
--- a/pkgs/applications/misc/slic3r/default.nix
+++ b/pkgs/applications/misc/slic3r/default.nix
@@ -69,5 +69,6 @@ stdenv.mkDerivation rec {
     license = licenses.agpl3;
     platforms = platforms.linux;
     maintainers = with maintainers; [ bjornfor the-kenny ];
+    broken = true; # requires Perl 5.14
   };
 }
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/fribid/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/fribid/default.nix
index 229aa4f23ba1..3b473019600f 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/fribid/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/fribid/default.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
     ./ipc-lazytrace.patch
     ];
 
+  postPatch = "substituteInPlace plugin/pluginutil.c --replace strndup strndup_";
+
   passthru.mozillaPlugin = "/lib/mozilla/plugins";
 
   meta = {
diff --git a/pkgs/applications/networking/browsers/netsurf/libsvgtiny.nix b/pkgs/applications/networking/browsers/netsurf/libsvgtiny.nix
index 300e9965092d..1e9f74a1ffd4 100644
--- a/pkgs/applications/networking/browsers/netsurf/libsvgtiny.nix
+++ b/pkgs/applications/networking/browsers/netsurf/libsvgtiny.nix
@@ -7,6 +7,8 @@ stdenv.mkDerivation {
                (fetchurl { url = "http://mawercer.de/~nix/repos/libsvgtiny-9721.tar.gz"; sha256 = "0c4c8e357c220218a32ef789eb2ba8226a403d4c2b550d7c65f351a0af5d1a71"; });
   # END
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   installPhase = "make PREFIX=$out install";
   buildInputs = [pkgconfig gperf libxml2];
 
diff --git a/pkgs/applications/networking/browsers/netsurf/libwapcaplet.nix b/pkgs/applications/networking/browsers/netsurf/libwapcaplet.nix
index 8d19d1c1ef24..5aa15d7b80d0 100644
--- a/pkgs/applications/networking/browsers/netsurf/libwapcaplet.nix
+++ b/pkgs/applications/networking/browsers/netsurf/libwapcaplet.nix
@@ -7,6 +7,8 @@ stdenv.mkDerivation {
                (fetchurl { url = "http://mawercer.de/~nix/repos/libwapcaplet-9721.tar.gz"; sha256 = "7f9f32ca772c939d67f3bc8bf0705544c2b2950760da3fe6a4e069ad0f77d91a"; });
   # END
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   installPhase = "make PREFIX=$out install";
   buildInputs = [];
 
diff --git a/pkgs/applications/networking/irc/weechat/devel.nix b/pkgs/applications/networking/irc/weechat/devel.nix
index 34ca4b4d7c6e..a2f32e2b3d3c 100644
--- a/pkgs/applications/networking/irc/weechat/devel.nix
+++ b/pkgs/applications/networking/irc/weechat/devel.nix
@@ -37,5 +37,6 @@ stdenv.mkDerivation rec {
     license     = stdenv.lib.licenses.gpl3;
     maintainers = with stdenv.lib.maintainers; [ lovek323 garbas the-kenny ];
     platforms   = stdenv.lib.platforms.unix;
+    broken      = true; # we have a newer stable that builds
   };
 }
diff --git a/pkgs/applications/video/vlc/default.nix b/pkgs/applications/video/vlc/default.nix
index 71db3d40a46f..f1d3cf836adb 100644
--- a/pkgs/applications/video/vlc/default.nix
+++ b/pkgs/applications/video/vlc/default.nix
@@ -1,14 +1,20 @@
 { stdenv, fetchurl, xz, bzip2, perl, xlibs, libdvdnav, libbluray
 , zlib, a52dec, libmad, faad2, ffmpeg, alsaLib
-, pkgconfig, dbus, fribidi, qt4, freefont_ttf, libebml, libmatroska
+, pkgconfig, dbus, fribidi, freefont_ttf, libebml, libmatroska
 , libvorbis, libtheora, speex, lua5, libgcrypt, libupnp
 , libcaca, pulseaudio, flac, schroedinger, libxml2, librsvg
 , mpeg2dec, udev, gnutls, avahi, libcddb, jack2, SDL, SDL_image
 , libmtp, unzip, taglib, libkate, libtiger, libv4l, samba, liboggz
 , libass, libva, libdvbpsi, libdc1394, libraw1394, libopus
 , libvdpau
+, onlyLibVLC ? false
+, qt4 ? null, qt5 ? null, withQt5 ? false
 }:
 
+with stdenv.lib;
+
+assert (withQt5 -> qt5 != null); assert (!withQt5 -> qt4 != null);
+
 stdenv.mkDerivation rec {
   name = "vlc-${version}";
   version = "2.1.5";
@@ -20,13 +26,13 @@ stdenv.mkDerivation rec {
 
   buildInputs =
     [ xz bzip2 perl zlib a52dec libmad faad2 ffmpeg alsaLib libdvdnav libdvdnav.libdvdread
-      libbluray dbus fribidi qt4 libvorbis libtheora speex lua5 libgcrypt
+      libbluray dbus fribidi libvorbis libtheora speex lua5 libgcrypt
       libupnp libcaca pulseaudio flac schroedinger libxml2 librsvg mpeg2dec
       udev gnutls avahi libcddb jack2 SDL SDL_image libmtp unzip taglib
       libkate libtiger libv4l samba liboggz libass libdvbpsi libva
       xlibs.xlibs xlibs.libXv xlibs.libXvMC xlibs.libXpm xlibs.xcbutilkeysyms
       libdc1394 libraw1394 libopus libebml libmatroska libvdpau
-    ];
+    ] ++ [(if withQt5 then qt5 else qt4)];
 
   nativeBuildInputs = [ pkgconfig ];
 
@@ -36,7 +42,8 @@ stdenv.mkDerivation rec {
       "--enable-dc1394"
       "--enable-ncurses"
       "--enable-vdpau"
-    ];
+    ]
+    ++ optional onlyLibVLC  "--disable-vlc";
 
   preConfigure = ''sed -e "s@/bin/echo@echo@g" -i configure'';
 
diff --git a/pkgs/build-support/setup-hooks/find-xml-catalogs.sh b/pkgs/build-support/setup-hooks/find-xml-catalogs.sh
new file mode 100644
index 000000000000..b742d5a8ffd9
--- /dev/null
+++ b/pkgs/build-support/setup-hooks/find-xml-catalogs.sh
@@ -0,0 +1,22 @@
+addXMLCatalogs () {
+    local d i
+    # ‘xml/dtd’ and ‘xml/xsl’ are deprecated. Catalogs should be
+    # installed underneath ‘share/xml’.
+    for d in $1/share/xml $1/xml/dtd $1/xml/xsl; do
+        if [ -d $d ]; then
+            for i in $(find $d -name catalog.xml); do
+                XML_CATALOG_FILES+=" $i"
+            done
+        fi
+    done
+}
+
+if [ -z "$libxmlHookDone" ]; then
+    libxmlHookDone=1
+
+    # Set up XML_CATALOG_FILES.  An empty initial value prevents
+    # xmllint and xsltproc from looking in /etc/xml/catalog.
+    export XML_CATALOG_FILES
+    if [ -z "$XML_CATALOG_FILES" ]; then XML_CATALOG_FILES=" "; fi
+    envHooks+=(addXMLCatalogs)
+fi
diff --git a/pkgs/build-support/setup-hooks/move-lib64.sh b/pkgs/build-support/setup-hooks/move-lib64.sh
index 46c90fcea6bd..7724be369c9c 100644
--- a/pkgs/build-support/setup-hooks/move-lib64.sh
+++ b/pkgs/build-support/setup-hooks/move-lib64.sh
@@ -3,6 +3,7 @@
 # $output/lib. The rationale is that lib64 directories are unnecessary
 # in Nix (since 32-bit and 64-bit builds of a package are in different
 # store paths anyway).
+# If the move would overwrite anything, it should fail on rmdir.
 
 fixupOutputHooks+=(_moveLib64)
 
@@ -13,7 +14,7 @@ _moveLib64() {
     mkdir -p $prefix/lib
     shopt -s dotglob
     for i in $prefix/lib64/*; do
-        mv "$i" $prefix/lib
+        mv --no-clobber "$i" $prefix/lib
     done
     shopt -u dotglob
     rmdir $prefix/lib64
diff --git a/pkgs/data/sgml+xml/schemas/docbook-5.0/builder.sh b/pkgs/data/sgml+xml/schemas/docbook-5.0/builder.sh
deleted file mode 100644
index 96ad77eaa57c..000000000000
--- a/pkgs/data/sgml+xml/schemas/docbook-5.0/builder.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-source $stdenv/setup
-
-unpackFile $src
-
-cd docbook-*
-
-mkdir -p $out/xml/rng
-cp -prv rng $out/xml/rng/docbook
-
-mkdir -p $out/xml/dtd
-cp -prv dtd $out/xml/dtd/docbook
-
-mkdir -p $out/share/doc
-cp -prv docs $out/share/doc/docbook
-
-mkdir -p $out/share/docbook
-cp -prv tools $out/share/docbook/
diff --git a/pkgs/data/sgml+xml/schemas/docbook-5.0/default.nix b/pkgs/data/sgml+xml/schemas/docbook-5.0/default.nix
index 1e0103a93059..a9d09945d7ff 100644
--- a/pkgs/data/sgml+xml/schemas/docbook-5.0/default.nix
+++ b/pkgs/data/sgml+xml/schemas/docbook-5.0/default.nix
@@ -1,13 +1,35 @@
-{stdenv, fetchurl, unzip}:
+{ lib, stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation {
   name = "docbook5-5.0";
-  builder = ./builder.sh;
 
   src = fetchurl {
     url = http://www.docbook.org/xml/5.0/docbook-5.0.zip;
     sha256 = "13i04dkd709f0p5f2413sf2y9321pfi4y85ynf8wih6ryphnbk9x";
   };
 
-  buildInputs = [unzip];
+  buildInputs = [ unzip ];
+
+  installPhase =
+    ''
+      dst=$out/share/xml/docbook-5.0
+      mkdir -p $dst
+      cp -prv * $dst/
+
+      substituteInPlace $dst/catalog.xml --replace 'uri="' "uri=\"$dst/"
+
+      rm -rf $dst/docs $dst/ChangeLog
+
+      # Backwards compatibility. Will remove eventually.
+      mkdir -p $out/xml/rng $out/xml/dtd
+      ln -s $dst/rng $out/xml/rng/docbook
+      ln -s $dst/dtd $out/xml/dtd/docbook
+    '';
+
+  meta = {
+    description = "Schemas for DocBook 5.0, a semantic markup language for technical documentation";
+    homepage = http://docbook.org/xml/5.0/;
+    maintainers = [ lib.maintainers.eelco ];
+    platforms = lib.platforms.all;
+  };
 }
diff --git a/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl-ns/default.nix b/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl-ns/default.nix
index bfe454a49fe1..36d2cc48c9f0 100644
--- a/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl-ns/default.nix
+++ b/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl-ns/default.nix
@@ -1,8 +1,8 @@
-{stdenv, fetchurl}:
+{ lib, stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "docbook-xsl-ns-1.78.1";
-  
+
   src = fetchurl {
     url = "mirror://sourceforge/docbook/${name}.tar.bz2";
     sha256 = "1x3sc0axk9z3i6n0jhlsmzlmb723a4sjgslm9g12by6phirdx3ng";
@@ -12,13 +12,20 @@ stdenv.mkDerivation rec {
 
   installPhase =
     ''
+      dst=$out/share/xml/docbook-xsl-ns
+      mkdir -p $dst
+      rm -rf RELEASE* README* INSTALL TODO NEWS* BUGS install.sh svn* tools log Makefile tests extensions webhelp
+      mv * $dst/
+
+      # Backwards compatibility. Will remove eventually.
       mkdir -p $out/xml/xsl
-      cd ..
-      mv docbook-xsl-ns-* $out/xml/xsl/docbook
+      ln -s $dst $out/xml/xsl/docbook
     '';
 
   meta = {
     homepage = http://wiki.docbook.org/topic/DocBookXslStylesheets;
     description = "XSL stylesheets for transforming DocBook documents into HTML and various other formats";
+    maintainers = [ lib.maintainers.eelco ];
+    platforms = lib.platforms.all;
   };
 }
diff --git a/pkgs/desktops/kde-4.14/kdebindings/pykde4.nix b/pkgs/desktops/kde-4.14/kdebindings/pykde4.nix
index 64e196452e31..f86412147d3b 100644
--- a/pkgs/desktops/kde-4.14/kdebindings/pykde4.nix
+++ b/pkgs/desktops/kde-4.14/kdebindings/pykde4.nix
@@ -1,5 +1,5 @@
 { kde, kdelibs, python, sip, pyqt4, kdepimlibs, shared_desktop_ontologies,
-  polkit_qt_1, boost, lndir, pkgconfig }:
+  polkit_qt4, boost, lndir, pkgconfig }:
 
 let pydir = "lib/python${python.majorVersion}"; in
 
@@ -9,7 +9,7 @@ kde {
 
   buildInputs = [
     python kdepimlibs shared_desktop_ontologies
-    boost polkit_qt_1
+    boost polkit_qt4
   ];
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/desktops/kde-4.14/kdelibs/kdelibs.nix b/pkgs/desktops/kde-4.14/kdelibs/kdelibs.nix
index 4207dfd56544..52e0ebf2062d 100644
--- a/pkgs/desktops/kde-4.14/kdelibs/kdelibs.nix
+++ b/pkgs/desktops/kde-4.14/kdelibs/kdelibs.nix
@@ -2,7 +2,7 @@
 , qt4, bzip2, fam, shared_mime_info, giflib, jasper, strigi
 , openexr, avahi, kerberos, shared_desktop_ontologies, libXScrnSaver
 , automoc4, soprano, qca2, attica, enchant, libdbusmenu_qt, grantlee
-, docbook_xml_dtd_42, docbook_xsl, polkit_qt_1, acl, attr, libXtst
+, docbook_xml_dtd_42, docbook_xsl, polkit_qt4, acl, attr, libXtst
 , udev, herqq, phonon, libjpeg, xz, ilmbase, libxslt
 , pkgconfig
 }:
@@ -13,7 +13,7 @@ kde {
 
   buildInputs =
     [ pkgconfig attica avahi bzip2 enchant fam giflib grantlee herqq
-      libdbusmenu_qt libXScrnSaver polkit_qt_1 qca2 acl jasper libxslt
+      libdbusmenu_qt libXScrnSaver polkit_qt4 qca2 acl jasper libxslt
       shared_desktop_ontologies xz udev libjpeg kerberos openexr
       libXtst attr
     ];
diff --git a/pkgs/development/compilers/gcc/4.8/bug-61801.patch b/pkgs/development/compilers/gcc/4.8/bug-61801.patch
new file mode 100644
index 000000000000..3d87e007813b
--- /dev/null
+++ b/pkgs/development/compilers/gcc/4.8/bug-61801.patch
@@ -0,0 +1,15 @@
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=212740
+
+--- a/gcc/sched-deps.c	2014/07/17 07:48:49	212739
++++ b/gcc/sched-deps.c	2014/07/17 07:49:44	212740
+@@ -2744,7 +2744,8 @@
+ 	   Consider for instance a volatile asm that changes the fpu rounding
+ 	   mode.  An insn should not be moved across this even if it only uses
+ 	   pseudo-regs because it might give an incorrectly rounded result.  */
+-	if (code != ASM_OPERANDS || MEM_VOLATILE_P (x))
++	if ((code != ASM_OPERANDS || MEM_VOLATILE_P (x))
++	    && !DEBUG_INSN_P (insn))
+ 	  reg_pending_barrier = TRUE_BARRIER;
+ 
+ 	/* For all ASM_OPERANDS, we must traverse the vector of input operands.
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index c240acb5e897..6547d9b12b6c 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -61,7 +61,7 @@ let version = "4.8.3";
 
     enableParallelBuilding = true;
 
-    patches = []
+    patches = [ ./bug-61801.patch ]
       ++ optional enableParallelBuilding ./parallel-bconfig.patch
       ++ optional (cross != null) ./libstdc++-target.patch
       ++ optional noSysDirs ./no-sys-dirs.patch
diff --git a/pkgs/development/compilers/go/1.1.nix b/pkgs/development/compilers/go/1.1.nix
index 14ea73c23840..11640f2393d2 100644
--- a/pkgs/development/compilers/go/1.1.nix
+++ b/pkgs/development/compilers/go/1.1.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation {
 
   buildInputs = [ bison glibc bash makeWrapper ];
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   # I'm not sure what go wants from its 'src', but the go installation manual
   # describes an installation keeping the src.
   preUnpack = ''
diff --git a/pkgs/development/compilers/go/1.2.nix b/pkgs/development/compilers/go/1.2.nix
index 9f95ad59b77c..a00fe7346701 100644
--- a/pkgs/development/compilers/go/1.2.nix
+++ b/pkgs/development/compilers/go/1.2.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation {
 
   buildInputs = [ bison glibc bash makeWrapper ];
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   # I'm not sure what go wants from its 'src', but the go installation manual
   # describes an installation keeping the src.
   preUnpack = ''
diff --git a/pkgs/development/compilers/go/default.nix b/pkgs/development/compilers/go/default.nix
index e289ce14ee11..b35159c10e79 100644
--- a/pkgs/development/compilers/go/default.nix
+++ b/pkgs/development/compilers/go/default.nix
@@ -60,6 +60,8 @@ stdenv.mkDerivation {
           else throw "Unsupported system";
   GOARM = stdenv.lib.optionalString (stdenv.system == "armv5tel-linux") "5";
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   installPhase = ''
     mkdir -p "$out/bin"
     export GOROOT="$(pwd)/"
diff --git a/pkgs/development/compilers/sdcc/default.nix b/pkgs/development/compilers/sdcc/default.nix
index fe293fbc4b8d..0650fae917a6 100644
--- a/pkgs/development/compilers/sdcc/default.nix
+++ b/pkgs/development/compilers/sdcc/default.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
     ${if gputils == null then "--disable-pic14-port --disable-pic16-port" else ""}
   '';
 
+  NIX_CFLAGS_COMPILE = "--std=c99"; # http://sourceforge.net/p/sdcc/code/9106/
+
   meta = with stdenv.lib; {
     description = "Small Device C Compiler";
     longDescription = ''
diff --git a/pkgs/development/interpreters/perl/5.14/default.nix b/pkgs/development/interpreters/perl/5.14/default.nix
deleted file mode 100644
index dd4e7acf71f3..000000000000
--- a/pkgs/development/interpreters/perl/5.14/default.nix
+++ /dev/null
@@ -1,64 +0,0 @@
-{ stdenv, fetchurl }:
-
-let 
-  
-  libc = if stdenv ? gcc && stdenv.gcc.libc != null then stdenv.gcc.libc else "/usr";
-
-in
-
-stdenv.mkDerivation rec {
-  name = "perl-5.14.4";
-
-  src = fetchurl {
-    url = "mirror://cpan/src/${name}.tar.gz";
-    sha256 = "1js47zzna3v38fjnirf2vq6y0rjp8m86ysj5vagzgkig956d8gw0";
-  };
-
-  patches = 
-    [ # Do not look in /usr etc. for dependencies.
-      ./no-sys-dirs.patch
-    ]
-    ++ stdenv.lib.optional stdenv.isSunOS  ./ld-shared.patch
-    ++ stdenv.lib.optional stdenv.isDarwin ./no-libutil.patch;
-
-  # Build a thread-safe Perl with a dynamic libperls.o.  We need the
-  # "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=gcc"
-      "-Uinstallusrbinperl"
-      "-Dinstallstyle=lib/perl5"
-      "-Duseshrplib"
-      "-Dlocincpth=${libc}/include"
-      "-Dloclibpth=${libc}/lib"
-    ] 
-    ++ stdenv.lib.optional (stdenv ? glibc) "-Dusethreads";
-
-  configureScript = "${stdenv.shell} ./Configure";
-
-  dontAddPrefix = true;
-
-  enableParallelBuilding = true;
-
-  preConfigure =
-    ''
-      configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
-
-      ${stdenv.lib.optionalString stdenv.isArm ''
-        configureFlagsArray=(-Dldflags="-lm -lrt")
-      ''}
-    '';
-
-  preBuild = stdenv.lib.optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
-    ''
-      # Make Cwd work on NixOS (where we don't have a /bin/pwd).
-      substituteInPlace dist/Cwd/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
-    '';
-
-  setupHook = ./setup-hook.sh;
-
-  passthru.libPrefix = "lib/perl5/site_perl";
-}
diff --git a/pkgs/development/interpreters/perl/5.14/ld-shared.patch b/pkgs/development/interpreters/perl/5.14/ld-shared.patch
deleted file mode 100644
index b1834ff7a1f2..000000000000
--- a/pkgs/development/interpreters/perl/5.14/ld-shared.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- perl-5.14.2/hints/solaris_2.sh.orig	2013-02-14 19:29:49.453988140 +0000
-+++ perl-5.14.2/hints/solaris_2.sh	2013-02-14 19:30:31.681631019 +0000
-@@ -568,7 +568,7 @@
- #		    ccflags="$ccflags -Wa,`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
- #		fi
- 		ldflags="$ldflags -m64"
--		lddlflags="$lddlflags -G -m64"
-+		lddlflags="$lddlflags -shared -m64"
- 		;;
- 	    *)
- 		getconfccflags="`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
diff --git a/pkgs/development/interpreters/perl/5.14/no-libutil.patch b/pkgs/development/interpreters/perl/5.14/no-libutil.patch
deleted file mode 100644
index 9b749bccf32c..000000000000
--- a/pkgs/development/interpreters/perl/5.14/no-libutil.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-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="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
--libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
-+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.14/no-sys-dirs.patch b/pkgs/development/interpreters/perl/5.14/no-sys-dirs.patch
deleted file mode 100644
index 54ffb28e2065..000000000000
--- a/pkgs/development/interpreters/perl/5.14/no-sys-dirs.patch
+++ /dev/null
@@ -1,152 +0,0 @@
-diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
---- perl-5.14.2-orig/Configure	2011-09-26 11:44:34.000000000 +0200
-+++ perl-5.14.2/Configure	2012-01-20 17:05:23.089223129 +0100
-@@ -106,15 +106,7 @@
- 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
-@@ -1311,8 +1303,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=''
-@@ -1328,17 +1319,12 @@
- archobjs=''
- 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
-@@ -1371,8 +1357,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
- 
-@@ -2380,7 +2364,6 @@
- zip
- "
- pth=`echo $PATH | sed -e "s/$p_/ /g"`
--pth="$pth /lib /usr/lib"
- for file in $loclist; do
- 	eval xxx=\$$file
- 	case "$xxx" in
-@@ -4785,7 +4768,7 @@
- : Set private lib path
- case "$plibpth" in
- '') if ./mips; then
--		plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
-+		plibpth="$incpath/usr/lib"
- 	fi;;
- esac
- case "$libpth" in
-@@ -8390,13 +8373,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
-@@ -19721,9 +19699,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 " "
-diff -ru -x '*~' perl-5.14.2-orig/ext/Errno/Errno_pm.PL perl-5.14.2/ext/Errno/Errno_pm.PL
---- perl-5.14.2-orig/ext/Errno/Errno_pm.PL	2011-09-26 11:44:34.000000000 +0200
-+++ perl-5.14.2/ext/Errno/Errno_pm.PL	2012-01-20 17:02:07.938138311 +0100
-@@ -137,11 +137,7 @@
- 	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) {
- 	# Some Linuxes have weird errno.hs which generate
- 	# no #file or #line directives
- 	my $linux_errno_h = -e '/usr/include/errno.h' ?
-diff -ru -x '*~' perl-5.14.2-orig/hints/freebsd.sh perl-5.14.2/hints/freebsd.sh
---- perl-5.14.2-orig/hints/freebsd.sh	2011-09-19 15:18:22.000000000 +0200
-+++ perl-5.14.2/hints/freebsd.sh	2012-01-20 17:10:37.267924044 +0100
-@@ -118,21 +118,21 @@
-         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 --git a/pkgs/development/interpreters/perl/5.14/setup-hook.sh b/pkgs/development/interpreters/perl/5.14/setup-hook.sh
deleted file mode 100644
index a8656b8531db..000000000000
--- a/pkgs/development/interpreters/perl/5.14/setup-hook.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-addPerlLibPath () {
-    addToSearchPath PERL5LIB $1/lib/perl5/site_perl
-}
-
-envHooks+=(addPerlLibPath)
diff --git a/pkgs/development/interpreters/perl/5.20/default.nix b/pkgs/development/interpreters/perl/5.20/default.nix
index 66a9ca597a40..bfd2c26bf70a 100644
--- a/pkgs/development/interpreters/perl/5.20/default.nix
+++ b/pkgs/development/interpreters/perl/5.20/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, enableThreading ? true }:
+{ stdenv, fetchurl, enableThreading ? stdenv ? glibc }:
 
 # We can only compile perl with threading on platforms where we have a
 # real glibc in the stdenv.
diff --git a/pkgs/development/interpreters/racket/default.nix b/pkgs/development/interpreters/racket/default.nix
index b626c8a1539c..af6cf4b19563 100644
--- a/pkgs/development/interpreters/racket/default.nix
+++ b/pkgs/development/interpreters/racket/default.nix
@@ -48,6 +48,7 @@ stdenv.mkDerivation rec {
   configureFlags = [ "--enable-shared" "--enable-lt=${libtool}/bin/libtool" ];
 
   NIX_LDFLAGS = "-lgcc_s";
+  enableParallelBuilding = true;
 
   postInstall = ''
     for p in $(ls $out/bin/) ; do
diff --git a/pkgs/development/libraries/aterm/2.5.nix b/pkgs/development/libraries/aterm/2.5.nix
index 10a22e00f650..ef53a76d20ba 100644
--- a/pkgs/development/libraries/aterm/2.5.nix
+++ b/pkgs/development/libraries/aterm/2.5.nix
@@ -21,6 +21,8 @@ stdenv.mkDerivation {
 
   dontDisableStatic = true;
 
+  NIX_CFLAGS_COMPILE = "-D__USE_BSD";
+
   meta = {
     homepage = http://www.cwi.nl/htbin/sen1/twiki/bin/view/SEN1/ATerm;
     license = "LGPL";
diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix
index dd73858c3fc2..97e455b1f30e 100644
--- a/pkgs/development/libraries/cairo/default.nix
+++ b/pkgs/development/libraries/cairo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, libiconvOrEmpty, libintlOrEmpty
+{ stdenv, fetchurl, fetchpatch, pkgconfig, libiconvOrEmpty, libintlOrEmpty
 , expat, zlib, libpng, pixman, fontconfig, freetype, xlibs
 , gobjectSupport ? true, glib
 , xcbSupport ? true # no longer experimental since 1.12
@@ -18,6 +18,12 @@ stdenv.mkDerivation rec {
     sha1 = "53cf589b983412ea7f78feee2e1ba9cea6e3ebae";
   };
 
+  patches = [(fetchpatch {
+    name = "fix-racket.diff";
+    url = "http://cgit.freedesktop.org/cairo/patch/?id=2de69581c28bf115852037ca41eba13cb7335976";
+    sha256 = "0mk2fd9fwxqzravlmnbbrzwak15wqspn7609y0yn6qh87va5i0x4";
+  })];
+
   nativeBuildInputs = [ pkgconfig ] ++ libintlOrEmpty ++ libiconvOrEmpty;
 
   propagatedBuildInputs =
diff --git a/pkgs/development/libraries/cairomm/default.nix b/pkgs/development/libraries/cairomm/default.nix
index f21abedc1f52..990d44dfef8e 100644
--- a/pkgs/development/libraries/cairomm/default.nix
+++ b/pkgs/development/libraries/cairomm/default.nix
@@ -1,15 +1,15 @@
 { fetchurl, stdenv, pkgconfig, cairo, x11, fontconfig, freetype, libsigcxx }:
 
 stdenv.mkDerivation rec {
-  name = "cairomm-1.10.0";
+  name = "cairomm-1.11.2";
 
   src = fetchurl {
     url = "http://cairographics.org/releases/${name}.tar.gz";
-    sha256 = "13rrp96px95m6xnvmsaqb0wcqsnizg3bz334k0yhlyxf7v29d386";
+    sha1 = "35e190a03f760924bece5dc1204cc36b3583c806";
   };
 
   buildInputs = [ pkgconfig ];
-  
+
   propagatedBuildInputs = [ cairo x11 fontconfig freetype libsigcxx ];
 
   meta = {
diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix
index 31e271277841..d332321a22ad 100644
--- a/pkgs/development/libraries/dbus/default.nix
+++ b/pkgs/development/libraries/dbus/default.nix
@@ -3,8 +3,8 @@
 , libX11, libICE, libSM, useX11 ? (stdenv.isLinux || stdenv.isDarwin) }:
 
 let
-  version = "1.8.10";
-  sha256 = "13mgvwigm931r8n9363imnn0vn6dvc0m322k3p8fs5c8nvyqggqh";
+  version = "1.8.12";
+  sha256 = "07jhcalg00i2rx5zrgk73rg0vm7lzi5q5z2gscrbl999ipr2h569";
 
   inherit (stdenv) lib;
 
diff --git a/pkgs/development/libraries/fontconfig/default.nix b/pkgs/development/libraries/fontconfig/default.nix
index d659c30083dd..b03528de2d5d 100644
--- a/pkgs/development/libraries/fontconfig/default.nix
+++ b/pkgs/development/libraries/fontconfig/default.nix
@@ -23,14 +23,6 @@ stdenv.mkDerivation rec {
     sha256 = "16baa4g5lswkyjlyf1h5lwc0zjap7c4d8grw79349a5w6dsl8qnw";
   };
 
-  infinality_patch =
-    let subvers = "1";
-      in fetchurl {
-        url = http://www.infinality.net/fedora/linux/zips/fontconfig-infinality-1-20130104_1.tar.bz2;
-        sha256 = "1fm5xx0mx2243jrq5rxk4v0ajw2nawpj23399h710bx6hd1rviq7";
-      }
-    ;
-
   patches = [
     (fetchpatch ({
         url = "http://cgit.freedesktop.org/fontconfig/patch/?id=f44157c809d280e2a0ce87fb078fc4b278d24a67";
@@ -71,7 +63,7 @@ stdenv.mkDerivation rec {
   installFlags = "fc_cachedir=$(TMPDIR)/dummy RUN_FC_CACHE_TEST=false";
 
   postInstall = ''
-    cd "$out/etc/fonts" && tar xvf ${infinality_patch}
+    cd "$out/etc/fonts"
     rm conf.d/{50-user,51-local}.conf
     "${libxslt}/bin/xsltproc" --stringparam fontDirectories "${fontbhttf}" \
       --stringparam fontconfig "$out" \
diff --git a/pkgs/development/libraries/glibc/2.19/cve-2014-0475.patch b/pkgs/development/libraries/glibc/2.19/cve-2014-0475.patch
deleted file mode 100644
index a4f983de8f6c..000000000000
--- a/pkgs/development/libraries/glibc/2.19/cve-2014-0475.patch
+++ /dev/null
@@ -1,170 +0,0 @@
-Picked from upstream commits, but excluding changes to news and tests:
-d183645616b0533 and 4e8f95a0df7c2
-Also see https://sourceware.org/bugzilla/show_bug.cgi?id=17137
-
-diff --git a/locale/setlocale.c b/locale/setlocale.c
-index 9458468..6455b8b 100644
---- a/locale/setlocale.c
-+++ b/locale/setlocale.c
-@@ -272,6 +272,8 @@ setlocale (int category, const char *locale)
- 	 of entries of the form `CATEGORY=VALUE'.  */
-       const char *newnames[__LC_LAST];
-       struct __locale_data *newdata[__LC_LAST];
-+      /* Copy of the locale argument, for in-place splitting.  */
-+      char *locale_copy = NULL;
- 
-       /* Set all name pointers to the argument name.  */
-       for (category = 0; category < __LC_LAST; ++category)
-@@ -281,7 +283,13 @@ setlocale (int category, const char *locale)
-       if (__glibc_unlikely (strchr (locale, ';') != NULL))
- 	{
- 	  /* This is a composite name.  Make a copy and split it up.  */
--	  char *np = strdupa (locale);
-+	  locale_copy = strdup (locale);
-+	  if (__glibc_unlikely (locale_copy == NULL))
-+	    {
-+	      __libc_rwlock_unlock (__libc_setlocale_lock);
-+	      return NULL;
-+	    }
-+	  char *np = locale_copy;
- 	  char *cp;
- 	  int cnt;
- 
-@@ -299,6 +307,7 @@ setlocale (int category, const char *locale)
- 		{
- 		error_return:
- 		  __libc_rwlock_unlock (__libc_setlocale_lock);
-+		  free (locale_copy);
- 
- 		  /* Bogus category name.  */
- 		  ERROR_RETURN;
-@@ -391,8 +400,9 @@ setlocale (int category, const char *locale)
-       /* Critical section left.  */
-       __libc_rwlock_unlock (__libc_setlocale_lock);
- 
--      /* Free the resources (the locale path variable).  */
-+      /* Free the resources.  */
-       free (locale_path);
-+      free (locale_copy);
- 
-       return composite;
-     }
-diff --git a/locale/findlocale.c b/locale/findlocale.c
-index bbaf708..22e8b53 100644
---- a/locale/findlocale.c
-+++ b/locale/findlocale.c
-@@ -17,6 +17,7 @@
-    <http://www.gnu.org/licenses/>.  */
- 
- #include <assert.h>
-+#include <errno.h>
- #include <locale.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -57,6 +58,45 @@ struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST];
- 
- const char _nl_default_locale_path[] attribute_hidden = LOCALEDIR;
- 
-+/* Checks if the name is actually present, that is, not NULL and not
-+   empty.  */
-+static inline int
-+name_present (const char *name)
-+{
-+  return name != NULL && name[0] != '\0';
-+}
-+
-+/* Checks that the locale name neither extremely long, nor contains a
-+   ".." path component (to prevent directory traversal).  */
-+static inline int
-+valid_locale_name (const char *name)
-+{
-+  /* Not set.  */
-+  size_t namelen = strlen (name);
-+  /* Name too long.  The limit is arbitrary and prevents stack overflow
-+     issues later.  */
-+  if (__glibc_unlikely (namelen > 255))
-+    return 0;
-+  /* Directory traversal attempt.  */
-+  static const char slashdot[4] = {'/', '.', '.', '/'};
-+  if (__glibc_unlikely (memmem (name, namelen,
-+				slashdot, sizeof (slashdot)) != NULL))
-+    return 0;
-+  if (namelen == 2 && __glibc_unlikely (name[0] == '.' && name [1] == '.'))
-+    return 0;
-+  if (namelen >= 3
-+      && __glibc_unlikely (((name[0] == '.'
-+			     && name[1] == '.'
-+			     && name[2] == '/')
-+			    || (name[namelen - 3] == '/'
-+				&& name[namelen - 2] == '.'
-+				&& name[namelen - 1] == '.'))))
-+    return 0;
-+  /* If there is a slash in the name, it must start with one.  */
-+  if (__glibc_unlikely (memchr (name, '/', namelen) != NULL) && name[0] != '/')
-+    return 0;
-+  return 1;
-+}
- 
- struct __locale_data *
- internal_function
-@@ -65,7 +105,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
- {
-   int mask;
-   /* Name of the locale for this category.  */
--  char *loc_name;
-+  char *loc_name = (char *) *name;
-   const char *language;
-   const char *modifier;
-   const char *territory;
-@@ -73,31 +113,39 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
-   const char *normalized_codeset;
-   struct loaded_l10nfile *locale_file;
- 
--  if ((*name)[0] == '\0')
-+  if (loc_name[0] == '\0')
-     {
-       /* The user decides which locale to use by setting environment
- 	 variables.  */
--      *name = getenv ("LC_ALL");
--      if (*name == NULL || (*name)[0] == '\0')
--	*name = getenv (_nl_category_names.str
-+      loc_name = getenv ("LC_ALL");
-+      if (!name_present (loc_name))
-+	loc_name = getenv (_nl_category_names.str
- 			+ _nl_category_name_idxs[category]);
--      if (*name == NULL || (*name)[0] == '\0')
--	*name = getenv ("LANG");
-+      if (!name_present (loc_name))
-+	loc_name = getenv ("LANG");
-+      if (!name_present (loc_name))
-+	loc_name = (char *) _nl_C_name;
-     }
- 
--  if (*name == NULL || (*name)[0] == '\0'
--      || (__builtin_expect (__libc_enable_secure, 0)
--	  && strchr (*name, '/') != NULL))
--    *name = (char *) _nl_C_name;
-+  /* We used to fall back to the C locale if the name contains a slash
-+     character '/', but we now check for directory traversal in
-+     valid_locale_name, so this is no longer necessary.  */
- 
--  if (__builtin_expect (strcmp (*name, _nl_C_name), 1) == 0
--      || __builtin_expect (strcmp (*name, _nl_POSIX_name), 1) == 0)
-+  if (__builtin_expect (strcmp (loc_name, _nl_C_name), 1) == 0
-+      || __builtin_expect (strcmp (loc_name, _nl_POSIX_name), 1) == 0)
-     {
-       /* We need not load anything.  The needed data is contained in
- 	 the library itself.  */
-       *name = (char *) _nl_C_name;
-       return _nl_C[category];
-     }
-+  else if (!valid_locale_name (loc_name))
-+    {
-+      __set_errno (EINVAL);
-+      return NULL;
-+    }
-+
-+  *name = loc_name;
- 
-   /* We really have to load some data.  First we try the archive,
-      but only if there was no LOCPATH environment variable specified.  */
diff --git a/pkgs/development/libraries/glibc/2.19/cve-2014-5119.patch b/pkgs/development/libraries/glibc/2.19/cve-2014-5119.patch
deleted file mode 100644
index cbae03425eb9..000000000000
--- a/pkgs/development/libraries/glibc/2.19/cve-2014-5119.patch
+++ /dev/null
@@ -1,206 +0,0 @@
-http://anonscm.debian.org/viewvc/pkg-glibc/glibc-package/trunk/debian/patches/any/cvs-CVE-2014-5119.diff?revision=6248&view=co
-
-commit a1a6a401ab0a3c9f15fb7eaebbdcee24192254e8
-Author: Florian Weimer <fweimer@redhat.com>
-Date:   Tue Aug 26 19:38:59 2014 +0200
-
-    __gconv_translit_find: Disable function [BZ #17187]
-    
-    This functionality has never worked correctly, and the implementation
-    contained a security vulnerability (CVE-2014-5119).
-
-2014-08-26  Florian Weimer  <fweimer@redhat.com>
-
-	[BZ #17187]
-	* iconv/gconv_trans.c (struct known_trans, search_tree, lock,
-	trans_compare, open_translit, __gconv_translit_find):
-	Remove module loading code.
-
---- a/iconv/gconv_trans.c
-+++ b/iconv/gconv_trans.c
-@@ -238,181 +238,12 @@ __gconv_transliterate (struct __gconv_step *step,
-   return __GCONV_ILLEGAL_INPUT;
- }
- 
--
--/* Structure to represent results of found (or not) transliteration
--   modules.  */
--struct known_trans
--{
--  /* This structure must remain the first member.  */
--  struct trans_struct info;
--
--  char *fname;
--  void *handle;
--  int open_count;
--};
--
--
--/* Tree with results of previous calls to __gconv_translit_find.  */
--static void *search_tree;
--
--/* We modify global data.   */
--__libc_lock_define_initialized (static, lock);
--
--
--/* Compare two transliteration entries.  */
--static int
--trans_compare (const void *p1, const void *p2)
--{
--  const struct known_trans *s1 = (const struct known_trans *) p1;
--  const struct known_trans *s2 = (const struct known_trans *) p2;
--
--  return strcmp (s1->info.name, s2->info.name);
--}
--
--
--/* Open (maybe reopen) the module named in the struct.  Get the function
--   and data structure pointers we need.  */
--static int
--open_translit (struct known_trans *trans)
--{
--  __gconv_trans_query_fct queryfct;
--
--  trans->handle = __libc_dlopen (trans->fname);
--  if (trans->handle == NULL)
--    /* Not available.  */
--    return 1;
--
--  /* Find the required symbol.  */
--  queryfct = __libc_dlsym (trans->handle, "gconv_trans_context");
--  if (queryfct == NULL)
--    {
--      /* We cannot live with that.  */
--    close_and_out:
--      __libc_dlclose (trans->handle);
--      trans->handle = NULL;
--      return 1;
--    }
--
--  /* Get the context.  */
--  if (queryfct (trans->info.name, &trans->info.csnames, &trans->info.ncsnames)
--      != 0)
--    goto close_and_out;
--
--  /* Of course we also have to have the actual function.  */
--  trans->info.trans_fct = __libc_dlsym (trans->handle, "gconv_trans");
--  if (trans->info.trans_fct == NULL)
--    goto close_and_out;
--
--  /* Now the optional functions.  */
--  trans->info.trans_init_fct =
--    __libc_dlsym (trans->handle, "gconv_trans_init");
--  trans->info.trans_context_fct =
--    __libc_dlsym (trans->handle, "gconv_trans_context");
--  trans->info.trans_end_fct =
--    __libc_dlsym (trans->handle, "gconv_trans_end");
--
--  trans->open_count = 1;
--
--  return 0;
--}
--
--
- int
- internal_function
- __gconv_translit_find (struct trans_struct *trans)
- {
--  struct known_trans **found;
--  const struct path_elem *runp;
--  int res = 1;
--
--  /* We have to have a name.  */
--  assert (trans->name != NULL);
--
--  /* Acquire the lock.  */
--  __libc_lock_lock (lock);
--
--  /* See whether we know this module already.  */
--  found = __tfind (trans, &search_tree, trans_compare);
--  if (found != NULL)
--    {
--      /* Is this module available?  */
--      if ((*found)->handle != NULL)
--	{
--	  /* Maybe we have to reopen the file.  */
--	  if ((*found)->handle != (void *) -1)
--	    /* The object is not unloaded.  */
--	    res = 0;
--	  else if (open_translit (*found) == 0)
--	    {
--	      /* Copy the data.  */
--	      *trans = (*found)->info;
--	      (*found)->open_count++;
--	      res = 0;
--	    }
--	}
--    }
--  else
--    {
--      size_t name_len = strlen (trans->name) + 1;
--      int need_so = 0;
--      struct known_trans *newp;
--
--      /* We have to continue looking for the module.  */
--      if (__gconv_path_elem == NULL)
--	__gconv_get_path ();
--
--      /* See whether we have to append .so.  */
--      if (name_len <= 4 || memcmp (&trans->name[name_len - 4], ".so", 3) != 0)
--	need_so = 1;
--
--      /* Create a new entry.  */
--      newp = (struct known_trans *) malloc (sizeof (struct known_trans)
--					    + (__gconv_max_path_elem_len
--					       + name_len + 3)
--					    + name_len);
--      if (newp != NULL)
--	{
--	  char *cp;
--
--	  /* Clear the struct.  */
--	  memset (newp, '\0', sizeof (struct known_trans));
--
--	  /* Store a copy of the module name.  */
--	  newp->info.name = cp = (char *) (newp + 1);
--	  cp = __mempcpy (cp, trans->name, name_len);
--
--	  newp->fname = cp;
--
--	  /* Search in all the directories.  */
--	  for (runp = __gconv_path_elem; runp->name != NULL; ++runp)
--	    {
--	      cp = __mempcpy (__stpcpy ((char *) newp->fname, runp->name),
--			      trans->name, name_len);
--	      if (need_so)
--		memcpy (cp, ".so", sizeof (".so"));
--
--	      if (open_translit (newp) == 0)
--		{
--		  /* We found a module.  */
--		  res = 0;
--		  break;
--		}
--	    }
--
--	  if (res)
--	    newp->fname = NULL;
--
--	  /* In any case we'll add the entry to our search tree.  */
--	  if (__tsearch (newp, &search_tree, trans_compare) == NULL)
--	    {
--	      /* Yickes, this should not happen.  Unload the object.  */
--	      res = 1;
--	      /* XXX unload here.  */
--	    }
--	}
--    }
--
--  __libc_lock_unlock (lock);
--
--  return res;
-+  /* Transliteration module loading has been removed because it never
-+     worked as intended and suffered from a security vulnerability.
-+     Consequently, this function always fails.  */
-+  return 1;
- }
diff --git a/pkgs/development/libraries/glibc/2.19/fix-math.patch b/pkgs/development/libraries/glibc/2.19/fix-math.patch
deleted file mode 100644
index 516f53954ddd..000000000000
--- a/pkgs/development/libraries/glibc/2.19/fix-math.patch
+++ /dev/null
@@ -1,336 +0,0 @@
-From: Siddhesh Poyarekar <siddhesh@redhat.com>
-Date: Thu, 27 Feb 2014 15:42:09 +0000 (+0530)
-Subject: Fix sign of input to bsloww1 (BZ #16623)
-X-Git-Url: http://repo.or.cz/w/glibc.git/commitdiff_plain/1cadc85813d736f7682fa2eeadae639ab6b66c65
-
-Fix sign of input to bsloww1 (BZ #16623)
-
-In 84ba214c, I removed some redundant sign computations and in the
-process, I incorrectly got rid of a temporary variable, thus passing
-the absolute value of the input to bsloww1.  This caused #16623.
-
-This fix undoes the incorrect change.
-
-[nix]: drop docs update (wouldn't apply)
----
-
-diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
-index ac5348f..fafe96f 100644
---- a/math/auto-libm-test-in
-+++ b/math/auto-libm-test-in
-@@ -594,6 +594,7 @@ cos 0x1.0000010b239a9p0
- cos 0x1.00000162a932bp0
- cos 0x1.000002d452a10p0
- cos 0x1.000005bc7d86dp0
-+cos 0x1.200145a975ce6p32
- cos 1
- cos 2
- cos 3
-@@ -1748,6 +1749,7 @@ sin 7
- sin 8
- sin 9
- sin 10
-+sin 0x1.2001469775ce6p32
- 
- sincos 0
- sincos -0
-diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
-index 8f79359..59c08a7 100644
---- a/math/auto-libm-test-out
-+++ b/math/auto-libm-test-out
-@@ -74446,6 +74446,75 @@ cos 0x1.000005bc7d86dp0
- = cos tonearest ldbl-128ibm 0x1.000005bc7d86dp+0L : 0x8.a513ba9f703d3ffffffcb92354p-4L : inexact-ok
- = cos towardzero ldbl-128ibm 0x1.000005bc7d86dp+0L : 0x8.a513ba9f703d3ffffffcb92354p-4L : inexact-ok
- = cos upward ldbl-128ibm 0x1.000005bc7d86dp+0L : 0x8.a513ba9f703d3ffffffcb92358p-4L : inexact-ok
-+cos 0x1.200145a975ce6p32
-+= cos downward flt-32 0x1.200146p+32f : -0xf.74fbep-4f : inexact-ok
-+= cos tonearest flt-32 0x1.200146p+32f : -0xf.74fbdp-4f : inexact-ok
-+= cos towardzero flt-32 0x1.200146p+32f : -0xf.74fbdp-4f : inexact-ok
-+= cos upward flt-32 0x1.200146p+32f : -0xf.74fbdp-4f : inexact-ok
-+= cos downward dbl-64 0x1.200146p+32 : -0xf.74fbd5498fe5p-4 : inexact-ok
-+= cos tonearest dbl-64 0x1.200146p+32 : -0xf.74fbd5498fe5p-4 : inexact-ok
-+= cos towardzero dbl-64 0x1.200146p+32 : -0xf.74fbd5498fe48p-4 : inexact-ok
-+= cos upward dbl-64 0x1.200146p+32 : -0xf.74fbd5498fe48p-4 : inexact-ok
-+= cos downward ldbl-96-intel 0x1.200146p+32L : -0xf.74fbd5498fe4c0dp-4L : inexact-ok
-+= cos tonearest ldbl-96-intel 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos towardzero ldbl-96-intel 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos upward ldbl-96-intel 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos downward ldbl-96-m68k 0x1.200146p+32L : -0xf.74fbd5498fe4c0dp-4L : inexact-ok
-+= cos tonearest ldbl-96-m68k 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos towardzero ldbl-96-m68k 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos upward ldbl-96-m68k 0x1.200146p+32L : -0xf.74fbd5498fe4c0cp-4L : inexact-ok
-+= cos downward ldbl-128 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef59e8p-4L : inexact-ok
-+= cos tonearest ldbl-128 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef59e8p-4L : inexact-ok
-+= cos towardzero ldbl-128 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef59ep-4L : inexact-ok
-+= cos upward ldbl-128 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef59ep-4L : inexact-ok
-+= cos downward ldbl-128ibm 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef5cp-4L : inexact-ok
-+= cos tonearest ldbl-128ibm 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef58p-4L : inexact-ok
-+= cos towardzero ldbl-128ibm 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef58p-4L : inexact-ok
-+= cos upward ldbl-128ibm 0x1.200146p+32L : -0xf.74fbd5498fe4c0c71bd9e4ef58p-4L : inexact-ok
-+= cos downward flt-32 0x1.200144p+32f : 0xf.bc96cp-4f : inexact-ok
-+= cos tonearest flt-32 0x1.200144p+32f : 0xf.bc96dp-4f : inexact-ok
-+= cos towardzero flt-32 0x1.200144p+32f : 0xf.bc96cp-4f : inexact-ok
-+= cos upward flt-32 0x1.200144p+32f : 0xf.bc96dp-4f : inexact-ok
-+= cos downward dbl-64 0x1.200144p+32 : 0xf.bc96ca2c658a8p-4 : inexact-ok
-+= cos tonearest dbl-64 0x1.200144p+32 : 0xf.bc96ca2c658a8p-4 : inexact-ok
-+= cos towardzero dbl-64 0x1.200144p+32 : 0xf.bc96ca2c658a8p-4 : inexact-ok
-+= cos upward dbl-64 0x1.200144p+32 : 0xf.bc96ca2c658bp-4 : inexact-ok
-+= cos downward ldbl-96-intel 0x1.200144p+32L : 0xf.bc96ca2c658abf5p-4L : inexact-ok
-+= cos tonearest ldbl-96-intel 0x1.200144p+32L : 0xf.bc96ca2c658abf6p-4L : inexact-ok
-+= cos towardzero ldbl-96-intel 0x1.200144p+32L : 0xf.bc96ca2c658abf5p-4L : inexact-ok
-+= cos upward ldbl-96-intel 0x1.200144p+32L : 0xf.bc96ca2c658abf6p-4L : inexact-ok
-+= cos downward ldbl-96-m68k 0x1.200144p+32L : 0xf.bc96ca2c658abf5p-4L : inexact-ok
-+= cos tonearest ldbl-96-m68k 0x1.200144p+32L : 0xf.bc96ca2c658abf6p-4L : inexact-ok
-+= cos towardzero ldbl-96-m68k 0x1.200144p+32L : 0xf.bc96ca2c658abf5p-4L : inexact-ok
-+= cos upward ldbl-96-m68k 0x1.200144p+32L : 0xf.bc96ca2c658abf6p-4L : inexact-ok
-+= cos downward ldbl-128 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8fbp-4L : inexact-ok
-+= cos tonearest ldbl-128 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8fbp-4L : inexact-ok
-+= cos towardzero ldbl-128 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8fbp-4L : inexact-ok
-+= cos upward ldbl-128 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8fb8p-4L : inexact-ok
-+= cos downward ldbl-128ibm 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8cp-4L : inexact-ok
-+= cos tonearest ldbl-128ibm 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a9p-4L : inexact-ok
-+= cos towardzero ldbl-128ibm 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a8cp-4L : inexact-ok
-+= cos upward ldbl-128ibm 0x1.200144p+32L : 0xf.bc96ca2c658abf5ace7b886a9p-4L : inexact-ok
-+= cos downward dbl-64 0x1.200145a975ce6p+32 : -0x6.568e7ed3dffdp-4 : inexact-ok
-+= cos tonearest dbl-64 0x1.200145a975ce6p+32 : -0x6.568e7ed3dffccp-4 : inexact-ok
-+= cos towardzero dbl-64 0x1.200145a975ce6p+32 : -0x6.568e7ed3dffccp-4 : inexact-ok
-+= cos upward dbl-64 0x1.200145a975ce6p+32 : -0x6.568e7ed3dffccp-4 : inexact-ok
-+= cos downward ldbl-96-intel 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe8p-4L : inexact-ok
-+= cos tonearest ldbl-96-intel 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos towardzero ldbl-96-intel 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos upward ldbl-96-intel 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos downward ldbl-96-m68k 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe8p-4L : inexact-ok
-+= cos tonearest ldbl-96-m68k 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos towardzero ldbl-96-m68k 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos upward ldbl-96-m68k 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfep-4L : inexact-ok
-+= cos downward ldbl-128 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd726840e8p-4L : inexact-ok
-+= cos tonearest ldbl-128 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd726840e4p-4L : inexact-ok
-+= cos towardzero ldbl-128 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd726840e4p-4L : inexact-ok
-+= cos upward ldbl-128 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd726840e4p-4L : inexact-ok
-+= cos downward ldbl-128ibm 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd726842p-4L : inexact-ok
-+= cos tonearest ldbl-128ibm 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd72684p-4L : inexact-ok
-+= cos towardzero ldbl-128ibm 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd72684p-4L : inexact-ok
-+= cos upward ldbl-128ibm 0x1.200145a975ce6p+32L : -0x6.568e7ed3dffcdfe227fd72684p-4L : inexact-ok
- cos 1
- = cos downward flt-32 0x1p+0f : 0x8.a514p-4f : inexact-ok
- = cos tonearest flt-32 0x1p+0f : 0x8.a514p-4f : inexact-ok
-@@ -157744,6 +157813,75 @@ sin 10
- = sin tonearest ldbl-128ibm 0xap+0L : -0x8.b44f7af9a7a92ce7fb22be025p-4L : inexact-ok
- = sin towardzero ldbl-128ibm 0xap+0L : -0x8.b44f7af9a7a92ce7fb22be024cp-4L : inexact-ok
- = sin upward ldbl-128ibm 0xap+0L : -0x8.b44f7af9a7a92ce7fb22be024cp-4L : inexact-ok
-+sin 0x1.2001469775ce6p32
-+= sin downward flt-32 0x1.200148p+32f : -0x5.595d8p-4f : inexact-ok
-+= sin tonearest flt-32 0x1.200148p+32f : -0x5.595d8p-4f : inexact-ok
-+= sin towardzero flt-32 0x1.200148p+32f : -0x5.595d78p-4f : inexact-ok
-+= sin upward flt-32 0x1.200148p+32f : -0x5.595d78p-4f : inexact-ok
-+= sin downward dbl-64 0x1.200148p+32 : -0x5.595d7e536fe38p-4 : inexact-ok
-+= sin tonearest dbl-64 0x1.200148p+32 : -0x5.595d7e536fe34p-4 : inexact-ok
-+= sin towardzero dbl-64 0x1.200148p+32 : -0x5.595d7e536fe34p-4 : inexact-ok
-+= sin upward dbl-64 0x1.200148p+32 : -0x5.595d7e536fe34p-4 : inexact-ok
-+= sin downward ldbl-96-intel 0x1.200148p+32L : -0x5.595d7e536fe35eep-4L : inexact-ok
-+= sin tonearest ldbl-96-intel 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin towardzero ldbl-96-intel 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin upward ldbl-96-intel 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin downward ldbl-96-m68k 0x1.200148p+32L : -0x5.595d7e536fe35eep-4L : inexact-ok
-+= sin tonearest ldbl-96-m68k 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin towardzero ldbl-96-m68k 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin upward ldbl-96-m68k 0x1.200148p+32L : -0x5.595d7e536fe35ed8p-4L : inexact-ok
-+= sin downward ldbl-128 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d944p-4L : inexact-ok
-+= sin tonearest ldbl-128 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d94p-4L : inexact-ok
-+= sin towardzero ldbl-128 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d94p-4L : inexact-ok
-+= sin upward ldbl-128 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d94p-4L : inexact-ok
-+= sin downward ldbl-128ibm 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9dap-4L : inexact-ok
-+= sin tonearest ldbl-128ibm 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9dap-4L : inexact-ok
-+= sin towardzero ldbl-128ibm 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d8p-4L : inexact-ok
-+= sin upward ldbl-128ibm 0x1.200148p+32L : -0x5.595d7e536fe35edbe2ad0df9d8p-4L : inexact-ok
-+= sin downward flt-32 0x1.200146p+32f : 0x4.220ffp-4f : inexact-ok
-+= sin tonearest flt-32 0x1.200146p+32f : 0x4.220ffp-4f : inexact-ok
-+= sin towardzero flt-32 0x1.200146p+32f : 0x4.220ffp-4f : inexact-ok
-+= sin upward flt-32 0x1.200146p+32f : 0x4.220ff8p-4f : inexact-ok
-+= sin downward dbl-64 0x1.200146p+32 : 0x4.220ff25f5cfp-4 : inexact-ok
-+= sin tonearest dbl-64 0x1.200146p+32 : 0x4.220ff25f5cf04p-4 : inexact-ok
-+= sin towardzero dbl-64 0x1.200146p+32 : 0x4.220ff25f5cfp-4 : inexact-ok
-+= sin upward dbl-64 0x1.200146p+32 : 0x4.220ff25f5cf04p-4 : inexact-ok
-+= sin downward ldbl-96-intel 0x1.200146p+32L : 0x4.220ff25f5cf02a4p-4L : inexact-ok
-+= sin tonearest ldbl-96-intel 0x1.200146p+32L : 0x4.220ff25f5cf02a48p-4L : inexact-ok
-+= sin towardzero ldbl-96-intel 0x1.200146p+32L : 0x4.220ff25f5cf02a4p-4L : inexact-ok
-+= sin upward ldbl-96-intel 0x1.200146p+32L : 0x4.220ff25f5cf02a48p-4L : inexact-ok
-+= sin downward ldbl-96-m68k 0x1.200146p+32L : 0x4.220ff25f5cf02a4p-4L : inexact-ok
-+= sin tonearest ldbl-96-m68k 0x1.200146p+32L : 0x4.220ff25f5cf02a48p-4L : inexact-ok
-+= sin towardzero ldbl-96-m68k 0x1.200146p+32L : 0x4.220ff25f5cf02a4p-4L : inexact-ok
-+= sin upward ldbl-96-m68k 0x1.200146p+32L : 0x4.220ff25f5cf02a48p-4L : inexact-ok
-+= sin downward ldbl-128 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679ccp-4L : inexact-ok
-+= sin tonearest ldbl-128 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679ccp-4L : inexact-ok
-+= sin towardzero ldbl-128 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679ccp-4L : inexact-ok
-+= sin upward ldbl-128 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679cc4p-4L : inexact-ok
-+= sin downward ldbl-128ibm 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679cp-4L : inexact-ok
-+= sin tonearest ldbl-128ibm 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679cp-4L : inexact-ok
-+= sin towardzero ldbl-128ibm 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679cp-4L : inexact-ok
-+= sin upward ldbl-128ibm 0x1.200146p+32L : 0x4.220ff25f5cf02a464dbb3a679ep-4L : inexact-ok
-+= sin downward dbl-64 0x1.2001469775ce6p+32 : -0x6.444fda50019fcp-4 : inexact-ok
-+= sin tonearest dbl-64 0x1.2001469775ce6p+32 : -0x6.444fda50019f8p-4 : inexact-ok
-+= sin towardzero dbl-64 0x1.2001469775ce6p+32 : -0x6.444fda50019f8p-4 : inexact-ok
-+= sin upward dbl-64 0x1.2001469775ce6p+32 : -0x6.444fda50019f8p-4 : inexact-ok
-+= sin downward ldbl-96-intel 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f6p-4L : inexact-ok
-+= sin tonearest ldbl-96-intel 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin towardzero ldbl-96-intel 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin upward ldbl-96-intel 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin downward ldbl-96-m68k 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f6p-4L : inexact-ok
-+= sin tonearest ldbl-96-m68k 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin towardzero ldbl-96-m68k 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin upward ldbl-96-m68k 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f58p-4L : inexact-ok
-+= sin downward ldbl-128 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca70604p-4L : inexact-ok
-+= sin tonearest ldbl-128 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
-+= sin towardzero ldbl-128 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
-+= sin upward ldbl-128 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
-+= sin downward ldbl-128ibm 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca708p-4L : inexact-ok
-+= sin tonearest ldbl-128ibm 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
-+= sin towardzero ldbl-128ibm 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
-+= sin upward ldbl-128ibm 0x1.2001469775ce6p+32L : -0x6.444fda50019f9f5ba3779ca706p-4L : inexact-ok
- sincos 0
- = sincos downward flt-32 0x0p+0f : 0x0p+0f 0x1p+0f : inexact-ok
- = sincos tonearest flt-32 0x0p+0f : 0x0p+0f 0x1p+0f : inexact-ok
-diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c
-index 6105e9f..50109b8 100644
---- a/sysdeps/ieee754/dbl-64/s_sin.c
-+++ b/sysdeps/ieee754/dbl-64/s_sin.c
-@@ -447,19 +447,21 @@ __sin (double x)
- 	    }
- 	  else
- 	    {
-+	      double t;
- 	      if (a > 0)
- 		{
- 		  m = 1;
-+		  t = a;
- 		  db = da;
- 		}
- 	      else
- 		{
- 		  m = 0;
--		  a = -a;
-+		  t = -a;
- 		  db = -da;
- 		}
--	      u.x = big + a;
--	      y = a - (u.x - big);
-+	      u.x = big + t;
-+	      y = t - (u.x - big);
- 	      res = do_sin (u, y, db, &cor);
- 	      cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
- 	      retval = ((res == res + cor) ? ((m) ? res : -res)
-@@ -671,19 +673,21 @@ __cos (double x)
- 	    }
- 	  else
- 	    {
-+	      double t;
- 	      if (a > 0)
- 		{
- 		  m = 1;
-+		  t = a;
- 		  db = da;
- 		}
- 	      else
- 		{
- 		  m = 0;
--		  a = -a;
-+		  t = -a;
- 		  db = -da;
- 		}
--	      u.x = big + a;
--	      y = a - (u.x - big);
-+	      u.x = big + t;
-+	      y = t - (u.x - big);
- 	      res = do_sin (u, y, db, &cor);
- 	      cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
- 	      retval = ((res == res + cor) ? ((m) ? res : -res)
-diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
-index f3980f8..544f1c7 100644
---- a/sysdeps/x86_64/fpu/libm-test-ulps
-+++ b/sysdeps/x86_64/fpu/libm-test-ulps
-@@ -10900,6 +10900,14 @@ idouble: 1
- Test "cos_downward (0x1.0c152382d7365p+0)":
- double: 1
- idouble: 1
-+Test "cos_downward (0x1.200145a975ce6p+32)":
-+double: 1
-+idouble: 1
-+ildouble: 1
-+ldouble: 1
-+Test "cos_downward (0x1.200146p+32)":
-+ildouble: 1
-+ldouble: 1
- Test "cos_downward (0x1.921fb4p+0)":
- ildouble: 1
- ldouble: 1
-@@ -11126,6 +11134,9 @@ idouble: 1
- Test "cos_towardzero (0x1.0c152382d7365p+0)":
- double: 1
- idouble: 1
-+Test "cos_towardzero (0x1.200146p+32)":
-+double: 1
-+idouble: 1
- Test "cos_towardzero (0x1.921fb4p+0)":
- ildouble: 1
- ldouble: 1
-@@ -11258,6 +11269,17 @@ idouble: 1
- Test "cos_upward (0x1.0c1524p+0)":
- double: 1
- idouble: 1
-+Test "cos_upward (0x1.200144p+32)":
-+double: 1
-+idouble: 1
-+Test "cos_upward (0x1.200145a975ce6p+32)":
-+ildouble: 1
-+ldouble: 1
-+Test "cos_upward (0x1.200146p+32)":
-+double: 1
-+idouble: 1
-+ildouble: 1
-+ldouble: 1
- Test "cos_upward (0x1.921fb4p+0)":
- double: 1
- idouble: 1
-@@ -15155,6 +15177,19 @@ double: 1
- idouble: 1
- ildouble: 1
- ldouble: 1
-+Test "sin_downward (0x1.2001469775ce6p+32)":
-+double: 1
-+idouble: 1
-+ildouble: 1
-+ldouble: 1
-+Test "sin_downward (0x1.200146p+32)":
-+double: 1
-+idouble: 1
-+Test "sin_downward (0x1.200148p+32)":
-+double: 1
-+idouble: 1
-+ildouble: 1
-+ldouble: 1
- Test "sin_downward (0x1.921fb54442d18468p+0)":
- ildouble: 1
- ldouble: 1
-@@ -15383,6 +15418,9 @@ double: 1
- idouble: 1
- ildouble: 1
- ldouble: 1
-+Test "sin_towardzero (0x1.200146p+32)":
-+double: 1
-+idouble: 1
- Test "sin_towardzero (0x1.921fb54442d18468p+0)":
- ildouble: 1
- ldouble: 1
-@@ -15532,6 +15570,12 @@ ldouble: 1
- Test "sin_upward (-0x8.60a92p-4)":
- ildouble: 1
- ldouble: 1
-+Test "sin_upward (0x1.2001469775ce6p+32)":
-+ildouble: 1
-+ldouble: 1
-+Test "sin_upward (0x1.200148p+32)":
-+ildouble: 1
-+ldouble: 1
- Test "sin_upward (0x1.921fb4p+0)":
- double: 1
- idouble: 1
diff --git a/pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch b/pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch
deleted file mode 100644
index 5d0b1a51762e..000000000000
--- a/pkgs/development/libraries/glibc/2.19/glibc-remove-date-from-compilation-banner.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ur glibc-2.17.orig/csu/Makefile glibc-2.17/csu/Makefile
---- glibc-2.17.orig/csu/Makefile	2012-12-25 04:02:13.000000000 +0100
-+++ glibc-2.17/csu/Makefile	2013-08-19 16:01:57.132378550 +0200
-@@ -172,7 +172,7 @@
- 		     os=Linux; \
- 		   fi; \
- 		   printf '"Compiled on a %s %s system on %s.\\n"\n' \
--			  "$$os" "$$version" "`date +%Y-%m-%d`";; \
-+			  "$$os" "$$version";; \
- 	   *) ;; \
- 	 esac; \
- 	 files="$(all-Banner-files)";				\
diff --git a/pkgs/development/libraries/glibc/2.19/builder.sh b/pkgs/development/libraries/glibc/builder.sh
index 3b077cbb3fd5..2836063e3bf4 100644
--- a/pkgs/development/libraries/glibc/2.19/builder.sh
+++ b/pkgs/development/libraries/glibc/builder.sh
@@ -46,10 +46,6 @@ postInstall() {
         ln -s lib $out/lib64
     fi
 
-    # This file, that should not remain in the glibc derivation,
-    # may have not been created during the preInstall
-    rm -f $out/lib/libgcc_s.so.1
-
     # Get rid of more unnecessary stuff.
     rm -rf $out/var $out/sbin/sln
 }
diff --git a/pkgs/development/libraries/glibc/2.19/common.nix b/pkgs/development/libraries/glibc/common.nix
index 23efc01a3975..da1d4f08fa2f 100644
--- a/pkgs/development/libraries/glibc/2.19/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -13,7 +13,7 @@ cross:
 
 let
 
-  version = "2.19";
+  version = "2.20";
 
 in
 
@@ -56,14 +56,6 @@ stdenv.mkDerivation ({
          "/bin:/usr/bin", which is inappropriate on NixOS machines. This
          patch extends the search path by "/run/current-system/sw/bin". */
       ./fix_path_attribute_in_getconf.patch
-
-      ./fix-math.patch
-
-      ./cve-2014-0475.patch
-      ./cve-2014-5119.patch
-
-      /* Remove references to the compilation date.  */
-      ./glibc-remove-date-from-compilation-banner.patch
     ];
 
   postPatch =
@@ -77,8 +69,11 @@ stdenv.mkDerivation ({
     + ''
       echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
     ''
-    # Replace the date and time in nscd by $out.
-    #  It is used as a protocol compatibility check.
+    # Replace the date and time in nscd by a prefix of $out.
+    # It is used as a protocol compatibility check.
+    # Note: the size of the struct changes, but using only a part
+    # would break hash-rewriting. When receiving stats it does check
+    # that the struct sizes match and can't cause overflow or something.
     + ''
       cat ${./glibc-remove-datetime-from-nscd.patch} \
         | sed "s,@out@,$out," | patch -p1
@@ -155,7 +150,7 @@ stdenv.mkDerivation ({
     }
     else fetchurl {
       url = "mirror://gnu/glibc/glibc-${version}.tar.gz";
-      sha256 = "15n7x9mmzhd7w6s5hd9srx0h23b32gwb306x98k9ss940yvnvb8q";
+      sha256 = "1g6ysvk15arpi7c1f1fpx5slgfr2k3dqd5xr0yvijajp1m0xxq9p";
     };
 
   # Remove absolute paths from `configure' & co.; build out-of-tree.
diff --git a/pkgs/development/libraries/glibc/2.19/default.nix b/pkgs/development/libraries/glibc/default.nix
index 52a94bd0a0d5..1abba35af088 100644
--- a/pkgs/development/libraries/glibc/2.19/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -35,7 +35,7 @@ in
     preInstall = ''
       if [ -f ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 ]; then
           mkdir -p $out/lib
-          ln -s ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
+          cp ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
       fi
     '';
 
diff --git a/pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-cache.patch b/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
index 95f537733204..95f537733204 100644
--- a/pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-cache.patch
+++ b/pkgs/development/libraries/glibc/dont-use-system-ld-so-cache.patch
diff --git a/pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-preload.patch b/pkgs/development/libraries/glibc/dont-use-system-ld-so-preload.patch
index fabb6c3ec5e1..894e2a11cf87 100644
--- a/pkgs/development/libraries/glibc/2.19/dont-use-system-ld-so-preload.patch
+++ b/pkgs/development/libraries/glibc/dont-use-system-ld-so-preload.patch
@@ -1,12 +1,12 @@
-diff -rupN a/elf/rtld.c b/elf/rtld.c
---- a/elf/rtld.c	2013-08-11 00:52:55.000000001 +0200
-+++ b/elf/rtld.c	2014-02-18 13:56:19.000000001 +0100
-@@ -1639,7 +1639,7 @@ ERROR: ld.so: object '%s' cannot be load
+diff -ru glibc-2.20-orig/elf/rtld.c glibc-2.20/elf/rtld.c
+--- glibc-2.20-orig/elf/rtld.c	2014-09-07 10:09:09.000000000 +0200
++++ glibc-2.20/elf/rtld.c	2014-10-27 11:32:25.203043157 +0100
+@@ -1513,7 +1513,7 @@
       open().  So we do this first.  If it succeeds we do almost twice
       the work but this does not matter, since it is not for production
       use.  */
 -  static const char preload_file[] = "/etc/ld.so.preload";
 +  static const char preload_file[] = "/etc/ld-nix.so.preload";
-   if (__builtin_expect (__access (preload_file, R_OK) == 0, 0))
+   if (__glibc_unlikely (__access (preload_file, R_OK) == 0))
      {
        /* Read the contents of the file.  */
diff --git a/pkgs/development/libraries/glibc/2.19/fix_path_attribute_in_getconf.patch b/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch
index 714e49db5607..714e49db5607 100644
--- a/pkgs/development/libraries/glibc/2.19/fix_path_attribute_in_getconf.patch
+++ b/pkgs/development/libraries/glibc/fix_path_attribute_in_getconf.patch
diff --git a/pkgs/development/libraries/glibc/2.19/glibc-crypt-blowfish.patch b/pkgs/development/libraries/glibc/glibc-crypt-blowfish.patch
index a0a8acdab63d..a0a8acdab63d 100644
--- a/pkgs/development/libraries/glibc/2.19/glibc-crypt-blowfish.patch
+++ b/pkgs/development/libraries/glibc/glibc-crypt-blowfish.patch
diff --git a/pkgs/development/libraries/glibc/2.19/glibc-remove-datetime-from-nscd.patch b/pkgs/development/libraries/glibc/glibc-remove-datetime-from-nscd.patch
index 0a5456ea5c42..db010e62366b 100644
--- a/pkgs/development/libraries/glibc/2.19/glibc-remove-datetime-from-nscd.patch
+++ b/pkgs/development/libraries/glibc/glibc-remove-datetime-from-nscd.patch
@@ -5,7 +5,7 @@
  
  /* We use this to make sure the receiver is the same.  */
 -static const char compilation[21] = __DATE__ " " __TIME__;
-+static const char compilation[21] = "@out@";
++static const char compilation[] = "@out@";
  
  /* Statistic data for one database.  */
  struct dbstat
diff --git a/pkgs/development/libraries/glibc/2.19/info.nix b/pkgs/development/libraries/glibc/info.nix
index e4cdb42dd689..e4cdb42dd689 100644
--- a/pkgs/development/libraries/glibc/2.19/info.nix
+++ b/pkgs/development/libraries/glibc/info.nix
diff --git a/pkgs/development/libraries/glibc/2.19/locales-builder.sh b/pkgs/development/libraries/glibc/locales-builder.sh
index d732e208fa22..d732e208fa22 100644
--- a/pkgs/development/libraries/glibc/2.19/locales-builder.sh
+++ b/pkgs/development/libraries/glibc/locales-builder.sh
diff --git a/pkgs/development/libraries/glibc/2.19/locales.nix b/pkgs/development/libraries/glibc/locales.nix
index 9f9fb86a396d..1dd15832f5b6 100644
--- a/pkgs/development/libraries/glibc/2.19/locales.nix
+++ b/pkgs/development/libraries/glibc/locales.nix
@@ -28,8 +28,8 @@ build null {
       mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
 
       # Hack to allow building of the locales (needed since glibc-2.12)
-      sed -i -e "s,^LOCALEDEF=.*,LOCALEDEF=localedef --prefix=$TMPDIR," -e \
-          /library-path/d ../glibc-2*/localedata/Makefile
+      sed -i -e 's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef --prefix='$TMPDIR',' ../glibc-2*/localedata/Makefile
+
       ${if allLocales then "" else
           "echo SUPPORTED-LOCALES=\"${toString locales}\" > ../glibc-2*/localedata/SUPPORTED"}
 
diff --git a/pkgs/development/libraries/glibc/2.19/multi.nix b/pkgs/development/libraries/glibc/multi.nix
index ad4a34152b65..ad4a34152b65 100644
--- a/pkgs/development/libraries/glibc/2.19/multi.nix
+++ b/pkgs/development/libraries/glibc/multi.nix
diff --git a/pkgs/development/libraries/glibc/2.19/nix-locale-archive.patch b/pkgs/development/libraries/glibc/nix-locale-archive.patch
index 88c8adef9226..88c8adef9226 100644
--- a/pkgs/development/libraries/glibc/2.19/nix-locale-archive.patch
+++ b/pkgs/development/libraries/glibc/nix-locale-archive.patch
diff --git a/pkgs/development/libraries/glibc/2.19/rpcgen-path.patch b/pkgs/development/libraries/glibc/rpcgen-path.patch
index 3349449d9163..3349449d9163 100644
--- a/pkgs/development/libraries/glibc/2.19/rpcgen-path.patch
+++ b/pkgs/development/libraries/glibc/rpcgen-path.patch
diff --git a/pkgs/development/libraries/glibmm/default.nix b/pkgs/development/libraries/glibmm/default.nix
index 66fb0179489c..c0f0983d73df 100644
--- a/pkgs/development/libraries/glibmm/default.nix
+++ b/pkgs/development/libraries/glibmm/default.nix
@@ -1,15 +1,15 @@
 { stdenv, fetchurl, pkgconfig, glib, libsigcxx }:
 
 let
-  ver_maj = "2.38";
-  ver_min = "1";
+  ver_maj = "2.42";
+  ver_min = "0";
 in
 stdenv.mkDerivation rec {
   name = "glibmm-${ver_maj}.${ver_min}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/glibmm/${ver_maj}/${name}.tar.xz";
-    sha256 = "18n4czi6lh4ncj54apxms18xn9k8pmrp2ba9sxn0sk9w3pp2bja9";
+    sha256 = "985083d97378d234da27a7243587cc0d186897a4b2d3c1286f794089be1a3397";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/development/libraries/gnutls/3.1.nix b/pkgs/development/libraries/gnutls/3.1.nix
deleted file mode 100644
index 44ea0176e38c..000000000000
--- a/pkgs/development/libraries/gnutls/3.1.nix
+++ /dev/null
@@ -1,67 +0,0 @@
-{ fetchurl, stdenv, zlib, lzo, libtasn1, nettle, pkgconfig, lzip
-, guileBindings, guile, perl, gmp }:
-
-assert guileBindings -> guile != null;
-
-stdenv.mkDerivation rec {
-  name = "gnutls-3.1.26";
-
-  src = fetchurl {
-    url = "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1/${name}.tar.lz";
-    sha256 = "7947e18fd0c292c0274d810c9bdf674b8faa3566e056ea404a39f335982607a3";
-  };
-
-  # FreeBSD doesn't have <alloca.h>, and Gnulib's `alloca' module isn't used.
-  patches = stdenv.lib.optional stdenv.isFreeBSD ./guile-gnulib-includes.patch;
-
-  # Note: GMP is a dependency of Nettle, whose public headers include
-  # GMP headers, hence the hack.
-  configurePhase = ''
-    ./configure --prefix="$out"                                 \
-      --disable-dependency-tracking --enable-fast-install       \
-      --without-p11-kit                                         \
-      --with-lzo --with-libtasn1-prefix="${libtasn1}"           \
-      --with-libnettle-prefix="${nettle}"                       \
-      CPPFLAGS="-I${gmp}/include"                               \
-      ${stdenv.lib.optionalString guileBindings
-          "--enable-guile --with-guile-site-dir=\"$out/share/guile/site\""}
-  '';
-
-  # Build of the Guile bindings is not parallel-safe.  See
-  # <http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=330995a920037b6030ec0282b51dde3f8b493cad>
-  # for the actual fix.
-  enableParallelBuilding = !guileBindings;
-
-  buildInputs = [ zlib lzo lzip ]
-    ++ stdenv.lib.optional guileBindings guile;
-
-  nativeBuildInputs = [ perl pkgconfig ];
-
-  propagatedBuildInputs = [ nettle libtasn1 ];
-
-  # XXX: Gnulib's `test-select' fails on FreeBSD:
-  # http://hydra.nixos.org/build/2962084/nixlog/1/raw .
-  doCheck = false;#(!stdenv.isFreeBSD && !stdenv.isDarwin);
-
-  meta = {
-    description = "The GNU Transport Layer Security Library";
-
-    longDescription = ''
-       GnuTLS is a project that aims to develop a library which
-       provides a secure layer, over a reliable transport
-       layer. Currently the GnuTLS library implements the proposed
-       standards by the IETF's TLS working group.
-
-       Quoting from the TLS protocol specification:
-
-       "The TLS protocol provides communications privacy over the
-       Internet. The protocol allows client/server applications to
-       communicate in a way that is designed to prevent eavesdropping,
-       tampering, or message forgery."
-    '';
-
-    homepage = http://www.gnu.org/software/gnutls/;
-    license = stdenv.lib.licenses.lgpl21Plus;
-    maintainers = [ stdenv.lib.maintainers.eelco ];
-  };
-}
diff --git a/pkgs/development/libraries/gnutls/3.2.nix b/pkgs/development/libraries/gnutls/3.2.nix
index 5bf933fbc961..e9254a445de4 100644
--- a/pkgs/development/libraries/gnutls/3.2.nix
+++ b/pkgs/development/libraries/gnutls/3.2.nix
@@ -4,11 +4,11 @@
 assert guileBindings -> guile != null;
 
 stdenv.mkDerivation rec {
-  name = "gnutls-3.2.17";
+  name = "gnutls-3.2.20";
 
   src = fetchurl {
     url = "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.2/${name}.tar.lz";
-    sha256 = "a332adda1d294fbee859ae46ee0c128d8959c4a5b9c28e7cdbe5c9b56898fc25";
+    sha256 = "0mjwzj486g0aj5i3zr70mixmbd4ldrj1ckrwmcr90si6bqa0sc6q";
   };
 
   patches =
diff --git a/pkgs/development/libraries/gtkmm/3.x.nix b/pkgs/development/libraries/gtkmm/3.x.nix
index 47057b819e0b..2d5798186c42 100644
--- a/pkgs/development/libraries/gtkmm/3.x.nix
+++ b/pkgs/development/libraries/gtkmm/3.x.nix
@@ -1,21 +1,22 @@
 { stdenv, fetchurl, pkgconfig, gtk3, glibmm, cairomm, pangomm, atkmm }:
 
 let
-  ver_maj = "3.11"; # unstable version, but ATM no stable builds with gtk-3.12 and this is the version used in GNOME-3.12 "stable"
-  ver_min = "9";
+  ver_maj = "3.12";
+  ver_min = "0";
 in
 stdenv.mkDerivation rec {
   name = "gtkmm-${ver_maj}.${ver_min}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/gtkmm/${ver_maj}/${name}.tar.xz";
-    sha256 = "04yji82prijlwpd3blx0am1ikjy7y7ih7jd628dywdjbbfq42920";
+    sha256 = "86c526ceec15d889996822128d566748bb36f70cf5a2c270530dfc546a2574e1";
   };
 
   nativeBuildInputs = [ pkgconfig ];
 
   propagatedBuildInputs = [ glibmm gtk3 atkmm cairomm pangomm ];
 
+  enableParallelBuilding = true;
   doCheck = true;
 
   meta = {
diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix
index 45cdc5be02b1..9c7244fdc6ed 100644
--- a/pkgs/development/libraries/harfbuzz/default.nix
+++ b/pkgs/development/libraries/harfbuzz/default.nix
@@ -8,11 +8,11 @@
 # (icu is a ~30 MB dependency, the rest is very small in comparison)
 
 stdenv.mkDerivation rec {
-  name = "harfbuzz-0.9.35";
+  name = "harfbuzz-0.9.36";
 
   src = fetchurl {
     url = "http://www.freedesktop.org/software/harfbuzz/release/${name}.tar.bz2";
-    sha256 = "1v86596994bnb9hx7laykhw4ipixqz9ckwzyyqf340pmlsmsi88a";
+    sha256 = "3bfbf7b016167ee6b2a2f83948fef75cc1253081873d6a91022161815956b9be";
   };
 
   configureFlags = [
diff --git a/pkgs/development/libraries/libevdev/default.nix b/pkgs/development/libraries/libevdev/default.nix
index 5dac8f888959..fd16866cceeb 100644
--- a/pkgs/development/libraries/libevdev/default.nix
+++ b/pkgs/development/libraries/libevdev/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, python }:
 
 stdenv.mkDerivation rec {
-  name = "libevdev-1.3";
+  name = "libevdev-1.3.1";
 
   src = fetchurl {
     url = "http://www.freedesktop.org/software/libevdev/${name}.tar.xz";
-    sha256 = "0iil4pnla0kjdx52ay7igq65sx32sjbzn1wx9q3v74m5g7712m16";
+    sha256 = "0hr6xjp7vcnr7lnr1il03235rcslqb95yv7j88qh51q0bwcpcz2b";
   };
 
   buildInputs = [ python ];
diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix
index 8dfe60f9026d..434b76a09eae 100644
--- a/pkgs/development/libraries/libxml2/default.nix
+++ b/pkgs/development/libraries/libxml2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, zlib, xz, python ? null, pythonSupport ? true }:
+{ stdenv, fetchurl, zlib, xz, python ? null, pythonSupport ? true, findXMLCatalogs }:
 
 assert pythonSupport -> python != null;
 
@@ -22,9 +22,7 @@ stdenv.mkDerivation (rec {
     # RUNPATH for that, leading to undefined references for its users.
     ++ (stdenv.lib.optional stdenv.isFreeBSD xz);
 
-  propagatedBuildInputs = [ zlib ];
-
-  setupHook = ./setup-hook.sh;
+  propagatedBuildInputs = [ zlib findXMLCatalogs ];
 
   passthru = { inherit pythonSupport version; };
 
diff --git a/pkgs/development/libraries/libxml2/setup-hook.sh b/pkgs/development/libraries/libxml2/setup-hook.sh
deleted file mode 100644
index 4acdd25a6b28..000000000000
--- a/pkgs/development/libraries/libxml2/setup-hook.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-addXMLCatalogs () {
-    for kind in dtd xsl; do
-        if test -d $1/xml/$kind; then
-            for i in $(find $1/xml/$kind -name catalog.xml); do
-                export XML_CATALOG_FILES="$XML_CATALOG_FILES $i"
-            done
-        fi
-    done
-}
-
-if test -z "$libxmlHookDone"; then
-    libxmlHookDone=1
-
-    # Set up XML_CATALOG_FILES.  An empty initial value prevents
-    # xmllint and xsltproc from looking in /etc/xml/catalog.
-    export XML_CATALOG_FILES
-    if test -z "$XML_CATALOG_FILES"; then XML_CATALOG_FILES=" "; fi
-    envHooks+=(addXMLCatalogs)
-fi
diff --git a/pkgs/development/libraries/libxslt/default.nix b/pkgs/development/libraries/libxslt/default.nix
index fd84c53c88fd..c5b91f3c4910 100644
--- a/pkgs/development/libraries/libxslt/default.nix
+++ b/pkgs/development/libraries/libxslt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libxml2 }:
+{ stdenv, fetchurl, libxml2, findXMLCatalogs }:
 
 stdenv.mkDerivation rec {
   name = "libxslt-1.1.28";
@@ -10,6 +10,8 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libxml2 ];
 
+  propagatedBuildInputs = [ findXMLCatalogs ];
+
   patches = stdenv.lib.optionals stdenv.isSunOS [ ./patch-ah.patch ];
 
   configureFlags = [
@@ -21,11 +23,6 @@ stdenv.mkDerivation rec {
     "--without-debugger"
   ];
 
-  postInstall = ''
-    mkdir -p $out/nix-support
-    ln -s ${libxml2}/nix-support/setup-hook $out/nix-support/
-  '';
-
   meta = {
     homepage = http://xmlsoft.org/XSLT/;
     description = "A C library and tools to do XSL transformations";
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 842f3dc7d9b8..a3b40eb612c2 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, intltool, flex, bison, autoreconfHook, substituteAll
+{ stdenv, fetchurl, fetchpatch, pkgconfig, intltool, flex, bison, autoreconfHook, substituteAll
 , python, libxml2Python, file, expat, makedepend
 , libdrm, xorg, wayland, udev, llvm, libffi
 , libvdpau, libelf
@@ -45,6 +45,12 @@ stdenv.mkDerivation {
     ./glx_ro_text_segm.patch # fix for grsecurity/PaX
    # TODO: revive ./dricore-gallium.patch when it gets ported (from Ubuntu),
    #  as it saved ~35 MB in $drivers; watch https://launchpad.net/ubuntu/+source/mesa/+changelog
+    (fetchpatch {
+      name = "fix-lp_test_arit.diff";
+      url = "http://cgit.freedesktop.org/mesa/mesa/patch/"
+        + "?id=8148a06b8fdb734f7f9a11ce787ee6505939fdaa";
+      sha256 = "0k2bnl7d28nx2y88jchw6jj4f3xfdjjvz4vpvhc40060c2iz8fla";
+    })
   ] ++ optional stdenv.isLinux
       (substituteAll {
         src = ./dlopen-absolute-paths.diff;
@@ -78,7 +84,7 @@ stdenv.mkDerivation {
 
     "--with-dri-drivers=i965,r200,radeon"
     "--with-gallium-drivers=i915,nouveau,r300,r600,svga,swrast,radeonsi"
-    "--with-egl-platforms=x11,drm" "--enable-gbm"
+    "--with-egl-platforms=x11,wayland,drm" "--enable-gbm"
   ]
     ++ optional enableTextureFloats "--enable-texture-float"
     ++ optionals enableExtraFeatures [
@@ -97,13 +103,13 @@ stdenv.mkDerivation {
     autoreconfHook intltool expat libxml2Python llvm
     glproto dri2proto dri3proto presentproto
     libX11 libXext libxcb libXt libXfixes libxshmfence
-    libffi /* wayland */ libvdpau libelf
+    libffi wayland libvdpau libelf
   ] ++ optionals enableExtraFeatures [ /*libXvMC*/ ]
     ++ optional stdenv.isLinux udev
     ;
 
   enableParallelBuilding = true;
-  #doCheck = true; # https://bugs.freedesktop.org/show_bug.cgi?id=67672
+  doCheck = true;
 
   # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM;
   #   also move libOSMesa to $osmesa, as it's relatively big
diff --git a/pkgs/development/libraries/phonon-backend-gstreamer/default.nix b/pkgs/development/libraries/phonon-backend-gstreamer/default.nix
index 844c2e580093..5067a3bd2c25 100644
--- a/pkgs/development/libraries/phonon-backend-gstreamer/default.nix
+++ b/pkgs/development/libraries/phonon-backend-gstreamer/default.nix
@@ -1,28 +1,39 @@
-{ stdenv, fetchurl, cmake, automoc4, qt4, pkgconfig, phonon, gstreamer
-, gst_plugins_base }:
+{ stdenv, fetchurl, cmake, automoc4, pkgconfig, gst_all_1
+, phonon, qt4 ? null, qt5 ? null, withQt5 ? false }:
+
+with stdenv.lib;
+
+assert (withQt5 -> qt5 != null); assert (!withQt5 -> qt4 != null);
 
 let
-  version = "4.7.2";
+  version = "4.8.0";
   pname = "phonon-backend-gstreamer";
+  qt = if withQt5 then qt5 else qt4;
+  # Force same Qt version in phonon
+  phonon_ = phonon.override { inherit qt4 qt5 withQt5; };
 in
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
-    url = "mirror://kde/stable/phonon/${pname}/${version}/src/${name}.tar.xz";
-    sha256 = "1cfjk450aajr8hfhnfq7zbmryprxiwr9ha5x585dsh7mja82mdw0";
+    url = "mirror://kde/stable/phonon/${pname}/${version}/${name}.tar.xz";
+    sha256 = "0zjqf1gpj6h9hj27225vihg5gj0fjgvh4n9nkrbij7kf57bcn6gq";
   };
 
-  buildInputs = [ phonon qt4 gstreamer gst_plugins_base ];
+  buildInputs = with gst_all_1; [ phonon_ qt gstreamer gst-plugins-base ];
 
   nativeBuildInputs = [ cmake automoc4 pkgconfig ];
 
-  cmakeFlags = [ "-DCMAKE_INSTALL_LIBDIR=lib" ];
+  cmakeFlags =
+    [ "-DCMAKE_INSTALL_LIBDIR=lib"
+    ] ++ optional withQt5 "-DPHONON_BUILD_PHONON4QT5=ON";
 
   meta = {
     homepage = http://phonon.kde.org/;
     description = "GStreamer backend for Phonon";
-    platforms = stdenv.lib.platforms.linux;
-  };  
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ ttuegel ];
+    license = licenses.lgpl21Plus;
+  };
 }
diff --git a/pkgs/development/libraries/phonon-backend-vlc/default.nix b/pkgs/development/libraries/phonon-backend-vlc/default.nix
index 8a196463639c..8883f5c11d9e 100644
--- a/pkgs/development/libraries/phonon-backend-vlc/default.nix
+++ b/pkgs/development/libraries/phonon-backend-vlc/default.nix
@@ -1,26 +1,37 @@
-{ stdenv, fetchurl, xz, qt4, vlc, automoc4, cmake, pkgconfig, phonon }:
+{ stdenv, fetchurl, xz, vlc, automoc4, cmake, pkgconfig, phonon
+, qt4 ? null, qt5 ? null, withQt5 ? false }:
+
+with stdenv.lib;
+
+assert (withQt5 -> qt5 != null); assert (!withQt5 -> qt4 != null);
 
 let
   pname = "phonon-backend-vlc";
-  v = "0.7.2";
-  vlc_ = vlc.override { inherit qt4; }; #Force using the same qt version
+  v = "0.8.1";
+  # Force same Qt version in phonon and VLC
+  vlc_ = vlc.override { inherit qt4 qt5 withQt5; };
+  phonon_ = phonon.override { inherit qt4 qt5 withQt5; };
 in
 
 stdenv.mkDerivation {
   name = "${pname}-${v}";
 
   src = fetchurl {
-    url = "mirror://kde/stable/phonon/${pname}/${v}/src/${pname}-${v}.tar.xz";
-    sha256 = "1acmbn8pmmq16gcz825dlzaf3haj6avp1bmcxzpkjd1fvxh86y0a";
+    url = "mirror://kde/stable/phonon/${pname}/${v}/${pname}-${v}.tar.xz";
+    sha256 = "1fyfh7qyb6rld350v2fgz452ld96d3z5ifchr323q0vc3hb9k222";
   };
 
   nativeBuildInputs = [ cmake pkgconfig automoc4 xz ];
 
-  buildInputs = [ qt4 vlc_ phonon ];
+  buildInputs = [ vlc_ phonon_ (if withQt5 then qt5 else qt4)];
+
+  cmakeFlags = optional withQt5 "-DPHONON_BUILD_PHONON4QT5=ON";
 
   meta = {
+    homepage = http://phonon.kde.org/;
     description = "VideoLAN backend for Phonon multimedia framework";
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.urkud ];
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ ttuegel urkud ];
+    license = licenses.lgpl21Plus;
   };
 }
diff --git a/pkgs/development/libraries/phonon/default.nix b/pkgs/development/libraries/phonon/default.nix
index 7fd99ab0244a..df32f04bb6c1 100644
--- a/pkgs/development/libraries/phonon/default.nix
+++ b/pkgs/development/libraries/phonon/default.nix
@@ -1,25 +1,33 @@
-{ stdenv, fetchurl, cmake, automoc4, qt4, pulseaudio }:
+{ stdenv, fetchurl, cmake, automoc4, pulseaudio
+, qt4 ? null, qt5 ? null, withQt5 ? false }:
+
+assert (withQt5 -> qt5 != null); assert (!withQt5 -> qt4 != null);
+
+with stdenv.lib;
 
 let
-  v = "4.7.2";
+  v = "4.8.1";
 in
 
 stdenv.mkDerivation rec {
   name = "phonon-${v}";
 
   src = fetchurl {
-    url = "mirror://kde/stable/phonon/${v}/${name}.tar.xz";
-    sha256 = "1ghidabmi6vnnmz8q272qi259nb8bbqlbayqk52ln98fs8s9g7l1";
+    url = "mirror://kde/stable/phonon/${v}/phonon-${v}.tar.xz";
+    sha256 = "1l97h1jj3gvl1chx1qbipizfvjgqc05wrhdcflc76c2krlk03jmn";
   };
 
-  buildInputs = [ qt4 pulseaudio ];
+  buildInputs = [ (if withQt5 then qt5 else qt4) pulseaudio ];
 
   nativeBuildInputs = [ cmake automoc4 ];
 
+  cmakeFlags = optional withQt5 "-DPHONON_BUILD_PHONON4QT5=ON";
+
   meta = {
     homepage = http://phonon.kde.org/;
     description = "Multimedia API for Qt";
     license = stdenv.lib.licenses.lgpl2;
     platforms = stdenv.lib.platforms.linux;
-  };  
+    maintainers = with stdenv.lib.maintainers; [ ttuegel ];
+  };
 }
diff --git a/pkgs/development/libraries/polkit-qt-1/default.nix b/pkgs/development/libraries/polkit-qt-1/default.nix
index 13bc992d0263..c60ae560fe59 100644
--- a/pkgs/development/libraries/polkit-qt-1/default.nix
+++ b/pkgs/development/libraries/polkit-qt-1/default.nix
@@ -1,20 +1,22 @@
-{ stdenv, fetchurl, cmake, qt4, pkgconfig, polkit, automoc4, glib }:
+{ stdenv, fetchurl, cmake, pkgconfig, polkit, automoc4, glib
+, qt4 ? null, qt5 ? null, withQt5 ? false }:
 
-stdenv.mkDerivation rec {
-  name = "polkit-qt-1-0.103.0";
+assert (withQt5 -> qt5 != null); assert (!withQt5 -> qt4 != null);
+
+stdenv.mkDerivation {
+  name = "polkit-qt-1-0.112.0";
 
   src = fetchurl {
-    url = "mirror://kde/stable/apps/KDE4.x/admin/${name}.tar.bz2";
-    sha256 = "0k17sb70ywk94dmncnkyig03sg1hcfbhi5wlc77xf3rxirmmccif";
+    url = "mirror://kde/stable/apps/KDE4.x/admin/polkit-qt-1-0.112.0.tar.bz2";
+    sha256 = "1ip78x20hjqvm08kxhp6gb8hf6k5n6sxyx6kk2yvvq53djzh7yv7";
   };
 
-  patches = [ ./polkit-install.patch ];
-
-  nativeBuildInputs = [ cmake automoc4 ];
+  nativeBuildInputs = [ cmake automoc4 pkgconfig ];
 
-  propagatedBuildInputs = [ polkit glib qt4 ];
+  propagatedBuildInputs = [ polkit glib (if withQt5 then qt5 else qt4) ];
 
   meta = {
     description = "A Qt wrapper around PolKit";
+    maintainers = with stdenv.lib.maintainers; [ ttuegel ];
   };
 }
diff --git a/pkgs/development/libraries/polkit-qt-1/polkit-install.patch b/pkgs/development/libraries/polkit-qt-1/polkit-install.patch
deleted file mode 100644
index 79beda2a3184..000000000000
--- a/pkgs/development/libraries/polkit-qt-1/polkit-install.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ru -x '*~' polkit-qt-1-0.99.0-orig/PolkitQt-1Config.cmake.in polkit-qt-1-0.99.0/PolkitQt-1Config.cmake.in
---- polkit-qt-1-0.99.0-orig/PolkitQt-1Config.cmake.in	2010-12-08 18:22:28.000000000 +0100
-+++ polkit-qt-1-0.99.0/PolkitQt-1Config.cmake.in	2011-07-12 13:26:51.000000000 +0200
-@@ -15,7 +15,7 @@
- 
- set(POLKITQT-1_INCLUDE_DIR              "@INCLUDE_INSTALL_DIR@/polkit-qt-1")
- set(POLKITQT-1_LIB_DIR                  "@LIB_INSTALL_DIR@")
--set(POLKITQT-1_POLICY_FILES_INSTALL_DIR "${POLKITQT-1_INSTALL_DIR}/share/polkit-1/actions")
-+set(POLKITQT-1_POLICY_FILES_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/polkit-1/actions")
- 
- # Compatibility
- if(WIN32)
diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix
index feb3750907f5..39059905a025 100644
--- a/pkgs/development/libraries/poppler/default.nix
+++ b/pkgs/development/libraries/poppler/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchgit, pkgconfig, cmake, libiconvOrEmpty, libintlOrEmpty
+{ stdenv, fetchurl, fetchpatch, pkgconfig, cmake, libiconvOrEmpty, libintlOrEmpty
 , zlib, curl, cairo, freetype, fontconfig, lcms, libjpeg, openjpeg
 , qt4Support ? false, qt4 ? null
 }:
@@ -7,6 +7,14 @@ let
   version = "0.28.1"; # even major numbers are stable
   sha256 = "01pxjdbhvpxf00ncf8d9wxc8gkcqcxz59lwrpa151ah988inxkrc";
 
+  # This is for Okular (and similar) to support subpixel rendering.
+  # It's kept from upstream because of political reasons.
+  qtcairo_patch = fetchpatch {
+    url = "https://github.com/giddie/poppler-qt4-cairo-backend/compare/"
+      + "fa1d636...b30f96c.diff"; # update to current maint...qt4-lcd
+    sha256 = "0g18y247k2vcz1n56rnfpy226f22v4r9c7pk8cf2h9l12vz2qxkm";
+  };
+
   poppler_drv = nameSuff: merge: stdenv.mkDerivation (stdenv.lib.mergeAttrsByFuncDefaultsClean [
   rec {
     name = "poppler-${nameSuff}-${version}";
@@ -53,6 +61,7 @@ let
   poppler_glib = poppler_drv "glib" { };
 
   poppler_qt4 = poppler_drv "qt4" {
+    patches = [ qtcairo_patch ];
     propagatedBuildInputs = [ qt4 poppler_glib ];
     NIX_LDFLAGS = "-lpoppler";
     postConfigure = ''
diff --git a/pkgs/development/libraries/qt-5/dlopen-gtkstyle.patch b/pkgs/development/libraries/qt-5/0001-dlopen-gtkstyle.patch
index 05ff30b7ac33..3f411139f5be 100644
--- a/pkgs/development/libraries/qt-5/dlopen-gtkstyle.patch
+++ b/pkgs/development/libraries/qt-5/0001-dlopen-gtkstyle.patch
@@ -1,7 +1,31 @@
-diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/widgets/styles/qgtkstyle_p.cpp qt-everywhere-opensource-src-5.1.1/qtbase/src/widgets/styles/qgtkstyle_p.cpp
---- qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/widgets/styles/qgtkstyle_p.cpp	2013-08-25 20:03:30.000000000 +0200
-+++ qt-everywhere-opensource-src-5.1.1/qtbase/src/widgets/styles/qgtkstyle_p.cpp	2013-09-25 17:58:04.229373681 +0200
-@@ -348,7 +348,7 @@
+From 35d5995a58c86a6addbf0aaf0d1be64d39182872 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:21:58 -0600
+Subject: [PATCH] dlopen-gtkstyle
+
+---
+ qtbase/src/widgets/styles/qgtk2painter.cpp |  2 +-
+ qtbase/src/widgets/styles/qgtkstyle_p.cpp  | 12 ++++++------
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/qtbase/src/widgets/styles/qgtk2painter.cpp b/qtbase/src/widgets/styles/qgtk2painter.cpp
+index 7b9bd97..075947a 100644
+--- a/qtbase/src/widgets/styles/qgtk2painter.cpp
++++ b/qtbase/src/widgets/styles/qgtk2painter.cpp
+@@ -104,7 +104,7 @@ static void initGtk()
+     static bool initialized = false;
+     if (!initialized) {
+         // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
+-        QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0);
++        QLibrary libgtk(QLS("@gtk@/lib/libgtk-x11-2.0"), 0, 0);
+ 
+         QGtk2PainterPrivate::gdk_pixmap_new = (Ptr_gdk_pixmap_new)libgtk.resolve("gdk_pixmap_new");
+         QGtk2PainterPrivate::gdk_pixbuf_get_from_drawable = (Ptr_gdk_pixbuf_get_from_drawable)libgtk.resolve("gdk_pixbuf_get_from_drawable");
+diff --git a/qtbase/src/widgets/styles/qgtkstyle_p.cpp b/qtbase/src/widgets/styles/qgtkstyle_p.cpp
+index 2c64225..3343d32 100644
+--- a/qtbase/src/widgets/styles/qgtkstyle_p.cpp
++++ b/qtbase/src/widgets/styles/qgtkstyle_p.cpp
+@@ -334,7 +334,7 @@ void QGtkStylePrivate::gtkWidgetSetFocus(GtkWidget *widget, bool focus)
  void QGtkStylePrivate::resolveGtk() const
  {
      // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
@@ -10,7 +34,7 @@ diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/widgets/styles/qgtk
  
      gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init");
      gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new");
-@@ -461,8 +461,8 @@
+@@ -432,8 +432,8 @@ void QGtkStylePrivate::resolveGtk() const
      pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family");
      pango_font_description_get_style = (Ptr_pango_font_description_get_style)libgtk.resolve("pango_font_description_get_style");
  
@@ -21,7 +45,7 @@ diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/widgets/styles/qgtk
  }
  
  /* \internal
-@@ -630,9 +630,9 @@
+@@ -601,9 +601,9 @@ void QGtkStylePrivate::cleanupGtkWidgets()
  static bool resolveGConf()
  {
      if (!QGtkStylePrivate::gconf_client_get_default) {
@@ -34,3 +58,6 @@ diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/widgets/styles/qgtk
      }
      return (QGtkStylePrivate::gconf_client_get_default !=0);
  }
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0002-dlopen-webkit-nsplugin.patch b/pkgs/development/libraries/qt-5/0002-dlopen-webkit-nsplugin.patch
new file mode 100644
index 000000000000..0752cdcf4793
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0002-dlopen-webkit-nsplugin.patch
@@ -0,0 +1,53 @@
+From 8c30f72dbe11752e8ed25f292c6e5695d7733f72 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:22:23 -0600
+Subject: [PATCH] dlopen-webkit-nsplugin
+
+---
+ qtwebkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp                  | 2 +-
+ qtwebkit/Source/WebCore/plugins/qt/PluginViewQt.cpp                     | 2 +-
+ .../WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp       | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/qtwebkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp b/qtwebkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+index 679480b..2c373cc 100644
+--- a/qtwebkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp
++++ b/qtwebkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+@@ -132,7 +132,7 @@ static void initializeGtk(QLibrary* module = 0)
+         }
+     }
+ 
+-    QLibrary library(QLatin1String("libgtk-x11-2.0"), 0);
++    QLibrary library(QLatin1String("@gtk@/lib/libgtk-x11-2.0"), 0);
+     if (library.load()) {
+         typedef void *(*gtk_init_check_ptr)(int*, char***);
+         gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
+diff --git a/qtwebkit/Source/WebCore/plugins/qt/PluginViewQt.cpp b/qtwebkit/Source/WebCore/plugins/qt/PluginViewQt.cpp
+index de06a2f..363bde5 100644
+--- a/qtwebkit/Source/WebCore/plugins/qt/PluginViewQt.cpp
++++ b/qtwebkit/Source/WebCore/plugins/qt/PluginViewQt.cpp
+@@ -697,7 +697,7 @@ static Display *getPluginDisplay()
+     // support gdk based plugins (like flash) that use a different X connection.
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
+-    QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++    QLibrary library(QLatin1String("@gdk_pixbuf@/lib/libgdk-x11-2.0"), 0);
+     if (!library.load())
+         return 0;
+ 
+diff --git a/qtwebkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/qtwebkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+index d734ff6..62a2197 100644
+--- a/qtwebkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
++++ b/qtwebkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+@@ -64,7 +64,7 @@ static Display* getPluginDisplay()
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
+ 
+-    QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++    QLibrary library(QLatin1String("@gdk_pixbuf@/libgdk-x11-2.0"), 0);
+     if (!library.load())
+         return 0;
+ 
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0003-glib-2.32.patch b/pkgs/development/libraries/qt-5/0003-glib-2.32.patch
new file mode 100644
index 000000000000..4abb69da4d85
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0003-glib-2.32.patch
@@ -0,0 +1,25 @@
+From a41c3e3a3a1ce4b373b1bbb98f3a835e9e8a0718 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:22:39 -0600
+Subject: [PATCH] glib-2.32
+
+---
+ qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+index 1f6d25e..087c3fb 100644
+--- a/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
++++ b/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+@@ -81,7 +81,7 @@
+ #include <pthread.h>
+ #elif PLATFORM(GTK)
+ #include <wtf/gtk/GOwnPtr.h>
+-typedef struct _GMutex GMutex;
++typedef union _GMutex GMutex;
+ typedef struct _GCond GCond;
+ #endif
+ 
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0004-dlopen-resolv.patch b/pkgs/development/libraries/qt-5/0004-dlopen-resolv.patch
new file mode 100644
index 000000000000..e6b921b771d3
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0004-dlopen-resolv.patch
@@ -0,0 +1,39 @@
+From 63af41c6eeca28c911c13b1a77afeaf860863c2d Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:22:55 -0600
+Subject: [PATCH] dlopen-resolv
+
+---
+ qtbase/src/network/kernel/qdnslookup_unix.cpp | 2 +-
+ qtbase/src/network/kernel/qhostinfo_unix.cpp  | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/qtbase/src/network/kernel/qdnslookup_unix.cpp b/qtbase/src/network/kernel/qdnslookup_unix.cpp
+index 8c5a0eb..27ebf16 100644
+--- a/qtbase/src/network/kernel/qdnslookup_unix.cpp
++++ b/qtbase/src/network/kernel/qdnslookup_unix.cpp
+@@ -87,7 +87,7 @@ static void resolveLibrary()
+     if (!lib.load())
+ #endif
+     {
+-        lib.setFileName(QLatin1String("resolv"));
++        lib.setFileName(QLatin1String("@glibc/lib/resolv"));
+         if (!lib.load())
+             return;
+     }
+diff --git a/qtbase/src/network/kernel/qhostinfo_unix.cpp b/qtbase/src/network/kernel/qhostinfo_unix.cpp
+index df8c8b1..613d0e0 100644
+--- a/qtbase/src/network/kernel/qhostinfo_unix.cpp
++++ b/qtbase/src/network/kernel/qhostinfo_unix.cpp
+@@ -103,7 +103,7 @@ static void resolveLibrary()
+     if (!lib.load())
+ #endif
+     {
+-        lib.setFileName(QLatin1String("resolv"));
++        lib.setFileName(QLatin1String("@glibc@/lib/libresolv"));
+         if (!lib.load())
+             return;
+     }
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0005-dlopen-gl.patch b/pkgs/development/libraries/qt-5/0005-dlopen-gl.patch
new file mode 100644
index 000000000000..d112427bdd63
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0005-dlopen-gl.patch
@@ -0,0 +1,25 @@
+From 6aaf6858bf817172a4c503158e1701c4837ee790 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:23:08 -0600
+Subject: [PATCH] dlopen-gl
+
+---
+ qtbase/src/plugins/platforms/xcb/qglxintegration.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp b/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp
+index 67235e0..2220a2e 100644
+--- a/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp
++++ b/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp
+@@ -434,7 +434,7 @@ void (*QGLXContext::getProcAddress(const QByteArray &procName)) ()
+             {
+                 extern const QString qt_gl_library_name();
+ //                QLibrary lib(qt_gl_library_name());
+-                QLibrary lib(QLatin1String("GL"));
++                QLibrary lib(QLatin1String("@openglDriver@/lib/libGL"));
+                 glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
+             }
+         }
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0006-tzdir.patch b/pkgs/development/libraries/qt-5/0006-tzdir.patch
new file mode 100644
index 000000000000..d5a74b25fb38
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0006-tzdir.patch
@@ -0,0 +1,52 @@
+From 775fd74351faaabd45f6751618b28e2b05812d05 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:23:22 -0600
+Subject: [PATCH] tzdir
+
+---
+ qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp | 21 +++++++++++++++------
+ 1 file changed, 15 insertions(+), 6 deletions(-)
+
+diff --git a/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp b/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp
+index b4ea91e..a56a245 100644
+--- a/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp
++++ b/qtbase/src/corelib/tools/qtimezoneprivate_tz.cpp
+@@ -68,7 +68,10 @@ typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;
+ // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
+ static QTzTimeZoneHash loadTzTimeZones()
+ {
+-    QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
++    QString path = qgetenv("TZDIR");
++    path += "/zone.tab";
++    if (!QFile::exists(path))
++        path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
+     if (!QFile::exists(path))
+         path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
+ 
+@@ -559,12 +562,18 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
+         if (!tzif.open(QIODevice::ReadOnly))
+             return;
+     } else {
+-        // Open named tz, try modern path first, if fails try legacy path
+-        tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++        // Try TZDIR first
++        QString zoneinfoDir = qgetenv("TZDIR");
++        zoneinfoDir += "/" + QString::fromLocal8Bit(ianaId);
++        tzif.setFileName(zoneinfoDir);
+         if (!tzif.open(QIODevice::ReadOnly)) {
+-            tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+-            if (!tzif.open(QIODevice::ReadOnly))
+-                return;
++            // Open named tz, try modern path first, if fails try legacy path
++            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++            if (!tzif.open(QIODevice::ReadOnly)) {
++                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++                if (!tzif.open(QIODevice::ReadOnly))
++                    return;
++            }
+         }
+     }
+ 
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0007-dlopen-webkit-gtk.patch b/pkgs/development/libraries/qt-5/0007-dlopen-webkit-gtk.patch
new file mode 100644
index 000000000000..9582b714c903
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0007-dlopen-webkit-gtk.patch
@@ -0,0 +1,25 @@
+From 089db8835c80bf2b7dd91a97a5c6eb26636b6ab9 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:26:39 -0600
+Subject: [PATCH] dlopen-webkit-gtk
+
+---
+ qtwebkit/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/qtwebkit/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp b/qtwebkit/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+index 8de6521..0b25748 100644
+--- a/qtwebkit/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
++++ b/qtwebkit/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+@@ -53,7 +53,7 @@ static void messageHandler(QtMsgType type, const QMessageLogContext&, const QStr
+ 
+ static bool initializeGtk()
+ {
+-    QLibrary gtkLibrary(QLatin1String("libgtk-x11-2.0"), 0);
++    QLibrary gtkLibrary(QLatin1String("@gtk@/lib/libgtk-x11-2.0"), 0);
+     if (!gtkLibrary.load())
+         return false;
+     typedef void* (*gtk_init_ptr)(void*, void*);
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0008-dlopen-webkit-udev.patch b/pkgs/development/libraries/qt-5/0008-dlopen-webkit-udev.patch
new file mode 100644
index 000000000000..e8a4ba6a2151
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0008-dlopen-webkit-udev.patch
@@ -0,0 +1,31 @@
+From 25d2922cce383fcaa4c138e0cc6c8d92328eeacb Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:30:41 -0600
+Subject: [PATCH] dlopen-webkit-udev
+
+---
+ qtwebkit/Source/WebCore/platform/qt/GamepadsQt.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/qtwebkit/Source/WebCore/platform/qt/GamepadsQt.cpp b/qtwebkit/Source/WebCore/platform/qt/GamepadsQt.cpp
+index 60ff317..da8ac69 100644
+--- a/qtwebkit/Source/WebCore/platform/qt/GamepadsQt.cpp
++++ b/qtwebkit/Source/WebCore/platform/qt/GamepadsQt.cpp
+@@ -111,12 +111,12 @@ private:
+     bool load()
+     {
+         m_libUdev.setLoadHints(QLibrary::ResolveAllSymbolsHint);
+-        m_libUdev.setFileNameAndVersion(QStringLiteral("udev"), 1);
++        m_libUdev.setFileNameAndVersion(QStringLiteral("@udev@/lib/libudev"), 1);
+         m_loaded = m_libUdev.load();
+         if (resolveMethods())
+             return true;
+ 
+-        m_libUdev.setFileNameAndVersion(QStringLiteral("udev"), 0);
++        m_libUdev.setFileNameAndVersion(QStringLiteral("@udev@/lib/libudev"), 0);
+         m_loaded = m_libUdev.load();
+         return resolveMethods();
+     }
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0009-dlopen-serialport-udev.patch b/pkgs/development/libraries/qt-5/0009-dlopen-serialport-udev.patch
new file mode 100644
index 000000000000..e1e66a3ce95a
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0009-dlopen-serialport-udev.patch
@@ -0,0 +1,28 @@
+From 17c7257e54c00ea2121f2cf95fb2be5e5db6b4ad Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:31:03 -0600
+Subject: [PATCH] dlopen-serialport-udev
+
+---
+ qtserialport/src/serialport/qtudev_p.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/qtserialport/src/serialport/qtudev_p.h b/qtserialport/src/serialport/qtudev_p.h
+index 09940ab..45460f9 100644
+--- a/qtserialport/src/serialport/qtudev_p.h
++++ b/qtserialport/src/serialport/qtudev_p.h
+@@ -119,9 +119,9 @@ inline void *resolveSymbol(QLibrary *udevLibrary, const char *symbolName)
+ inline bool resolveSymbols(QLibrary *udevLibrary)
+ {
+     if (!udevLibrary->isLoaded()) {
+-        udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++        udevLibrary->setFileNameAndVersion(QStringLiteral("@udev@/lib/libudev"), 1);
+         if (!udevLibrary->load()) {
+-            udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++            udevLibrary->setFileNameAndVersion(QStringLiteral("@udev@/lib/libudev"), 0);
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0010-dlopen-libXcursor.patch b/pkgs/development/libraries/qt-5/0010-dlopen-libXcursor.patch
new file mode 100644
index 000000000000..49ade86fae3f
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0010-dlopen-libXcursor.patch
@@ -0,0 +1,29 @@
+From b56e3737ca97e3de664603976989da4419297eb3 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:33:51 -0600
+Subject: [PATCH] dlopen-libXcursor
+
+---
+ qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
+index 6dbac90..4b23fc2 100644
+--- a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
++++ b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp
+@@ -305,10 +305,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
+ #ifdef XCB_USE_XLIB
+     static bool function_ptrs_not_initialized = true;
+     if (function_ptrs_not_initialized) {
+-        QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
++        QLibrary xcursorLib(QLatin1String("@libXcursor@/lib/libXcursor"), 1);
+         bool xcursorFound = xcursorLib.load();
+         if (!xcursorFound) { // try without the version number
+-            xcursorLib.setFileName(QLatin1String("Xcursor"));
++            xcursorLib.setFileName(QLatin1String("@libXcursor@/lib/Xcursor"));
+             xcursorFound = xcursorLib.load();
+         }
+         if (xcursorFound) {
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0011-dlopen-openssl.patch b/pkgs/development/libraries/qt-5/0011-dlopen-openssl.patch
new file mode 100644
index 000000000000..d08061dd5dd6
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0011-dlopen-openssl.patch
@@ -0,0 +1,38 @@
+From 99d458c93698b2d4f16ff164ed54237279ffbb64 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:35:21 -0600
+Subject: [PATCH] dlopen-openssl
+
+---
+ qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp b/qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp
+index 4e6200f..d9c3e7d 100644
+--- a/qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp
++++ b/qtbase/src/network/ssl/qsslsocket_openssl_symbols.cpp
+@@ -585,8 +585,8 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
+ #endif
+ #if defined(SHLIB_VERSION_NUMBER) && !defined(Q_OS_QNX) // on QNX, the libs are always libssl.so and libcrypto.so
+     // first attempt: the canonical name is libssl.so.<SHLIB_VERSION_NUMBER>
+-    libssl->setFileNameAndVersion(QLatin1String("ssl"), QLatin1String(SHLIB_VERSION_NUMBER));
+-    libcrypto->setFileNameAndVersion(QLatin1String("crypto"), QLatin1String(SHLIB_VERSION_NUMBER));
++    libssl->setFileNameAndVersion(QLatin1String("@openssl@/lib/libssl"), QLatin1String(SHLIB_VERSION_NUMBER));
++    libcrypto->setFileNameAndVersion(QLatin1String("@openssl@/lib/libcrypto"), QLatin1String(SHLIB_VERSION_NUMBER));
+     if (libcrypto->load() && libssl->load()) {
+         // libssl.so.<SHLIB_VERSION_NUMBER> and libcrypto.so.<SHLIB_VERSION_NUMBER> found
+         return pair;
+@@ -597,8 +597,8 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl()
+ #endif
+ 
+     // second attempt: find the development files libssl.so and libcrypto.so
+-    libssl->setFileNameAndVersion(QLatin1String("ssl"), -1);
+-    libcrypto->setFileNameAndVersion(QLatin1String("crypto"), -1);
++    libssl->setFileNameAndVersion(QLatin1String("@openssl@/lib/libssl"), -1);
++    libcrypto->setFileNameAndVersion(QLatin1String("@openssl@/lib/libcrypto"), -1);
+     if (libcrypto->load() && libssl->load()) {
+         // libssl.so.0 and libcrypto.so.0 found
+         return pair;
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/0012-dlopen-dbus.patch b/pkgs/development/libraries/qt-5/0012-dlopen-dbus.patch
new file mode 100644
index 000000000000..f32386e114b7
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/0012-dlopen-dbus.patch
@@ -0,0 +1,25 @@
+From eec8a79c6cc9e2c65fd43db48ca2347de3ae0c5e Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 1 Dec 2014 17:38:04 -0600
+Subject: [PATCH] dlopen-dbus
+
+---
+ qtbase/src/dbus/qdbus_symbols.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/qtbase/src/dbus/qdbus_symbols.cpp b/qtbase/src/dbus/qdbus_symbols.cpp
+index a7a1b67..661baf1 100644
+--- a/qtbase/src/dbus/qdbus_symbols.cpp
++++ b/qtbase/src/dbus/qdbus_symbols.cpp
+@@ -93,7 +93,7 @@ bool qdbus_loadLibDBus()
+ 
+     static int majorversions[] = { 3, 2, -1 };
+     lib->unload();
+-    lib->setFileName(QLatin1String("dbus-1"));
++    lib->setFileName(QLatin1String("@dbus_libs@/lib/libdbus-1"));
+     for (uint i = 0; i < sizeof(majorversions) / sizeof(majorversions[0]); ++i) {
+         lib->setFileNameAndVersion(lib->fileName(), majorversions[i]);
+         if (lib->load() && lib->resolve("dbus_connection_open_private"))
+-- 
+2.1.3
+
diff --git a/pkgs/development/libraries/qt-5/default.nix b/pkgs/development/libraries/qt-5/default.nix
index fe290fd69fcf..d11980752976 100644
--- a/pkgs/development/libraries/qt-5/default.nix
+++ b/pkgs/development/libraries/qt-5/default.nix
@@ -3,9 +3,9 @@
 , mesaSupported, mesa, mesa_glu, openssl, dbus, cups, pkgconfig
 , libtiff, glib, icu, mysql, postgresql, sqlite, perl, coreutils, libXi
 , gdk_pixbuf, python, gdb, xlibs, libX11, libxcb, xcbutil, xcbutilimage
-, xcbutilkeysyms, xcbutilwm,udev, libxml2, libxslt, pcre, libxkbcommon
+, xcbutilkeysyms, xcbutilwm, udev, libxml2, libxslt, pcre, libxkbcommon
 , alsaLib, gstreamer, gst_plugins_base
-, pulseaudio, bison, flex, gperf, ruby, libwebp
+, pulseaudio, bison, flex, gperf, ruby, libwebp, libXcursor
 , flashplayerFix ? false
 , gtkStyle ? false, libgnomeui, gtk, GConf, gnome_vfs
 , buildDocs ? false
@@ -17,8 +17,8 @@
 with stdenv.lib;
 
 let
-  v_maj = "5.2";
-  v_min = "1";
+  v_maj = "5.3";
+  v_min = "2";
   ver = "${v_maj}.${v_min}";
 in
 
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
   src = fetchurl {
     url = "http://download.qt-project.org/official_releases/qt/"
       + "${v_maj}/${ver}/single/qt-everywhere-opensource-src-${ver}.tar.gz";
-    sha256 = "18bxrnyis7xbhpxpf7w42i54hs4qr062b1wx4c0dpmja3lc29sc4";
+    sha256 = "0b98n2jl62dyqxwn1gdj9xmk8wrrdxnazr65fdk5qw1hmlpgvly8";
   };
 
   # The version property must be kept because it will be included into the QtSDK package name
@@ -45,23 +45,40 @@ stdenv.mkDerivation rec {
   '';
 
   patches =
-    [ ./glib-2.32.patch
+    optional gtkStyle
       (substituteAll {
-        src = ./qt-5.2-dlopen-absolute-paths.patch;
-        inherit cups icu libXfixes;
-        glibc = stdenv.gcc.libc;
-        openglDriver = if mesaSupported then mesa.driverLink else "/no-such-path";
-      })
-    ] ++ optional gtkStyle (substituteAll {
-        src = ./dlopen-gtkstyle.patch;
+        src = ./0001-dlopen-gtkstyle.patch;
         # substituteAll ignores env vars starting with capital letter
         gconf = GConf;
         inherit gnome_vfs libgnomeui gtk;
       })
-    ++ optional flashplayerFix (substituteAll {
-        src = ./dlopen-webkit-nsplugin.patch;
+    ++ optional flashplayerFix
+      (substituteAll {
+        src = ./0002-dlopen-webkit-nsplugin.patch;
         inherit gtk gdk_pixbuf;
-      });
+      })
+    ++ optional flashplayerFix
+      (substituteAll {
+        src = ./0007-dlopen-webkit-gtk.patch;
+        inherit gtk;
+      })
+    ++ [
+      ./0003-glib-2.32.patch
+      (substituteAll {
+        src = ./0004-dlopen-resolv.patch;
+        glibc = stdenv.gcc.libc;
+      })
+      (substituteAll {
+        src = ./0005-dlopen-gl.patch;
+        openglDriver = if mesaSupported then mesa.driverLink else "/no-such-path";
+      })
+      ./0006-tzdir.patch
+      (substituteAll { src = ./0008-dlopen-webkit-udev.patch; inherit udev; })
+      (substituteAll { src = ./0009-dlopen-serialport-udev.patch; inherit udev; })
+      (substituteAll { src = ./0010-dlopen-libXcursor.patch; inherit libXcursor; })
+      (substituteAll { src = ./0011-dlopen-openssl.patch; inherit openssl; })
+      (substituteAll { src = ./0012-dlopen-dbus.patch; dbus_libs = dbus; })
+    ];
 
   preConfigure = ''
     export LD_LIBRARY_PATH="$PWD/qtbase/lib:$PWD/qtbase/plugins/platforms:$PWD/qttools/lib:$LD_LIBRARY_PATH"
@@ -92,7 +109,6 @@ stdenv.mkDerivation rec {
     -gui
     -widgets
     -opengl desktop
-    -javascript-jit
     -qml-debug
     -nis
     -iconv
@@ -160,7 +176,7 @@ stdenv.mkDerivation rec {
     homepage = http://qt-project.org;
     description = "A cross-platform application framework for C++";
     license = "GPL/LGPL";
-    maintainers = [ maintainers.bbenoist ];
+    maintainers = with maintainers; [ bbenoist qknight ttuegel ];
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/qt-5/dlopen-webkit-nsplugin.patch b/pkgs/development/libraries/qt-5/dlopen-webkit-nsplugin.patch
deleted file mode 100644
index 7cd90551454f..000000000000
--- a/pkgs/development/libraries/qt-5/dlopen-webkit-nsplugin.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtwebkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp qt-everywhere-opensource-src-5.1.1/qtwebkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp
---- qt-everywhere-opensource-src-5.1.1-orig/qtwebkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp	2013-08-25 20:04:47.000000000 +0200
-+++ qt-everywhere-opensource-src-5.1.1/qtwebkit/Source/WebCore/plugins/qt/PluginPackageQt.cpp	2013-09-25 17:59:45.925363807 +0200
-@@ -132,7 +132,7 @@
-         }
-     }
- 
--    QLibrary library(QLatin1String("libgtk-x11-2.0"), 0);
-+    QLibrary library(QLatin1String("@gtk@/lib/libgtk-x11-2.0"), 0);
-     if (library.load()) {
-         typedef void *(*gtk_init_check_ptr)(int*, char***);
-         gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
-diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtwebkit/Source/WebCore/plugins/qt/PluginViewQt.cpp qt-everywhere-opensource-src-5.1.1/qtwebkit/Source/WebCore/plugins/qt/PluginViewQt.cpp
---- qt-everywhere-opensource-src-5.1.1-orig/qtwebkit/Source/WebCore/plugins/qt/PluginViewQt.cpp	2013-08-25 20:04:47.000000000 +0200
-+++ qt-everywhere-opensource-src-5.1.1/qtwebkit/Source/WebCore/plugins/qt/PluginViewQt.cpp	2013-09-25 18:00:29.551215155 +0200
-@@ -702,7 +702,7 @@
-     // support gdk based plugins (like flash) that use a different X connection.
-     // The code below has the same effect as this one:
-     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
--    QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
-+    QLibrary library(QLatin1String("@gdk_pixbuf@/lib/libgdk-x11-2.0"), 0);
-     if (!library.load())
-         return 0;
- 
-diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtwebkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp qt-everywhere-opensource-src-5.1.1/qtwebkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
---- qt-everywhere-opensource-src-5.1.1-orig/qtwebkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2013-08-25 20:04:42.000000000 +0200
-+++ qt-everywhere-opensource-src-5.1.1/qtwebkit/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp	2013-09-25 18:04:54.955408293 +0200
-@@ -64,7 +64,7 @@
-     // The code below has the same effect as this one:
-     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
- 
--    QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
-+    QLibrary library(QLatin1String("@gdk_pixbuf@/libgdk-x11-2.0"), 0);
-     if (!library.load())
-         return 0;
- 
diff --git a/pkgs/development/libraries/qt-5/glib-2.32.patch b/pkgs/development/libraries/qt-5/glib-2.32.patch
deleted file mode 100644
index eb71e79d1472..000000000000
--- a/pkgs/development/libraries/qt-5/glib-2.32.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h qt-everywhere-opensource-src-5.1.1/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
---- qt-everywhere-opensource-src-5.1.1-orig/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h	2013-08-25 20:04:35.000000000 +0200
-+++ qt-everywhere-opensource-src-5.1.1/qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h	2013-09-25 18:09:22.154639482 +0200
-@@ -81,7 +81,7 @@
- #include <pthread.h>
- #elif PLATFORM(GTK)
- #include <wtf/gtk/GOwnPtr.h>
--typedef struct _GMutex GMutex;
-+typedef union _GMutex GMutex;
- typedef struct _GCond GCond;
- #endif
- 
diff --git a/pkgs/development/libraries/qt-5/qt-5.2-dlopen-absolute-paths.patch b/pkgs/development/libraries/qt-5/qt-5.2-dlopen-absolute-paths.patch
deleted file mode 100644
index 3163e235d02c..000000000000
--- a/pkgs/development/libraries/qt-5/qt-5.2-dlopen-absolute-paths.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/network/kernel/qhostinfo_unix.cpp qt-everywhere-opensource-src-5.1.1/qtbase/src/network/kernel/qhostinfo_unix.cpp
---- qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/network/kernel/qhostinfo_unix.cpp	2013-08-25 20:03:35.000000000 +0200
-+++ qt-everywhere-opensource-src-5.1.1/qtbase/src/network/kernel/qhostinfo_unix.cpp	2013-09-25 17:43:14.047015411 +0200
-@@ -103,7 +103,7 @@
-     if (!lib.load())
- #endif
-     {
--        lib.setFileName(QLatin1String("resolv"));
-+        lib.setFileName(QLatin1String("@glibc@/lib/libresolv"));
-         if (!lib.load())
-             return;
-     }
-diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp qt-everywhere-opensource-src-5.1.1/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp
---- qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp	2013-08-25 20:03:35.000000000 +0200
-+++ qt-everywhere-opensource-src-5.1.1/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp	2013-09-25 17:51:29.834674976 +0200
-@@ -379,7 +379,7 @@
-             {
-                 extern const QString qt_gl_library_name();
- //                QLibrary lib(qt_gl_library_name());
--                QLibrary lib(QLatin1String("GL"));
-+                QLibrary lib(QLatin1String("@openglDriver@/lib/libGL"));
-                 glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
-             }
-         }
-diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/printsupport/kernel/qcups.cpp qt-everywhere-opensource-src-5.1.1/qtbase/src/printsupport/kernel/qcups.cpp
---- qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/printsupport/kernel/qcups.cpp	2013-08-25 20:03:36.000000000 +0200
-+++ qt-everywhere-opensource-src-5.1.1/qtbase/src/printsupport/kernel/qcups.cpp	2013-09-25 17:40:35.895942599 +0200
-@@ -91,7 +91,7 @@
- 
- static void resolveCups()
- {
--    QLibrary cupsLib(QLatin1String("cups"), 2);
-+    QLibrary cupsLib(QLatin1String("@cups@/lib/libcups"), 2);
-     if(cupsLib.load()) {
-         _cupsGetDests = (CupsGetDests) cupsLib.resolve("cupsGetDests");
-         _cupsFreeDests = (CupsFreeDests) cupsLib.resolve("cupsFreeDests");
diff --git a/pkgs/development/libraries/qt-5/qt-5.3-dlopen-absolute-paths.patch b/pkgs/development/libraries/qt-5/qt-5.3-dlopen-absolute-paths.patch
deleted file mode 100644
index 66cf342c1076..000000000000
--- a/pkgs/development/libraries/qt-5/qt-5.3-dlopen-absolute-paths.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/network/kernel/qhostinfo_unix.cpp qt-everywhere-opensource-src-5.1.1/qtbase/src/network/kernel/qhostinfo_unix.cpp
---- qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/network/kernel/qhostinfo_unix.cpp	2013-08-25 20:03:35.000000000 +0200
-+++ qt-everywhere-opensource-src-5.1.1/qtbase/src/network/kernel/qhostinfo_unix.cpp	2013-09-25 17:43:14.047015411 +0200
-@@ -103,7 +103,7 @@
-     if (!lib.load())
- #endif
-     {
--        lib.setFileName(QLatin1String("resolv"));
-+        lib.setFileName(QLatin1String("@glibc@/lib/libresolv"));
-         if (!lib.load())
-             return;
-     }
-diff -ruN qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp qt-everywhere-opensource-src-5.1.1/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp
---- qt-everywhere-opensource-src-5.1.1-orig/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp	2013-08-25 20:03:35.000000000 +0200
-+++ qt-everywhere-opensource-src-5.1.1/qtbase/src/plugins/platforms/xcb/qglxintegration.cpp	2013-09-25 17:51:29.834674976 +0200
-@@ -379,7 +379,7 @@
-             {
-                 extern const QString qt_gl_library_name();
- //                QLibrary lib(qt_gl_library_name());
--                QLibrary lib(QLatin1String("GL"));
-+                QLibrary lib(QLatin1String("@openglDriver@/lib/libGL"));
-                 glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
-             }
-         }
diff --git a/pkgs/development/libraries/qt-5/qt-5.3.nix b/pkgs/development/libraries/qt-5/qt-5.3.nix
deleted file mode 100644
index 18b464c6f248..000000000000
--- a/pkgs/development/libraries/qt-5/qt-5.3.nix
+++ /dev/null
@@ -1,165 +0,0 @@
-{ stdenv, fetchurl, substituteAll, libXrender, libXext
-, libXfixes, freetype, fontconfig, zlib, libjpeg, libpng
-, mesaSupported, mesa, mesa_glu, openssl, dbus, cups, pkgconfig
-, libtiff, glib, icu, mysql, postgresql, sqlite, perl, coreutils, libXi
-, gdk_pixbuf, python, gdb, xlibs, libX11, libxcb, xcbutil, xcbutilimage
-, xcbutilkeysyms, xcbutilwm,udev, libxml2, libxslt, pcre, libxkbcommon
-, alsaLib, gstreamer, gst_plugins_base
-, pulseaudio, bison, flex, gperf, ruby, libwebp
-, flashplayerFix ? false
-, gtkStyle ? false, libgnomeui, gtk, GConf, gnome_vfs
-, buildDocs ? false
-, buildExamples ? false
-, buildTests ? false
-, developerBuild ? false
-}:
-
-with stdenv.lib;
-
-let
-  v_maj = "5.3";
-  v_min = "1";
-  ver = "${v_maj}.${v_min}";
-in
-
-stdenv.mkDerivation rec {
-  name = "qt-${ver}";
-
-  src = fetchurl {
-    url = "http://download.qt-project.org/official_releases/qt/"
-      + "${v_maj}/${ver}/single/qt-everywhere-opensource-src-${ver}.tar.gz";
-    sha256 = "189mgfqxjg0jp0vkfrj55p9brl018wzf7lir8yjr0pajp8jqd2ds";
-  };
-
-  # The version property must be kept because it will be included into the QtSDK package name
-  version = ver;
-
-  prePatch = ''
-    substituteInPlace configure --replace /bin/pwd pwd
-    substituteInPlace qtbase/configure --replace /bin/pwd pwd
-    substituteInPlace qtbase/src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
-    substituteInPlace qtbase/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp \
-        --replace /usr/share/X11/locale ${libX11}/share/X11/locale \
-        --replace /usr/lib/X11/locale ${libX11}/share/X11/locale
-    sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i config.tests/*/*.test -i qtbase/mkspecs/*/*.conf
-  '';
-
-  patches =
-    [ ./glib-2.32.patch
-      (substituteAll {
-        src = ./qt-5.3-dlopen-absolute-paths.patch;
-        inherit cups icu libXfixes;
-        glibc = stdenv.gcc.libc;
-        openglDriver = if mesaSupported then mesa.driverLink else "/no-such-path";
-      })
-    ] ++ optional gtkStyle (substituteAll {
-        src = ./dlopen-gtkstyle.patch;
-        # substituteAll ignores env vars starting with capital letter
-        gconf = GConf;
-        inherit gnome_vfs libgnomeui gtk;
-      })
-    ++ optional flashplayerFix (substituteAll {
-        src = ./dlopen-webkit-nsplugin.patch;
-        inherit gtk gdk_pixbuf;
-      });
-
-  preConfigure = ''
-    export LD_LIBRARY_PATH="$PWD/qtbase/lib:$PWD/qtbase/plugins/platforms:$PWD/qttools/lib:$LD_LIBRARY_PATH"
-    export MAKEFLAGS=-j$NIX_BUILD_CORES
-  '';
-
-  prefixKey = "-prefix ";
-
-  # -no-eglfs, -no-directfb, -no-linuxfb and -no-kms because of the current minimalist mesa
-  # TODO Remove obsolete and useless flags once the build will be totally mastered
-  configureFlags = ''
-    -verbose
-    -confirm-license
-    -opensource
-
-    -release
-    -shared
-    -c++11
-    ${optionalString developerBuild "-developer-build"}
-    -largefile
-    -accessibility
-    -rpath
-    -optimized-qmake
-    -strip
-    -reduce-relocations
-    -system-proxies
-
-    -gui
-    -widgets
-    -opengl desktop
-    -qml-debug
-    -nis
-    -iconv
-    -icu
-    -pch
-    -glib
-    -xcb
-    -qpa xcb
-    -${optionalString (cups == null) "no-"}cups
-
-    -no-eglfs
-    -no-directfb
-    -no-linuxfb
-    -no-kms
-
-    -system-zlib
-    -system-libpng
-    -system-libjpeg
-    -system-xcb
-    -system-xkbcommon
-    -openssl-linked
-    -dbus-linked
-
-    -system-sqlite
-    -${if mysql != null then "plugin" else "no"}-sql-mysql
-    -${if postgresql != null then "plugin" else "no"}-sql-psql
-
-    -make libs
-    -make tools
-    -${optionalString (buildExamples == false) "no"}make examples
-    -${optionalString (buildTests == false) "no"}make tests
-  '';
-
-  propagatedBuildInputs = [
-    xlibs.libXcomposite libX11 libxcb libXext libXrender libXi
-    fontconfig freetype openssl dbus.libs glib udev libxml2 libxslt pcre
-    zlib libjpeg libpng libtiff sqlite icu
-    libwebp alsaLib gstreamer gst_plugins_base pulseaudio
-    xcbutil xcbutilimage xcbutilkeysyms xcbutilwm libxkbcommon
-  ]
-  # Qt doesn't directly need GLU (just GL), but many apps use, it's small and
-  # doesn't remain a runtime-dep if not used
-  ++ optionals mesaSupported [ mesa mesa_glu ]
-  ++ optional (cups != null) cups
-  ++ optional (mysql != null) mysql
-  ++ optional (postgresql != null) postgresql;
-
-  buildInputs = [ gdb bison flex gperf ruby ];
-
-  nativeBuildInputs = [ python perl pkgconfig ];
-
-  postInstall =
-    ''
-      ${optionalString buildDocs ''
-        make docs && make install_docs
-      ''}
-
-      # Don't retain build-time dependencies like gdb and ruby.
-      sed '/QMAKE_DEFAULT_.*DIRS/ d' -i $out/mkspecs/qconfig.pri
-    '';
-
-  enableParallelBuilding = true; # often fails on Hydra, as well as qt4
-
-  meta = {
-    homepage = http://qt-project.org;
-    description = "A cross-platform application framework for C++";
-    license = "GPL/LGPL";
-    maintainers = [ maintainers.bbenoist maintainers.qknight ];
-    platforms = platforms.linux;
-  };
-}
diff --git a/pkgs/development/libraries/stlport/default.nix b/pkgs/development/libraries/stlport/default.nix
index 5588646e53ad..30f87d36ddf9 100644
--- a/pkgs/development/libraries/stlport/default.nix
+++ b/pkgs/development/libraries/stlport/default.nix
@@ -21,5 +21,6 @@ stdenv.mkDerivation rec {
     description = "An implementation of the C++ Standard Library";
     homepage = http://sourceforge.net/projects/stlport/;
     license = stdenv.lib.licenses.free; # seems BSD-like
+    broken = true; # probably glibc-2.20 -related issue
   };
 }
diff --git a/pkgs/development/tools/misc/tcptrack/default.nix b/pkgs/development/tools/misc/tcptrack/default.nix
index 645bd0611777..a6e40a4809ab 100644
--- a/pkgs/development/tools/misc/tcptrack/default.nix
+++ b/pkgs/development/tools/misc/tcptrack/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ ncurses libpcap ];
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   meta = with stdenv.lib; {
     description = "libpcap based program for live TCP connection monitoring";
     homepage = http://www.rhythm.cx/~steve/devel/tcptrack/; # dead link
diff --git a/pkgs/os-specific/linux/busybox/busybox-in-store.patch b/pkgs/os-specific/linux/busybox/busybox-in-store.patch
new file mode 100644
index 000000000000..ea245a49259b
--- /dev/null
+++ b/pkgs/os-specific/linux/busybox/busybox-in-store.patch
@@ -0,0 +1,16 @@
+Allow BusyBox to be invoked as "<something>-busybox". This is
+necessary when it's run from the Nix store as <hash>-busybox during
+stdenv bootstrap.
+
+diff -ru -x '*~' busybox-1.22.1-orig/libbb/appletlib.c busybox-1.22.1/libbb/appletlib.c
+--- busybox-1.22.1-orig/libbb/appletlib.c	2014-01-09 19:15:44.000000000 +0100
++++ busybox-1.22.1/libbb/appletlib.c	2014-10-29 09:53:01.232052068 +0100
+@@ -764,7 +764,7 @@
+ 	int applet = find_applet_by_name(name);
+ 	if (applet >= 0)
+ 		run_applet_no_and_exit(applet, argv);
+-	if (strncmp(name, "busybox", 7) == 0)
++	if (strstr(name, "busybox") != 0)
+ 		exit(busybox_main(argv));
+ }
+ 
diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix
index 34eb19380d4a..47f9fb9a5a40 100644
--- a/pkgs/os-specific/linux/busybox/default.nix
+++ b/pkgs/os-specific/linux/busybox/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, enableStatic ? false, extraConfig ? ""}:
+{ lib, stdenv, uclibc, fetchurl, enableStatic ? false, enableMinimal ? false, useUclibc ? false, extraConfig ? "" }:
 
 let
   configParser = ''
@@ -7,14 +7,7 @@ let
             NAME=`echo "$LINE" | cut -d \  -f 1`
             OPTION=`echo "$LINE" | cut -d \  -f 2`
 
-            if test -z "$NAME"; then
-                continue
-            fi
-
-            if test "$NAME" == "CLEAR"; then
-                echo "parseconfig: CLEAR"
-                echo > .config
-            fi
+            if ! [[ "$NAME" =~ ^CONFIG_ ]]; then continue; fi
 
             echo "parseconfig: removing $NAME"
             sed -i /$NAME'\(=\| \)'/d .config
@@ -25,19 +18,6 @@ let
     }
   '';
 
-  nixConfig = ''
-    CONFIG_PREFIX "$out"
-    CONFIG_INSTALL_NO_USR y
-
-    # Use the external mount.cifs program.
-    CONFIG_FEATURE_MOUNT_CIFS n
-    CONFIG_FEATURE_MOUNT_HELPERS y
-  '';
-
-  staticConfig = stdenv.lib.optionalString enableStatic ''
-    CONFIG_STATIC y
-  '';
-
 in
 
 stdenv.mkDerivation rec {
@@ -48,17 +28,34 @@ stdenv.mkDerivation rec {
     sha256 = "12v7nri79v8gns3inmz4k24q7pcnwi00hybs0wddfkcy1afh42xf";
   };
 
+  patches = [ ./busybox-in-store.patch ];
+
   configurePhase = ''
     export KCONFIG_NOTIMESTAMP=1
-    make defconfig
+    make ${if enableMinimal then "allnoconfig" else "defconfig"}
+
     ${configParser}
+
     cat << EOF | parseconfig
-    ${staticConfig}
-    ${nixConfig}
+
+    CONFIG_PREFIX "$out"
+    CONFIG_INSTALL_NO_USR y
+
+    ${lib.optionalString enableStatic ''
+      CONFIG_STATIC y
+    ''}
+
+    # Use the external mount.cifs program.
+    CONFIG_FEATURE_MOUNT_CIFS n
+    CONFIG_FEATURE_MOUNT_HELPERS y
+
     ${extraConfig}
     $extraCrossConfig
     EOF
+
     make oldconfig
+  '' + lib.optionalString useUclibc ''
+    makeFlagsArray+=("CC=gcc -isystem ${uclibc}/include -B${uclibc}/lib -L${uclibc}/lib")
   '';
 
   crossAttrs = {
@@ -75,8 +72,8 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Tiny versions of common UNIX utilities in a single small executable";
     homepage = http://busybox.net/;
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl2;
+    maintainers = [ lib.maintainers.viric ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/busybox/include-missing-sys-resource-header.patch b/pkgs/os-specific/linux/busybox/include-missing-sys-resource-header.patch
deleted file mode 100644
index 8163a86e3cdb..000000000000
--- a/pkgs/os-specific/linux/busybox/include-missing-sys-resource-header.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/include/libbb.h b/include/libbb.h
-index f12800f..e7806c2 100644
---- a/include/libbb.h
-+++ b/include/libbb.h
-@@ -40,6 +40,7 @@
- #include <sys/poll.h>
- #include <sys/ioctl.h>
- #include <sys/mman.h>
-+#include <sys/resource.h>
- #include <sys/socket.h>
- #include <sys/stat.h>
- #include <sys/time.h>
diff --git a/pkgs/os-specific/linux/disk-indicator/default.nix b/pkgs/os-specific/linux/disk-indicator/default.nix
index b60232a9b754..11c1e7ee8a2e 100644
--- a/pkgs/os-specific/linux/disk-indicator/default.nix
+++ b/pkgs/os-specific/linux/disk-indicator/default.nix
@@ -18,6 +18,8 @@ stdenv.mkDerivation {
 
   buildPhase = "make -f makefile";
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   installPhase = ''
     mkdir -p "$out/bin"
     cp ./disk_indicator "$out/bin/"
diff --git a/pkgs/os-specific/linux/e3cfsprogs/default.nix b/pkgs/os-specific/linux/e3cfsprogs/default.nix
index 89d5ad5158ce..ef25d59a9df5 100644
--- a/pkgs/os-specific/linux/e3cfsprogs/default.nix
+++ b/pkgs/os-specific/linux/e3cfsprogs/default.nix
@@ -11,20 +11,10 @@ stdenv.mkDerivation {
     sha256 = "8dd3de546aeb1ae42fb05409aeb724a145fe9aa1dbe1115441c2297c9d48cf31";
   };
 
-  configureFlags =
-    if stdenv ? isDietLibC
-    then ""
-    else "--enable-dynamic-e2fsck --enable-elf-shlibs";
+  configureFlags ="--enable-dynamic-e2fsck --enable-elf-shlibs";
   buildInputs = [gettext];
   preInstall = "installFlagsArray=('LN=ln -s')";
   postInstall = "make install-libs";
-
-  NIX_CFLAGS_COMPILE =
-    if stdenv ? isDietLibC then
-      "-UHAVE_SYS_PRCTL_H " +
-      (if stdenv.system == "x86_64-linux" then "-DHAVE_LSEEK64_PROTOTYPE=1 -Dstat64=stat" else "")
-    else "";
 }
 
-
 #note that ext3cow requires the ext3cow kernel patch !!!!
diff --git a/pkgs/os-specific/linux/kernel-headers/3.7.nix b/pkgs/os-specific/linux/kernel-headers/3.12.nix
index 9bf189c40eda..2fd34c68edc6 100644
--- a/pkgs/os-specific/linux/kernel-headers/3.7.nix
+++ b/pkgs/os-specific/linux/kernel-headers/3.12.nix
@@ -4,7 +4,7 @@ assert cross == null -> stdenv.isLinux;
 
 let
 
-  version = "3.12.6";
+  version = "3.12.32";
 
   kernelHeadersBaseConfig =
     if cross == null
@@ -17,8 +17,8 @@ stdenv.mkDerivation {
   name = "linux-headers-${version}";
 
   src = fetchurl {
-    url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.bz2";
-    sha256 = "1qh6f1az0flfrbkdjx1i9r7yf31ad0gxigax91nd33z2jmd6h4df";
+    url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.xz";
+    sha256 = "1hzws2bf267hfk81ywqcxspkyi1lg56x63izdc0pv1338xcfas53";
   };
 
   targetConfig = if cross != null then cross.config else null;
diff --git a/pkgs/os-specific/linux/kernel/perf.nix b/pkgs/os-specific/linux/kernel/perf.nix
index 8b8f7e1e78db..be375ea310f1 100644
--- a/pkgs/os-specific/linux/kernel/perf.nix
+++ b/pkgs/os-specific/linux/kernel/perf.nix
@@ -25,6 +25,8 @@ stdenv.mkDerivation {
   buildInputs = [ elfutils python perl newt slang pkgconfig] ++
     stdenv.lib.optional withGtk gtk;
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   installFlags = "install install-man ASCIIDOC8=1";
 
   inherit elfutils;
diff --git a/pkgs/os-specific/linux/module-init-tools/default.nix b/pkgs/os-specific/linux/module-init-tools/default.nix
index 4877a2c77946..1302d7b1fef0 100644
--- a/pkgs/os-specific/linux/module-init-tools/default.nix
+++ b/pkgs/os-specific/linux/module-init-tools/default.nix
@@ -26,10 +26,6 @@ stdenv.mkDerivation {
 
   postInstall = "rm $out/sbin/insmod.static"; # don't need it
 
-  # We don't want bash (and therefore glibc) in the closure of the
-  # output, since we want to put this in a initrd.
-  dontPatchShebangs = stdenv ? isDietLibC;
-
   meta = {
     homepage = http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/;
     description = "Tools for loading and managing Linux kernel modules";
diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix
index a0df3d526f59..169733112054 100644
--- a/pkgs/os-specific/linux/uclibc/default.nix
+++ b/pkgs/os-specific/linux/uclibc/default.nix
@@ -16,11 +16,6 @@ let
                 continue
             fi
 
-            if test "$NAME" == "CLEAR"; then
-                echo "parseconfig: CLEAR"
-                echo > .config
-            fi
-
             echo "parseconfig: removing $NAME"
             sed -i /^$NAME=/d .config
 
@@ -51,13 +46,14 @@ let
   '';
 
 in
+
 stdenv.mkDerivation {
-  name = "uclibc-0.9.33.2" + stdenv.lib.optionalString (cross != null)
+  name = "uclibc-0.9.34-pre-20141029" + stdenv.lib.optionalString (cross != null)
     ("-" + cross.config);
 
   src = fetchurl {
-    url = http://www.uclibc.org/downloads/uClibc-0.9.33.2.tar.bz2;
-    sha256 = "0qhngsbzj2s6nz92b1s2p0dmvwk8xiqpy58j7ljzw186grvjr3cq";
+    url = http://www.uclibc.org/downloads/snapshots/uClibc-20141029.tar.bz2;
+    sha256 = "018r3bhw1jyyihmm5xxq1psl3r5yx02a57p8qxvay3vvzxn2cvzm";
   };
 
   # 'ftw' needed to build acl, a coreutils dependency
@@ -80,6 +76,8 @@ stdenv.mkDerivation {
 
   buildInputs = stdenv.lib.optional (gccCross != null) gccCross;
 
+  enableParallelBuilding = true;
+
   installPhase = ''
     mkdir -p $out
     make PREFIX=$out VERBOSE=1 install ${crossMakeFlag}
@@ -92,7 +90,7 @@ stdenv.mkDerivation {
     # Derivations may check for the existance of this attribute, to know what to link to.
     inherit libiconv;
   };
-  
+
   meta = {
     homepage = http://www.uclibc.org/;
     description = "A small implementation of the C library";
diff --git a/pkgs/servers/monitoring/seyren/default.nix b/pkgs/servers/monitoring/seyren/default.nix
index e428067ab62b..ab8365c23f81 100644
--- a/pkgs/servers/monitoring/seyren/default.nix
+++ b/pkgs/servers/monitoring/seyren/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   phases = ["installPhase"];
 
-  buildInputs = [ makeWrapper jre src ];
+  buildInputs = [ makeWrapper jre ];
 
   installPhase = ''
     mkdir -p "$out"/bin
diff --git a/pkgs/servers/restund/default.nix b/pkgs/servers/restund/default.nix
index d6952e9700ee..cf07d0e6e3e1 100644
--- a/pkgs/servers/restund/default.nix
+++ b/pkgs/servers/restund/default.nix
@@ -28,5 +28,6 @@ stdenv.mkDerivation rec {
     downloadPage = "http://www.creytiv.com/pub/";
     updateWalker = true;
     downloadURLRegexp = "/restund-.*[.]tar[.]";
+    broken = true; # probably due to glibc-2.20
   };
 }
diff --git a/pkgs/servers/sip/freeswitch/default.nix b/pkgs/servers/sip/freeswitch/default.nix
index c4a5fcc4284e..5b6ff15cb10a 100644
--- a/pkgs/servers/sip/freeswitch/default.nix
+++ b/pkgs/servers/sip/freeswitch/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ ncurses curl pkgconfig gnutls readline openssl perl libjpeg
     libzrtpcpp ];
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   meta = {
     description = "Cross-Platform Scalable FREE Multi-Protocol Soft Switch";
     homepage = http://freeswitch.org/;
diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix
index 04f820223731..c0548f07dd33 100644
--- a/pkgs/servers/sql/mariadb/default.nix
+++ b/pkgs/servers/sql/mariadb/default.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DWITH_READLINE=yes" "-DWITH_EMBEDDED_SERVER=yes" "-DINSTALL_SCRIPTDIR=bin" ];
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   enableParallelBuilding = true;
 
   prePatch = ''
diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index efe35b42b40d..8e4566d906d4 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -1375,11 +1375,11 @@ let
   }) // {inherit ;};
 
   xf86inputevdev = (mkDerivation "xf86inputevdev" {
-    name = "xf86-input-evdev-2.8.4";
+    name = "xf86-input-evdev-2.9.1";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-input-evdev-2.8.4.tar.bz2;
-      sha256 = "030haki1h0m85h91c91812gdnk6znfamw5kpr010zxwwbsgxxyl5";
+      url = mirror://xorg/individual/driver/xf86-input-evdev-2.9.1.tar.bz2;
+      sha256 = "1y82hpx86rngb0yrvcl4ni88wkc3zf9dj25myjk91b7ymll07qqc";
     };
     buildInputs = [pkgconfig inputproto udev xorgserver xproto ];
   }) // {inherit inputproto udev xorgserver xproto ;};
@@ -1645,11 +1645,11 @@ let
   }) // {inherit fontsproto glproto libdrm udev libpciaccess randrproto renderproto videoproto libX11 libXext xextproto xf86driproto xorgserver xproto libXvMC ;};
 
   xf86videoqxl = (mkDerivation "xf86videoqxl" {
-    name = "xf86-video-qxl-0.1.2";
+    name = "xf86-video-qxl-0.1.3";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-video-qxl-0.1.2.tar.bz2;
-      sha256 = "09sjpkg7klzzg9sagmqpsw911501vqk9wdd4nr0jkqqanvkx39s3";
+      url = mirror://xorg/individual/driver/xf86-video-qxl-0.1.3.tar.bz2;
+      sha256 = "1368dd5mihn3s098n7wa3fpjkp8pnamabfjjipkqs9zyrcvncy3m";
     };
     buildInputs = [pkgconfig fontsproto libdrm udev libpciaccess randrproto renderproto videoproto xf86dgaproto xorgserver xproto ];
   }) // {inherit fontsproto libdrm udev libpciaccess randrproto renderproto videoproto xf86dgaproto xorgserver xproto ;};
@@ -1865,11 +1865,11 @@ let
   }) // {inherit inputproto libX11 libXext libXi libXinerama libXrandr ;};
 
   xkbcomp = (mkDerivation "xkbcomp" {
-    name = "xkbcomp-1.2.4";
+    name = "xkbcomp-1.3.0";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/X11R7.7/src/everything/xkbcomp-1.2.4.tar.bz2;
-      sha256 = "0bas1d2wjiy5zy9d0g92d2p9pwv4aapfbfidi7hxy8ax8jmwkl4i";
+      url = mirror://xorg/individual/app/xkbcomp-1.3.0.tar.bz2;
+      sha256 = "0aibcbhhjlwcrxh943xg2dswwx5bz1x0pmhs28b55gzsg0vrgb6g";
     };
     buildInputs = [pkgconfig libX11 libxkbfile xproto ];
   }) // {inherit libX11 libxkbfile xproto ;};
@@ -1985,11 +1985,11 @@ let
   }) // {inherit ;};
 
   xorgserver = (mkDerivation "xorgserver" {
-    name = "xorg-server-1.16.1";
+    name = "xorg-server-1.16.2";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/xserver/xorg-server-1.16.1.tar.bz2;
-      sha256 = "0q706wdbwipyfcvywl7apih3p5mrms3p0wr1hdj5jyzvr5p7qrzl";
+      url = mirror://xorg/individual/xserver/xorg-server-1.16.2.tar.bz2;
+      sha256 = "0r6fhyvlifmg4zw9gm0pf4qybwbkmslhn060ivbwwsjmplz0qvj4";
     };
     buildInputs = [pkgconfig renderproto libdrm openssl libX11 libXau libXaw libxcb xcbutil xcbutilwm xcbutilimage xcbutilkeysyms libXdmcp libXfixes libxkbfile libXmu libXpm libXrender libXres libxshmfence libXt ];
   }) // {inherit renderproto libdrm openssl libX11 libXau libXaw libxcb xcbutil xcbutilwm xcbutilimage xcbutilkeysyms libXdmcp libXfixes libxkbfile libXmu libXpm libXrender libXres libxshmfence libXt ;};
diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix
index a29d184e48c6..a95d88186515 100644
--- a/pkgs/servers/x11/xorg/overrides.nix
+++ b/pkgs/servers/x11/xorg/overrides.nix
@@ -173,6 +173,7 @@ in
   xf86inputevdev = attrs: attrs // {
     preBuild = "sed -e '/motion_history_proc/d; /history_size/d;' -i src/*.c";
     installFlags = "sdkdir=\${out}/include/xorg";
+    buildInputs = attrs.buildInputs ++ [ args.mtdev args.libevdev ];
   };
 
   xf86inputmouse = attrs: attrs // {
@@ -194,6 +195,11 @@ in
       "--with-xorg-conf-dir=$(out)/share/X11/xorg.conf.d"
       "--with-udev-rules-dir=$(out)/lib/udev/rules.d"
     ];
+    patches = [( args.fetchpatch {
+      url = "http://cgit.freedesktop.org/xorg/driver/xf86-input-vmmouse/patch/"
+        + "?id=1cbbc03c4b37d57760c57bd2e0b0f89d744a5795";
+      sha256 = "1qkhwj2yal0cz15lv9557d10ylvxlq05ibq43pm2rrvqdg3mb6h4";
+    })];
   };
 
   xf86videoati = attrs: attrs // {
@@ -209,6 +215,11 @@ in
 
   xf86videovmware = attrs: attrs // {
     buildInputs =  attrs.buildInputs ++ [ args.mesa_drivers ]; # for libxatracker
+    patches = [( args.fetchpatch {
+      url = "http://cgit.freedesktop.org/xorg/driver/xf86-video-vmware/patch/"
+        + "?id=4664412d7a5266d2b392957406b34abc5db95e48";
+      sha256 = "1gix83f1is91iq1zd66nj4k72jm24jjjd9s9l0bzpzhgc8smqdk2";
+    })];
   };
 
   xf86videoqxl = attrs: attrs // {
diff --git a/pkgs/servers/x11/xorg/tarballs-7.7.list b/pkgs/servers/x11/xorg/tarballs-7.7.list
index d3a2f1b45f96..746880171528 100644
--- a/pkgs/servers/x11/xorg/tarballs-7.7.list
+++ b/pkgs/servers/x11/xorg/tarballs-7.7.list
@@ -41,7 +41,7 @@ mirror://xorg/X11R7.7/src/everything/font-mutt-misc-1.0.3.tar.bz2
 mirror://xorg/X11R7.7/src/everything/font-schumacher-misc-1.1.2.tar.bz2
 mirror://xorg/X11R7.7/src/everything/font-screen-cyrillic-1.0.4.tar.bz2
 mirror://xorg/X11R7.7/src/everything/font-sony-misc-1.0.3.tar.bz2
-mirror://xorg/X11R7.7/src/everything/fontsproto-2.1.3.tar.bz2
+mirror://xorg/individual/proto/fontsproto-2.1.3.tar.bz2
 mirror://xorg/X11R7.7/src/everything/font-sun-misc-1.0.3.tar.bz2
 mirror://xorg/X11R7.7/src/everything/font-util-1.3.0.tar.bz2
 mirror://xorg/X11R7.7/src/everything/font-winitzki-cyrillic-1.0.3.tar.bz2
@@ -115,7 +115,7 @@ 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.8.4.tar.bz2
+mirror://xorg/individual/driver/xf86-input-evdev-2.9.1.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-mouse-1.9.1.tar.bz2
@@ -138,7 +138,7 @@ mirror://xorg/individual/driver/xf86-video-intel-2.99.916.tar.bz2
 mirror://xorg/individual/driver/xf86-video-mach64-6.9.4.tar.bz2
 mirror://xorg/individual/driver/xf86-video-mga-1.6.3.tar.bz2
 mirror://xorg/individual/driver/xf86-video-modesetting-0.9.0.tar.bz2
-mirror://xorg/individual/driver/xf86-video-qxl-0.1.2.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/X11R7.7/src/everything/xf86-video-newport-0.2.4.tar.bz2
 mirror://xorg/individual/driver/xf86-video-nv-2.1.20.tar.bz2
@@ -162,7 +162,7 @@ mirror://xorg/X11R7.7/src/everything/xgamma-1.0.5.tar.bz2
 mirror://xorg/individual/app/xhost-1.0.6.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/X11R7.7/src/everything/xkbcomp-1.2.4.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/xkbutils-1.0.4.tar.bz2
 mirror://xorg/individual/data/xkeyboard-config/xkeyboard-config-2.11.tar.bz2
@@ -171,7 +171,7 @@ mirror://xorg/X11R7.7/src/everything/xlsatoms-1.1.1.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/xserver/xorg-server-1.16.1.tar.bz2
+mirror://xorg/individual/xserver/xorg-server-1.16.2.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
 mirror://xorg/individual/app/xprop-1.2.2.tar.bz2
diff --git a/pkgs/shells/bash/bash-4.2-patches.nix b/pkgs/shells/bash/bash-4.2-patches.nix
deleted file mode 100644
index 8ec6bf738352..000000000000
--- a/pkgs/shells/bash/bash-4.2-patches.nix
+++ /dev/null
@@ -1,57 +0,0 @@
-# Automatically generated by `update-patch-set.sh'; do not edit.
-
-patch: [
-(patch "001" "0yml2b6yarrr0dzv7h45lz4126i228hvqbqacqzg4jkcawla0v4d")
-(patch "002" "1yffzfxryvqns513yv3r46slkysa3nbqv40442xfxb4rw4kwkfpy")
-(patch "003" "1kdl9hcpf1m7gz0ja3mvin3syprl2kmbxc3wm27391wc04apq2js")
-(patch "004" "1ha0453cjqdgkns2xkdgpd2izj5b6xlsc9a2w5b3sn6j63wb0d2f")
-(patch "005" "182r2iyk27l28b8kyppfavvzxhax6vn5n1zyy3yirf0463klj5x8")
-(patch "006" "1labcciavnfmn0alncz1x92ydrsriikcimw24rwzmnidbaa4h4f9")
-(patch "007" "15byzdqvavc3zg2lbzzdwpdy43kzdnvmr89nya211pa3yjn2cn20")
-(patch "008" "0dr4p83m2xpxhvd61yny0gdlasq6r9mpyiz220998y0alq8hs213")
-(patch "009" "086b9jkyjgf2zhwln72d7s5x759iskgg3r4hdrw6b5y1ni059vg7")
-(patch "010" "1p23m9kssdmpnjfp96bjmmshzf25cdzlyjygdw8j6sayqa159z5c")
-(patch "011" "0chm4r6zv2kafq1g8xs7r0gixmw9h9r63rgd38rdgfvyk8ssx4d4")
-(patch "012" "1f5pp64rv4mx3r34577pmb15pyxvhmdhmliccnwz20nssbqk6i1m")
-(patch "013" "1sl5rxl3kz39xbnbaf0085jcx0l19l2yqjk0ja2wirmwrg3ca4il")
-(patch "014" "0cwb5ilgx1gcbvnfk93pcpyhvq5wzasyvyllbxrk51c517k7i9mm")
-(patch "015" "164afkc75534x1ad1h6qkl511k2cpirqs2kyx1jddwxx0j1nm1rd")
-(patch "016" "19p20g7h7563m79vvy0adkpzlaxg192affzsm1rxm67wyyycr598")
-(patch "017" "0zzfva20hxfrj5njd321pcjfydiv0kzcqryxfdh1sxlc95228mbk")
-(patch "018" "0ka9pfnjmdak8lvmbryv2r1kkrlffnxbqjxq656la39pf9qlbag2")
-(patch "019" "0mpb0whacppwcdx7pcnf0ah5vjvkw14ang6r2rh9fmkn401cvdx8")
-(patch "020" "0vrwv9wpbr692kf427npmsxzvn007d9alk6jf99v7307s3q76is9")
-(patch "021" "1p5s6apnnbmx4yf1kzndw7fiwvdxamkcgqiv937mwmr6w9xsk1x8")
-(patch "022" "0sswp2c63pclvdwi2hbkwbqf9ysmiw6mmi0qinl2pkgqyyfzdkcx")
-(patch "023" "1gzhcmwj0741libjqwln4r4h9k7lskprc4q87hvqgj56y6a17hax")
-(patch "024" "1rlrdfk67g8as6pr076ldhjhnkd2c86mb4ci18fjivivsfyjdj4r")
-(patch "025" "05am4w789v630x0a6a9wrxhvrjvs73fjn68i55qdand5sxpn9c0d")
-(patch "026" "1li3sd3hpdxhh257hdwzzn2g18m4ksflx6crqswv9qxwmgx0rsg7")
-(patch "027" "0hpdywvny6vihls2qqlwwxkvps7q710vp6szq117zhgwarr6n7qc")
-(patch "028" "0ypdn590h5f8y7kvk2sk93vcjbh5vrcwsaasvprsm0ds77g2chi0")
-(patch "029" "10gm73rvfhr42v7i70qqc56wl8l459i2frs6ifrcsnmw2w48rc6h")
-(patch "030" "1bmg8iz95jijxp89czwaw9msppgj220233nbrn66s4qsb5k46n8j")
-(patch "031" "1yfrz093hghhlrj8na48dzc8v6ax34mj5i0h6l3bnpvp6i6qrwsm")
-(patch "032" "1vci8xh1r8f59j6d95iljw9i555jm1fm2lssm1ycprdivdivba73")
-(patch "033" "0js38r5gmlyz70zjfw0m2j08h26c3vma2vy8gbsb5pwzss82glgm")
-(patch "034" "1f213qpvqnv2bm79a01r44xjlwk65483cxvw6kgwx28k20rg7h81")
-(patch "035" "1pvqxpm7m1y7ab5srq3s7r095z34nbcr62gz6nb89d1qn1iy9kff")
-(patch "036" "1yma0m9wrk6a15x36libb8a0cz7gmzihv6lvmrrd5i1ar4dklagy")
-(patch "037" "0x0niqv7zwqvz4l8n9nivhk0g0036jh5h3vlkil3095vsgfqqmy7")
-(patch "038" "0mvdpsxxs4bn5zvsm04yfsplhcrv6y0avpwilj5yasr0vwdsijdq")
-(patch "039" "148pkj5s73ym0jhpr8d3z5vfily4chm0am4yms4506ijc0531ygl")
-(patch "040" "0v5a98ybibwsd4iyh18gy0kc51mx8qn9w2wfpjaiycn7yg5gjrdj")
-(patch "041" "1szmm8xv41hvbzgxfwrj6dg85wa7zy3781nnil428rlzpm8ikk05")
-(patch "042" "017kpdqy6v9sgi2a931wyzpix86n9mkalpm6n9cb45v58lgmraps")
-(patch "043" "0mswgjk3z80qm1mb93jmbql27nbczxk86cw5byf0m29y1y2869nw")
-(patch "044" "1rk6jywzfvg1crvhib1zk37rsps73minhr7l4vcb3vfdkin2vlqh")
-(patch "045" "0vcqn9rb26bahhrarbwhpa0ny0nrf4vyrzh97d44lfcxypqfzdyx")
-(patch "046" "0vc1ngkxkamwr022ww3vjp9ww9c647az4pjn175c1v60d0xk5hcm")
-(patch "047" "0ymgimqz65sx2izg1dvm1h5cc01arl3j9j5137212l1ls00r55y1")
-(patch "048" "091xk1ms7ycnczsl3fx461gjhj69j6ycnfijlymwj6mj60ims6km")
-(patch "049" "03jipi8qz5baf1dyhld7yvazkkad7lz5czchrjsrnglzvm6df74h")
-(patch "050" "19lb9nh0x5siwf21xkga3khy5pa3srfrlx97mby4cfz8am2bh68s")
-(patch "051" "0705948wzi27zxphkh5vx4n62i671afyrb4qx276n49sq9xk859y")
-(patch "052" "036wc4azli48ri7641fflxh6j95fnsma2167hbn80v7p91qzm67h")
-(patch "053" "1pnkzx8bj8rz219wk8kxs8iga1k2wn13g1yvg3dci19qakbr7ri0")
-]
diff --git a/pkgs/shells/bash/bash-4.3-patches.nix b/pkgs/shells/bash/bash-4.3-patches.nix
new file mode 100644
index 000000000000..cd1fb578e62b
--- /dev/null
+++ b/pkgs/shells/bash/bash-4.3-patches.nix
@@ -0,0 +1,34 @@
+# Automatically generated by `update-patch-set.sh'; do not edit.
+
+patch: [
+(patch "001" "0hip2n2s5hws8p4nfcz37379zn6cak83ljsm64z52rw6ckrdzczc")
+(patch "002" "0ashj5d1g3zbyr7zf0r72s5wnk96cz1xj919y3jajadbc9qcvrzf")
+(patch "003" "0z88q4daq7dmw93iqd9c5i5d1sndklih3nrh0v75746da2n6w3h0")
+(patch "004" "0f0kh9j5k4ym6knshscx31przm50x5cc7ifkwqk0swh6clna982y")
+(patch "005" "1ym3b8b7lgmdp3dklp8qaqhyq965wd5392namq8mz7rb0d231j0s")
+(patch "006" "04q20igq49py49ynb0f83f6f52cdkyqwd9bpic6akr0m5pkqwr50")
+(patch "007" "18zkz23d9myshrwfcwcdjk7qmkqp8az5n91ni9jaixlwqlhy64qi")
+(patch "008" "0pprcwvh7ngdli0x95pc1cpssg4qg7layi9xrv2jq6c7965ajhcr")
+(patch "009" "19a0pf0alp30d1bjj0zf3zq2f5n0s6y91w7brm9jyswl51kns8n0")
+(patch "010" "1dzhr5ammyijisz48cqi5vaw26hfr5vh9smnqxq4qc9p06f7j1ff")
+(patch "011" "0fvzdzzi142a8rf3v965r6gbpn0k7fv2gif1yq8a4160vcn40qvw")
+(patch "012" "04lcgfcyz7p3zagb4hkia3hkpd7lii9m8ycy9qqwzyrm1c1pj4ry")
+(patch "013" "0y9cqi378z6flapkd5k5lfl4lq3ivzg4njj3i3wmw7xb6r9wma5z")
+(patch "014" "04xcb0k9fxxq4vashgzb98567xzdnm4655nlm4jvfvjv6si6ykas")
+(patch "015" "13ay6lldy1p00xj41nfjpq8lai3vw2qwca79gx6s80z04j53wa8k")
+(patch "016" "0wq7bvx3pfw90pnfb86yg5nr9jgjsvm2nq5rrkqxf6zn977hpmlj")
+(patch "017" "103p7sibihv6cshqj12k546zsbz0dnd5cv5vlx1719avddfc4rqj")
+(patch "018" "0n1x3812y1brb9xbabaj3fvr4cpvm2225iwckmqk2fcpkq5b9a3s")
+(patch "019" "08rd1p7zpzgbpmmmnj2im8wj2pcwmbbx51psr9vdc5c049si9ad7")
+(patch "020" "163c6g05qpag2plx5q795pmw3f3m904jy7z93xj2i08pgzc8cpna")
+(patch "021" "1a90cl3h10dh8k9f2ddrsjmw5ywaw2d5x78xb4fd2sryi039yhs1")
+(patch "022" "120s0s4qcqd0q12j1iv0hkpf9fp3w5jnqw646kv66n66jnxlfkgx")
+(patch "023" "1m00sfi88p2akgiyrg4hw0gvz3s1586pkzjdr3dm73vs773m1hls")
+(patch "024" "0v0gjqzjsqjfgj5x17fq7g649k94jn8zq92qsxkhc2d6l215hl1v")
+(patch "025" "0lcj96i659q35f1jcmwwbnw3p7w7vvlxjxqi989vn6d6qksqcl8y")
+(patch "026" "0k919ir0inwn4wai2vdzpbwqq5h54fnrlkmgccxjg91v3ch15k1f")
+(patch "027" "1gnsfvq6bhb3srlbh0cannj2hackdsipcg7z0ds7zlk1hp96mdqy")
+(patch "028" "17a65c4fn4c5rgsiw9gqqnzhznh3gwnd2xzzv2dppyi48znxpc78")
+(patch "029" "14k27p28r5l2fz3r03kd0x72vvsq8bja8c6hjz5kxikbzsbs7i2c")
+(patch "030" "0nrqb0m7s89qsrbfaffpilc5gcf82bx9yvgzld4hr79p5y54yhw5")
+]
diff --git a/pkgs/shells/bash/default.nix b/pkgs/shells/bash/default.nix
index ca12c26f256c..cc3108841b61 100644
--- a/pkgs/shells/bash/default.nix
+++ b/pkgs/shells/bash/default.nix
@@ -3,7 +3,7 @@
 assert interactive -> readline != null;
 
 let
-  realName = "bash-4.2";
+  realName = "bash-4.3";
   baseConfigureFlags = if interactive then "--with-installed-readline" else "--disable-readline";
 in
 
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://gnu/bash/${realName}.tar.gz";
-    sha256 = "a27a1179ec9c0830c65c6aa5d7dab60f7ce1a2a608618570f96bfa72e95ab3d8";
+    sha256 = "1m14s1f61mf6bijfibcjm9y6pkyvz6gibyl8p4hxq90fisi8gimg";
   };
 
   NIX_CFLAGS_COMPILE = ''
@@ -30,11 +30,11 @@ stdenv.mkDerivation rec {
     (let
       patch = nr: sha256:
         fetchurl {
-          url = "mirror://gnu/bash/bash-4.2-patches/bash42-${nr}";
+          url = "mirror://gnu/bash/bash-4.3-patches/bash43-${nr}";
           inherit sha256;
         };
     in
-      import ./bash-4.2-patches.nix patch);
+      import ./bash-4.3-patches.nix patch);
 
   crossAttrs = {
     configureFlags = baseConfigureFlags +
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix
index cf95a5edfadf..3917f63563aa 100644
--- a/pkgs/stdenv/adapters.nix
+++ b/pkgs/stdenv/adapters.nix
@@ -29,63 +29,6 @@ rec {
   overrideSetup = stdenv: setupScript: stdenv.override { inherit setupScript; };
 
 
-  # Return a modified stdenv that uses dietlibc to create small
-  # statically linked binaries.
-  useDietLibC = stdenv: stdenv //
-    { mkDerivation = args: stdenv.mkDerivation (args // {
-        NIX_CFLAGS_LINK = "-static";
-
-        # libcompat.a contains some commonly used functions.
-        NIX_LDFLAGS = "-lcompat";
-
-        # These are added *after* the command-line flags, so we'll
-        # always optimise for size.
-        NIX_CFLAGS_COMPILE =
-          args.NIX_CFLAGS_COMPILE or ""
-          + " -Os -s -D_BSD_SOURCE=1";
-
-        configureFlags =
-          args.configureFlags or ""
-          + " --disable-shared"; # brrr...
-
-        NIX_GCC = import ../build-support/gcc-wrapper {
-          inherit stdenv;
-          libc = pkgs.dietlibc;
-          inherit (stdenv.gcc) gcc binutils nativeTools nativePrefix;
-          nativeLibc = false;
-        };
-      });
-      isDietLibC = true;
-    };
-
-
-  # Return a modified stdenv that uses klibc to create small
-  # statically linked binaries.
-  useKlibc = stdenv: klibc: stdenv //
-    { mkDerivation = args: stdenv.mkDerivation (args // {
-        NIX_CFLAGS_LINK = "-static";
-
-        # These are added *after* the command-line flags, so we'll
-        # always optimise for size.
-        NIX_CFLAGS_COMPILE =
-          args.NIX_CFLAGS_COMPILE or "" + " -Os -s";
-
-        configureFlags =
-          args.configureFlags or "" + " --disable-shared"; # brrr...
-
-        NIX_GCC = pkgs.runCommand "klibc-wrapper" {} ''
-          mkdir -p $out/bin
-          ln -s ${klibc}/bin/klcc $out/bin/gcc
-          ln -s ${klibc}/bin/klcc $out/bin/cc
-          mkdir -p $out/nix-support
-          echo 'PATH=$PATH:${stdenv.gcc.binutils}/bin' > $out/nix-support/setup-hook
-        '';
-      });
-      isKlibc = true;
-      isStatic = true;
-    };
-
-
   # Return a modified stdenv that tries to build statically linked
   # binaries.
   makeStaticBinaries = stdenv: stdenv //
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 904cc13e06c7..1cc60ebf02bc 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -176,10 +176,11 @@ fi
 
 # Check that the pre-hook initialised SHELL.
 if [ -z "$SHELL" ]; then echo "SHELL not set"; exit 1; fi
+BASH="$SHELL"
+export CONFIG_SHELL="$SHELL"
 
 
 # Execute the pre-hook.
-export CONFIG_SHELL="$SHELL"
 if [ -z "$shell" ]; then export shell=$SHELL; fi
 runHook preHook
 
@@ -387,7 +388,7 @@ substituteAll() {
     local output="$2"
 
     # Select all environment variables that start with a lowercase character.
-    for envVar in $(env | sed "s/^[^a-z].*//" | sed "s/^\([^=]*\)=.*/\1/"); do
+    for envVar in $(env | sed -e $'s/^\([a-z][^=]*\)=.*/\\1/; t \n d'); do
         if [ "$NIX_DEBUG" = "1" ]; then
             echo "$envVar -> ${!envVar}"
         fi
diff --git a/pkgs/stdenv/linux/bootstrap/i686.nix b/pkgs/stdenv/linux/bootstrap/i686.nix
index 7b6b3ee80344..88bd984bab96 100644
--- a/pkgs/stdenv/linux/bootstrap/i686.nix
+++ b/pkgs/stdenv/linux/bootstrap/i686.nix
@@ -1,39 +1,12 @@
-let
-
-  fetch = { file, sha256 }: import <nix/fetchurl.nix> {
-    url = "http://tarballs.nixos.org/stdenv-linux/i686/r24519/${file}";
-    inherit sha256;
+{
+  busybox = import <nix/fetchurl.nix> {
+    url = http://tarballs.nixos.org/stdenv-linux/i686/73b75f6157db79fc899154a497823e82e409e76d/busybox;
+    sha256 = "159208615405938d9830634f15d38adf5a9c33643926845c44499dbe6dd62042";
     executable = true;
   };
 
-in {
-  sh = fetch {
-    file = "sh";
-    sha256 = "1l6sdhyqjlh4m5gj3pfpi8aisp1m012lpwxfcc4v1x8g429mflmy";
-  };
-
-  bzip2 = fetch {
-    file = "bzip2";
-    sha256 = "1p5nkrdn52jm6rsx8x3wwjpsh83f2qsjl1qckkgnkplwhj23zjp7";
-  };
-
-  mkdir = fetch {
-    file = "mkdir";
-    sha256 = "02ff7i9ph9ahiapsg2v9c3pwr7sl73sk4n7ic112ljkrgwkail33";
-  };
-
-  cpio = fetch {
-    file = "cpio";
-    sha256 = "046if3aqqramyhrn2yxrjf4bfkl8x1bcqxhvi7ml9nrv9smx8irg";
-  };
-
-  curl = fetch {
-    file = "curl.bz2";
-    sha256 = "1v0yfb4gcdyqpl2fxlxjh337r28c23iqm7vwck4p4643xd55di7q";
-  };
-
-  bootstrapTools = {
-    url = http://tarballs.nixos.org/stdenv-linux/i686/r24519/bootstrap-tools.cpio.bz2;
-    sha256 = "0imypaxy6piwbk8ff2y1nr7yk49pqmdgdbv6g8miq1zs5yfip6ij";
+  bootstrapTools = import <nix/fetchurl.nix> {
+    url = http://tarballs.nixos.org/stdenv-linux/i686/73b75f6157db79fc899154a497823e82e409e76d/bootstrap-tools.tar.xz;
+    sha256 = "68c430b84dbeac0bd1bea4cdd3159dce44a76445e07860caed1972b4608c42ca";
   };
 }
diff --git a/pkgs/stdenv/linux/bootstrap/x86_64.nix b/pkgs/stdenv/linux/bootstrap/x86_64.nix
index 71961e6961e6..96822f57e504 100644
--- a/pkgs/stdenv/linux/bootstrap/x86_64.nix
+++ b/pkgs/stdenv/linux/bootstrap/x86_64.nix
@@ -1,10 +1,9 @@
-# Use the static tools for i686-linux.  They work on x86_64-linux
-# machines as well.
+# Use busybox for i686-linux since it works on x86_64-linux as well.
 (import ./i686.nix) //
 
 {
-  bootstrapTools = {
-    url = http://tarballs.nixos.org/stdenv-linux/x86_64/r23302/bootstrap-tools.cpio.bz2;
-    sha256 = "0w89kqhx47yl0jifp2vffp073pyrqha5f312kp971smi4h41drna";
+  bootstrapTools = import <nix/fetchurl.nix> {
+    url = http://tarballs.nixos.org/stdenv-linux/x86_64/73b75f6157db79fc899154a497823e82e409e76d/bootstrap-tools.tar.xz;
+    sha256 = "e29d47a5dc9f1ff10c3fbaacbd03a3cca0c784299df09fcdd9e25797ec6414ad";
   };
 }
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 76849c2c61ab..cbbddc718969 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -40,20 +40,15 @@ rec {
   bootstrapTools = derivation {
     name = "bootstrap-tools";
 
-    builder = bootstrapFiles.sh;
+    builder = bootstrapFiles.busybox;
 
     args =
       if system == "armv5tel-linux" || system == "armv6l-linux"
         || system == "armv7l-linux"
       then [ ./scripts/unpack-bootstrap-tools-arm.sh ]
-      else [ ./scripts/unpack-bootstrap-tools.sh ];
+      else [ "ash" "-e" ./scripts/unpack-bootstrap-tools.sh ];
 
-    # FIXME: get rid of curl.
-    inherit (bootstrapFiles) bzip2 mkdir curl cpio;
-
-    tarball = import <nix/fetchurl.nix> {
-      inherit (bootstrapFiles.bootstrapTools) url sha256;
-    };
+    tarball = bootstrapFiles.bootstrapTools;
 
     inherit system;
 
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix
index 9116b2225690..e202f691fa8d 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix
@@ -1,4 +1,4 @@
-{system ? builtins.currentSystem}:
+{ system ? builtins.currentSystem }:
 
 with import ../../top-level/all-packages.nix {inherit system;};
 
@@ -6,84 +6,32 @@ rec {
 
 
   # We want coreutils without ACL support.
-  coreutils_ = coreutils.override (args: {
+  coreutilsMinimal = coreutils.override (args: {
     aclSupport = false;
   });
 
-  # bzip2 wants utime.h, a header 'legacy' in uclibc
-  uclibcForBzip2 = uclibc.override {
-    extraConfig = ''
-        UCLIBC_SUSV3_LEGACY y
-        UCLIBC_SUSV4_LEGACY y
-    '';
-  };
-
-  gccLinkStatic = wrapGCCWith (import ../../build-support/gcc-wrapper) uclibcForBzip2
-    stdenv.gcc.gcc;
-  stdenvLinkStatic = overrideGCC stdenv gccLinkStatic;
-
-  curlStatic = import ../../tools/networking/curl {
-    stdenv = stdenvLinkStatic;
-    inherit fetchurl;
+  curlMinimal = curl.override {
     zlibSupport = false;
     sslSupport = false;
-    linkStatic = true;
+    scpSupport = false;
   };
 
-
-  bzip2Static = import ../../tools/compression/bzip2 {
-    stdenv = stdenvLinkStatic;
-    inherit fetchurl;
-    linkStatic = true;
-  };
-
-  #gccNoShared = wrapGCC ( gcc.gcc.override { enableShared = false; } );
-
-  busyboxStaticSh = busybox.override {
+  busyboxMinimal = busybox.override {
+    useUclibc = true;
+    enableStatic = true;
+    enableMinimal = true;
     extraConfig = ''
-      CLEAR
-      CONFIG_STATIC y
-
       CONFIG_ASH y
-      CONFIG_BASH_COMPAT y
-      CONFIG_ASH_ALIAS y
-      CONFIG_ASH_GETOPTS y
-      CONFIG_ASH_CMDCMD y
-      CONFIG_ASH_JOB_CONTROL y
       CONFIG_ASH_BUILTIN_ECHO y
-      CONFIG_ASH_BUILTIN_PRINTF y
       CONFIG_ASH_BUILTIN_TEST y
-    '';
-  };
-
-  busyboxStaticLn = busybox.override {
-    extraConfig = ''
-      CLEAR
-      CONFIG_STATIC y
-      CONFIG_LN y
-    '';
-  };
-
-  busyboxStaticMkdir = busybox.override {
-    extraConfig = ''
-      CLEAR
-      CONFIG_STATIC y
+      CONFIG_ASH_OPTIMIZE_FOR_SIZE y
       CONFIG_MKDIR y
+      CONFIG_TAR y
+      CONFIG_UNXZ y
     '';
   };
 
-  busyboxStaticCpio = busybox.override {
-    extraConfig = ''
-      CLEAR
-      CONFIG_STATIC y
-      CONFIG_CPIO y
-      # (shlevy) Are these necessary?
-      CONFIG_FEATURE_CPIO_O y
-      CONFIG_FEATURE_CPIO_P y
-    '';
-  };
-
-  build = 
+  build =
 
     stdenv.mkDerivation {
       name = "build";
@@ -91,7 +39,7 @@ rec {
       buildInputs = [nukeReferences cpio];
 
       buildCommand = ''
-	set -x
+        set -x
         mkdir -p $out/bin $out/lib $out/libexec
 
         # Copy what we need of Glibc.
@@ -105,26 +53,26 @@ rec {
         cp -d ${glibc}/lib/libnsl*.so* $out/lib
         cp -d ${glibc}/lib/libutil*.so* $out/lib
         cp -d ${glibc}/lib/crt?.o $out/lib
-        
+
         cp -rL ${glibc}/include $out
         chmod -R u+w $out/include
-        
+
         # Hopefully we won't need these.
         rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video
         find $out/include -name .install -exec rm {} \;
         find $out/include -name ..install.cmd -exec rm {} \;
         mv $out/include $out/include-glibc
-        
+
         # Copy coreutils, bash, etc.
-        cp ${coreutils_}/bin/* $out/bin
+        cp ${coreutilsMinimal}/bin/* $out/bin
         (cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
-        
+
         cp ${bash}/bin/bash $out/bin
         cp ${findutils}/bin/find $out/bin
         cp ${findutils}/bin/xargs $out/bin
         cp -d ${diffutils}/bin/* $out/bin
         cp -d ${gnused}/bin/* $out/bin
-        cp -d ${gnugrep}/bin/* $out/bin
+        cp -d ${gnugrep}/bin/grep $out/bin
         cp ${gawk}/bin/gawk $out/bin
         cp -d ${gawk}/bin/awk $out/bin
         cp ${gnutar}/bin/tar $out/bin
@@ -133,9 +81,11 @@ rec {
         cp -d ${gnumake}/bin/* $out/bin
         cp -d ${patch}/bin/* $out/bin
         cp ${patchelf}/bin/* $out/bin
+        cp ${curlMinimal}/bin/curl $out/bin
+        cp -d ${curlMinimal}/lib/libcurl* $out/lib
 
         cp -d ${gnugrep.pcre}/lib/libpcre*.so* $out/lib # needed by grep
-        
+
         # Copy what we need of GCC.
         cp -d ${gcc.gcc}/bin/gcc $out/bin
         cp -d ${gcc.gcc}/bin/cpp $out/bin
@@ -151,6 +101,8 @@ rec {
         rm -rf $out/lib/gcc/*/*/plugin
         #rm -f $out/lib/gcc/*/*/*.a
         cp -rd ${gcc.gcc}/libexec/* $out/libexec
+        chmod -R u+w $out/libexec
+        rm -rf $out/libexec/gcc/*/*/plugin
         mkdir $out/include
         cp -rd ${gcc.gcc}/include/c++ $out/include
         chmod -R u+w $out/include
@@ -159,19 +111,18 @@ rec {
 
         cp -d ${gmpxx}/lib/libgmp*.so* $out/lib
         cp -d ${mpfr}/lib/libmpfr*.so* $out/lib
-        cp -d ${ppl}/lib/libppl*.so* $out/lib
-        cp -d ${cloogppl}/lib/libcloog*.so* $out/lib
         cp -d ${mpc}/lib/libmpc*.so* $out/lib
         cp -d ${zlib}/lib/libz.so* $out/lib
         cp -d ${libelf}/lib/libelf.so* $out/lib
-        
+
         # Copy binutils.
         for i in as ld ar ranlib nm strip readelf objdump; do
           cp ${binutils}/bin/$i $out/bin
         done
+        cp -d ${binutils}/lib/lib*.so* $out/lib
 
         chmod -R u+w $out
-        
+
         # Strip executables even further.
         for i in $out/bin/* $out/libexec/gcc/*/*/*; do
             if test -x $i -a ! -L $i; then
@@ -189,19 +140,10 @@ rec {
         mv $out/.pack $out/pack
 
         mkdir $out/on-server
-        (cd $out/pack && (find | cpio -o -H newc)) | bzip2 > $out/on-server/bootstrap-tools.cpio.bz2
-
-        mkdir $out/in-nixpkgs
-        cp ${busyboxStaticSh}/bin/busybox $out/in-nixpkgs/sh
-        cp ${busyboxStaticCpio}/bin/busybox $out/in-nixpkgs/cpio
-        cp ${busyboxStaticMkdir}/bin/busybox $out/in-nixpkgs/mkdir
-        cp ${busyboxStaticLn}/bin/busybox $out/in-nixpkgs/ln
-        cp ${curlStatic}/bin/curl $out/in-nixpkgs
-        cp ${bzip2Static}/bin/bzip2 $out/in-nixpkgs
-        chmod u+w $out/in-nixpkgs/*
-        strip $out/in-nixpkgs/*
-        nuke-refs $out/in-nixpkgs/*
-        bzip2 $out/in-nixpkgs/curl
+        tar cvfJ $out/on-server/bootstrap-tools.tar.xz -C $out/pack .
+        cp ${busyboxMinimal}/bin/busybox $out/on-server
+        chmod u+w $out/on-server/busybox
+        nuke-refs $out/on-server/busybox
       ''; # */
 
       # The result should not contain any references (store paths) so
@@ -210,22 +152,33 @@ rec {
       allowedReferences = [];
     };
 
-  
+
   unpack =
-    
-    stdenv.mkDerivation {
+
+    derivation {
       name = "unpack";
+      inherit system;
+      builder = "${build}/on-server/busybox";
+      args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
 
       buildCommand = ''
-        ${build}/in-nixpkgs/mkdir $out
-        ${build}/in-nixpkgs/bzip2 -d < ${build}/on-server/bootstrap-tools.cpio.bz2 | (cd $out && ${build}/in-nixpkgs/cpio -v -i)
+        export PATH=${build}/on-server:$out/bin
+
+        busybox mkdir $out
+        < ${build}/on-server/bootstrap-tools.tar.xz busybox unxz | busybox tar x -C $out
 
         for i in $out/bin/* $out/libexec/gcc/*/*/*; do
-            echo patching $i
-            if ! test -L $i; then
-                LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
-                    $out/bin/patchelf --set-interpreter $out/lib/ld-linux*.so.2 --set-rpath $out/lib --force-rpath $i
-            fi
+            if [ -L "$i" ]; then continue; fi
+            if [ -z "''${i##*/liblto*}" ]; then continue; fi
+            echo patching "$i"
+            LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
+                $out/bin/patchelf --set-interpreter $out/lib/ld-linux*.so.2 --set-rpath $out/lib --force-rpath "$i"
+        done
+
+        for i in $out/lib/libpcre*; do
+            if [ -L "$i" ]; then continue; fi
+            echo patching "$i"
+            $out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
         done
 
         # Fix the libc linker script.
@@ -241,11 +194,12 @@ rec {
 
   test =
 
-    stdenv.mkDerivation {
+    derivation {
       name = "test";
+      inherit system;
+      builder = "${build}/on-server/busybox";
+      args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
 
-      realBuilder = "${unpack}/bin/bash";
-      
       buildCommand = ''
         export PATH=${unpack}/bin
         ls -l
@@ -259,23 +213,22 @@ rec {
         awk --version
         grep --version
         gcc --version
-
-        ${build}/in-nixpkgs/sh -c 'echo Hello World'
+        curl --version
 
         ldlinux=$(echo ${unpack}/lib/ld-linux*.so.2)
 
         export CPP="cpp -idirafter ${unpack}/include-glibc -B${unpack}"
         export CC="gcc -idirafter ${unpack}/include-glibc -B${unpack} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${unpack}/lib"
         export CXX="g++ -idirafter ${unpack}/include-glibc -B${unpack} -Wl,-dynamic-linker,$ldlinux -Wl,-rpath,${unpack}/lib"
-        
+
         echo '#include <stdio.h>' >> foo.c
         echo '#include <limits.h>' >> foo.c
-        echo 'int main() { printf("Hello World\n"); return 0; }' >> foo.c
+        echo 'int main() { printf("Hello World\\n"); return 0; }' >> foo.c
         $CC -o $out/bin/foo foo.c
         $out/bin/foo
 
         echo '#include <iostream>' >> bar.cc
-        echo 'int main() { std::cout << "Hello World\n"; }' >> bar.cc
+        echo 'int main() { std::cout << "Hello World\\n"; }' >> bar.cc
         $CXX -v -o $out/bin/bar bar.cc
         $out/bin/bar
 
@@ -286,5 +239,5 @@ rec {
         make install
       ''; # */
     };
-    
+
 }
diff --git a/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh b/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh
index 422dc6dd5fef..52953c9b88da 100644
--- a/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh
+++ b/pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh
@@ -1,9 +1,7 @@
-set -e
-
 # Unpack the bootstrap tools tarball.
 echo Unpacking the bootstrap tools...
-$mkdir $out
-$bzip2 -d < $tarball | (cd $out && $cpio -i)
+$builder mkdir $out
+< $tarball $builder unxz | $builder tar x -C $out
 
 # Set the ELF interpreter / RPATH in the bootstrap binaries.
 echo Patching the bootstrap tools...
@@ -21,32 +19,17 @@ fi
 LD_LIBRARY_PATH=$out/lib $LD_BINARY $out/bin/cp $out/bin/patchelf .
 
 for i in $out/bin/* $out/libexec/gcc/*/*/*; do
-    echo patching $i
-    if ! test -L $i; then
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
-    fi
-done
-for i in $out/lib/librt* ; do
-    echo patching $i
-    if ! test -L $i; then
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath $i
-    fi
+    if [ -L "$i" ]; then continue; fi
+    if [ -z "${i##*/liblto*}" ]; then continue; fi
+    echo patching "$i"
+    LD_LIBRARY_PATH=$out/lib $out/lib/ld-linux*.so.2 \
+        $out/bin/patchelf --set-interpreter $LD_BINARY --set-rpath $out/lib --force-rpath "$i"
 done
 
-for i in $out/lib/libgmp* $out/lib/libppl* $out/lib/libcloog* $out/lib/libmpc* $out/lib/libpcre* $out/lib/libstdc++*.so.*[0-9]; do
-    echo trying to patch $i
-    if test -f $i -a ! -L $i; then
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-rpath $out/lib --force-rpath $i
-         LD_LIBRARY_PATH=$out/lib $LD_BINARY \
-             $out/bin/patchelf --set-rpath $out/lib --force-rpath $i
-    fi
+for i in $out/lib/libpcre*; do
+    if [ -L "$i" ]; then continue; fi
+    echo patching "$i"
+    $out/bin/patchelf --set-rpath $out/lib --force-rpath "$i"
 done
 
 # Fix the libc linker script.
@@ -60,13 +43,21 @@ mv $out/lib/libpthread.so.tmp $out/lib/libpthread.so
 ln -s bash $out/bin/sh
 ln -s bzip2 $out/bin/bunzip2
 
-# Mimic the gunzip script as in gzip installations
+# Provide a gunzip script.
 cat > $out/bin/gunzip <<EOF
 #!$out/bin/sh
 exec $out/bin/gzip -d "\$@"
 EOF
 chmod +x $out/bin/gunzip
 
-# fetchurl needs curl.
-bzip2 -d < $curl > $out/bin/curl
-chmod +x $out/bin/curl
+# Provide fgrep/egrep.
+echo "#! $out/bin/sh" > $out/bin/egrep
+echo "exec $out/bin/grep -E \"\$@\"" >> $out/bin/egrep
+echo "#! $out/bin/sh" > $out/bin/fgrep
+echo "exec $out/bin/grep -F \"\$@\"" >> $out/bin/fgrep
+
+# Provide xz (actually only xz -d will work).
+echo "#! $out/bin/sh" > $out/bin/xz
+echo "exec $builder unxz \"\$@\"" >> $out/bin/xz
+
+chmod +x $out/bin/egrep $out/bin/fgrep $out/bin/xz
diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix
index 256f574c2e0c..74da91431a43 100644
--- a/pkgs/tools/compression/bzip2/default.nix
+++ b/pkgs/tools/compression/bzip2/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation {
   };
 
   sharedLibrary =
-    !stdenv.isDarwin && !(stdenv ? isDietLibC) && !(stdenv ? isStatic) && stdenv.system != "i686-cygwin" && !linkStatic;
+    !stdenv.isDarwin && !(stdenv ? isStatic) && stdenv.system != "i686-cygwin" && !linkStatic;
 
   patchPhase = stdenv.lib.optionalString stdenv.isDarwin "substituteInPlace Makefile --replace 'CC=gcc' 'CC=clang'";
 
diff --git a/pkgs/tools/filesystems/squashfs/default.nix b/pkgs/tools/filesystems/squashfs/default.nix
index a016627b7a47..5e1700af0178 100644
--- a/pkgs/tools/filesystems/squashfs/default.nix
+++ b/pkgs/tools/filesystems/squashfs/default.nix
@@ -12,8 +12,6 @@ stdenv.mkDerivation rec {
   buildInputs = [ zlib xz ];
 
   preBuild = "cd squashfs-tools";
-  
-  NIX_LDFLAGS = "-lgcc_s"; # for pthread_cancel
 
   installFlags = "INSTALL_DIR=\${out}/bin";
 
diff --git a/pkgs/tools/misc/grub/2.0x.nix b/pkgs/tools/misc/grub/2.0x.nix
index e5471a6c404c..1dbdfff7448d 100644
--- a/pkgs/tools/misc/grub/2.0x.nix
+++ b/pkgs/tools/misc/grub/2.0x.nix
@@ -77,7 +77,7 @@ stdenv.mkDerivation rec {
            -e "s|/usr/src/unifont.bdf|$PWD/unifont.bdf|g"
     '';
 
-  patches = [ ./fix-bash-completion.patch ];
+  patches = [ ./fix-bash-completion.patch ./glibc-2.20.patch ];
 
   configureFlags = optional zfsSupport "--enable-libzfs"
     ++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystems.${stdenv.system}.target}" "--program-prefix=" ];
diff --git a/pkgs/tools/misc/grub/glibc-2.20.patch b/pkgs/tools/misc/grub/glibc-2.20.patch
new file mode 100644
index 000000000000..6bb4f677541b
--- /dev/null
+++ b/pkgs/tools/misc/grub/glibc-2.20.patch
@@ -0,0 +1,29 @@
+* grub-core/kern/emu/hostfs.c: squahes below warning
+  warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use 
+_DEFAULT_SOURCE"
+
+Signed-off-by: Khem Raj <address@hidden>
+
+Upstream-Status: Submitted
+---
+ grub-core/kern/emu/hostfs.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/grub-core/kern/emu/hostfs.c b/grub-core/kern/emu/hostfs.c
+index 7e725f6..823116d 100644
+--- a/grub-core/kern/emu/hostfs.c
++++ b/grub-core/kern/emu/hostfs.c
+@@ -19,7 +19,11 @@
+ 
+ #include <config-util.h>
+ 
++/* Legacy feature macro.*/
+ #define _BSD_SOURCE
++/* New feature macro that provides everything _BSD_SOURCE and
++ *    _SVID_SOURCE provided and possibly more.  */
++#define _DEFAULT_SOURCE
+ #include <grub/fs.h>
+ #include <grub/file.h>
+ #include <grub/disk.h>
+-- 
+2.1.0
diff --git a/pkgs/tools/networking/curl/7.15.nix b/pkgs/tools/networking/curl/7.15.nix
index 0a87eaa944cd..2b13437d95ca 100644
--- a/pkgs/tools/networking/curl/7.15.nix
+++ b/pkgs/tools/networking/curl/7.15.nix
@@ -32,6 +32,12 @@ stdenv.mkDerivation rec {
   preConfigure = ''
     sed -e 's|/usr/bin|/no-such-path|g' -i.bak configure
   '';
+
+  # make curl honor CURL_CA_BUNDLE & SSL_CERT_FILE
+  postConfigure = ''
+    echo  '#define CURL_CA_BUNDLE (getenv("CURL_CA_BUNDLE") || getenv("SSL_CERT_FILE"))' >> lib/curl_config.h
+  '';
+
   configureFlags = [
       ( if sslSupport then "--with-ssl=${openssl}" else "--without-ssl" )
       ( if scpSupport then "--with-libssh2=${libssh2}" else "--without-libssh2" )
@@ -43,7 +49,6 @@ stdenv.mkDerivation rec {
 
   dontDisableStatic = linkStatic;
 
-  CFLAGS = if stdenv ? isDietLibC then "-DHAVE_INET_NTOA_R_2_ARGS=1" else "";
   LDFLAGS = if linkStatic then "-static" else "";
   CXX = "g++";
   CXXCPP = "g++ -E";
diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index 85b935ebd767..b54df60ef0a9 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -4,7 +4,6 @@
 , scpSupport ? false, libssh2 ? null
 , gssSupport ? false, gss ? null
 , c-aresSupport ? false, c-ares ? null
-, linkStatic ? false
 }:
 
 assert zlibSupport -> zlib != null;
@@ -36,35 +35,28 @@ stdenv.mkDerivation rec {
     rm src/tool_hugehelp.c
   '';
 
+  # make curl honor CURL_CA_BUNDLE & SSL_CERT_FILE
+  postConfigure = ''
+    echo  '#define CURL_CA_BUNDLE (getenv("CURL_CA_BUNDLE") ? getenv("CURL_CA_BUNDLE") : getenv("SSL_CERT_FILE"))' >> lib/curl_config.h
+  '';
+
   configureFlags = [
       ( if sslSupport then "--with-ssl=${openssl}" else "--without-ssl" )
       ( if scpSupport then "--with-libssh2=${libssh2}" else "--without-libssh2" )
     ]
     ++ stdenv.lib.optional c-aresSupport "--enable-ares=${c-ares}"
-    ++ stdenv.lib.optional gssSupport "--with-gssapi=${gss}"
-    ++ stdenv.lib.optionals linkStatic [ "--enable-static" "--disable-shared" ]
-  ;
+    ++ stdenv.lib.optional gssSupport "--with-gssapi=${gss}";
 
-  dontDisableStatic = linkStatic;
-
-  CFLAGS = if stdenv ? isDietLibC then "-DHAVE_INET_NTOA_R_2_ARGS=1" else "";
-  LDFLAGS = if linkStatic then "-static" else "";
   CXX = "g++";
   CXXCPP = "g++ -E";
 
-  # libtool hack to get a static binary. Notice that to 'configure' I passed
-  # other LDFLAGS, because it doesn't use libtool for linking in the tests.
-  makeFlags = if linkStatic then "LDFLAGS=-all-static" else "";
-
   crossAttrs = {
     # We should refer to the cross built openssl
     # For the 'urandom', maybe it should be a cross-system option
     configureFlags = [
         ( if sslSupport then "--with-ssl=${openssl.crossDrv}" else "--without-ssl" )
         "--with-random /dev/urandom"
-      ]
-      ++ stdenv.lib.optionals linkStatic [ "--enable-static" "--disable-shared" ]
-    ;
+      ];
   };
 
   passthru = {
diff --git a/pkgs/tools/networking/inadyn/default.nix b/pkgs/tools/networking/inadyn/default.nix
index a821684e5b4b..7e4d5fbe5f05 100644
--- a/pkgs/tools/networking/inadyn/default.nix
+++ b/pkgs/tools/networking/inadyn/default.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation {
 
   buildInputs = [ gnutls ];
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   meta = {
     homepage = http://inadyn.sourceforge.net/;
     description = "Free dynamic DNS client";
diff --git a/pkgs/tools/networking/openssh/default.nix b/pkgs/tools/networking/openssh/default.nix
index 05b97bdcaacb..19957de5d1c8 100644
--- a/pkgs/tools/networking/openssh/default.nix
+++ b/pkgs/tools/networking/openssh/default.nix
@@ -75,5 +75,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.bsd2;
     platforms = platforms.unix;
     maintainers = with maintainers; [ eelco ];
+    broken = hpnSupport; # probably after 6.7 update
   };
 }
diff --git a/pkgs/tools/security/polkit-kde-agent/default.nix b/pkgs/tools/security/polkit-kde-agent/default.nix
index 7696ee93bce0..b3990b53a87a 100644
--- a/pkgs/tools/security/polkit-kde-agent/default.nix
+++ b/pkgs/tools/security/polkit-kde-agent/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, kdelibs, polkit_qt_1, gettext }:
+{ stdenv, fetchurl, kdelibs, polkit_qt4, gettext }:
 
 stdenv.mkDerivation rec {
   name = "polkit-kde-agent-1-0.99.0";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0rxlq6x0vhvha8i6w109zpzzacp4imins55v4p4fq7a3k0kgywg3";
   };
 
-  buildInputs = [ kdelibs polkit_qt_1 ];
+  buildInputs = [ kdelibs polkit_qt4 ];
 
   nativeBuildInputs = [ gettext ];
 
diff --git a/pkgs/tools/system/collectd/default.nix b/pkgs/tools/system/collectd/default.nix
index 4210a0a04a5a..692016153a6c 100644
--- a/pkgs/tools/system/collectd/default.nix
+++ b/pkgs/tools/system/collectd/default.nix
@@ -33,8 +33,6 @@ stdenv.mkDerivation rec {
     sha256 = "1q365zx6d1wyhv7n97bagfxqnqbhj2j14zz552nhmjviy8lj2ibm";
   };
 
-  NIX_LDFLAGS = "-lgcc_s"; # for pthread_cancel
-
   buildInputs = [
     pkgconfig curl iptables libcredis libdbi libgcrypt libmemcached cyrus_sasl
     libmodbus libnotify gdk_pixbuf liboping libpcap libsigrok libvirt
@@ -45,6 +43,8 @@ stdenv.mkDerivation rec {
   # for some reason libsigrok isn't auto-detected
   configureFlags = stdenv.lib.optional (libsigrok != null) "--with-libsigrok";
 
+  NIX_CFLAGS_COMPILE = "-Wno-error=cpp";
+
   meta = with stdenv.lib; {
     description = "Daemon which collects system performance statistics periodically";
     homepage = http://collectd.org;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d24ed182412f..0abff60f78df 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -437,7 +437,10 @@ let
     ../build-support/setup-hooks/make-coverage-analysis-report.sh;
 
   # intended to be used like nix-build -E 'with <nixpkgs> {}; enableDebugging fooPackage'
-  enableDebugging = pkg : pkg.override { stdenv = stdenvAdapters.keepDebugInfo pkg.stdenv; };
+  enableDebugging = pkg: pkg.override { stdenv = stdenvAdapters.keepDebugInfo pkg.stdenv; };
+
+  findXMLCatalogs = makeSetupHook { } ../build-support/setup-hooks/find-xml-catalogs.sh;
+
 
   ### TOOLS
 
@@ -2267,6 +2270,7 @@ let
   rng_tools = callPackage ../tools/security/rng-tools { };
 
   rsnapshot = callPackage ../tools/backup/rsnapshot {
+    perl = perl516; # fails to create docs: POD document had syntax errors
     # For the `logger' command, we can use either `utillinux' or
     # GNU Inetutils.  The latter is more portable.
     logger = inetutils;
@@ -4050,15 +4054,13 @@ let
 
   ocropus = callPackage ../applications/misc/ocropus { };
 
-  perl514 = callPackage ../development/interpreters/perl/5.14 { };
+  perl516 = callPackage ../development/interpreters/perl/5.16 { };
 
-  perl516 = callPackage ../development/interpreters/perl/5.16 {
+  perl520 = callPackage ../development/interpreters/perl/5.20 {
     fetchurl = fetchurlBoot;
   };
 
-  perl520 = callPackage ../development/interpreters/perl/5.20 { };
-
-  perl = if system != "i686-cygwin" then perl516 else sysPerl;
+  perl = if system != "i686-cygwin" then perl520 else sysPerl;
 
   php = php54;
 
@@ -5239,7 +5241,7 @@ let
   glfw2 = callPackage ../development/libraries/glfw/2.x.nix { };
   glfw3 = callPackage ../development/libraries/glfw/3.x.nix { };
 
-  glibc = callPackage ../development/libraries/glibc/2.19 {
+  glibc = callPackage ../development/libraries/glibc {
     kernelHeaders = linuxHeaders;
     installLocales = config.glibc.locales or false;
     machHeaders = null;
@@ -5247,13 +5249,13 @@ let
     gccCross = null;
   };
 
-  glibc_memusage = callPackage ../development/libraries/glibc/2.19 {
+  glibc_memusage = callPackage ../development/libraries/glibc {
     kernelHeaders = linuxHeaders;
     installLocales = false;
     withGd = true;
   };
 
-  glibcCross = forceNativeDrv (makeOverridable (import ../development/libraries/glibc/2.19)
+  glibcCross = forceNativeDrv (makeOverridable (import ../development/libraries/glibc)
     (let crossGNU = crossSystem != null && crossSystem.config == "i586-pc-gnu";
      in {
        inherit stdenv fetchurl;
@@ -5281,11 +5283,11 @@ let
     installLocales = config.glibc.locales or false;
   };
 
-  glibcLocales = callPackage ../development/libraries/glibc/2.19/locales.nix { };
+  glibcLocales = callPackage ../development/libraries/glibc/locales.nix { };
 
-  glibcInfo = callPackage ../development/libraries/glibc/2.19/info.nix { };
+  glibcInfo = callPackage ../development/libraries/glibc/info.nix { };
 
-  glibc_multi = callPackage ../development/libraries/glibc/2.19/multi.nix {
+  glibc_multi = callPackage ../development/libraries/glibc/multi.nix {
     inherit glibc;
     glibc32 = (import ./all-packages.nix {system = "i686-linux";}).glibc;
   };
@@ -5380,10 +5382,6 @@ let
 
   gnutls = gnutls32;
 
-  gnutls31 = callPackage ../development/libraries/gnutls/3.1.nix {
-    guileBindings = config.gnutls.guile or false;
-  };
-
   gnutls32 = callPackage ../development/libraries/gnutls/3.2.nix {
     guileBindings = config.gnutls.guile or false;
   };
@@ -6594,11 +6592,29 @@ let
 
   pdf2xml = callPackage ../development/libraries/pdf2xml {} ;
 
-  phonon = callPackage ../development/libraries/phonon { };
+  phonon = callPackage ../development/libraries/phonon { inherit qt4; };
 
-  phonon_backend_gstreamer = callPackage ../development/libraries/phonon-backend-gstreamer { };
+  phonon_qt5 = phonon.override {
+    withQt5 = true;
+    inherit qt5;
+    qt4 = null;
+  };
 
-  phonon_backend_vlc = callPackage ../development/libraries/phonon-backend-vlc { };
+  phonon_backend_gstreamer = callPackage ../development/libraries/phonon-backend-gstreamer { inherit qt4; };
+
+  phonon_qt5_backend_gstreamer = phonon_backend_gstreamer.override {
+    withQt5 = true;
+    inherit qt5;
+    qt4 = null;
+  };
+
+  phonon_backend_vlc = callPackage ../development/libraries/phonon-backend-vlc { inherit qt4; };
+
+  phonon_qt5_backend_vlc = phonon_backend_vlc.override {
+    withQt5 = true;
+    inherit qt5;
+    qt4 = null;
+  };
 
   physfs = callPackage ../development/libraries/physfs { };
 
@@ -6616,7 +6632,14 @@ let
     spidermonkey = spidermonkey_185;
   };
 
-  polkit_qt_1 = callPackage ../development/libraries/polkit-qt-1 { };
+  polkit_qt4 = callPackage ../development/libraries/polkit-qt-1 {
+    inherit qt4;
+  };
+
+  polkit_qt5 = callPackage ../development/libraries/polkit-qt-1 {
+    inherit qt5;
+    withQt5 = true;
+  };
 
   policykit = callPackage ../development/libraries/policykit { };
 
@@ -6697,21 +6720,6 @@ let
     qtLib = qt48Full;
   };
 
-  qt53Full = appendToName "full" (qt53.override {
-    buildDocs = true;
-    buildExamples = true;
-    buildTests = true;
-    developerBuild = true;
-  });
-
-  qt53 = callPackage ../development/libraries/qt-5/qt-5.3.nix {
-    mesa = mesa_noglu;
-    cups = if stdenv.isLinux then cups else null;
-    # GNOME dependencies are not used unless gtkStyle == true
-    inherit (gnome) libgnomeui GConf gnome_vfs;
-    bison = bison2; # error: too few arguments to function 'int yylex(...
-  };
-
   qt5 = callPackage ../development/libraries/qt-5 {
     mesa = mesa_noglu;
     cups = if stdenv.isLinux then cups else null;
@@ -7326,14 +7334,6 @@ let
     overrides = (config.perlPackageOverrides or (p: {})) pkgs;
   });
 
-  perl514Packages = import ./perl-packages.nix {
-    pkgs = pkgs // {
-      perl = perl514;
-      buildPerlPackage = import ../development/perl-modules/generic perl514;
-    };
-    overrides = (config.perl514PackageOverrides or (p: {})) pkgs;
-  };
-
   perlXMLParser = perlPackages.XMLParser;
 
   ack = perlPackages.ack;
@@ -8164,7 +8164,7 @@ let
 
   # -- Linux kernel expressions ------------------------------------------------
 
-  linuxHeaders = linuxHeaders_3_7;
+  linuxHeaders = linuxHeaders_3_12;
 
   linuxHeaders24Cross = forceNativeDrv (import ../os-specific/linux/kernel-headers/2.4.nix {
     inherit stdenv fetchurl perl;
@@ -8176,7 +8176,7 @@ let
     cross = assert crossSystem != null; crossSystem;
   });
 
-  linuxHeaders_3_7 = callPackage ../os-specific/linux/kernel-headers/3.7.nix { };
+  linuxHeaders_3_12 = callPackage ../os-specific/linux/kernel-headers/3.12.nix { };
 
   linuxHeaders_3_14 = callPackage ../os-specific/linux/kernel-headers/3.14.nix { };
 
@@ -8921,7 +8921,9 @@ let
 
   proggyfonts = callPackage ../data/fonts/proggyfonts { };
 
-  pthreadmanpages = callPackage ../data/documentation/pthread-man-pages { };
+  pthreadmanpages = callPackage ../data/documentation/pthread-man-pages {
+    perl = perl516; # syntax error at troffprepro line 49, near "do subst("
+  };
 
   shared_mime_info = callPackage ../data/misc/shared-mime-info { };
 
@@ -10713,11 +10715,7 @@ let
 
   lightdm_gtk_greeter = callPackage ../applications/display-managers/lightdm-gtk-greeter { };
 
-  # slic3r 0.9.10b says: "Running Slic3r under Perl >= 5.16 is not supported nor recommended"
-  slic3r = callPackage ../applications/misc/slic3r {
-    perlPackages = perl514Packages;
-    perl = perl514;
-  };
+  slic3r = callPackage ../applications/misc/slic3r { };
 
   curaengine = callPackage ../applications/misc/curaengine { };
 
@@ -11068,6 +11066,8 @@ let
     ffmpeg = ffmpeg_2_3;
   };
 
+  libvlc = vlc.override { onlyLibVLC = true; };
+
   vmpk = callPackage ../applications/audio/vmpk { };
 
   vnstat = callPackage ../applications/networking/vnstat { };
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index d02a4f69a167..e1dd33e92815 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -239,6 +239,19 @@ let self = _self // overrides; _self = with self; {
     };
   };
 
+  ArchiveExtract = buildPerlPackage {
+    name = "Archive-Extract-0.74";
+    src = fetchurl {
+      url = mirror://cpan/authors/id/B/BI/BINGOS/Archive-Extract-0.74.tar.gz;
+      sha256 = "b297d230fe91720a423a01482db7e037b2acf589f9c8f58cef39f3148374e216";
+    };
+    propagatedBuildInputs = [ if_ ];
+    meta = {
+      description = "Generic archive extracting mechanism";
+      license = "perl";
+    };
+  };
+
   ArchiveZip = buildPerlPackage {
     name = "Archive-Zip-1.16";
     src = fetchurl {
@@ -329,19 +342,7 @@ let self = _self // overrides; _self = with self; {
     };
   };
 
-  autodie = buildPerlPackage {
-    name = "autodie-2.20";
-    src = fetchurl {
-      url = mirror://cpan/authors/id/P/PJ/PJF/autodie-2.20.tar.gz;
-      sha256 = "346763c582cd8066b4e5d07e4013202f9f9296d32b42343e117dbfb13ea6e4f0";
-    };
-    meta = {
-      description = "Replace functions with ones that succeed or die with lexical scope";
-      license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
-      maintainers = with maintainers; [ ocharles ];
-      platforms   = stdenv.lib.platforms.unix;
-    };
-  };
+  autodie = null; # part of Perl
 
   autovivification = buildPerlPackage {
     name = "autovivification-0.12";
@@ -643,16 +644,16 @@ let self = _self // overrides; _self = with self; {
   };
 
   CatalystActionREST = buildPerlPackage {
-    name = "Catalyst-Action-REST-1.07";
+    name = "Catalyst-Action-REST-1.17";
     src = fetchurl {
-      url = mirror://cpan/authors/id/B/BO/BOBTFISH/Catalyst-Action-REST-1.07.tar.gz;
-      sha256 = "0c893iia1bmqlrknylaqhc9ln1xqz7yw9z639rxmyjyidx5b4q0d";
+      url = mirror://cpan/authors/id/F/FR/FREW/Catalyst-Action-REST-1.17.tar.gz;
+      sha256 = "c833c6ba2150b035b0486ff568c1e5928c14bb53d6a70758271feb969aaedde6";
     };
-    propagatedBuildInputs = [ CatalystRuntime ClassInspector ConfigGeneral DataSerializer DataTaxi FreezeThaw HTMLParser JSONXS LWPUserAgent Moose MROCompat namespaceautoclean ParamsValidate PHPSerialization URIFind XMLSimple YAMLSyck ];
+    buildInputs = [ TestRequires ];
+    propagatedBuildInputs = [ CatalystRuntime ClassInspector LWP MROCompat ModulePluggable Moose ParamsValidate URIFind namespaceautoclean ];
     meta = {
       description = "Automated REST Method Dispatching";
-      license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
-      platforms = stdenv.lib.platforms.linux;
+      license = "perl";
     };
   };
 
@@ -1498,11 +1499,16 @@ let self = _self // overrides; _self = with self; {
     propagatedBuildInputs = [ IOCompress ];
   };
 
-  ConfigAny = buildPerlPackage rec {
+  ConfigAny = buildPerlPackage {
     name = "Config-Any-0.24";
     src = fetchurl {
-      url = "mirror://cpan/modules/by-module/Config/${name}.tar.gz";
-      sha256 = "06n6jn3q3xhk57icwip0ihzqixxav6sgp6rrb35hahj1z748y3vi";
+      url = mirror://cpan/authors/id/B/BR/BRICAS/Config-Any-0.24.tar.gz;
+      sha256 = "710f8fc8f9414205cb58399bfbb4d9aaf7883f8ce046cee22913f6818795c61a";
+    };
+    propagatedBuildInputs = [ ModulePluggable ];
+    meta = {
+      description = "Load configuration from different file formats, transparently";
+      license = "perl";
     };
   };
 
@@ -1733,6 +1739,21 @@ let self = _self // overrides; _self = with self; {
     };
   };
 
+  CPANPLUS = buildPerlPackage {
+    name = "CPANPLUS-0.9152";
+    src = fetchurl {
+      url = mirror://cpan/authors/id/B/BI/BINGOS/CPANPLUS-0.9152.tar.gz;
+      sha256 = "732d9978ca6e8cde9b16431e1d1bafa543a66d8bce3fbfca4e5ac297a348ad17";
+    };
+    propagatedBuildInputs = [ ArchiveExtract LogMessage ModulePluggable ObjectAccessor PackageConstants ];
+    doCheck = false;
+    meta = {
+      homepage = http://github.com/jib/cpanplus-devel;
+      description = "Ameliorated interface to the CPAN";
+      license = "perl";
+    };
+  };
+
   CPANUploader = buildPerlPackage {
     name = "CPAN-Uploader-0.103006";
     src = fetchurl {
@@ -2200,15 +2221,15 @@ let self = _self // overrides; _self = with self; {
   };
 
   DateTimeFormatFlexible = buildPerlPackage {
-    name = "DateTime-Format-Flexible-0.25";
+    name = "DateTime-Format-Flexible-0.26";
     src = fetchurl {
-      url = mirror://cpan/authors/id/T/TH/THINC/DateTime-Format-Flexible-0.25.tar.gz;
-      sha256 = "cd3267e68736ece386d677289b334d4ef1f33ff2524b17b9c9deb53d20420090";
+      url = mirror://cpan/authors/id/T/TH/THINC/DateTime-Format-Flexible-0.26.tar.gz;
+      sha256 = "436efbc5e87cc385112e1c44336427fea32df670caf2b7d6dbb7a113ac6e693d";
     };
-    propagatedBuildInputs = [ DateTime DateTimeFormatBuilder DateTimeTimeZone ListMoreUtils TestMockTime ];
+    propagatedBuildInputs = [ DateTime DateTimeFormatBuilder DateTimeTimeZone ListMoreUtils ModulePluggable TestMockTime ];
     meta = {
       description = "DateTime::Format::Flexible - Flexibly parse strings and turn them into DateTime objects";
-      license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
+      license = "perl";
     };
   };
 
@@ -3094,11 +3115,13 @@ let self = _self // overrides; _self = with self; {
     name = "Email-Abstract-3.007";
     src = fetchurl {
       url = mirror://cpan/authors/id/R/RJ/RJBS/Email-Abstract-3.007.tar.gz;
-      sha256 = "1a7aynf5jd5lr77x4k51hphnbmxf6p0s2gm1a6fbmxjqlnimm48h";
+      sha256 = "10915aa3a558f6ba9c51a13ea1c135aed765e185a14cd2cfc9b434599cf5eaa8";
     };
-    propagatedBuildInputs = [ EmailSimple MROCompat ];
+    propagatedBuildInputs = [ EmailSimple MROCompat ModulePluggable ];
     meta = {
-      license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
+      homepage = https://github.com/rjbs/Email-Abstract;
+      description = "Unified interface to mail representations";
+      license = "perl";
     };
   };
 
@@ -3597,17 +3620,20 @@ let self = _self // overrides; _self = with self; {
     };
   };
 
-  FileChangeNotify = buildPerlModule rec {
+  FileChangeNotify = buildPerlModule {
     name = "File-ChangeNotify-0.24";
     src = fetchurl {
-      url = "mirror://cpan/authors/id/D/DR/DROLSKY/${name}.tar.gz";
-      sha256 = "090i265f73jlcl5rv250791vw32j9vvl4nd5abc7myg0klb8109w";
+      url = mirror://cpan/authors/id/D/DR/DROLSKY/File-ChangeNotify-0.24.tar.gz;
+      sha256 = "3c8180169de0f97ad852a55942f74e520cbe433aa0889d0b65548ee38a111124";
     };
     buildInputs = [ TestException ];
     propagatedBuildInputs =
-      [ ClassMOP Moose MooseXParamsValidate MooseXSemiAffordanceAccessor
-        namespaceautoclean
-      ] ++ stdenv.lib.optional stdenv.isLinux LinuxInotify2;
+      [ ClassLoad ListMoreUtils ModulePluggable Moose MooseXParamsValidate MooseXSemiAffordanceAccessor namespaceautoclean ]
+      ++ stdenv.lib.optional stdenv.isLinux LinuxInotify2;
+    meta = {
+      description = "Watch for changes to files, cross-platform style";
+      license = "artistic_2";
+    };
   };
 
   Filechdir = buildPerlPackage rec {
@@ -5101,6 +5127,19 @@ let self = _self // overrides; _self = with self; {
     };
   };
 
+  LogMessage = buildPerlPackage {
+    name = "Log-Message-0.08";
+    src = fetchurl {
+      url = mirror://cpan/authors/id/B/BI/BINGOS/Log-Message-0.08.tar.gz;
+      sha256 = "bd697dd62aaf26d118e9f0a0813429deb1c544e4501559879b61fcbdfe99fe46";
+    };
+    propagatedBuildInputs = [ if_ ];
+    meta = {
+      description = "Powerful and flexible message logging mechanism";
+      license = "perl";
+    };
+  };
+
   LogTrace = buildPerlPackage rec {
     name = "Log-Trace-1.070";
     src = fetchurl {
@@ -5615,16 +5654,16 @@ let self = _self // overrides; _self = with self; {
   };
 
   ModuleInstall = buildPerlPackage {
-    name = "Module-Install-1.06";
+    name = "Module-Install-1.14";
     src = fetchurl {
-      url = mirror://cpan/authors/id/A/AD/ADAMK/Module-Install-1.06.tar.gz;
-      sha256 = "06a5375q1cr21rzcr07z3n8w6hv611a9p199jrnpsj9vbcwwi7ny";
+      url = mirror://cpan/authors/id/B/BI/BINGOS/Module-Install-1.14.tar.gz;
+      sha256 = "3f02f0a33603aff2f5cf06d15f74d1a9be65e844ada99e1a9c2102330ffa0d49";
     };
     buildInputs = [ YAMLTiny ];
-    propagatedBuildInputs = [ FileRemove LWPUserAgent ModuleScanDeps PARDist YAMLTiny ];
+    propagatedBuildInputs = [ FileRemove ModuleScanDeps YAMLTiny ];
     meta = {
       description = "Standalone, extensible Perl module installer";
-      license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
+      license = "perl";
     };
   };
 
@@ -5748,14 +5787,15 @@ let self = _self // overrides; _self = with self; {
   };
 
   ModuleScanDeps = buildPerlPackage {
-    name = "Module-ScanDeps-1.10";
+    name = "Module-ScanDeps-1.17";
     src = fetchurl {
-      url = mirror://cpan/authors/id/R/RS/RSCHUPP/Module-ScanDeps-1.10.tar.gz;
-      sha256 = "0z85zqvqpj2ck80sw91hmzn94q8m3s40anybw324xh3pcrm9cg5s";
+      url = mirror://cpan/authors/id/R/RS/RSCHUPP/Module-ScanDeps-1.17.tar.gz;
+      sha256 = "1b2999344919826476c59e08e65e4877121b4da1e847c9f354841df688927dd2";
     };
+    buildInputs = [ TestRequires ];
     meta = {
       description = "Recursively scan Perl code for dependencies";
-      license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
+      license = "perl";
     };
   };
 
@@ -6235,17 +6275,17 @@ let self = _self // overrides; _self = with self; {
   };
 
   MooseXTypes = buildPerlPackage {
-    name = "MooseX-Types-0.35";
+    name = "MooseX-Types-0.45";
     src = fetchurl {
-      url = mirror://cpan/authors/id/D/DR/DROLSKY/MooseX-Types-0.35.tar.gz;
-      sha256 = "11namg9pjw328ybvj70cgn15aac093jwdm4jv0b173gb7vkflx8a";
+      url = mirror://cpan/authors/id/E/ET/ETHER/MooseX-Types-0.45.tar.gz;
+      sha256 = "d01ff4a3db78e1150101b4b63569e4bce3ced3b5b0024c52c87575e0820609c7";
     };
-    buildInputs = [ TestFatal TestMoose TestRequires ];
-    propagatedBuildInputs = [ CarpClan Moose namespaceclean SubInstall SubName ];
+    buildInputs = [ ModuleBuildTiny Moose TestFatal TestRequires if_ ];
+    propagatedBuildInputs = [ CarpClan ModuleRuntime Moose SubExporter SubName namespaceautoclean ];
     meta = {
-      homepage = http://search.cpan.org/perldoc?CPAN::Meta::Spec;
+      homepage = https://github.com/moose/MooseX-Types;
       description = "Organise your Moose types in libraries";
-      license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
+      license = "perl";
     };
   };
 
@@ -6815,6 +6855,18 @@ let self = _self // overrides; _self = with self; {
     };
   };
 
+  ObjectAccessor = buildPerlPackage {
+    name = "Object-Accessor-0.48";
+    src = fetchurl {
+      url = mirror://cpan/authors/id/B/BI/BINGOS/Object-Accessor-0.48.tar.gz;
+      sha256 = "76cb824a27b6b4e560409fcf6fd5b3bfbbd38b72f1f3d37ed0b54bd9c0baeade";
+    };
+    meta = {
+      description = "Per object accessors";
+      license = "perl";
+    };
+  };
+
   ObjectInsideOut = buildPerlPackage {
     name = "Object-InsideOut-3.98";
     src = fetchurl {
@@ -6887,6 +6939,18 @@ let self = _self // overrides; _self = with self; {
     propagatedBuildInputs = [ NetOpenIDCommon JSON LWP ];
   };
 
+  PackageConstants = buildPerlPackage {
+    name = "Package-Constants-0.04";
+    src = fetchurl {
+      url = mirror://cpan/authors/id/B/BI/BINGOS/Package-Constants-0.04.tar.gz;
+      sha256 = "7e09a88da2c0df24f498eb3a133f7d979404a7bc853f21afa2ba68dfd859a880";
+    };
+    meta = {
+      description = "List constants defined in a package";
+      license = "perl";
+    };
+  };
+
   PackageDeprecationManager = buildPerlPackage {
     name = "Package-DeprecationManager-0.13";
     src = fetchurl {
@@ -7541,11 +7605,15 @@ let self = _self // overrides; _self = with self; {
     };
   };
 
-  RegexpCommon = buildPerlPackage rec {
-    name = "Regexp-Common-2.122";
+  RegexpCommon = buildPerlPackage {
+    name = "Regexp-Common-2013031301";
     src = fetchurl {
-      url = "mirror://cpan/authors/id/A/AB/ABIGAIL/${name}.tar.gz";
-      sha256 = "1mi411nfsx58nfsgjsbyck50x9d0yfvwqpw63iavajlpx1z38n8r";
+      url = mirror://cpan/authors/id/A/AB/ABIGAIL/Regexp-Common-2013031301.tar.gz;
+      sha256 = "729a8198d264aa64ecbb233ff990507f97fbb66bda746b95f3286f50f5f25c84";
+    };
+    meta = {
+      description = "Provide commonly requested regular expressions";
+      license = "mit";
     };
   };
 
@@ -9080,11 +9148,17 @@ let self = _self // overrides; _self = with self; {
     propagatedBuildInputs = [ProbePerl IPCRun3];
   };
 
-  TestSharedFork = buildPerlPackage rec {
-    name = "Test-SharedFork-0.18";
+  TestSharedFork = buildPerlPackage {
+    name = "Test-SharedFork-0.29";
     src = fetchurl {
-      url = "mirror://cpan/authors/id/T/TO/TOKUHIROM/${name}.tar.gz";
-      sha256 = "1wc41jzi780w75m2ry1038mzxyz7386r8rmhbnmj3krcdxy676cc";
+      url = mirror://cpan/authors/id/E/EX/EXODIST/Test-SharedFork-0.29.tar.gz;
+      sha256 = "63af7788cc35b9b7e6fa37c61220ca66abd6364d8bb90c20038e3d8241988a6e";
+    };
+    buildInputs = [ TestRequires ];
+    meta = {
+      homepage = https://github.com/tokuhirom/Test-SharedFork;
+      description = "Fork test";
+      license = "perl";
     };
   };
 
@@ -9725,10 +9799,15 @@ let self = _self // overrides; _self = with self; {
   };
 
   UNIVERSALcan = buildPerlPackage {
-    name = "UNIVERSAL-can-1.12";
+    name = "UNIVERSAL-can-1.20140328";
     src = fetchurl {
-      url = mirror://cpan/authors/id/C/CH/CHROMATIC/UNIVERSAL-can-1.12.tar.gz;
-      sha256 = "1abadbgcy11cmlmj9qf1v73ycic1qhysxv5xx81h8s4p81alialr";
+      url = mirror://cpan/authors/id/C/CH/CHROMATIC/UNIVERSAL-can-1.20140328.tar.gz;
+      sha256 = "522da9f274786fe2cba99bc77cc1c81d2161947903d7fad10bd62dfb7f11990f";
+    };
+    meta = {
+      homepage = https://github.com/chromatic/UNIVERSAL-can;
+      description = "Work around buggy code calling UNIVERSAL::can() as a function";
+      license = "perl";
     };
   };
 
@@ -10256,10 +10335,10 @@ let self = _self // overrides; _self = with self; {
   };
 
   YAMLLibYAML = buildPerlPackage rec {
-    name = "YAML-LibYAML-0.41";
+    name = "YAML-LibYAML-0.52";
     src = fetchurl {
       url = "mirror://cpan/authors/id/I/IN/INGY/${name}.tar.gz";
-      sha256 = "1kj506lpg3fhqq0726p6y2h7pk24l6xihfyhqqsf8gd6lckl8rcs";
+      sha256 = "14qajsfbi2syjz38iynj8c6qf0rv1zmy71kydzvvg9kcq1ib3h86";
     };
   };