summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/dr14_tmeter/default.nix29
-rw-r--r--pkgs/applications/audio/mpg123/default.nix4
-rw-r--r--pkgs/applications/editors/ed/default.nix8
-rw-r--r--pkgs/applications/graphics/mypaint/default.nix39
-rw-r--r--pkgs/applications/graphics/sxiv/default.nix10
-rw-r--r--pkgs/applications/misc/noice/default.nix31
-rw-r--r--pkgs/applications/misc/pdfpc/default.nix4
-rw-r--r--pkgs/applications/misc/urlscan/default.nix16
-rw-r--r--pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix15
-rw-r--r--pkgs/applications/networking/browsers/w3m/cygwin.patch1710
-rw-r--r--pkgs/applications/networking/browsers/w3m/default.nix3
-rw-r--r--pkgs/applications/networking/cluster/minikube/default.nix8
-rw-r--r--pkgs/applications/networking/cluster/terraform/default.nix6
-rw-r--r--pkgs/applications/networking/instant-messengers/franz/default.nix24
-rw-r--r--pkgs/applications/networking/instant-messengers/rambox/default.nix28
-rw-r--r--pkgs/applications/networking/p2p/qbittorrent/default.nix12
-rw-r--r--pkgs/applications/version-management/gogs/default.nix4
-rw-r--r--pkgs/applications/virtualization/virtualbox/default.nix2
-rw-r--r--pkgs/applications/virtualization/virtualbox/guest-additions/default.nix3
-rw-r--r--pkgs/applications/virtualization/virtualbox/linux-4.12.patch80
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix6
-rw-r--r--pkgs/build-support/cc-wrapper/utils.sh21
-rwxr-xr-xpkgs/build-support/fetchgit/nix-prefetch-git1
-rw-r--r--pkgs/build-support/setup-hooks/win-dll-link.sh2
-rw-r--r--pkgs/data/icons/papirus-icon-theme/default.nix28
-rw-r--r--pkgs/desktops/gnome-3/extensions/topicons-plus/default.nix26
-rw-r--r--pkgs/development/compilers/gcc/6/darwin-const-correct.patch25
-rw-r--r--pkgs/development/compilers/gcc/6/default.nix9
-rw-r--r--pkgs/development/compilers/haxe/default.nix98
-rw-r--r--pkgs/development/compilers/haxe/hxcpp.nix52
-rw-r--r--pkgs/development/compilers/haxe/setup-hook.sh2
-rw-r--r--pkgs/development/compilers/llvm/4/clang/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/4/default.nix25
-rw-r--r--pkgs/development/compilers/llvm/4/llvm.nix2
-rw-r--r--pkgs/development/compilers/neko/default.nix6
-rw-r--r--pkgs/development/compilers/rust/rustc.nix3
-rw-r--r--pkgs/development/compilers/wla-dx/default.nix7
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix2
-rw-r--r--pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix8
-rw-r--r--pkgs/development/haskell-modules/hackage-packages.nix963
-rw-r--r--pkgs/development/interpreters/python/cpython/2.7/default.nix12
-rw-r--r--pkgs/development/libraries/gdbm/default.nix17
-rw-r--r--pkgs/development/libraries/gettext/default.nix29
-rw-r--r--pkgs/development/libraries/glew/1.10.nix4
-rw-r--r--pkgs/development/libraries/glew/default.nix4
-rw-r--r--pkgs/development/libraries/glib/default.nix4
-rw-r--r--pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_AUDIT.patch209
-rw-r--r--pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_LIBRARY_PATH.patch33
-rw-r--r--pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_PRELOAD.patch115
-rw-r--r--pkgs/development/libraries/glibc/common.nix10
-rw-r--r--pkgs/development/libraries/glibc/i686-fix-vectorized-strcspn.patch42
-rw-r--r--pkgs/development/libraries/kirigami/default.nix4
-rw-r--r--pkgs/development/libraries/libbsd/default.nix4
-rw-r--r--pkgs/development/libraries/libelf/default.nix5
-rw-r--r--pkgs/development/libraries/libelf/dont-hardcode-ar.patch (renamed from pkgs/development/libraries/libelf/cross-ar.patch)0
-rw-r--r--pkgs/development/libraries/libev/default.nix4
-rw-r--r--pkgs/development/libraries/libiconv/default.nix12
-rw-r--r--pkgs/development/libraries/libiconv/libiconv-1.14-reloc.patch269
-rw-r--r--pkgs/development/libraries/libiconv/libiconv-1.14-wchar.patch102
-rw-r--r--pkgs/development/libraries/libmicrohttpd/default.nix4
-rw-r--r--pkgs/development/libraries/libunwind/default.nix4
-rw-r--r--pkgs/development/libraries/libunwind/version-1.2.1.patch13
-rw-r--r--pkgs/development/libraries/libxslt/default.nix6
-rw-r--r--pkgs/development/libraries/mesa/default.nix4
-rw-r--r--pkgs/development/libraries/ncurses/default.nix7
-rw-r--r--pkgs/development/libraries/openldap/default.nix4
-rw-r--r--pkgs/development/libraries/openssl/1.0.1-cygwin64.patch136
-rw-r--r--pkgs/development/libraries/openssl/default.nix1
-rw-r--r--pkgs/development/libraries/sqlite/default.nix6
-rw-r--r--pkgs/development/libraries/utf8proc/default.nix4
-rw-r--r--pkgs/development/libraries/zlib/default.nix60
-rw-r--r--pkgs/development/libraries/zlib/disable-cygwin-widechar.patch13
-rw-r--r--pkgs/development/ocaml-modules/csv/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/lwt/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/pgocaml/default.nix6
-rw-r--r--pkgs/development/python-modules/dogpile.cache/default.nix4
-rw-r--r--pkgs/development/tools/analysis/flow/default.nix4
-rw-r--r--pkgs/development/tools/haskell/tinc/default.nix11
-rw-r--r--pkgs/development/tools/misc/binutils/default.nix12
-rw-r--r--pkgs/development/tools/misc/csmith/default.nix48
-rw-r--r--pkgs/development/tools/misc/gdb/default.nix5
-rw-r--r--pkgs/development/tools/misc/help2man/1.40.4-cygwin-nls.patch10
-rw-r--r--pkgs/development/tools/misc/help2man/default.nix7
-rw-r--r--pkgs/development/tools/misc/pkgconfig/2.36.3-not-win32.patch13
-rw-r--r--pkgs/development/tools/misc/pkgconfig/default.nix2
-rw-r--r--pkgs/games/uqm/default.nix2
-rw-r--r--pkgs/os-specific/darwin/binutils/default.nix13
-rw-r--r--pkgs/os-specific/darwin/cctools/port.nix15
-rw-r--r--pkgs/os-specific/linux/alsa-lib/default.nix4
-rw-r--r--pkgs/os-specific/linux/alsa-plugins/default.nix4
-rw-r--r--pkgs/os-specific/linux/alsa-tools/default.nix4
-rw-r--r--pkgs/os-specific/linux/alsa-utils/default.nix4
-rw-r--r--pkgs/os-specific/linux/busybox/default.nix6
-rw-r--r--pkgs/os-specific/linux/iw/default.nix4
-rw-r--r--pkgs/os-specific/linux/procps-ng/default.nix2
-rw-r--r--pkgs/os-specific/linux/psmisc/default.nix4
-rw-r--r--pkgs/os-specific/linux/util-linux/default.nix6
-rw-r--r--pkgs/os-specific/linux/zfs/default.nix4
-rw-r--r--pkgs/servers/gpm/default.nix2
-rw-r--r--pkgs/servers/mail/exim/default.nix10
-rw-r--r--pkgs/servers/mail/postfix/default.nix10
-rw-r--r--pkgs/servers/unifi/default.nix6
-rw-r--r--pkgs/shells/bash/4.4.nix12
-rw-r--r--pkgs/shells/bash/cygwin-bash-4.3.33-1.src.patch1393
-rw-r--r--pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch607
-rw-r--r--pkgs/stdenv/booter.nix2
-rw-r--r--pkgs/stdenv/cygwin/rebase-i686.sh6
-rw-r--r--pkgs/stdenv/cygwin/rebase-x86_64.sh6
-rw-r--r--pkgs/stdenv/darwin/default.nix10
-rw-r--r--pkgs/stdenv/native/default.nix2
-rw-r--r--pkgs/tools/admin/cli53/default.nix30
-rw-r--r--pkgs/tools/archivers/unzip/default.nix5
-rw-r--r--pkgs/tools/archivers/unzip/dont-hardcode-cc.patch (renamed from pkgs/tools/archivers/unzip/cross-cc.patch)4
-rw-r--r--pkgs/tools/compression/gzip/default.nix4
-rw-r--r--pkgs/tools/filesystems/ntfs-3g/default.nix2
-rw-r--r--pkgs/tools/misc/coreutils/default.nix9
-rw-r--r--pkgs/tools/misc/cpuminer/default.nix4
-rw-r--r--pkgs/tools/misc/partition-manager/default.nix4
-rw-r--r--pkgs/tools/misc/tlp/default.nix4
-rw-r--r--pkgs/tools/networking/iperf/3.nix4
-rw-r--r--pkgs/tools/networking/ucspi-tcp/default.nix1
-rw-r--r--pkgs/tools/networking/ucspi-tcp/remove-setuid.patch15
-rw-r--r--pkgs/tools/security/afl/default.nix4
-rw-r--r--pkgs/tools/security/hologram/default.nix4
-rw-r--r--pkgs/tools/security/jd-gui/default.nix30
-rw-r--r--pkgs/tools/security/vulnix/requirements.nix2
-rw-r--r--pkgs/tools/system/ddrescue/default.nix5
-rw-r--r--pkgs/tools/text/gnupatch/default.nix2
-rw-r--r--pkgs/top-level/all-packages.nix28
-rw-r--r--pkgs/top-level/haxe-packages.nix120
-rw-r--r--pkgs/top-level/perl-packages.nix10
-rw-r--r--pkgs/top-level/python-packages.nix14
132 files changed, 2747 insertions, 4293 deletions
diff --git a/pkgs/applications/audio/dr14_tmeter/default.nix b/pkgs/applications/audio/dr14_tmeter/default.nix
new file mode 100644
index 000000000000..3e315e2d1a75
--- /dev/null
+++ b/pkgs/applications/audio/dr14_tmeter/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, python3Packages, pkgs }:
+
+python3Packages.buildPythonApplication rec {
+  name = "dr14_tmeter-${version}";
+  version = "1.0.16";
+
+  disabled = !python3Packages.isPy3k;
+
+  src = fetchFromGitHub {
+    owner = "simon-r";
+    repo = "dr14_t.meter";
+    rev = "v${version}";
+    sha256 = "1nfsasi7kx0myxkahbd7rz8796mcf5nsadrsjjpx2kgaaw5nkv1m";
+  };
+
+  propagatedBuildInputs = with pkgs; [
+    python3Packages.numpy flac vorbis-tools ffmpeg faad2 lame
+  ];
+
+  # There are no tests
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Compute the DR14 of a given audio file according to the procedure described by the Pleasurize Music Foundation";
+    license = licenses.gpl3Plus;
+    homepage = http://dr14tmeter.sourceforge.net/;
+    maintainers = [ maintainers.adisbladis ];
+  };
+}
diff --git a/pkgs/applications/audio/mpg123/default.nix b/pkgs/applications/audio/mpg123/default.nix
index 2909dd70ce9a..59012432caf6 100644
--- a/pkgs/applications/audio/mpg123/default.nix
+++ b/pkgs/applications/audio/mpg123/default.nix
@@ -1,6 +1,6 @@
 { stdenv
 , fetchurl, alsaLib
-, buildPlatform, hostPlatform
+, hostPlatform
 }:
 
 stdenv.mkDerivation rec {
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
 
-  ${if buildPlatform != hostPlatform then "configureFlags" else null} =
+  configureFlags =
     stdenv.lib.optional (hostPlatform ? mpg123) "--with-cpu=${hostPlatform.mpg123.cpu}";
 
   meta = {
diff --git a/pkgs/applications/editors/ed/default.nix b/pkgs/applications/editors/ed/default.nix
index 053e1d22af31..2404405c307f 100644
--- a/pkgs/applications/editors/ed/default.nix
+++ b/pkgs/applications/editors/ed/default.nix
@@ -32,7 +32,13 @@ stdenv.mkDerivation rec {
     */
   doCheck = !(hostPlatform.isDarwin || hostPlatform != buildPlatform);
 
-  configureFlags = if hostPlatform == buildPlatform then null else [
+  # TODO(@Ericson2314): Use placeholder to make this a configure flag once Nix
+  # 1.12 is released.
+  preConfigure = ''
+    export DESTDIR=$out
+  '';
+
+  configureFlags = [
     "--exec-prefix=${stdenv.cc.prefix}"
     "CC=${stdenv.cc.prefix}cc"
   ];
diff --git a/pkgs/applications/graphics/mypaint/default.nix b/pkgs/applications/graphics/mypaint/default.nix
index db5e6e1a7e37..630834fc9e99 100644
--- a/pkgs/applications/graphics/mypaint/default.nix
+++ b/pkgs/applications/graphics/mypaint/default.nix
@@ -1,41 +1,42 @@
-{ stdenv, fetchurl, gettext, glib, gtk2, hicolor_icon_theme, json_c
-, lcms2, libpng , makeWrapper, pkgconfig, python2Packages
-, scons, swig
-}:
+{ stdenv, fetchFromGitHub, gtk3, intltool, json_c, lcms2, libpng, librsvg,
+  pkgconfig, python2Packages, scons, swig, wrapGAppsHook }:
 
 let
-  inherit (python2Packages) python pygtk numpy;
+  inherit (python2Packages) python pycairo pygobject3 numpy;
 in stdenv.mkDerivation rec {
   name = "mypaint-${version}";
-  version = "1.1.0";
+  version = "1.2.1";
 
-  src = fetchurl {
-    url = "http://download.gna.org/mypaint/${name}.tar.bz2";
-    sha256 = "0f7848hr65h909c0jkcx616flc0r4qh53g3kd1cgs2nr1pjmf3bq";
+  src = fetchFromGitHub {
+    owner = "mypaint";
+    repo = "mypaint";
+    rev = "bcf5a28d38bbd586cc9d4cee223f849fa303864f";
+    sha256 = "1zwx7n629vz1jcrqjqmw6vl6sxdf81fq6a5jzqiga8167gg8s9pf";
+    fetchSubmodules = true;
   };
 
-  buildInputs = [
-    gettext glib gtk2 json_c lcms2 libpng makeWrapper pkgconfig pygtk
-    python scons swig
-  ];
+  nativeBuildInputs = [ intltool pkgconfig scons swig wrapGAppsHook ];
 
-  propagatedBuildInputs = [ hicolor_icon_theme numpy ];
+  buildInputs = [ gtk3 json_c lcms2 libpng librsvg pycairo pygobject3 python ];
+
+  propagatedBuildInputs = [ numpy ];
 
   buildPhase = "scons prefix=$out";
 
   installPhase = ''
     scons prefix=$out install
     sed -i -e 's|/usr/bin/env python2.7|${python}/bin/python|' $out/bin/mypaint
-    wrapProgram $out/bin/mypaint \
-      --prefix PYTHONPATH : $PYTHONPATH \
-      --prefix XDG_DATA_DIRS ":" "${hicolor_icon_theme}/share"
+  '';
+
+  preFixup = ''
+    gappsWrapperArgs+=(--prefix PYTHONPATH : $PYTHONPATH)
   '';
 
   meta = with stdenv.lib; {
     description = "A graphics application for digital painters";
-    homepage = http://mypaint.intilinux.com;
+    homepage = http://mypaint.org/;
     license = licenses.gpl2Plus;
     platforms = platforms.linux;
-    maintainers = [ maintainers.goibhniu ];
+    maintainers = with maintainers; [ goibhniu jtojnar ];
   };
 }
diff --git a/pkgs/applications/graphics/sxiv/default.nix b/pkgs/applications/graphics/sxiv/default.nix
index e2d5357f814b..843352b27913 100644
--- a/pkgs/applications/graphics/sxiv/default.nix
+++ b/pkgs/applications/graphics/sxiv/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchFromGitHub, libX11, imlib2, giflib, libexif }:
+{ stdenv, fetchFromGitHub, libX11, imlib2, giflib, libexif, conf ? null }:
+
+with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "sxiv-${version}";
@@ -16,12 +18,16 @@ stdenv.mkDerivation rec {
       --replace /usr/local $out
   '';
 
+  configFile = optionalString (conf!=null) (builtins.toFile "config.def.h" conf);
+  preBuild = optionalString (conf!=null) "cp ${configFile} config.def.h";
+
   buildInputs = [ libX11 imlib2 giflib libexif ];
+
   meta = {
     description = "Simple X Image Viewer";
     homepage = "https://github.com/muennich/sxiv";
     license = stdenv.lib.licenses.gpl2Plus;
     platforms = stdenv.lib.platforms.linux;
-    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+    maintainers = with maintainers; [ jfrankenau fuuzetsu ];
   };
 }
diff --git a/pkgs/applications/misc/noice/default.nix b/pkgs/applications/misc/noice/default.nix
new file mode 100644
index 000000000000..bcf2edd8f2f6
--- /dev/null
+++ b/pkgs/applications/misc/noice/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchgit, ncurses, conf ? null }:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "noice-${version}";
+  version = "0.6";
+
+  src = fetchgit {
+    url = "git://git.2f30.org/noice.git";
+    rev = "refs/tags/v${version}";
+    sha256 = "03rwglcy47fh6rb630vws10m95bxpcfv47nxrlws2li2ljam8prw";
+  };
+
+  configFile = optionalString (conf!=null) (builtins.toFile "config.def.h" conf);
+  preBuild = optionalString (conf!=null) "cp ${configFile} config.def.h";
+
+  buildInputs = [ ncurses ];
+
+  buildFlags = [ "LDLIBS=-lncurses" ];
+
+  installFlags = [ "DESTDIR=$(out)" "PREFIX=" ];
+
+  meta = {
+    description = "Small ncurses-based file browser";
+    homepage = https://git.2f30.org/noice/;
+    license = licenses.bsd2;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ jfrankenau ];
+  };
+}
diff --git a/pkgs/applications/misc/pdfpc/default.nix b/pkgs/applications/misc/pdfpc/default.nix
index 3c42e8d8fcc0..8e0fc6137210 100644
--- a/pkgs/applications/misc/pdfpc/default.nix
+++ b/pkgs/applications/misc/pdfpc/default.nix
@@ -4,13 +4,13 @@
 stdenv.mkDerivation rec {
   name = "${product}-${version}";
   product = "pdfpc";
-  version = "4.0.6";
+  version = "4.0.7";
 
   src = fetchFromGitHub {
     repo = "pdfpc";
     owner = "pdfpc";
     rev = "v${version}";
-    sha256 = "05cfx45i0xnwvclrbwlmqsjj2sk1galk62dc0mrkhr6293mbp1mx";
+    sha256 = "00qfmmk8h762p53z46g976z7j4fbxyi16w5axzsv1ymvdq95ds8c";
   };
 
   nativeBuildInputs = [ cmake pkgconfig vala ];
diff --git a/pkgs/applications/misc/urlscan/default.nix b/pkgs/applications/misc/urlscan/default.nix
index dc9cb3189d5b..7c4def952104 100644
--- a/pkgs/applications/misc/urlscan/default.nix
+++ b/pkgs/applications/misc/urlscan/default.nix
@@ -1,25 +1,21 @@
-{ stdenv, buildPythonPackage, fetchFromGitHub, urwid, pythonOlder }:
+{ stdenv, python3Packages, fetchFromGitHub }:
 
-buildPythonPackage rec {
+python3Packages.buildPythonApplication rec {
   name = "urlscan-${version}";
-  version = "0.8.3";
+  version = "0.8.6";
 
   src = fetchFromGitHub {
     owner = "firecat53";
     repo = "urlscan";
     rev = version;
-    # (equivalent but less nice(?): rev = "00333f6d03bf3151c9884ec778715fc605f58cc5")
-    sha256 = "0l40anfznam4d3q0q0jp2wwfrvfypz9ppbpjyzjdrhb3r2nizb0y";
+    sha256 = "1v26fni64n0lbv37m35plh2bsrvhpb4ibgmg2mv05qfc3df721s5";
   };
 
-  propagatedBuildInputs = [ urwid ];
-
-  # FIXME doesn't work with 2.7; others than 2.7 and 3.5 were not tested (yet)
-  disabled = !pythonOlder "3.5";
+  propagatedBuildInputs = [ python3Packages.urwid ];
 
   meta = with stdenv.lib; {
     description = "Mutt and terminal url selector (similar to urlview)";
     license = licenses.gpl2;
-    maintainers = [ maintainers.dpaetzel ];
+    maintainers = with maintainers; [ dpaetzel jfrankenau ];
   };
 }
diff --git a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
index 09ca83b5acd9..419f24cfb0ce 100644
--- a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
+++ b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
@@ -81,7 +81,7 @@ let
   fteLibPath = makeLibraryPath [ stdenv.cc.cc gmp ];
 
   # Upstream source
-  version = "7.0.1";
+  version = "7.0.2";
 
   lang = "en-US";
 
@@ -91,7 +91,7 @@ let
         "https://github.com/TheTorProject/gettorbrowser/releases/download/v${version}/tor-browser-linux64-${version}_${lang}.tar.xz"
         "https://dist.torproject.org/torbrowser/${version}/tor-browser-linux64-${version}_${lang}.tar.xz"
       ];
-      sha256 = "1zmczf1bpbd85zcrs5qw91d1xmplikbna5xs053jnjl6pbbq1fs9";
+      sha256 = "0xdw8mvyxz9vaxikzsj4ygzp36m4jfhvhqfiyaiiywpf39rqpkqr";
     };
 
     "i686-linux" = fetchurl {
@@ -99,7 +99,7 @@ let
         "https://github.com/TheTorProject/gettorbrowser/releases/download/v${version}/tor-browser-linux32-${version}_${lang}.tar.xz"
         "https://dist.torproject.org/torbrowser/${version}/tor-browser-linux32-${version}_${lang}.tar.xz"
       ];
-      sha256 = "0mdlgmqkryg0i55jgf3x1nnjni0x45g1xcjwsfacsck3m70v4flq";
+      sha256 = "0m522i8zih5sj18dyzk9im7gmpmrbf96657v38m3pxn4ci38b83z";
     };
   };
 in
@@ -190,6 +190,12 @@ stdenv.mkDerivation rec {
 
     // Stop obnoxious first-run redirection.
     lockPref("noscript.firstRunRedirection", false);
+
+    // Insist on using IPC for communicating with Tor
+    //
+    // Defaults to creating $TBB_HOME/TorBrowser/Data/Tor/{socks,control}.socket
+    lockPref("extensions.torlauncher.control_port_use_ipc", true);
+    lockPref("extensions.torlauncher.socks_port_use_ipc", true);
     EOF
 
     # Hard-code path to TBB fonts; see also FONTCONFIG_FILE in
@@ -233,6 +239,9 @@ stdenv.mkDerivation rec {
     # Initialize the Tor data directory.
     mkdir -p "\$HOME/TorBrowser/Data/Tor"
 
+    # TBB will fail if ownership is too permissive
+    chmod 0700 "\$HOME/TorBrowser/Data/Tor"
+
     # Initialize the browser profile state.  Note that the only data
     # copied from the Store payload is the initial bookmark file, which is
     # never updated once created.  All other files under user's profile
diff --git a/pkgs/applications/networking/browsers/w3m/cygwin.patch b/pkgs/applications/networking/browsers/w3m/cygwin.patch
deleted file mode 100644
index 767cc289b5f6..000000000000
--- a/pkgs/applications/networking/browsers/w3m/cygwin.patch
+++ /dev/null
@@ -1,1710 +0,0 @@
-diff -ur w3m-0.5.3/config.guess new/w3m-0.5.3/config.guess
---- w3m-0.5.3/config.guess	2004-08-04 13:32:27.000000000 -0400
-+++ w3m-0.5.3/config.guess	2013-04-28 18:43:59.480227700 -0400
-@@ -1,13 +1,14 @@
- #! /bin/sh
- # Attempt to guess a canonical system name.
- #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
--#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-+#   2011, 2012, 2013 Free Software Foundation, Inc.
- 
--timestamp='2004-03-12'
-+timestamp='2012-12-29'
- 
- # This file is free software; you can redistribute it and/or modify it
- # under the terms of the GNU General Public License as published by
--# the Free Software Foundation; either version 2 of the License, or
-+# the Free Software Foundation; either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful, but
-@@ -16,24 +17,22 @@
- # General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
--# along with this program; if not, write to the Free Software
--# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-+# along with this program; if not, see <http://www.gnu.org/licenses/>.
- #
- # As a special exception to the GNU General Public License, if you
- # distribute this file as part of a program that contains a
- # configuration script generated by Autoconf, you may include it under
--# the same distribution terms that you use for the rest of that program.
--
--# Originally written by Per Bothner <per@bothner.com>.
--# Please send patches to <config-patches@gnu.org>.  Submit a context
--# diff and a properly formatted ChangeLog entry.
-+# the same distribution terms that you use for the rest of that
-+# program.  This Exception is an additional permission under section 7
-+# of the GNU General Public License, version 3 ("GPLv3").
-+#
-+# Originally written by Per Bothner. 
- #
--# This script attempts to guess a canonical system name similar to
--# config.sub.  If it succeeds, it prints the system name on stdout, and
--# exits with 0.  Otherwise, it exits with 1.
-+# You can get the latest version of this script from:
-+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
- #
--# The plan is that this can be called by configure scripts if you
--# don't specify an explicit build system type.
-+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
-+
- 
- me=`echo "$0" | sed -e 's,.*/,,'`
- 
-@@ -53,8 +52,9 @@
- GNU config.guess ($timestamp)
- 
- Originally written by Per Bothner.
--Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
--Free Software Foundation, Inc.
-+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
-+2012, 2013 Free Software Foundation, Inc.
- 
- This is free software; see the source for copying conditions.  There is NO
- warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-@@ -66,11 +66,11 @@
- while test $# -gt 0 ; do
-   case $1 in
-     --time-stamp | --time* | -t )
--       echo "$timestamp" ; exit 0 ;;
-+       echo "$timestamp" ; exit ;;
-     --version | -v )
--       echo "$version" ; exit 0 ;;
-+       echo "$version" ; exit ;;
-     --help | --h* | -h )
--       echo "$usage"; exit 0 ;;
-+       echo "$usage"; exit ;;
-     -- )     # Stop option processing
-        shift; break ;;
-     - )	# Use stdin as input.
-@@ -104,7 +104,7 @@
- trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
- trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
- : ${TMPDIR=/tmp} ;
-- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
-+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
-  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
-  { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
-  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-@@ -123,7 +123,7 @@
- 	;;
-  ,,*)   CC_FOR_BUILD=$CC ;;
-  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
--esac ;'
-+esac ; set_cc_for_build= ;'
- 
- # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
- # (ghazi@noc.rutgers.edu 1994-08-24)
-@@ -141,7 +141,7 @@
- case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
-     *:NetBSD:*:*)
- 	# NetBSD (nbsd) targets should (where applicable) match one or
--	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
-+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
- 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
- 	# switched to ELF, *-*-netbsd* would select the old
- 	# object file format.  This provides both forward
-@@ -158,6 +158,7 @@
- 	    arm*) machine=arm-unknown ;;
- 	    sh3el) machine=shl-unknown ;;
- 	    sh3eb) machine=sh-unknown ;;
-+	    sh5el) machine=sh5le-unknown ;;
- 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- 	esac
- 	# The Operating System including object format, if it has switched
-@@ -166,7 +167,7 @@
- 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- 		eval $set_cc_for_build
- 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
--			| grep __ELF__ >/dev/null
-+			| grep -q __ELF__
- 		then
- 		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- 		    # Return netbsd for either.  FIX?
-@@ -176,7 +177,7 @@
- 		fi
- 		;;
- 	    *)
--	        os=netbsd
-+		os=netbsd
- 		;;
- 	esac
- 	# The OS release
-@@ -196,71 +197,34 @@
- 	# contains redundant information, the shorter form:
- 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- 	echo "${machine}-${os}${release}"
--	exit 0 ;;
--    amd64:OpenBSD:*:*)
--	echo x86_64-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    amiga:OpenBSD:*:*)
--	echo m68k-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    arc:OpenBSD:*:*)
--	echo mipsel-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    cats:OpenBSD:*:*)
--	echo arm-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    hp300:OpenBSD:*:*)
--	echo m68k-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    mac68k:OpenBSD:*:*)
--	echo m68k-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    macppc:OpenBSD:*:*)
--	echo powerpc-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    mvme68k:OpenBSD:*:*)
--	echo m68k-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    mvme88k:OpenBSD:*:*)
--	echo m88k-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    mvmeppc:OpenBSD:*:*)
--	echo powerpc-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    pegasos:OpenBSD:*:*)
--	echo powerpc-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    pmax:OpenBSD:*:*)
--	echo mipsel-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    sgi:OpenBSD:*:*)
--	echo mipseb-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    sun3:OpenBSD:*:*)
--	echo m68k-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
--    wgrisc:OpenBSD:*:*)
--	echo mipsel-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-+    *:Bitrig:*:*)
-+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
-+	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
-+	exit ;;
-     *:OpenBSD:*:*)
--	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
--	exit 0 ;;
-+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
-+	exit ;;
-     *:ekkoBSD:*:*)
- 	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-+    *:SolidBSD:*:*)
-+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
-+	exit ;;
-     macppc:MirBSD:*:*)
--	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
--	exit 0 ;;
-+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
-+	exit ;;
-     *:MirBSD:*:*)
- 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     alpha:OSF1:*:*)
- 	case $UNAME_RELEASE in
- 	*4.0)
- 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- 		;;
- 	*5.*)
--	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
-+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- 		;;
- 	esac
- 	# According to Compaq, /usr/sbin/psrinfo has been available on
-@@ -306,40 +270,46 @@
- 	# A Xn.n version is an unreleased experimental baselevel.
- 	# 1.2 uses "1.2" for uname -r.
- 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
--	exit 0 ;;
--    Alpha*:OpenVMS:*:*)
--	echo alpha-hp-vms
--	exit 0 ;;
-+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
-+	exitcode=$?
-+	trap '' 0
-+	exit $exitcode ;;
-     Alpha\ *:Windows_NT*:*)
- 	# How do we know it's Interix rather than the generic POSIX subsystem?
- 	# Should we change UNAME_MACHINE based on the output of uname instead
- 	# of the specific Alpha model?
- 	echo alpha-pc-interix
--	exit 0 ;;
-+	exit ;;
-     21064:Windows_NT:50:3)
- 	echo alpha-dec-winnt3.5
--	exit 0 ;;
-+	exit ;;
-     Amiga*:UNIX_System_V:4.0:*)
- 	echo m68k-unknown-sysv4
--	exit 0;;
-+	exit ;;
-     *:[Aa]miga[Oo][Ss]:*:*)
- 	echo ${UNAME_MACHINE}-unknown-amigaos
--	exit 0 ;;
-+	exit ;;
-     *:[Mm]orph[Oo][Ss]:*:*)
- 	echo ${UNAME_MACHINE}-unknown-morphos
--	exit 0 ;;
-+	exit ;;
-     *:OS/390:*:*)
- 	echo i370-ibm-openedition
--	exit 0 ;;
-+	exit ;;
-+    *:z/VM:*:*)
-+	echo s390-ibm-zvmoe
-+	exit ;;
-     *:OS400:*:*)
--        echo powerpc-ibm-os400
--	exit 0 ;;
-+	echo powerpc-ibm-os400
-+	exit ;;
-     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- 	echo arm-acorn-riscix${UNAME_RELEASE}
--	exit 0;;
-+	exit ;;
-+    arm*:riscos:*:*|arm*:RISCOS:*:*)
-+	echo arm-unknown-riscos
-+	exit ;;
-     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- 	echo hppa1.1-hitachi-hiuxmpp
--	exit 0;;
-+	exit ;;
-     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- 	if test "`(/bin/universe) 2>/dev/null`" = att ; then
-@@ -347,32 +317,51 @@
- 	else
- 		echo pyramid-pyramid-bsd
- 	fi
--	exit 0 ;;
-+	exit ;;
-     NILE*:*:*:dcosx)
- 	echo pyramid-pyramid-svr4
--	exit 0 ;;
-+	exit ;;
-     DRS?6000:unix:4.0:6*)
- 	echo sparc-icl-nx6
--	exit 0 ;;
--    DRS?6000:UNIX_SV:4.2*:7*)
-+	exit ;;
-+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- 	case `/usr/bin/uname -p` in
--	    sparc) echo sparc-icl-nx7 && exit 0 ;;
-+	    sparc) echo sparc-icl-nx7; exit ;;
- 	esac ;;
-+    s390x:SunOS:*:*)
-+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-+	exit ;;
-     sun4H:SunOS:5.*:*)
- 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
--	exit 0 ;;
-+	exit ;;
-     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
--	exit 0 ;;
--    i86pc:SunOS:5.*:*)
--	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
--	exit 0 ;;
-+	exit ;;
-+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
-+	echo i386-pc-auroraux${UNAME_RELEASE}
-+	exit ;;
-+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-+	eval $set_cc_for_build
-+	SUN_ARCH="i386"
-+	# If there is a compiler, see if it is configured for 64-bit objects.
-+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
-+	# This test works for both compilers.
-+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-+		grep IS_64BIT_ARCH >/dev/null
-+	    then
-+		SUN_ARCH="x86_64"
-+	    fi
-+	fi
-+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-+	exit ;;
-     sun4*:SunOS:6*:*)
- 	# According to config.sub, this is the proper way to canonicalize
- 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
- 	# it's likely to be more like Solaris than SunOS4.
- 	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
--	exit 0 ;;
-+	exit ;;
-     sun4*:SunOS:*:*)
- 	case "`/usr/bin/arch -k`" in
- 	    Series*|S4*)
-@@ -381,10 +370,10 @@
- 	esac
- 	# Japanese Language versions have a version number like `4.1.3-JL'.
- 	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
--	exit 0 ;;
-+	exit ;;
-     sun3*:SunOS:*:*)
- 	echo m68k-sun-sunos${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     sun*:*:4.2BSD:*)
- 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- 	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
-@@ -396,10 +385,10 @@
- 		echo sparc-sun-sunos${UNAME_RELEASE}
- 		;;
- 	esac
--	exit 0 ;;
-+	exit ;;
-     aushp:SunOS:*:*)
- 	echo sparc-auspex-sunos${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     # The situation for MiNT is a little confusing.  The machine name
-     # can be virtually everything (everything which is not
-     # "atarist" or "atariste" at least should have a processor
-@@ -409,41 +398,41 @@
-     # MiNT.  But MiNT is downward compatible to TOS, so this should
-     # be no problem.
-     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
--        echo m68k-atari-mint${UNAME_RELEASE}
--	exit 0 ;;
-+	echo m68k-atari-mint${UNAME_RELEASE}
-+	exit ;;
-     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- 	echo m68k-atari-mint${UNAME_RELEASE}
--        exit 0 ;;
-+	exit ;;
-     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
--        echo m68k-atari-mint${UNAME_RELEASE}
--	exit 0 ;;
-+	echo m68k-atari-mint${UNAME_RELEASE}
-+	exit ;;
-     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
--        echo m68k-milan-mint${UNAME_RELEASE}
--        exit 0 ;;
-+	echo m68k-milan-mint${UNAME_RELEASE}
-+	exit ;;
-     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
--        echo m68k-hades-mint${UNAME_RELEASE}
--        exit 0 ;;
-+	echo m68k-hades-mint${UNAME_RELEASE}
-+	exit ;;
-     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
--        echo m68k-unknown-mint${UNAME_RELEASE}
--        exit 0 ;;
-+	echo m68k-unknown-mint${UNAME_RELEASE}
-+	exit ;;
-     m68k:machten:*:*)
- 	echo m68k-apple-machten${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     powerpc:machten:*:*)
- 	echo powerpc-apple-machten${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     RISC*:Mach:*:*)
- 	echo mips-dec-mach_bsd4.3
--	exit 0 ;;
-+	exit ;;
-     RISC*:ULTRIX:*:*)
- 	echo mips-dec-ultrix${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     VAX*:ULTRIX*:*:*)
- 	echo vax-dec-ultrix${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     2020:CLIX:*:* | 2430:CLIX:*:*)
- 	echo clipper-intergraph-clix${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     mips:*:*:UMIPS | mips:*:*:RISCos)
- 	eval $set_cc_for_build
- 	sed 's/^	//' << EOF >$dummy.c
-@@ -467,35 +456,36 @@
- 	  exit (-1);
- 	}
- EOF
--	$CC_FOR_BUILD -o $dummy $dummy.c \
--	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
--	  && exit 0
-+	$CC_FOR_BUILD -o $dummy $dummy.c &&
-+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-+	  SYSTEM_NAME=`$dummy $dummyarg` &&
-+	    { echo "$SYSTEM_NAME"; exit; }
- 	echo mips-mips-riscos${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     Motorola:PowerMAX_OS:*:*)
- 	echo powerpc-motorola-powermax
--	exit 0 ;;
-+	exit ;;
-     Motorola:*:4.3:PL8-*)
- 	echo powerpc-harris-powermax
--	exit 0 ;;
-+	exit ;;
-     Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- 	echo powerpc-harris-powermax
--	exit 0 ;;
-+	exit ;;
-     Night_Hawk:Power_UNIX:*:*)
- 	echo powerpc-harris-powerunix
--	exit 0 ;;
-+	exit ;;
-     m88k:CX/UX:7*:*)
- 	echo m88k-harris-cxux7
--	exit 0 ;;
-+	exit ;;
-     m88k:*:4*:R4*)
- 	echo m88k-motorola-sysv4
--	exit 0 ;;
-+	exit ;;
-     m88k:*:3*:R3*)
- 	echo m88k-motorola-sysv3
--	exit 0 ;;
-+	exit ;;
-     AViiON:dgux:*:*)
--        # DG/UX returns AViiON for all architectures
--        UNAME_PROCESSOR=`/usr/bin/uname -p`
-+	# DG/UX returns AViiON for all architectures
-+	UNAME_PROCESSOR=`/usr/bin/uname -p`
- 	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- 	then
- 	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-@@ -508,29 +498,29 @@
- 	else
- 	    echo i586-dg-dgux${UNAME_RELEASE}
- 	fi
-- 	exit 0 ;;
-+	exit ;;
-     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
- 	echo m88k-dolphin-sysv3
--	exit 0 ;;
-+	exit ;;
-     M88*:*:R3*:*)
- 	# Delta 88k system running SVR3
- 	echo m88k-motorola-sysv3
--	exit 0 ;;
-+	exit ;;
-     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- 	echo m88k-tektronix-sysv3
--	exit 0 ;;
-+	exit ;;
-     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- 	echo m68k-tektronix-bsd
--	exit 0 ;;
-+	exit ;;
-     *:IRIX*:*:*)
- 	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
--	exit 0 ;;
-+	exit ;;
-     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
--	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
--	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
-+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
-     i*86:AIX:*:*)
- 	echo i386-ibm-aix
--	exit 0 ;;
-+	exit ;;
-     ia64:AIX:*:*)
- 	if [ -x /usr/bin/oslevel ] ; then
- 		IBM_REV=`/usr/bin/oslevel`
-@@ -538,7 +528,7 @@
- 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- 	fi
- 	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
--	exit 0 ;;
-+	exit ;;
-     *:AIX:2:3)
- 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- 		eval $set_cc_for_build
-@@ -553,15 +543,19 @@
- 			exit(0);
- 			}
- EOF
--		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
--		echo rs6000-ibm-aix3.2.5
-+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
-+		then
-+			echo "$SYSTEM_NAME"
-+		else
-+			echo rs6000-ibm-aix3.2.5
-+		fi
- 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- 		echo rs6000-ibm-aix3.2.4
- 	else
- 		echo rs6000-ibm-aix3.2
- 	fi
--	exit 0 ;;
--    *:AIX:*:[45])
-+	exit ;;
-+    *:AIX:*:[4567])
- 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- 		IBM_ARCH=rs6000
-@@ -574,28 +568,28 @@
- 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- 	fi
- 	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
--	exit 0 ;;
-+	exit ;;
-     *:AIX:*:*)
- 	echo rs6000-ibm-aix
--	exit 0 ;;
-+	exit ;;
-     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- 	echo romp-ibm-bsd4.4
--	exit 0 ;;
-+	exit ;;
-     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
- 	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
--	exit 0 ;;                           # report: romp-ibm BSD 4.3
-+	exit ;;                             # report: romp-ibm BSD 4.3
-     *:BOSX:*:*)
- 	echo rs6000-bull-bosx
--	exit 0 ;;
-+	exit ;;
-     DPX/2?00:B.O.S.:*:*)
- 	echo m68k-bull-sysv3
--	exit 0 ;;
-+	exit ;;
-     9000/[34]??:4.3bsd:1.*:*)
- 	echo m68k-hp-bsd
--	exit 0 ;;
-+	exit ;;
-     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- 	echo m68k-hp-bsd4.4
--	exit 0 ;;
-+	exit ;;
-     9000/[34678]??:HP-UX:*:*)
- 	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- 	case "${UNAME_MACHINE}" in
-@@ -604,52 +598,52 @@
- 	    9000/[678][0-9][0-9])
- 		if [ -x /usr/bin/getconf ]; then
- 		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
--                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
--                    case "${sc_cpu_version}" in
--                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
--                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
--                      532)                      # CPU_PA_RISC2_0
--                        case "${sc_kernel_bits}" in
--                          32) HP_ARCH="hppa2.0n" ;;
--                          64) HP_ARCH="hppa2.0w" ;;
-+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-+		    case "${sc_cpu_version}" in
-+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-+		      532)                      # CPU_PA_RISC2_0
-+			case "${sc_kernel_bits}" in
-+			  32) HP_ARCH="hppa2.0n" ;;
-+			  64) HP_ARCH="hppa2.0w" ;;
- 			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
--                        esac ;;
--                    esac
-+			esac ;;
-+		    esac
- 		fi
- 		if [ "${HP_ARCH}" = "" ]; then
- 		    eval $set_cc_for_build
--		    sed 's/^              //' << EOF >$dummy.c
-+		    sed 's/^		//' << EOF >$dummy.c
- 
--              #define _HPUX_SOURCE
--              #include <stdlib.h>
--              #include <unistd.h>
--
--              int main ()
--              {
--              #if defined(_SC_KERNEL_BITS)
--                  long bits = sysconf(_SC_KERNEL_BITS);
--              #endif
--                  long cpu  = sysconf (_SC_CPU_VERSION);
--
--                  switch (cpu)
--              	{
--              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
--              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
--              	case CPU_PA_RISC2_0:
--              #if defined(_SC_KERNEL_BITS)
--              	    switch (bits)
--              		{
--              		case 64: puts ("hppa2.0w"); break;
--              		case 32: puts ("hppa2.0n"); break;
--              		default: puts ("hppa2.0"); break;
--              		} break;
--              #else  /* !defined(_SC_KERNEL_BITS) */
--              	    puts ("hppa2.0"); break;
--              #endif
--              	default: puts ("hppa1.0"); break;
--              	}
--                  exit (0);
--              }
-+		#define _HPUX_SOURCE
-+		#include <stdlib.h>
-+		#include <unistd.h>
-+
-+		int main ()
-+		{
-+		#if defined(_SC_KERNEL_BITS)
-+		    long bits = sysconf(_SC_KERNEL_BITS);
-+		#endif
-+		    long cpu  = sysconf (_SC_CPU_VERSION);
-+
-+		    switch (cpu)
-+			{
-+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-+			case CPU_PA_RISC2_0:
-+		#if defined(_SC_KERNEL_BITS)
-+			    switch (bits)
-+				{
-+				case 64: puts ("hppa2.0w"); break;
-+				case 32: puts ("hppa2.0n"); break;
-+				default: puts ("hppa2.0"); break;
-+				} break;
-+		#else  /* !defined(_SC_KERNEL_BITS) */
-+			    puts ("hppa2.0"); break;
-+		#endif
-+			default: puts ("hppa1.0"); break;
-+			}
-+		    exit (0);
-+		}
- EOF
- 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- 		    test -z "$HP_ARCH" && HP_ARCH=hppa
-@@ -657,9 +651,19 @@
- 	esac
- 	if [ ${HP_ARCH} = "hppa2.0w" ]
- 	then
--	    # avoid double evaluation of $set_cc_for_build
--	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
--	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
-+	    eval $set_cc_for_build
-+
-+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
-+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
-+	    # generating 64-bit code.  GNU and HP use different nomenclature:
-+	    #
-+	    # $ CC_FOR_BUILD=cc ./config.guess
-+	    # => hppa2.0w-hp-hpux11.23
-+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
-+	    # => hppa64-hp-hpux11.23
-+
-+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-+		grep -q __LP64__
- 	    then
- 		HP_ARCH="hppa2.0w"
- 	    else
-@@ -667,11 +671,11 @@
- 	    fi
- 	fi
- 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
--	exit 0 ;;
-+	exit ;;
-     ia64:HP-UX:*:*)
- 	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- 	echo ia64-hp-hpux${HPUX_REV}
--	exit 0 ;;
-+	exit ;;
-     3050*:HI-UX:*:*)
- 	eval $set_cc_for_build
- 	sed 's/^	//' << EOF >$dummy.c
-@@ -699,224 +703,269 @@
- 	  exit (0);
- 	}
- EOF
--	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
-+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
-+		{ echo "$SYSTEM_NAME"; exit; }
- 	echo unknown-hitachi-hiuxwe2
--	exit 0 ;;
-+	exit ;;
-     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- 	echo hppa1.1-hp-bsd
--	exit 0 ;;
-+	exit ;;
-     9000/8??:4.3bsd:*:*)
- 	echo hppa1.0-hp-bsd
--	exit 0 ;;
-+	exit ;;
-     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- 	echo hppa1.0-hp-mpeix
--	exit 0 ;;
-+	exit ;;
-     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- 	echo hppa1.1-hp-osf
--	exit 0 ;;
-+	exit ;;
-     hp8??:OSF1:*:*)
- 	echo hppa1.0-hp-osf
--	exit 0 ;;
-+	exit ;;
-     i*86:OSF1:*:*)
- 	if [ -x /usr/sbin/sysversion ] ; then
- 	    echo ${UNAME_MACHINE}-unknown-osf1mk
- 	else
- 	    echo ${UNAME_MACHINE}-unknown-osf1
- 	fi
--	exit 0 ;;
-+	exit ;;
-     parisc*:Lites*:*:*)
- 	echo hppa1.1-hp-lites
--	exit 0 ;;
-+	exit ;;
-     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- 	echo c1-convex-bsd
--        exit 0 ;;
-+	exit ;;
-     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- 	if getsysinfo -f scalar_acc
- 	then echo c32-convex-bsd
- 	else echo c2-convex-bsd
- 	fi
--        exit 0 ;;
-+	exit ;;
-     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- 	echo c34-convex-bsd
--        exit 0 ;;
-+	exit ;;
-     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- 	echo c38-convex-bsd
--        exit 0 ;;
-+	exit ;;
-     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- 	echo c4-convex-bsd
--        exit 0 ;;
-+	exit ;;
-     CRAY*Y-MP:*:*:*)
- 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
--	exit 0 ;;
-+	exit ;;
-     CRAY*[A-Z]90:*:*:*)
- 	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- 	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- 	      -e 's/\.[^.]*$/.X/'
--	exit 0 ;;
-+	exit ;;
-     CRAY*TS:*:*:*)
- 	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
--	exit 0 ;;
-+	exit ;;
-     CRAY*T3E:*:*:*)
- 	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
--	exit 0 ;;
-+	exit ;;
-     CRAY*SV1:*:*:*)
- 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
--	exit 0 ;;
-+	exit ;;
-     *:UNICOS/mp:*:*)
--	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
--	exit 0 ;;
-+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-+	exit ;;
-     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
--        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
--        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
--        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
--        exit 0 ;;
-+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-+	exit ;;
-     5000:UNIX_System_V:4.*:*)
--        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
--        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
--        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
--	exit 0 ;;
-+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-+	exit ;;
-     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     sparc*:BSD/OS:*:*)
- 	echo sparc-unknown-bsdi${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     *:BSD/OS:*:*)
- 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     *:FreeBSD:*:*)
--	# Determine whether the default compiler uses glibc.
--	eval $set_cc_for_build
--	sed 's/^	//' << EOF >$dummy.c
--	#include <features.h>
--	#if __GLIBC__ >= 2
--	LIBC=gnu
--	#else
--	LIBC=
--	#endif
--EOF
--	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
--	# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
--	# FreeBSD's kernel, but not the complete OS.
--	case ${LIBC} in gnu) kernel_only='k' ;; esac
--	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
--	exit 0 ;;
-+	UNAME_PROCESSOR=`/usr/bin/uname -p`
-+	case ${UNAME_PROCESSOR} in
-+	    amd64)
-+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-+	    *)
-+		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-+	esac
-+	exit ;;
-     i*:CYGWIN*:*)
- 	echo ${UNAME_MACHINE}-pc-cygwin
--	exit 0 ;;
--    i*:MINGW*:*)
-+	exit ;;
-+    *:MINGW64*:*)
-+	echo ${UNAME_MACHINE}-pc-mingw64
-+	exit ;;
-+    *:MINGW*:*)
- 	echo ${UNAME_MACHINE}-pc-mingw32
--	exit 0 ;;
-+	exit ;;
-+    i*:MSYS*:*)
-+	echo ${UNAME_MACHINE}-pc-msys
-+	exit ;;
-+    i*:windows32*:*)
-+	# uname -m includes "-pc" on this system.
-+	echo ${UNAME_MACHINE}-mingw32
-+	exit ;;
-     i*:PW*:*)
- 	echo ${UNAME_MACHINE}-pc-pw32
--	exit 0 ;;
--    x86:Interix*:[34]*)
--	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
--	exit 0 ;;
-+	exit ;;
-+    *:Interix*:*)
-+	case ${UNAME_MACHINE} in
-+	    x86)
-+		echo i586-pc-interix${UNAME_RELEASE}
-+		exit ;;
-+	    authenticamd | genuineintel | EM64T)
-+		echo x86_64-unknown-interix${UNAME_RELEASE}
-+		exit ;;
-+	    IA64)
-+		echo ia64-unknown-interix${UNAME_RELEASE}
-+		exit ;;
-+	esac ;;
-     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- 	echo i${UNAME_MACHINE}-pc-mks
--	exit 0 ;;
-+	exit ;;
-+    8664:Windows_NT:*)
-+	echo x86_64-pc-mks
-+	exit ;;
-     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- 	# How do we know it's Interix rather than the generic POSIX subsystem?
- 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- 	# UNAME_MACHINE based on the output of uname instead of i386?
- 	echo i586-pc-interix
--	exit 0 ;;
-+	exit ;;
-     i*:UWIN*:*)
- 	echo ${UNAME_MACHINE}-pc-uwin
--	exit 0 ;;
-+	exit ;;
-+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-+	echo x86_64-unknown-cygwin
-+	exit ;;
-     p*:CYGWIN*:*)
- 	echo powerpcle-unknown-cygwin
--	exit 0 ;;
-+	exit ;;
-     prep*:SunOS:5.*:*)
- 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
--	exit 0 ;;
-+	exit ;;
-     *:GNU:*:*)
- 	# the GNU system
- 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
--	exit 0 ;;
-+	exit ;;
-     *:GNU/*:*:*)
- 	# other systems with GNU libc and userland
- 	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
--	exit 0 ;;
-+	exit ;;
-     i*86:Minix:*:*)
- 	echo ${UNAME_MACHINE}-pc-minix
--	exit 0 ;;
-+	exit ;;
-+    aarch64:Linux:*:*)
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	exit ;;
-+    aarch64_be:Linux:*:*)
-+	UNAME_MACHINE=aarch64_be
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	exit ;;
-+    alpha:Linux:*:*)
-+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-+	  EV5)   UNAME_MACHINE=alphaev5 ;;
-+	  EV56)  UNAME_MACHINE=alphaev56 ;;
-+	  PCA56) UNAME_MACHINE=alphapca56 ;;
-+	  PCA57) UNAME_MACHINE=alphapca56 ;;
-+	  EV6)   UNAME_MACHINE=alphaev6 ;;
-+	  EV67)  UNAME_MACHINE=alphaev67 ;;
-+	  EV68*) UNAME_MACHINE=alphaev68 ;;
-+	esac
-+	objdump --private-headers /bin/sh | grep -q ld.so.1
-+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-+	exit ;;
-     arm*:Linux:*:*)
-+	eval $set_cc_for_build
-+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
-+	    | grep -q __ARM_EABI__
-+	then
-+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	else
-+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
-+		| grep -q __ARM_PCS_VFP
-+	    then
-+		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
-+	    else
-+		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
-+	    fi
-+	fi
-+	exit ;;
-+    avr32*:Linux:*:*)
- 	echo ${UNAME_MACHINE}-unknown-linux-gnu
--	exit 0 ;;
-+	exit ;;
-     cris:Linux:*:*)
--	echo cris-axis-linux-gnu
--	exit 0 ;;
--    ia64:Linux:*:*)
--	echo ${UNAME_MACHINE}-unknown-linux-gnu
--	exit 0 ;;
--    m32r*:Linux:*:*)
-+	echo ${UNAME_MACHINE}-axis-linux-gnu
-+	exit ;;
-+    crisv32:Linux:*:*)
-+	echo ${UNAME_MACHINE}-axis-linux-gnu
-+	exit ;;
-+    frv:Linux:*:*)
- 	echo ${UNAME_MACHINE}-unknown-linux-gnu
--	exit 0 ;;
--    m68*:Linux:*:*)
-+	exit ;;
-+    hexagon:Linux:*:*)
- 	echo ${UNAME_MACHINE}-unknown-linux-gnu
--	exit 0 ;;
--    mips:Linux:*:*)
-+	exit ;;
-+    i*86:Linux:*:*)
-+	LIBC=gnu
- 	eval $set_cc_for_build
- 	sed 's/^	//' << EOF >$dummy.c
--	#undef CPU
--	#undef mips
--	#undef mipsel
--	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
--	CPU=mipsel
--	#else
--	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
--	CPU=mips
--	#else
--	CPU=
--	#endif
-+	#ifdef __dietlibc__
-+	LIBC=dietlibc
- 	#endif
- EOF
--	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
--	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
--	;;
--    mips64:Linux:*:*)
-+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
-+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-+	exit ;;
-+    ia64:Linux:*:*)
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	exit ;;
-+    m32r*:Linux:*:*)
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	exit ;;
-+    m68*:Linux:*:*)
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	exit ;;
-+    mips:Linux:*:* | mips64:Linux:*:*)
- 	eval $set_cc_for_build
- 	sed 's/^	//' << EOF >$dummy.c
- 	#undef CPU
--	#undef mips64
--	#undef mips64el
-+	#undef ${UNAME_MACHINE}
-+	#undef ${UNAME_MACHINE}el
- 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
--	CPU=mips64el
-+	CPU=${UNAME_MACHINE}el
- 	#else
- 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
--	CPU=mips64
-+	CPU=${UNAME_MACHINE}
- 	#else
- 	CPU=
- 	#endif
- 	#endif
- EOF
--	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
--	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
-+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
-+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- 	;;
--    ppc:Linux:*:*)
--	echo powerpc-unknown-linux-gnu
--	exit 0 ;;
--    ppc64:Linux:*:*)
--	echo powerpc64-unknown-linux-gnu
--	exit 0 ;;
--    alpha:Linux:*:*)
--	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
--	  EV5)   UNAME_MACHINE=alphaev5 ;;
--	  EV56)  UNAME_MACHINE=alphaev56 ;;
--	  PCA56) UNAME_MACHINE=alphapca56 ;;
--	  PCA57) UNAME_MACHINE=alphapca56 ;;
--	  EV6)   UNAME_MACHINE=alphaev6 ;;
--	  EV67)  UNAME_MACHINE=alphaev67 ;;
--	  EV68*) UNAME_MACHINE=alphaev68 ;;
--        esac
--	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
--	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
--	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
--	exit 0 ;;
-+    or32:Linux:*:*)
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	exit ;;
-+    padre:Linux:*:*)
-+	echo sparc-unknown-linux-gnu
-+	exit ;;
-+    parisc64:Linux:*:* | hppa64:Linux:*:*)
-+	echo hppa64-unknown-linux-gnu
-+	exit ;;
-     parisc:Linux:*:* | hppa:Linux:*:*)
- 	# Look for CPU level
- 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-@@ -924,115 +973,71 @@
- 	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
- 	  *)    echo hppa-unknown-linux-gnu ;;
- 	esac
--	exit 0 ;;
--    parisc64:Linux:*:* | hppa64:Linux:*:*)
--	echo hppa64-unknown-linux-gnu
--	exit 0 ;;
-+	exit ;;
-+    ppc64:Linux:*:*)
-+	echo powerpc64-unknown-linux-gnu
-+	exit ;;
-+    ppc:Linux:*:*)
-+	echo powerpc-unknown-linux-gnu
-+	exit ;;
-     s390:Linux:*:* | s390x:Linux:*:*)
- 	echo ${UNAME_MACHINE}-ibm-linux
--	exit 0 ;;
-+	exit ;;
-     sh64*:Linux:*:*)
--    	echo ${UNAME_MACHINE}-unknown-linux-gnu
--	exit 0 ;;
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	exit ;;
-     sh*:Linux:*:*)
- 	echo ${UNAME_MACHINE}-unknown-linux-gnu
--	exit 0 ;;
-+	exit ;;
-     sparc:Linux:*:* | sparc64:Linux:*:*)
- 	echo ${UNAME_MACHINE}-unknown-linux-gnu
--	exit 0 ;;
-+	exit ;;
-+    tile*:Linux:*:*)
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	exit ;;
-+    vax:Linux:*:*)
-+	echo ${UNAME_MACHINE}-dec-linux-gnu
-+	exit ;;
-     x86_64:Linux:*:*)
--	echo x86_64-unknown-linux-gnu
--	exit 0 ;;
--    i*86:Linux:*:*)
--	# The BFD linker knows what the default object file format is, so
--	# first see if it will tell us. cd to the root directory to prevent
--	# problems with other programs or directories called `ld' in the path.
--	# Set LC_ALL=C to ensure ld outputs messages in English.
--	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
--			 | sed -ne '/supported targets:/!d
--				    s/[ 	][ 	]*/ /g
--				    s/.*supported targets: *//
--				    s/ .*//
--				    p'`
--        case "$ld_supported_targets" in
--	  elf32-i386)
--		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
--		;;
--	  a.out-i386-linux)
--		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
--		exit 0 ;;
--	  coff-i386)
--		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
--		exit 0 ;;
--	  "")
--		# Either a pre-BFD a.out linker (linux-gnuoldld) or
--		# one that does not give us useful --help.
--		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
--		exit 0 ;;
--	esac
--	# Determine whether the default compiler is a.out or elf
--	eval $set_cc_for_build
--	sed 's/^	//' << EOF >$dummy.c
--	#include <features.h>
--	#ifdef __ELF__
--	# ifdef __GLIBC__
--	#  if __GLIBC__ >= 2
--	LIBC=gnu
--	#  else
--	LIBC=gnulibc1
--	#  endif
--	# else
--	LIBC=gnulibc1
--	# endif
--	#else
--	#ifdef __INTEL_COMPILER
--	LIBC=gnu
--	#else
--	LIBC=gnuaout
--	#endif
--	#endif
--	#ifdef __dietlibc__
--	LIBC=dietlibc
--	#endif
--EOF
--	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
--	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
--	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
--	;;
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	exit ;;
-+    xtensa*:Linux:*:*)
-+	echo ${UNAME_MACHINE}-unknown-linux-gnu
-+	exit ;;
-     i*86:DYNIX/ptx:4*:*)
- 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- 	# earlier versions are messed up and put the nodename in both
- 	# sysname and nodename.
- 	echo i386-sequent-sysv4
--	exit 0 ;;
-+	exit ;;
-     i*86:UNIX_SV:4.2MP:2.*)
--        # Unixware is an offshoot of SVR4, but it has its own version
--        # number series starting with 2...
--        # I am not positive that other SVR4 systems won't match this,
-+	# Unixware is an offshoot of SVR4, but it has its own version
-+	# number series starting with 2...
-+	# I am not positive that other SVR4 systems won't match this,
- 	# I just have to hope.  -- rms.
--        # Use sysv4.2uw... so that sysv4* matches it.
-+	# Use sysv4.2uw... so that sysv4* matches it.
- 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
--	exit 0 ;;
-+	exit ;;
-     i*86:OS/2:*:*)
- 	# If we were able to find `uname', then EMX Unix compatibility
- 	# is probably installed.
- 	echo ${UNAME_MACHINE}-pc-os2-emx
--	exit 0 ;;
-+	exit ;;
-     i*86:XTS-300:*:STOP)
- 	echo ${UNAME_MACHINE}-unknown-stop
--	exit 0 ;;
-+	exit ;;
-     i*86:atheos:*:*)
- 	echo ${UNAME_MACHINE}-unknown-atheos
--	exit 0 ;;
--	i*86:syllable:*:*)
-+	exit ;;
-+    i*86:syllable:*:*)
- 	echo ${UNAME_MACHINE}-pc-syllable
--	exit 0 ;;
--    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-+	exit ;;
-+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- 	echo i386-unknown-lynxos${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     i*86:*DOS:*:*)
- 	echo ${UNAME_MACHINE}-pc-msdosdjgpp
--	exit 0 ;;
-+	exit ;;
-     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- 	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-@@ -1040,15 +1045,16 @@
- 	else
- 		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- 	fi
--	exit 0 ;;
--    i*86:*:5:[78]*)
-+	exit ;;
-+    i*86:*:5:[678]*)
-+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
- 	case `/bin/uname -X | grep "^Machine"` in
- 	    *486*)	     UNAME_MACHINE=i486 ;;
- 	    *Pentium)	     UNAME_MACHINE=i586 ;;
- 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- 	esac
- 	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
--	exit 0 ;;
-+	exit ;;
-     i*86:*:3.2:*)
- 	if test -f /usr/options/cb.name; then
- 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-@@ -1066,73 +1072,86 @@
- 	else
- 		echo ${UNAME_MACHINE}-pc-sysv32
- 	fi
--	exit 0 ;;
-+	exit ;;
-     pc:*:*:*)
- 	# Left here for compatibility:
--        # uname -m prints for DJGPP always 'pc', but it prints nothing about
--        # the processor, so we play safe by assuming i386.
--	echo i386-pc-msdosdjgpp
--        exit 0 ;;
-+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
-+	# the processor, so we play safe by assuming i586.
-+	# Note: whatever this is, it MUST be the same as what config.sub
-+	# prints for the "djgpp" host, or else GDB configury will decide that
-+	# this is a cross-build.
-+	echo i586-pc-msdosdjgpp
-+	exit ;;
-     Intel:Mach:3*:*)
- 	echo i386-pc-mach3
--	exit 0 ;;
-+	exit ;;
-     paragon:*:*:*)
- 	echo i860-intel-osf1
--	exit 0 ;;
-+	exit ;;
-     i860:*:4.*:*) # i860-SVR4
- 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- 	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- 	else # Add other i860-SVR4 vendors below as they are discovered.
- 	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
- 	fi
--	exit 0 ;;
-+	exit ;;
-     mini*:CTIX:SYS*5:*)
- 	# "miniframe"
- 	echo m68010-convergent-sysv
--	exit 0 ;;
-+	exit ;;
-     mc68k:UNIX:SYSTEM5:3.51m)
- 	echo m68k-convergent-sysv
--	exit 0 ;;
-+	exit ;;
-     M680?0:D-NIX:5.3:*)
- 	echo m68k-diab-dnix
--	exit 0 ;;
--    M68*:*:R3V[567]*:*)
--	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
--    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
-+	exit ;;
-+    M68*:*:R3V[5678]*:*)
-+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
-+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- 	OS_REL=''
- 	test -r /etc/.relid \
- 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
--	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
-+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
--	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
-+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
-     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
--        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
--          && echo i486-ncr-sysv4 && exit 0 ;;
-+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-+	  && { echo i486-ncr-sysv4; exit; } ;;
-+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
-+	OS_REL='.3'
-+	test -r /etc/.relid \
-+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
-+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
-+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
-+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
-+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
-     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- 	echo m68k-unknown-lynxos${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     mc68030:UNIX_System_V:4.*:*)
- 	echo m68k-atari-sysv4
--	exit 0 ;;
-+	exit ;;
-     TSUNAMI:LynxOS:2.*:*)
- 	echo sparc-unknown-lynxos${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     rs6000:LynxOS:2.*:*)
- 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
--	exit 0 ;;
--    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
-+	exit ;;
-+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- 	echo powerpc-unknown-lynxos${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     SM[BE]S:UNIX_SV:*:*)
- 	echo mips-dde-sysv${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     RM*:ReliantUNIX-*:*:*)
- 	echo mips-sni-sysv4
--	exit 0 ;;
-+	exit ;;
-     RM*:SINIX-*:*:*)
- 	echo mips-sni-sysv4
--	exit 0 ;;
-+	exit ;;
-     *:SINIX-*:*:*)
- 	if uname -p 2>/dev/null >/dev/null ; then
- 		UNAME_MACHINE=`(uname -p) 2>/dev/null`
-@@ -1140,68 +1159,97 @@
- 	else
- 		echo ns32k-sni-sysv
- 	fi
--	exit 0 ;;
--    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
--                      # says <Richard.M.Bartel@ccMail.Census.GOV>
--        echo i586-unisys-sysv4
--        exit 0 ;;
-+	exit ;;
-+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-+			# says <Richard.M.Bartel@ccMail.Census.GOV>
-+	echo i586-unisys-sysv4
-+	exit ;;
-     *:UNIX_System_V:4*:FTX*)
- 	# From Gerald Hewes <hewes@openmarket.com>.
- 	# How about differentiating between stratus architectures? -djm
- 	echo hppa1.1-stratus-sysv4
--	exit 0 ;;
-+	exit ;;
-     *:*:*:FTX*)
- 	# From seanf@swdc.stratus.com.
- 	echo i860-stratus-sysv4
--	exit 0 ;;
-+	exit ;;
-+    i*86:VOS:*:*)
-+	# From Paul.Green@stratus.com.
-+	echo ${UNAME_MACHINE}-stratus-vos
-+	exit ;;
-     *:VOS:*:*)
- 	# From Paul.Green@stratus.com.
- 	echo hppa1.1-stratus-vos
--	exit 0 ;;
-+	exit ;;
-     mc68*:A/UX:*:*)
- 	echo m68k-apple-aux${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     news*:NEWS-OS:6*:*)
- 	echo mips-sony-newsos6
--	exit 0 ;;
-+	exit ;;
-     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- 	if [ -d /usr/nec ]; then
--	        echo mips-nec-sysv${UNAME_RELEASE}
-+		echo mips-nec-sysv${UNAME_RELEASE}
- 	else
--	        echo mips-unknown-sysv${UNAME_RELEASE}
-+		echo mips-unknown-sysv${UNAME_RELEASE}
- 	fi
--        exit 0 ;;
-+	exit ;;
-     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
- 	echo powerpc-be-beos
--	exit 0 ;;
-+	exit ;;
-     BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
- 	echo powerpc-apple-beos
--	exit 0 ;;
-+	exit ;;
-     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
- 	echo i586-pc-beos
--	exit 0 ;;
-+	exit ;;
-+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
-+	echo i586-pc-haiku
-+	exit ;;
-+    x86_64:Haiku:*:*)
-+	echo x86_64-unknown-haiku
-+	exit ;;
-     SX-4:SUPER-UX:*:*)
- 	echo sx4-nec-superux${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     SX-5:SUPER-UX:*:*)
- 	echo sx5-nec-superux${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     SX-6:SUPER-UX:*:*)
- 	echo sx6-nec-superux${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-+    SX-7:SUPER-UX:*:*)
-+	echo sx7-nec-superux${UNAME_RELEASE}
-+	exit ;;
-+    SX-8:SUPER-UX:*:*)
-+	echo sx8-nec-superux${UNAME_RELEASE}
-+	exit ;;
-+    SX-8R:SUPER-UX:*:*)
-+	echo sx8r-nec-superux${UNAME_RELEASE}
-+	exit ;;
-     Power*:Rhapsody:*:*)
- 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     *:Rhapsody:*:*)
- 	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     *:Darwin:*:*)
--	case `uname -p` in
--	    *86) UNAME_PROCESSOR=i686 ;;
--	    powerpc) UNAME_PROCESSOR=powerpc ;;
-+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-+	case $UNAME_PROCESSOR in
-+	    i386)
-+		eval $set_cc_for_build
-+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-+		      grep IS_64BIT_ARCH >/dev/null
-+		  then
-+		      UNAME_PROCESSOR="x86_64"
-+		  fi
-+		fi ;;
-+	    unknown) UNAME_PROCESSOR=powerpc ;;
- 	esac
- 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     *:procnto*:*:* | *:QNX:[0123456789]*:*)
- 	UNAME_PROCESSOR=`uname -p`
- 	if test "$UNAME_PROCESSOR" = "x86"; then
-@@ -1209,22 +1257,28 @@
- 		UNAME_MACHINE=pc
- 	fi
- 	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     *:QNX:*:4*)
- 	echo i386-pc-qnx
--	exit 0 ;;
-+	exit ;;
-+    NEO-?:NONSTOP_KERNEL:*:*)
-+	echo neo-tandem-nsk${UNAME_RELEASE}
-+	exit ;;
-+    NSE-*:NONSTOP_KERNEL:*:*)
-+	echo nse-tandem-nsk${UNAME_RELEASE}
-+	exit ;;
-     NSR-?:NONSTOP_KERNEL:*:*)
- 	echo nsr-tandem-nsk${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     *:NonStop-UX:*:*)
- 	echo mips-compaq-nonstopux
--	exit 0 ;;
-+	exit ;;
-     BS2000:POSIX*:*:*)
- 	echo bs2000-siemens-sysv
--	exit 0 ;;
-+	exit ;;
-     DS/*:UNIX_System_V:*:*)
- 	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
--	exit 0 ;;
-+	exit ;;
-     *:Plan9:*:*)
- 	# "uname -m" is not consistent, so use $cputype instead. 386
- 	# is converted to i386 for consistency with other x86
-@@ -1235,36 +1289,55 @@
- 	    UNAME_MACHINE="$cputype"
- 	fi
- 	echo ${UNAME_MACHINE}-unknown-plan9
--	exit 0 ;;
-+	exit ;;
-     *:TOPS-10:*:*)
- 	echo pdp10-unknown-tops10
--	exit 0 ;;
-+	exit ;;
-     *:TENEX:*:*)
- 	echo pdp10-unknown-tenex
--	exit 0 ;;
-+	exit ;;
-     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- 	echo pdp10-dec-tops20
--	exit 0 ;;
-+	exit ;;
-     XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- 	echo pdp10-xkl-tops20
--	exit 0 ;;
-+	exit ;;
-     *:TOPS-20:*:*)
- 	echo pdp10-unknown-tops20
--	exit 0 ;;
-+	exit ;;
-     *:ITS:*:*)
- 	echo pdp10-unknown-its
--	exit 0 ;;
-+	exit ;;
-     SEI:*:*:SEIUX)
--        echo mips-sei-seiux${UNAME_RELEASE}
--	exit 0 ;;
-+	echo mips-sei-seiux${UNAME_RELEASE}
-+	exit ;;
-     *:DragonFly:*:*)
- 	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
--	exit 0 ;;
-+	exit ;;
-+    *:*VMS:*:*)
-+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
-+	case "${UNAME_MACHINE}" in
-+	    A*) echo alpha-dec-vms ; exit ;;
-+	    I*) echo ia64-dec-vms ; exit ;;
-+	    V*) echo vax-dec-vms ; exit ;;
-+	esac ;;
-+    *:XENIX:*:SysV)
-+	echo i386-pc-xenix
-+	exit ;;
-+    i*86:skyos:*:*)
-+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
-+	exit ;;
-+    i*86:rdos:*:*)
-+	echo ${UNAME_MACHINE}-pc-rdos
-+	exit ;;
-+    i*86:AROS:*:*)
-+	echo ${UNAME_MACHINE}-pc-aros
-+	exit ;;
-+    x86_64:VMkernel:*:*)
-+	echo ${UNAME_MACHINE}-unknown-esx
-+	exit ;;
- esac
- 
--#echo '(No uname command or uname output not recognized.)' 1>&2
--#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
--
- eval $set_cc_for_build
- cat >$dummy.c <<EOF
- #ifdef _SEQUENT_
-@@ -1282,16 +1355,16 @@
- #include <sys/param.h>
-   printf ("m68k-sony-newsos%s\n",
- #ifdef NEWSOS4
--          "4"
-+	"4"
- #else
--	  ""
-+	""
- #endif
--         ); exit (0);
-+	); exit (0);
- #endif
- #endif
- 
- #if defined (__arm) && defined (__acorn) && defined (__unix)
--  printf ("arm-acorn-riscix"); exit (0);
-+  printf ("arm-acorn-riscix\n"); exit (0);
- #endif
- 
- #if defined (hp300) && !defined (hpux)
-@@ -1380,11 +1453,12 @@
- }
- EOF
- 
--$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
-+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-+	{ echo "$SYSTEM_NAME"; exit; }
- 
- # Apollos put the system type in the environment.
- 
--test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
-+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
- 
- # Convex versions that predate uname can use getsysinfo(1)
- 
-@@ -1393,22 +1467,22 @@
-     case `getsysinfo -f cpu_type` in
-     c1*)
- 	echo c1-convex-bsd
--	exit 0 ;;
-+	exit ;;
-     c2*)
- 	if getsysinfo -f scalar_acc
- 	then echo c32-convex-bsd
- 	else echo c2-convex-bsd
- 	fi
--	exit 0 ;;
-+	exit ;;
-     c34*)
- 	echo c34-convex-bsd
--	exit 0 ;;
-+	exit ;;
-     c38*)
- 	echo c38-convex-bsd
--	exit 0 ;;
-+	exit ;;
-     c4*)
- 	echo c4-convex-bsd
--	exit 0 ;;
-+	exit ;;
-     esac
- fi
- 
-@@ -1419,7 +1493,9 @@
- the operating system you are using. It is advised that you
- download the most up to date version of the config scripts from
- 
--    ftp://ftp.gnu.org/pub/gnu/config/
-+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-+and
-+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
- 
- If the version you run ($0) is already up to date, please
- send the following data and any information you think might be
-diff -ur w3m-0.5.3/main.c new/w3m-0.5.3/main.c
---- w3m-0.5.3/main.c	2011-01-04 04:42:19.000000000 -0500
-+++ w3m-0.5.3/main.c	2013-04-28 18:42:08.408034100 -0400
-@@ -789,7 +789,8 @@
-     }
- 
- #ifdef USE_BINMODE_STREAM
--    setmode(fileno(stdout), O_BINARY);
-+  /* Seems to only be needed for old versions of Cygwin */
-+  /***setmode(fileno(stdout), O_BINARY);***/
- #endif
-     if (!w3m_dump && !w3m_backend) {
- 	fmInit();
diff --git a/pkgs/applications/networking/browsers/w3m/default.nix b/pkgs/applications/networking/browsers/w3m/default.nix
index 637041379dbd..e7641eb773dc 100644
--- a/pkgs/applications/networking/browsers/w3m/default.nix
+++ b/pkgs/applications/networking/browsers/w3m/default.nix
@@ -38,8 +38,7 @@ stdenv.mkDerivation rec {
       url = "https://aur.archlinux.org/cgit/aur.git/plain/https.patch?h=w3m-mouse&id=5b5f0fbb59f674575e87dd368fed834641c35f03";
       sha256 = "08skvaha1hjyapsh8zw5dgfy433mw2hk7qy9yy9avn8rjqj7kjxk";
     })
-  ] ++ optional (graphicsSupport && !x11Support) [ ./no-x11.patch ]
-    ++ optional stdenv.isCygwin ./cygwin.patch;
+  ] ++ optional (graphicsSupport && !x11Support) [ ./no-x11.patch ];
 
   buildInputs = [ pkgconfig ncurses boehmgc gettext zlib ]
     ++ optional sslSupport openssl
diff --git a/pkgs/applications/networking/cluster/minikube/default.nix b/pkgs/applications/networking/cluster/minikube/default.nix
index 36e9db7323d5..5cdb30b3f00e 100644
--- a/pkgs/applications/networking/cluster/minikube/default.nix
+++ b/pkgs/applications/networking/cluster/minikube/default.nix
@@ -14,15 +14,15 @@ let
   # instead, we download localkube ourselves and shove it into the minikube binary. The versions URL that minikube uses is
   # currently https://storage.googleapis.com/minikube/k8s_releases.json
 
-  localkube-version = "1.6.0";
+  localkube-version = "1.6.3";
   localkube-binary = fetchurl {
     url = "https://storage.googleapis.com/minikube/k8sReleases/v${localkube-version}/localkube-linux-amd64";
-    sha256 = "0zx0c9fwairvga1g1112l5g5pspm2m9wxb42qgfxfgyidywvirha";
+    sha256 = "1fmxxjv1bxrfngc4ykfgg76b79dh8pq0k1gsbzhiy3hhrppfqylm";
   };
 in buildGoPackage rec {
   pname   = "minikube";
   name    = "${pname}-${version}";
-  version = "0.19.1";
+  version = "0.20.0";
 
   goPackagePath = "k8s.io/minikube";
 
@@ -30,7 +30,7 @@ in buildGoPackage rec {
     owner  = "kubernetes";
     repo   = "minikube";
     rev    = "v${version}";
-    sha256 = "19kw2xhpcbyh32im0lnvajcjf1f8p357vhggk0jl342a23vr3rxl";
+    sha256 = "0bly2phy67x4ckcg46g6r4kqfdpjfs1cb3588a900m8b4xyavvvb";
   };
 
   # kubernetes is here only to shut up a loud warning when generating the completions below. minikube checks very eagerly
diff --git a/pkgs/applications/networking/cluster/terraform/default.nix b/pkgs/applications/networking/cluster/terraform/default.nix
index d22b5c9a8834..4ecf63427648 100644
--- a/pkgs/applications/networking/cluster/terraform/default.nix
+++ b/pkgs/applications/networking/cluster/terraform/default.nix
@@ -48,9 +48,9 @@ in {
     sha256 = "0ibgpcpvz0bmn3cw60nzsabsrxrbmmym1hv7fx6zmjxiwd68w5gb";
   };
 
-  terraform_0_9_10 = generic {
-    version = "0.9.10";
-    sha256 = "0sg8czfn4hh7cf7zcdqwkygsvm9p47f5bi6kbl37bx9rn6bi5m6s";
+  terraform_0_9_11 = generic {
+    version = "0.9.11";
+    sha256 = "045zcpd4g9c52ynhgh3213p422ahds63mzhmd2iwcmj88g8i1w6x";
     doCheck = true;
   };
 }
diff --git a/pkgs/applications/networking/instant-messengers/franz/default.nix b/pkgs/applications/networking/instant-messengers/franz/default.nix
index d5ef754e173a..a238009cd11b 100644
--- a/pkgs/applications/networking/instant-messengers/franz/default.nix
+++ b/pkgs/applications/networking/instant-messengers/franz/default.nix
@@ -8,6 +8,17 @@ let
 
   version = "4.0.4";
 
+  runtimeDeps = [
+    udev libnotify
+  ];
+  deps = (with xorg; [
+    libXi libXcursor libXdamage libXrandr libXcomposite libXext libXfixes
+    libXrender libX11 libXtst libXScrnSaver
+  ]) ++ [
+    gtk2 atk glib pango gdk_pixbuf cairo freetype fontconfig dbus
+    gnome2.GConf nss nspr alsaLib cups expat stdenv.cc.cc
+  ] ++ runtimeDeps;
+
   desktopItem = makeDesktopItem rec {
     name = "Franz";
     exec = name;
@@ -28,17 +39,6 @@ in stdenv.mkDerivation rec {
   # don't remove runtime deps
   dontPatchELF = true;
 
-  deps = (with xorg; [
-    libXi libXcursor libXdamage libXrandr libXcomposite libXext libXfixes
-    libXrender libX11 libXtst libXScrnSaver
-  ]) ++ [
-    gtk2 atk glib pango gdk_pixbuf cairo freetype fontconfig dbus
-    gnome2.GConf nss nspr alsaLib cups expat stdenv.cc.cc
-  # runtime deps
-  ] ++ [
-    udev libnotify
-  ];
-
   unpackPhase = ''
     tar xzf $src
   '';
@@ -65,7 +65,7 @@ in stdenv.mkDerivation rec {
     description = "A free messaging app that combines chat & messaging services into one application";
     homepage = http://meetfranz.com;
     license = licenses.free;
-    maintainers = [ stdenv.lib.maintainers.gnidorah ];
+    maintainers = [ maintainers.gnidorah ];
     platforms = ["i686-linux" "x86_64-linux"];
     hydraPlatforms = [];
   };
diff --git a/pkgs/applications/networking/instant-messengers/rambox/default.nix b/pkgs/applications/networking/instant-messengers/rambox/default.nix
index 8f650e889f64..7cb89f019e0e 100644
--- a/pkgs/applications/networking/instant-messengers/rambox/default.nix
+++ b/pkgs/applications/networking/instant-messengers/rambox/default.nix
@@ -6,7 +6,18 @@ let
   bits = if stdenv.system == "x86_64-linux" then "x64"
          else "ia32";
 
-  version = "0.5.9";
+  version = "0.5.10";
+
+  runtimeDeps = [
+    udev libnotify
+  ];
+  deps = (with xorg; [
+    libXi libXcursor libXdamage libXrandr libXcomposite libXext libXfixes
+    libXrender libX11 libXtst libXScrnSaver libxcb
+  ]) ++ [
+    gtk2 atk glib pango gdk_pixbuf cairo freetype fontconfig dbus
+    gnome2.GConf nss nspr alsaLib cups expat stdenv.cc.cc
+  ] ++ runtimeDeps;
 
   myIcon = fetchurl {
     url = "https://raw.githubusercontent.com/saenzramiro/rambox/9e4444e6297dd35743b79fe23f8d451a104028d5/resources/Icon.png";
@@ -25,24 +36,13 @@ in stdenv.mkDerivation rec {
   src = fetchurl {
     url = "https://github.com/saenzramiro/rambox/releases/download/${version}/Rambox-${version}-${bits}.tar.gz";
     sha256 = if bits == "x64" then
-      "0wx1cj3h1h28lhvl8ysmvr2wxq39lklk37361i598vph2pvnibi0" else
-      "1dqjd5rmml63h3y43n1r68il3pn8zwy0wwr0866cnpizsbis96fy";
+      "1i5jbhsfdbhr0rsb5w2pfpwjiagz47ppxk65qny3ay3lr4lbccn3" else
+      "1p1m6vsa9xvl3pjf3pygvllyk7j4q9vnlzmrizb8f5q30fpls25x";
   };
 
   # don't remove runtime deps
   dontPatchELF = true;
 
-  deps = (with xorg; [
-    libXi libXcursor libXdamage libXrandr libXcomposite libXext libXfixes
-    libXrender libX11 libXtst libXScrnSaver libxcb
-  ]) ++ [
-    gtk2 atk glib pango gdk_pixbuf cairo freetype fontconfig dbus
-    gnome2.GConf nss nspr alsaLib cups expat stdenv.cc.cc
-  # runtime deps
-  ] ++ [
-    udev libnotify
-  ];
-
   installPhase = ''
     patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" rambox
     patchelf --set-rpath "$out/opt/rambox:${stdenv.lib.makeLibraryPath deps}" rambox
diff --git a/pkgs/applications/networking/p2p/qbittorrent/default.nix b/pkgs/applications/networking/p2p/qbittorrent/default.nix
index 4db6c9dc16bb..c848f13b0d98 100644
--- a/pkgs/applications/networking/p2p/qbittorrent/default.nix
+++ b/pkgs/applications/networking/p2p/qbittorrent/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, which
-, boost, libtorrentRasterbar, qmake, qtbase, qttools
+, boost, libtorrentRasterbar, qtbase, qttools
 , debugSupport ? false # Debugging
 , guiSupport ? true, dbus_libs ? null # GUI (disable to run headless)
 , webuiSupport ? true # WebUI
@@ -10,14 +10,14 @@ assert guiSupport -> (dbus_libs != null);
 with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "qbittorrent-${version}";
-  version = "3.3.12";
+  version = "3.3.13";
 
   src = fetchurl {
     url = "mirror://sourceforge/qbittorrent/${name}.tar.xz";
-    sha256 = "0vs626khavhqqnq2hrwrxyc8ihbngharcf1fd37nwccvy13qqljn";
+    sha256 = "13a6rv4f4xgbjh6nai7fnqb04rh7i2kjpp7y2z5j1wyy4x8pncc4";
   };
 
-  nativeBuildInputs = [ pkgconfig which qmake ];
+  nativeBuildInputs = [ pkgconfig which ];
 
   buildInputs = [ boost libtorrentRasterbar qtbase qttools ]
     ++ optional guiSupport dbus_libs;
@@ -34,9 +34,9 @@ stdenv.mkDerivation rec {
   ] ++ optional debugSupport "--enable-debug";
 
   # The lrelease binary is named lrelease instead of lrelease-qt4
-  patches = [ ./fix-lrelease.patch];
+  patches = [ ./fix-lrelease.patch ];
 
-  # https://github.com/qbittorrent/qBittorrent/issues/1992 
+  # https://github.com/qbittorrent/qBittorrent/issues/1992
   enableParallelBuilding = false;
 
   meta = {
diff --git a/pkgs/applications/version-management/gogs/default.nix b/pkgs/applications/version-management/gogs/default.nix
index 7d1e3710ac07..c8af3fe63f92 100644
--- a/pkgs/applications/version-management/gogs/default.nix
+++ b/pkgs/applications/version-management/gogs/default.nix
@@ -26,7 +26,9 @@ buildGoPackage rec {
 
   outputs = [ "bin" "out" "data" ];
 
-  postInstall = ''
+  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+    install_name_tool -delete_rpath $out/lib $bin/bin/gogs
+  '' + ''
     mkdir $data
     cp -R $src/{public,templates} $data
 
diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix
index 73ba76676b98..6675068bda97 100644
--- a/pkgs/applications/virtualization/virtualbox/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/default.nix
@@ -88,7 +88,7 @@ in stdenv.mkDerivation {
   '';
 
   patches = optional enableHardening ./hardened.patch
-    ++ [ ./qtx11extras.patch ];
+    ++ [ ./qtx11extras.patch ./linux-4.12.patch ];
 
   postPatch = ''
     sed -i -e 's|/sbin/ifconfig|${nettools}/bin/ifconfig|' \
diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
index 3c9f28f4f2d5..8865022c23e4 100644
--- a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
@@ -62,6 +62,9 @@ stdenv.mkDerivation {
     for i in *
     do
         cd $i
+        # Files within the guest additions ISO are using DOS line endings
+        sed -re '/^(@@|---|\+\+\+)/!s/$/\r/' ${../linux-4.12.patch} \
+          | patch -d vboxguest -p4
         find . -type f | xargs sed 's/depmod -a/true/' -i
         make
         cd ..
diff --git a/pkgs/applications/virtualization/virtualbox/linux-4.12.patch b/pkgs/applications/virtualization/virtualbox/linux-4.12.patch
new file mode 100644
index 000000000000..7157365466f9
--- /dev/null
+++ b/pkgs/applications/virtualization/virtualbox/linux-4.12.patch
@@ -0,0 +1,80 @@
+commit 47fee9325e3b5feed0dbc4ba9e2de77c6d55e3bb
+Author: vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>
+Date:   Wed May 17 09:42:23 2017 +0000
+
+    Runtime/r0drv: Linux 4.12 5-level page table adaptions
+    
+    
+    git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@66927 cfe28804-0f27-0410-a406-dd0f0b0b656f
+
+diff --git a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+index 28dc33f963..41ed058860 100644
+--- a/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
++++ b/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+@@ -902,6 +902,9 @@ static struct page *rtR0MemObjLinuxVirtToPage(void *pv)
+     union
+     {
+         pgd_t       Global;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++        p4d_t       Four;
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+         pud_t       Upper;
+ #endif
+@@ -917,12 +920,26 @@ static struct page *rtR0MemObjLinuxVirtToPage(void *pv)
+     u.Global = *pgd_offset(current->active_mm, ulAddr);
+     if (RT_UNLIKELY(pgd_none(u.Global)))
+         return NULL;
+-
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++    u.Four  = *p4d_offset(&u.Global, ulAddr);
++    if (RT_UNLIKELY(p4d_none(u.Four)))
++        return NULL;
++    if (p4d_large(u.Four))
++    {
++        pPage = p4d_page(u.Four);
++        AssertReturn(pPage, NULL);
++        pfn   = page_to_pfn(pPage);      /* doing the safe way... */
++        AssertCompile(P4D_SHIFT - PAGE_SHIFT < 31);
++        pfn  += (ulAddr >> PAGE_SHIFT) & ((UINT32_C(1) << (P4D_SHIFT - PAGE_SHIFT)) - 1);
++        return pfn_to_page(pfn);
++    }
++    u.Upper = *pud_offset(&u.Four, ulAddr);
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+     u.Upper = *pud_offset(&u.Global, ulAddr);
++#endif
+     if (RT_UNLIKELY(pud_none(u.Upper)))
+         return NULL;
+-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+     if (pud_large(u.Upper))
+     {
+         pPage = pud_page(u.Upper);
+@@ -931,8 +948,8 @@ static struct page *rtR0MemObjLinuxVirtToPage(void *pv)
+         pfn += (ulAddr >> PAGE_SHIFT) & ((UINT32_C(1) << (PUD_SHIFT - PAGE_SHIFT)) - 1);
+         return pfn_to_page(pfn);
+     }
+-# endif
+-
++#endif
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+     u.Middle = *pmd_offset(&u.Upper, ulAddr);
+ #else  /* < 2.6.11 */
+     u.Middle = *pmd_offset(&u.Global, ulAddr);
+diff --git a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
+index 5afdee9e71..20aab0817f 100644
+--- a/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
++++ b/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
+@@ -159,6 +159,11 @@
+ # include <asm/tlbflush.h>
+ #endif
+ 
++/* for set_pages_x() */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++# include <asm/set_memory.h>
++#endif
++
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
+ # include <asm/smap.h>
+ #else
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index ad6f6832298a..935e6fb6267c 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -359,7 +359,13 @@ stdenv.mkDerivation {
       if [[ "$($ldPath/${prefix}ld -z relro 2>&1 || true)" =~ un(recognized|known)\ option ]]; then
         hardening_unsupported_flags+=" relro"
       fi
+    ''
+
+    + optionalString hostPlatform.isCygwin ''
+      hardening_unsupported_flags+=" pic"
+    ''
 
+    + ''
       substituteAll ${preWrap ./add-flags.sh} $out/nix-support/add-flags.sh
       substituteAll ${preWrap ./add-hardening.sh} $out/nix-support/add-hardening.sh
       cp -p ${preWrap ./utils.sh} $out/nix-support/utils.sh
diff --git a/pkgs/build-support/cc-wrapper/utils.sh b/pkgs/build-support/cc-wrapper/utils.sh
index d17930e8ab5d..8cefc47816f8 100644
--- a/pkgs/build-support/cc-wrapper/utils.sh
+++ b/pkgs/build-support/cc-wrapper/utils.sh
@@ -28,17 +28,16 @@ badPath() {
 # States: 0 - outside, 1/2 - unquoted arg/slash, 3/4 - 'arg'/slash, 5/6 - "arg"/slash.
 # State transitions:
 rspT=(01235 01235 11111 33413 33333 55651 55555)
-# Push char on transition:
-rspC[01]=1 rspC[11]=1 rspC[21]=1 rspC[33]=1 rspC[43]=1 rspC[55]=1 rspC[65]=1
+# Push (a) arg or (c) char on transition:
+rspP[10]=a rspP[01]=c rspP[11]=c rspP[21]=c rspP[33]=c rspP[43]=c rspP[55]=c rspP[65]=c
 
 rspParse() {
     rsp=()
-    local s="$1"
     local state=0
     local arg=''
+    local c
 
-    for (( i=0; i<${#s}; i++ )); do
-        local c="${s:$i:1}"
+    while read -r -N1 c; do
         local cls=1
         case "$c" in
             ' ' | $'\t' | $'\r' | $'\n') cls=0 ;;
@@ -48,12 +47,10 @@ rspParse() {
         esac
         local nextstates="${rspT[$state]}"
         local nextstate="${nextstates:$cls:1}"
-        if [ "${rspC[$state$nextstate]}" ]; then
-            arg+="$c"
-        elif [ "$state$nextstate" = "10" ]; then
-            rsp+=("$arg")
-            arg=''
-        fi
+        case "${rspP[$state$nextstate]}" in
+            'c') arg+="$c" ;;
+            'a') rsp+=("$arg"); arg='' ;;
+        esac
         state="$nextstate"
     done
 
@@ -68,7 +65,7 @@ expandResponseParams() {
         local p="$1"
         shift
         if [ "${p:0:1}" = '@' -a -e "${p:1}" ]; then
-            rspParse "$(<"${p:1}")"
+            rspParse <"${p:1}"
             set -- "${rsp[@]}" "$@"
         else
             params+=("$p")
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git
index 9e4f346f7a52..fa66a1f55406 100755
--- a/pkgs/build-support/fetchgit/nix-prefetch-git
+++ b/pkgs/build-support/fetchgit/nix-prefetch-git
@@ -47,6 +47,7 @@ Options:
       --leave-dotGit  Keep the .git directories.
       --fetch-submodules Fetch submodules.
       --builder       Clone as fetchgit does, but url, rev, and out option are mandatory.
+      --quiet         Only print the final json summary.
 "
     exit 1
 }
diff --git a/pkgs/build-support/setup-hooks/win-dll-link.sh b/pkgs/build-support/setup-hooks/win-dll-link.sh
index 634a9d18f00d..9658b9f82595 100644
--- a/pkgs/build-support/setup-hooks/win-dll-link.sh
+++ b/pkgs/build-support/setup-hooks/win-dll-link.sh
@@ -35,7 +35,7 @@ _linkDLLs() {
         local dllPath2
         for dllPath2 in "$dllPath" "$(dirname $(readlink "$dllPath" || echo "$dllPath"))"/*.dll; do
             if [ -e ./"$(basename "$dllPath2")" ]; then continue; fi
-            ln -sr "$dllPath2" .
+            CYGWIN+=\ winsymlinks:nativestrict ln -sr "$dllPath2" .
             linkCount=$(($linkCount+1))
         done
     done
diff --git a/pkgs/data/icons/papirus-icon-theme/default.nix b/pkgs/data/icons/papirus-icon-theme/default.nix
new file mode 100644
index 000000000000..70bf0186f1cc
--- /dev/null
+++ b/pkgs/data/icons/papirus-icon-theme/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "papirus-icon-theme-${version}";
+  version = "20170616";
+
+  src = fetchFromGitHub {
+    owner = "PapirusDevelopmentTeam";
+    repo = "papirus-icon-theme";
+    rev = "${version}";
+    sha256 = "008nkmxp3f9qqljif3v9ns3a8mflzffv2mm5zgjng9pmdl5x70j4";
+  };
+
+  dontBuild = true;
+
+  installPhase = ''
+     install -dm 755 $out/share/icons
+     cp -dr Papirus{,-Dark,-Light} $out/share/icons/
+     cp -dr ePapirus $out/share/icons/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Papirus icon theme for Linux";
+    homepage = "https://github.com/PapirusDevelopmentTeam/papirus-icon-theme";
+    license = licenses.lgpl3;
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/desktops/gnome-3/extensions/topicons-plus/default.nix b/pkgs/desktops/gnome-3/extensions/topicons-plus/default.nix
new file mode 100644
index 000000000000..4612c35ad250
--- /dev/null
+++ b/pkgs/desktops/gnome-3/extensions/topicons-plus/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, glib, gettext, bash }:
+
+stdenv.mkDerivation rec {
+  name = "gnome-shell-extension-topicons-plus-${version}";
+  version = "v20";
+
+  src = fetchFromGitHub {
+    owner = "phocean";
+    repo = "TopIcons-plus";
+    rev = "01535328bd43ecb3f2c71376de6fc8d1d8a88577";
+    sha256 = "0pwpg72ihgj2jl9pg63y0hibdsl27srr3mab881w0gh17vwyixzi";
+  };
+
+  buildInputs = [ glib ];
+
+  nativeBuildInputs = [ gettext ];
+
+  makeFlags = [ "INSTALL_PATH=$(out)/share/gnome-shell/extensions" ];
+
+  meta = with stdenv.lib; {
+    description = "Brings all icons back to the top panel, so that it's easier to keep track of apps running in the backround";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ eperuffo ];
+    homepage = https://github.com/phocean/TopIcons-plus;
+  };
+}
diff --git a/pkgs/development/compilers/gcc/6/darwin-const-correct.patch b/pkgs/development/compilers/gcc/6/darwin-const-correct.patch
deleted file mode 100644
index a9b9b85acab2..000000000000
--- a/pkgs/development/compilers/gcc/6/darwin-const-correct.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 5972cd58bde3bc8bacfe994e5b127c411241f255 Mon Sep 17 00:00:00 2001
-From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Tue, 3 Jan 2017 05:36:40 +0000
-Subject: [PATCH] 	* config/darwin-driver.c (darwin_driver_init):
- Const-correctness 	fixes for first_period and second_period variables.
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244010 138bc75d-0d04-0410-961f-82ee72b054a4
----
-diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c
-index 0c4f0cd..e3ed79d 100644
---- a/gcc/config/darwin-driver.c
-+++ b/gcc/config/darwin-driver.c
-@@ -299,10 +299,10 @@ darwin_driver_init (unsigned int *decoded_options_count,
-   if (vers_string != NULL)
-     {
-       char *asm_major = NULL;
--      char *first_period = strchr(vers_string, '.');
-+      const char *first_period = strchr(vers_string, '.');
-       if (first_period != NULL)
- 	{
--	  char *second_period = strchr(first_period+1, '.');
-+	  const char *second_period = strchr(first_period+1, '.');
- 	  if (second_period  != NULL)
- 	    asm_major = xstrndup (vers_string, second_period-vers_string);
- 	  else
diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix
index c439703fa8e4..b091fd1ae370 100644
--- a/pkgs/development/compilers/gcc/6/default.nix
+++ b/pkgs/development/compilers/gcc/6/default.nix
@@ -58,7 +58,7 @@ assert langGo -> langCC;
 with stdenv.lib;
 with builtins;
 
-let version = "6.3.0";
+let version = "6.4.0";
 
     # Whether building a cross-compiler for GNU/Hurd.
     crossGNU = targetPlatform != hostPlatform && targetPlatform.config == "i586-pc-gnu";
@@ -72,8 +72,7 @@ let version = "6.3.0";
       # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
       # target libraries and tools.
       ++ optional langAda ../gnat-cflags.patch
-      ++ optional langFortran ../gfortran-driving.patch
-      ++ optional hostPlatform.isDarwin ./darwin-const-correct.patch; # Kill this after 6.3.0
+      ++ optional langFortran ../gfortran-driving.patch;
 
     javaEcj = fetchurl {
       # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
@@ -213,8 +212,8 @@ stdenv.mkDerivation ({
   builder = ../builder.sh;
 
   src = fetchurl {
-    url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
-    sha256 = "17xjz30jb65hcf714vn9gcxvrrji8j20xm7n33qg1ywhyzryfsph";
+    url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz";
+    sha256 = "1m0lr7938lw5d773dkvwld90hjlcq2282517d1gwvrfzmwgg42w5";
   };
 
   inherit patches;
diff --git a/pkgs/development/compilers/haxe/default.nix b/pkgs/development/compilers/haxe/default.nix
index 684c6d25daad..ca41545eb451 100644
--- a/pkgs/development/compilers/haxe/default.nix
+++ b/pkgs/development/compilers/haxe/default.nix
@@ -1,40 +1,82 @@
-{ stdenv, fetchgit, ocaml, zlib, pcre, neko, camlp4 }:
+{ stdenv, fetchgit, bash, coreutils, ocaml, zlib, pcre, neko, camlp4 }:
 
-stdenv.mkDerivation {
-  name = "haxe-3.4.2";
+let
+  generic = { version, sha256, prePatch }:
+    stdenv.mkDerivation rec {
+      name = "haxe-${version}";
 
-  buildInputs = [ocaml zlib pcre neko camlp4];
+      buildInputs = [ocaml zlib pcre neko camlp4];
 
-  src = fetchgit {
-    url = "https://github.com/HaxeFoundation/haxe.git";
-    sha256 = "1m5fp183agqv8h3ynhxw4kndkpq2d6arysmirv3zl3vz5crmpwqd";
-    fetchSubmodules = true;
+      src = fetchgit {
+        url = https://github.com/HaxeFoundation/haxe.git;
+        inherit sha256;
+        fetchSubmodules = true;
+        rev = "refs/tags/${version}";
+      };
 
-    # Tag 3.4.2
-    rev = "890f8c70cf23ce6f9fe0fdd0ee514a9699433ca7";
-  };
+      inherit prePatch;
+
+      buildFlags = [ "all" "tools" ];
 
-  prePatch = ''
-    sed -i -e 's|"/usr/lib/haxe/std/";|"'"$out/lib/haxe/std/"'";\n&|g' src/main.ml
-  '';
+      installPhase = ''
+        install -vd "$out/bin" "$out/lib/haxe/std"
+        cp -vr haxe haxelib std "$out/lib/haxe"
 
-  buildFlags = [ "all" "tools" ];
+        # make wrappers which provide a temporary HAXELIB_PATH with symlinks to multiple repositories HAXELIB_PATH may point to
+        for name in haxe haxelib; do
+        cat > $out/bin/$name <<EOF
+        #!{bash}/bin/bash
 
-  installPhase = ''
-    install -vd "$out/bin" "$out/lib/haxe/std"
-    install -vt "$out/bin" haxe haxelib
-    cp -vr std "$out/lib/haxe"
-  '';
+        if [[ "\$HAXELIB_PATH" =~ : ]]; then
+          NEW_HAXELIB_PATH="\$(${coreutils}/bin/mktemp -d)"
 
-  setupHook = ./setup-hook.sh;
+          IFS=':' read -ra libs <<< "\$HAXELIB_PATH"
+          for libdir in "\''${libs[@]}"; do
+            for lib in "\$libdir"/*; do
+              if [ ! -e "\$NEW_HAXELIB_PATH/\$(${coreutils}/bin/basename "\$lib")" ]; then
+                ${coreutils}/bin/ln -s "--target-directory=\$NEW_HAXELIB_PATH" "\$lib"
+              fi
+            done
+          done
+          export HAXELIB_PATH="\$NEW_HAXELIB_PATH"
+          $out/lib/haxe/$name "\$@"
+          rm -rf "\$NEW_HAXELIB_PATH"
+        else
+          exec $out/lib/haxe/$name "\$@"
+        fi
+        EOF
+        chmod +x $out/bin/$name
+        done
+      '';
 
-  dontStrip = true;
+      setupHook = ./setup-hook.sh;
 
-  meta = with stdenv.lib; {
-    description = "Programming language targeting JavaScript, Flash, NekoVM, PHP, C++";
-    homepage = https://haxe.org;
-    license = with licenses; [ gpl2 bsd2 /*?*/ ];  # -> docs/license.txt
-    maintainers = [ maintainers.marcweber ];
-    platforms = platforms.linux ++ platforms.darwin;
+      dontStrip = true;
+
+      meta = with stdenv.lib; {
+        description = "Programming language targeting JavaScript, Flash, NekoVM, PHP, C++";
+        homepage = https://haxe.org;
+        license = with licenses; [ gpl2 bsd2 /*?*/ ];  # -> docs/license.txt
+        maintainers = [ maintainers.marcweber ];
+        platforms = platforms.linux ++ platforms.darwin;
+      };
+    };
+in {
+  # this old version is required to compile some libraries
+  haxe_3_2 = generic {
+    version = "3.2.1";
+    sha256 = "1x9ay5a2llq46fww3k07jxx8h1vfpyxb522snc6702a050ki5vz3";
+    prePatch = ''
+      sed -i -e 's|"/usr/lib/haxe/std/";|"'"$out/lib/haxe/std/"'";\n&|g' main.ml
+      sed -i -e 's|"neko"|"${neko}/bin/neko"|g' extra/haxelib_src/src/tools/haxelib/Main.hx
+    '';
+  };
+  haxe_3_4 = generic {
+    version = "3.4.2";
+    sha256 = "1m5fp183agqv8h3ynhxw4kndkpq2d6arysmirv3zl3vz5crmpwqd";
+    prePatch = ''
+      sed -i -e 's|"/usr/lib/haxe/std/";|"'"$out/lib/haxe/std/"'";\n&|g' src/main.ml
+      sed -i -e 's|"neko"|"${neko}/bin/neko"|g' extra/haxelib_src/src/haxelib/client/Main.hx
+    '';
   };
 }
diff --git a/pkgs/development/compilers/haxe/hxcpp.nix b/pkgs/development/compilers/haxe/hxcpp.nix
deleted file mode 100644
index 56b43fc128ef..000000000000
--- a/pkgs/development/compilers/haxe/hxcpp.nix
+++ /dev/null
@@ -1,52 +0,0 @@
-{ stdenv, fetchzip, haxe, neko, pcre, sqlite, zlib }:
-
-stdenv.mkDerivation rec {
-  name = "hxcpp-3.2.27";
-
-  src = let
-    zipFile = stdenv.lib.replaceChars ["."] [","] name;
-  in fetchzip {
-    inherit name;
-    url = "http://lib.haxe.org/files/3.0/${zipFile}.zip";
-    sha256 = "1hw4kr1f8q7f4fkzis7kvkm7h1cxhv6cf5v1iq7rvxs2fxiys7fr";
-  };
-
-  NIX_LDFLAGS = "-lpcre -lz -lsqlite3";
-
-  outputs = [ "out" "lib" ];
-
-  patchPhase = ''
-    rm -rf bin lib project/thirdparty project/libs/sqlite/sqlite3.[ch]
-    find . -name '*.n' -delete
-    sed -i -re '/(PCRE|ZLIB)_DIR|\<sqlite3\.c\>/d' project/Build.xml
-    sed -i -e 's/mFromFile = "@";/mFromFile = "";/' tools/hxcpp/Linker.hx
-    sed -i -e '/dll_ext/s,HX_CSTRING("./"),HX_CSTRING("'"$lib"'/"),' \
-      src/hx/Lib.cpp
-  '';
-
-  buildInputs = [ haxe neko pcre sqlite zlib ];
-
-  targetArch = "linux-m${if stdenv.is64bit then "64" else "32"}";
-
-  buildPhase = ''
-    haxe -neko project/build.n -cp tools/build -main Build
-    haxe -neko run.n -cp tools/run -main RunMain
-    haxe -neko hxcpp.n -cp tools/hxcpp -main BuildTool
-    (cd project && neko build.n "ndll-$targetArch")
-  '';
-
-  installPhase = ''
-    for i in bin/Linux*/*.dso; do
-      install -vD "$i" "$lib/$(basename "$i")"
-    done
-    find *.n toolchain/*.xml build-tool/BuildCommon.xml src include \
-      -type f -exec install -vD -m 0644 {} "$out/lib/haxe/hxcpp/{}" \;
-  '';
-
-  meta = {
-    homepage = "http://lib.haxe.org/p/hxcpp";
-    description = "Runtime support library for the Haxe C++ backend";
-    license = stdenv.lib.licenses.bsd2;
-    platforms = stdenv.lib.platforms.linux;
-  };
-}
diff --git a/pkgs/development/compilers/haxe/setup-hook.sh b/pkgs/development/compilers/haxe/setup-hook.sh
index a29e04a989b6..21cc0206859f 100644
--- a/pkgs/development/compilers/haxe/setup-hook.sh
+++ b/pkgs/development/compilers/haxe/setup-hook.sh
@@ -1,5 +1,7 @@
 addHaxeLibPath() {
+  if [ ! -d "$1/lib/haxe/std" ]; then
     addToSearchPath HAXELIB_PATH "$1/lib/haxe"
+  fi
 }
 
 envHooks+=(addHaxeLibPath)
diff --git a/pkgs/development/compilers/llvm/4/clang/default.nix b/pkgs/development/compilers/llvm/4/clang/default.nix
index 64dbaa21dd42..276db7a7b416 100644
--- a/pkgs/development/compilers/llvm/4/clang/default.nix
+++ b/pkgs/development/compilers/llvm/4/clang/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetch, cmake, libxml2, libedit, llvm, version, release_version, clang-tools-extra_src, python
 , fixDarwinDylibNames
-, enableManpages ? true
+, enableManpages ? false
 }:
 
 let
diff --git a/pkgs/development/compilers/llvm/4/default.nix b/pkgs/development/compilers/llvm/4/default.nix
index 15918f9c1ebd..20e9d8d4d978 100644
--- a/pkgs/development/compilers/llvm/4/default.nix
+++ b/pkgs/development/compilers/llvm/4/default.nix
@@ -1,4 +1,4 @@
-{ newScope, stdenv, cmake, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, darwin, ccWrapperFun }:
+{ lowPrio, newScope, stdenv, cmake, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, darwin, ccWrapperFun }:
 let
   callPackage = newScope (self // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
 
@@ -13,14 +13,25 @@ let
   compiler-rt_src = fetch "compiler-rt" "059ipqq27gd928ay06f1ck3vw6y5h5z4zd766x8k0k7jpqimpwnk";
   clang-tools-extra_src = fetch "clang-tools-extra" "16bwckgcxfn56mbqjlxi7fxja0zm9hjfa6s3ncm3dz98n5zd7ds1";
 
+  # Add man output without introducing extra dependencies.
+  overrideManOutput = drv:
+    let drv-manpages = drv.override { enableManpages = true; }; in
+    drv // { man = drv-manpages.man; outputs = drv.outputs ++ ["man"]; };
+
+  llvm = callPackage ./llvm.nix {
+    inherit compiler-rt_src stdenv;
+  };
+
+  clang-unwrapped = callPackage ./clang {
+    inherit clang-tools-extra_src stdenv;
+  };
+
   self = {
-    llvm = callPackage ./llvm.nix {
-      inherit compiler-rt_src stdenv;
-    };
+    llvm = overrideManOutput llvm;
+    clang-unwrapped = overrideManOutput clang-unwrapped;
 
-    clang-unwrapped = callPackage ./clang {
-      inherit clang-tools-extra_src stdenv;
-    };
+    llvm-manpages = lowPrio self.llvm.man;
+    clang-manpages = lowPrio self.clang-unwrapped.man;
 
     clang = wrapCC self.clang-unwrapped;
 
diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix
index 98c24495355c..c5d22825f301 100644
--- a/pkgs/development/compilers/llvm/4/llvm.nix
+++ b/pkgs/development/compilers/llvm/4/llvm.nix
@@ -16,7 +16,7 @@
 , compiler-rt_src
 , libcxxabi
 , debugVersion ? false
-, enableManpages ? true
+, enableManpages ? false
 , enableSharedLibraries ? true
 , darwin
 }:
diff --git a/pkgs/development/compilers/neko/default.nix b/pkgs/development/compilers/neko/default.nix
index 493748d369b7..e90f3af704df 100644
--- a/pkgs/development/compilers/neko/default.nix
+++ b/pkgs/development/compilers/neko/default.nix
@@ -24,6 +24,12 @@ stdenv.mkDerivation rec {
           + "fe87462d9c7a6ee27e28f5be5e4fc0ac87b34574.patch";
       sha256 = "1jbmq6j32vg3qv20dbh82cp54886lgrh7gkcqins8a2y4l4dl3sc";
     })
+    # https://github.com/HaxeFoundation/neko/pull/165
+    (fetchpatch {
+      url = "https://github.com/HaxeFoundation/neko/commit/"
+          + "c6d9c6d796200990b3b6a53a4dc716c9192398e6.patch";
+      sha256 = "1pq0qhhb9gbhc3zbgylwp0amhwsz0q0ggpj6v2xgv0hfy7d63rcd";
+    })
   ];
 
   buildInputs =
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index 717c0092c946..28863e450a7a 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -138,8 +138,7 @@ stdenv.mkDerivation {
 
   inherit doCheck;
 
-  ${if buildPlatform == hostPlatform then "dontSetConfigureCross" else null} = true;
-  ${if buildPlatform != hostPlatform then "configurePlatforms" else null} = [];
+  configurePlatforms = [];
 
   # https://github.com/NixOS/nixpkgs/pull/21742#issuecomment-272305764
   # https://github.com/rust-lang/rust/issues/30181
diff --git a/pkgs/development/compilers/wla-dx/default.nix b/pkgs/development/compilers/wla-dx/default.nix
index 13a48aaaa30c..2ea2faa3e09e 100644
--- a/pkgs/development/compilers/wla-dx/default.nix
+++ b/pkgs/development/compilers/wla-dx/default.nix
@@ -1,13 +1,14 @@
 {stdenv, fetchFromGitHub, cmake}:
 
 stdenv.mkDerivation rec {
-  name = "wla-dx-git-2016-02-27";
+  version = "2017-06-05";
+  name = "wla-dx-git-${version}";
 
   src = fetchFromGitHub {
     owner = "vhelin";
     repo = "wla-dx";
-    rev = "8189fe8d5620584ea16563875ff3c5430527c86a";
-    sha256 = "02zgkcyfx7y8j6jvyi12lm29fydnd7m3rxv6g2psv23fyzmpkkir";
+    rev = "ae6843f9711cbc2fa6dd8c200877b40bd2bcad7f";
+    sha256 = "09c2kz12ld97ad41j6r8r65jknllrak1x8r43fgr26x7hdlxz5c6";
   };
 
   hardeningDisable = [ "format" ];
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index abf477189f07..230016d78c8c 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -670,7 +670,7 @@ self: super: {
   haste-compiler      = markBroken (self.callPackage ../tools/haskell/haste/haste-compiler.nix { inherit overrideCabal; super-haste-compiler = super.haste-compiler; });
 
   # tinc is a new build driver a la Stack that's not yet available from Hackage.
-  tinc = self.callPackage ../tools/haskell/tinc {};
+  tinc = self.callPackage ../tools/haskell/tinc { inherit (pkgs) cabal-install cabal2nix; };
 
   # Tools that use gtk2hs-buildtools now depend on them in a custom-setup stanza
   cairo = addBuildTool super.cairo self.gtk2hs-buildtools;
diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix
index 35cd857b6620..e4d0e00a3266 100644
--- a/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix
+++ b/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix
@@ -59,4 +59,12 @@ self: super: {
   # https://github.com/nominolo/ghc-syb/issues/20
   ghc-syb-utils = dontCheck super.ghc-syb-utils;
 
+  # Older, LTS-8-based versions don't compile.
+  vector = super.vector_0_12_0_1;
+  primitive = self.primitive_0_6_2_0;
+  syb = self.syb_0_7;
+
+  # Work around overly restrictive constraints on the version of 'base'.
+  doctest = doJailbreak super.doctest;
+
 }
diff --git a/pkgs/development/haskell-modules/hackage-packages.nix b/pkgs/development/haskell-modules/hackage-packages.nix
index f75d435cddc2..af123de56547 100644
--- a/pkgs/development/haskell-modules/hackage-packages.nix
+++ b/pkgs/development/haskell-modules/hackage-packages.nix
@@ -17950,8 +17950,8 @@ self: {
      }:
      mkDerivation {
        pname = "VKHS";
-       version = "1.9";
-       sha256 = "0vfspcsm2fgpqwbwli5a4ca8lsh50j8m9x2v4ccs6zd8svcimg3q";
+       version = "1.9.1";
+       sha256 = "1jhllxylsclshs027vinx5p3rql3964dy4p37q916g4g58ml83j6";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -20602,8 +20602,8 @@ self: {
        pname = "active";
        version = "0.2.0.13";
        sha256 = "1yw029rh0gb63bhwwjynbv173mny14is4cyjkrlvzvxwb0fi96jx";
-       revision = "1";
-       editedCabalFile = "15z0n337bglkn1a3hx2gvh64jx311nmsa4vijynmwp2hq11rgvm6";
+       revision = "2";
+       editedCabalFile = "1ml42hbvfhqzpdi1y5q6dqp4wq6zqb30f15r34n9ip9iv44qjwwf";
        libraryHaskellDepends = [
          base lens linear semigroupoids semigroups vector
        ];
@@ -26741,7 +26741,7 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "arithmoi_0_5_0_0" = callPackage
+  "arithmoi_0_5_0_1" = callPackage
     ({ mkDerivation, array, base, containers, criterion, exact-pi
      , ghc-prim, integer-gmp, integer-logarithms, mtl, QuickCheck
      , random, smallcheck, tasty, tasty-hunit, tasty-quickcheck
@@ -26749,8 +26749,8 @@ self: {
      }:
      mkDerivation {
        pname = "arithmoi";
-       version = "0.5.0.0";
-       sha256 = "0gja9x6y2nprlg5d2wjycjvxgc7bb4p6y8d4fg3dxxzzwgqgrrab";
+       version = "0.5.0.1";
+       sha256 = "1hny1xnkwi0ahzdw4d1pfskdi416wl6k6p4pfzqssj79bhlpp6vg";
        configureFlags = [ "-f-llvm" ];
        libraryHaskellDepends = [
          array base containers exact-pi ghc-prim integer-gmp
@@ -26823,12 +26823,12 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {inherit (pkgs) arpack;};
 
-  "array_0_5_1_1" = callPackage
+  "array_0_5_2_0" = callPackage
     ({ mkDerivation, base }:
      mkDerivation {
        pname = "array";
-       version = "0.5.1.1";
-       sha256 = "08r2rq4blvc737mrg3xhlwiw13jmsz5dlf2fd0ghb9cdaxc6kjc9";
+       version = "0.5.2.0";
+       sha256 = "12v83s2imxb3p2crnlzrpjh0nk6lpysw9bdk9yahs6f37csa5jaj";
        libraryHaskellDepends = [ base ];
        description = "Mutable and immutable arrays";
        license = stdenv.lib.licenses.bsd3;
@@ -27727,6 +27727,30 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "async-refresh-tokens_0_2_0_0" = callPackage
+    ({ mkDerivation, async-refresh, base, bytestring, criterion
+     , formatting, HUnit, lifted-async, microlens, microlens-th
+     , monad-control, monad-logger, safe-exceptions, stm, test-framework
+     , test-framework-hunit, text
+     }:
+     mkDerivation {
+       pname = "async-refresh-tokens";
+       version = "0.2.0.0";
+       sha256 = "1inpl44hmk4g5y0p09wdg85k921174zz5f5kn0z69b13gfrhncw6";
+       libraryHaskellDepends = [
+         async-refresh base bytestring formatting lifted-async microlens
+         microlens-th monad-control monad-logger safe-exceptions stm text
+       ];
+       testHaskellDepends = [
+         base criterion HUnit monad-logger stm test-framework
+         test-framework-hunit
+       ];
+       homepage = "https://github.com/mtesseract/async-refresh-tokens#readme";
+       description = "Package implementing core logic for refreshing of expiring access tokens";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "async-timer" = callPackage
     ({ mkDerivation, base, containers, criterion, HUnit, lifted-async
      , lifted-base, monad-control, safe-exceptions, test-framework
@@ -33533,37 +33557,45 @@ self: {
 
   "bitcoin-payment-channel" = callPackage
     ({ mkDerivation, aeson, base, base16-bytestring, base64-bytestring
-     , bytestring, cereal, criterion, deepseq, errors, haskoin-core
-     , hexstring, hspec, monad-time, mtl, QuickCheck, random, rbpcp-api
-     , scientific, semigroups, string-conversions, tagged
-     , test-framework, test-framework-quickcheck2, text, tf-random, time
+     , blockchain-restful-address-index-api, bytestring, cereal
+     , criterion, data-default-class, deepseq, either, errors
+     , haskoin-core, hexstring, hspec, hspec-discover, monad-time, mtl
+     , QuickCheck, random, rbpcp-api, scientific, semigroups
+     , string-conversions, tagged, test-framework
+     , test-framework-quickcheck2, text, tf-random, time, transformers
      }:
      mkDerivation {
        pname = "bitcoin-payment-channel";
-       version = "1.0.1.0";
-       sha256 = "18hg95jgmjpmpak2rspb0l5602j112gya9ydv9xm2gpx13wc88xp";
+       version = "1.2.0.0";
+       sha256 = "022wkygx76557cqkw0rvkmv3111n6hiyk3vwym3ampbkr2dv998f";
        libraryHaskellDepends = [
-         aeson base base16-bytestring bytestring cereal deepseq errors
-         haskoin-core hexstring hspec monad-time QuickCheck rbpcp-api
+         aeson base base16-bytestring blockchain-restful-address-index-api
+         bytestring cereal data-default-class deepseq either errors
+         haskoin-core hexstring hspec monad-time mtl QuickCheck rbpcp-api
          scientific semigroups string-conversions tagged text time
+         transformers
        ];
        testHaskellDepends = [
-         aeson base base16-bytestring base64-bytestring bytestring cereal
-         deepseq errors haskoin-core hexstring hspec monad-time mtl
-         QuickCheck random rbpcp-api scientific semigroups
-         string-conversions tagged test-framework test-framework-quickcheck2
-         text tf-random time
+         aeson base base16-bytestring base64-bytestring
+         blockchain-restful-address-index-api bytestring cereal
+         data-default-class deepseq either errors haskoin-core hexstring
+         hspec hspec-discover monad-time mtl QuickCheck random rbpcp-api
+         scientific semigroups string-conversions tagged test-framework
+         test-framework-quickcheck2 text tf-random time transformers
        ];
        benchmarkHaskellDepends = [
-         aeson base base16-bytestring bytestring cereal criterion deepseq
-         errors haskoin-core hexstring hspec monad-time QuickCheck rbpcp-api
-         scientific semigroups string-conversions tagged text time
+         aeson base base16-bytestring blockchain-restful-address-index-api
+         bytestring cereal criterion data-default-class deepseq either
+         errors haskoin-core hexstring hspec monad-time mtl QuickCheck
+         rbpcp-api scientific semigroups string-conversions tagged text time
+         transformers
        ];
        homepage = "https://github.com/runeksvendsen/bitcoin-payment-channel";
        description = "Instant, two-party Bitcoin payments";
        license = "unknown";
        hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
+       broken = true;
+     }) {blockchain-restful-address-index-api = null;};
 
   "bitcoin-rpc" = callPackage
     ({ mkDerivation, aeson, attoparsec, base, bytestring, cereal
@@ -34667,20 +34699,21 @@ self: {
   "blockchain" = callPackage
     ({ mkDerivation, aeson, async, base, byteable, bytestring
      , cryptonite, deepseq, either, errors, hashable, hspec, memory, mtl
-     , QuickCheck, text, time, transformers, unordered-containers
+     , QuickCheck, quickcheck-instances, text, time, transformers
+     , unordered-containers
      }:
      mkDerivation {
        pname = "blockchain";
-       version = "0.0.2";
-       sha256 = "1abd2p587p3kvg3zyn3qmlhk0lw42cs18f7msgkcz07r2k99r047";
+       version = "0.0.3";
+       sha256 = "0hyyg4gpp8wijisvh176pjkjzrvb3v8v0gaws7j6cpirkpjgi895";
        libraryHaskellDepends = [
          aeson base byteable bytestring cryptonite either errors hashable
          memory mtl text time transformers unordered-containers
        ];
        testHaskellDepends = [
          aeson async base byteable bytestring cryptonite deepseq either
-         errors hashable hspec memory mtl QuickCheck text time transformers
-         unordered-containers
+         errors hashable hspec memory mtl QuickCheck quickcheck-instances
+         text time transformers unordered-containers
        ];
        homepage = "https://github.com/TGOlson/blockchain";
        description = "Generic blockchain implementation";
@@ -35397,8 +35430,8 @@ self: {
      }:
      mkDerivation {
        pname = "boomange";
-       version = "0.1.3.2";
-       sha256 = "0sc003xcqv8qdfjrn2mil81f3dspwjzdg9jj0mnffrws66mkw38a";
+       version = "0.1.3.3";
+       sha256 = "0am2b5f6a47khka31mxynl9j2fisa6zyfk3ca8yna02hdkw3rlf6";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -38264,34 +38297,37 @@ self: {
 
   "cabal2nix" = callPackage
     ({ mkDerivation, aeson, ansi-wl-pprint, base, bytestring, Cabal
-     , containers, deepseq, directory, distribution-nixpkgs, doctest
-     , filepath, hackage-db, language-nix, lens, monad-par
-     , monad-par-extras, mtl, optparse-applicative, pretty, process, SHA
-     , split, text, time, transformers, utf8-string, yaml
+     , cabal-doctest, containers, deepseq, directory
+     , distribution-nixpkgs, doctest, filepath, hackage-db, hopenssl
+     , language-nix, lens, monad-par, monad-par-extras, mtl
+     , optparse-applicative, pretty, process, split, text, time
+     , transformers, utf8-string, yaml
      }:
      mkDerivation {
        pname = "cabal2nix";
-       version = "2.2.1";
-       sha256 = "1hw3x3dk1gc2am3w1cxxsb1rdz976vc35zrjabdlx52ncb2lmfx7";
+       version = "2.3.1";
+       sha256 = "0xi4mj8gyb2k9a43dp49wc84sbxpv9sfa8cmzfp0mkak0alwqahj";
        isLibrary = true;
        isExecutable = true;
+       setupHaskellDepends = [ base Cabal cabal-doctest ];
        libraryHaskellDepends = [
          aeson ansi-wl-pprint base bytestring Cabal containers deepseq
-         directory distribution-nixpkgs filepath hackage-db language-nix
-         lens optparse-applicative pretty process SHA split text
+         directory distribution-nixpkgs filepath hackage-db hopenssl
+         language-nix lens optparse-applicative pretty process split text
          transformers yaml
        ];
        executableHaskellDepends = [
          aeson ansi-wl-pprint base bytestring Cabal containers deepseq
-         directory distribution-nixpkgs filepath hackage-db language-nix
-         lens monad-par monad-par-extras mtl optparse-applicative pretty
-         process SHA split text time transformers utf8-string yaml
+         directory distribution-nixpkgs filepath hackage-db hopenssl
+         language-nix lens monad-par monad-par-extras mtl
+         optparse-applicative pretty process split text time transformers
+         utf8-string yaml
        ];
        testHaskellDepends = [
          aeson ansi-wl-pprint base bytestring Cabal containers deepseq
-         directory distribution-nixpkgs doctest filepath hackage-db
-         language-nix lens optparse-applicative pretty process SHA split
-         text transformers yaml
+         directory distribution-nixpkgs doctest filepath hackage-db hopenssl
+         language-nix lens optparse-applicative pretty process split text
+         transformers yaml
        ];
        homepage = "https://github.com/nixos/cabal2nix#readme";
        description = "Convert Cabal files into Nix build instructions";
@@ -41032,36 +41068,27 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "chart-unit_0_3_1" = callPackage
-    ({ mkDerivation, ad, base, colour, containers, data-default
-     , diagrams, diagrams-core, diagrams-lib, diagrams-svg, foldl
-     , formatting, HUnit, lens, linear, ListLike, mwc-probability
-     , mwc-random, numhask, numhask-range, primitive, protolude
-     , QuickCheck, reflection, smallcheck, SVGFonts, tasty, tasty-hspec
-     , tasty-hunit, tasty-quickcheck, tasty-smallcheck, tdigest, text
+  "chart-unit_0_3_2" = callPackage
+    ({ mkDerivation, ad, base, colour, diagrams-lib, diagrams-svg
+     , foldl, formatting, lens, linear, mwc-probability, mwc-random
+     , numhask, numhask-range, primitive, protolude, reflection, tasty
+     , tasty-hspec, tdigest, text
      }:
      mkDerivation {
        pname = "chart-unit";
-       version = "0.3.1";
-       sha256 = "0z7f604y08d8bki6fjx5fz2b1c9lrhalxdjlx1wmhlxz320dpm2w";
+       version = "0.3.2";
+       sha256 = "06yilm8ldkf59vxycydfhn990x6lmykgma2nwc87mxnqc6820a22";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
-         base colour containers data-default diagrams diagrams-core
-         diagrams-lib diagrams-svg foldl formatting lens linear numhask
-         numhask-range protolude QuickCheck SVGFonts text
+         base colour diagrams-lib diagrams-svg foldl formatting lens linear
+         numhask numhask-range text
        ];
        executableHaskellDepends = [
-         ad base containers diagrams diagrams-core diagrams-lib diagrams-svg
-         foldl formatting lens linear ListLike mwc-probability mwc-random
-         numhask numhask-range primitive protolude reflection SVGFonts
-         tdigest text
-       ];
-       testHaskellDepends = [
-         base data-default diagrams-lib HUnit numhask numhask-range
-         protolude QuickCheck smallcheck tasty tasty-hspec tasty-hunit
-         tasty-quickcheck tasty-smallcheck
+         ad base foldl mwc-probability mwc-random numhask primitive
+         protolude reflection tdigest text
        ];
+       testHaskellDepends = [ base numhask tasty tasty-hspec ];
        homepage = "https://github.com/tonyday567/chart-unit";
        description = "A set of native haskell charts";
        license = stdenv.lib.licenses.bsd3;
@@ -45889,8 +45916,8 @@ self: {
      }:
      mkDerivation {
        pname = "concurrent-machines";
-       version = "0.3.0";
-       sha256 = "1lha3bk98cdd3bsy5kbl92hp3f35x3q1p135j37r9xw9ix4kivy5";
+       version = "0.3.1";
+       sha256 = "0n04gnnv323fk1h9mp8krqbl2v6ljjv1vzw5df38cxvj2xd64y94";
        libraryHaskellDepends = [
          async base containers lifted-async machines monad-control
          semigroups time transformers transformers-base
@@ -49470,6 +49497,26 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "crypt-sha512" = callPackage
+    ({ mkDerivation, attoparsec, base, bytestring, cryptohash-sha512
+     , quickcheck-instances, tasty, tasty-hunit, tasty-quickcheck
+     }:
+     mkDerivation {
+       pname = "crypt-sha512";
+       version = "0";
+       sha256 = "1wsma9frdrn39i506zydlzlk1ir6jh1pidqfjms8rwqjpx965gn2";
+       libraryHaskellDepends = [
+         attoparsec base bytestring cryptohash-sha512
+       ];
+       testHaskellDepends = [
+         base bytestring quickcheck-instances tasty tasty-hunit
+         tasty-quickcheck
+       ];
+       homepage = "https://github.com/phadej/crypt-sha512";
+       description = "Pure Haskell implelementation for GNU SHA512 crypt algorithm";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "crypto-api" = callPackage
     ({ mkDerivation, base, bytestring, cereal, entropy, tagged
      , transformers
@@ -52178,8 +52225,8 @@ self: {
     ({ mkDerivation, base, containers, ghc-prim, hspec, lens, tagged }:
      mkDerivation {
        pname = "data-diverse";
-       version = "0.3.0.0";
-       sha256 = "1h6i10qixy0603xamal2v54knznjmza081hg410a2s97cigclay8";
+       version = "0.4.0.0";
+       sha256 = "0jqyn4jwdvzijqwrb5j0052h95vxdwgixfb5a7cgwa574yipks09";
        libraryHaskellDepends = [ base containers ghc-prim lens tagged ];
        testHaskellDepends = [ base hspec lens tagged ];
        homepage = "https://github.com/louispan/data-diverse#readme";
@@ -55921,6 +55968,34 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "diagrams-contrib_1_4_1" = callPackage
+    ({ mkDerivation, base, circle-packing, colour, containers
+     , cubicbezier, data-default, data-default-class, diagrams-core
+     , diagrams-lib, diagrams-solve, force-layout, hashable, HUnit, lens
+     , linear, mfsolve, MonadRandom, monoid-extras, mtl, mtl-compat
+     , parsec, QuickCheck, random, semigroups, split, test-framework
+     , test-framework-hunit, test-framework-quickcheck2, text
+     }:
+     mkDerivation {
+       pname = "diagrams-contrib";
+       version = "1.4.1";
+       sha256 = "1apbgicaq7qaij42hwh5aiy67si2fjd0m4lah1hw4vz0cqfxxs2v";
+       libraryHaskellDepends = [
+         base circle-packing colour containers cubicbezier data-default
+         data-default-class diagrams-core diagrams-lib diagrams-solve
+         force-layout hashable lens linear mfsolve MonadRandom monoid-extras
+         mtl mtl-compat parsec random semigroups split text
+       ];
+       testHaskellDepends = [
+         base containers diagrams-lib HUnit QuickCheck test-framework
+         test-framework-hunit test-framework-quickcheck2
+       ];
+       homepage = "http://projects.haskell.org/diagrams/";
+       description = "Collection of user contributions to diagrams EDSL";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "diagrams-core" = callPackage
     ({ mkDerivation, adjunctions, base, containers, distributive
      , dual-tree, lens, linear, monoid-extras, mtl, profunctors
@@ -56054,8 +56129,8 @@ self: {
        pname = "diagrams-lib";
        version = "1.4.1.2";
        sha256 = "0w16cljv9jcvn46hd19qvw1bfvxijlak286nap9qbvyavq2qhvjb";
-       revision = "2";
-       editedCabalFile = "0na2aqk7aw2f1nq62r1zwmv3f5h9yx61b0b5qxmsazgyvqjgc3z3";
+       revision = "3";
+       editedCabalFile = "14ni87kwmjhbphcihiivvz0nxga355263q36wvbyvvjmxvbdj98n";
        libraryHaskellDepends = [
          active adjunctions array base bytestring cereal colour containers
          data-default-class diagrams-core diagrams-solve directory
@@ -56243,6 +56318,24 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "diagrams-solve_0_1_1" = callPackage
+    ({ mkDerivation, base, deepseq, tasty, tasty-hunit
+     , tasty-quickcheck
+     }:
+     mkDerivation {
+       pname = "diagrams-solve";
+       version = "0.1.1";
+       sha256 = "17agchqkmj14b17sw50kzxq4hm056g5d8yy0wnqn5w8h1d0my7x4";
+       libraryHaskellDepends = [ base ];
+       testHaskellDepends = [
+         base deepseq tasty tasty-hunit tasty-quickcheck
+       ];
+       homepage = "http://projects.haskell.org/diagrams";
+       description = "Pure Haskell solver routines used by diagrams";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "diagrams-svg" = callPackage
     ({ mkDerivation, base, base64-bytestring, bytestring, colour
      , containers, diagrams-core, diagrams-lib, filepath, hashable
@@ -56956,8 +57049,8 @@ self: {
     ({ mkDerivation, base, Cabal, ghc-prim, QuickCheck }:
      mkDerivation {
        pname = "dimensions";
-       version = "0.1.0.0";
-       sha256 = "0162ki2vw1k3wza7b4zfp4ya4lb3cdzp0vdr0k8d8k5b3w107p26";
+       version = "0.3.0.0";
+       sha256 = "00932v3j629ik2n4flq74zcxvvqxgsl88sifyn2ppdwvp535cmhm";
        libraryHaskellDepends = [ base ghc-prim ];
        testHaskellDepends = [ base Cabal QuickCheck ];
        homepage = "https://github.com/achirkin/easytensor#readme";
@@ -57188,6 +57281,24 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "direct-sqlite_2_3_20" = callPackage
+    ({ mkDerivation, base, base16-bytestring, bytestring, directory
+     , HUnit, temporary, text
+     }:
+     mkDerivation {
+       pname = "direct-sqlite";
+       version = "2.3.20";
+       sha256 = "0wdjmqfs968319nl6ikmrrjqajfcb48k11hmmljwg81n1sbdydbf";
+       libraryHaskellDepends = [ base bytestring text ];
+       testHaskellDepends = [
+         base base16-bytestring bytestring directory HUnit temporary text
+       ];
+       homepage = "https://github.com/IreneKnapp/direct-sqlite";
+       description = "Low-level binding to SQLite3. Includes UTF8 and BLOB support.";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "directed-cubical" = callPackage
     ({ mkDerivation, base, bytestring, containers, deepseq, hashable
      , parallel, QuickCheck, unordered-containers, vector
@@ -59976,6 +60087,25 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "dual-tree_0_2_1" = callPackage
+    ({ mkDerivation, base, monoid-extras, newtype-generics, QuickCheck
+     , semigroups, testing-feat
+     }:
+     mkDerivation {
+       pname = "dual-tree";
+       version = "0.2.1";
+       sha256 = "06azc2lwli9aw81a23g82yxiann2qjc3bk7cdyh9kiwimdyj8r94";
+       libraryHaskellDepends = [
+         base monoid-extras newtype-generics semigroups
+       ];
+       testHaskellDepends = [
+         base monoid-extras QuickCheck semigroups testing-feat
+       ];
+       description = "Rose trees with cached and accumulating monoidal annotations";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "duckling" = callPackage
     ({ mkDerivation, aeson, array, attoparsec, base, bytestring
      , containers, deepseq, dependent-sum, directory, extra, filepath
@@ -60702,13 +60832,13 @@ self: {
      }:
      mkDerivation {
        pname = "easytensor";
-       version = "0.2.0.0";
-       sha256 = "1z5myc51q96pbwaryf6pvjvfqq9l2d0cwnhpxpxn3bkcj6jr9yf8";
+       version = "0.3.0.0";
+       sha256 = "1a6y6lrnc82354jqfrns4bb3pwhiwnidfcgfwzg38wsdmpq5rhg9";
        libraryHaskellDepends = [ base dimensions ghc-prim ];
        testHaskellDepends = [ base Cabal dimensions QuickCheck ];
        benchmarkHaskellDepends = [ base dimensions time ];
        homepage = "https://github.com/achirkin/easytensor#readme";
-       description = "Initial project template from stack";
+       description = "Pure, type-indexed haskell vector, matrix, and tensor library";
        license = stdenv.lib.licenses.mit;
        hydraPlatforms = [ "x86_64-darwin" "x86_64-linux" ];
      }) {};
@@ -61808,6 +61938,19 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "eliminators" = callPackage
+    ({ mkDerivation, base, hspec, singletons }:
+     mkDerivation {
+       pname = "eliminators";
+       version = "0.1";
+       sha256 = "0amd3gwnxhdbpg9afv2zs4c3lhc9s7ri66cpdp4x7vmp5xx6yi3n";
+       libraryHaskellDepends = [ base singletons ];
+       testHaskellDepends = [ base hspec singletons ];
+       homepage = "https://github.com/RyanGlScott/eliminators";
+       description = "Dependently typed elimination functions using singletons";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "elision" = callPackage
     ({ mkDerivation, base, profunctors }:
      mkDerivation {
@@ -67348,6 +67491,25 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "file-templates" = callPackage
+    ({ mkDerivation, attoparsec, base, bytestring, directory, filepath
+     , foundation, transformers, unordered-containers
+     }:
+     mkDerivation {
+       pname = "file-templates";
+       version = "1.1.0.0";
+       sha256 = "0vh83vpcfz5yringls1w8ydl3xr5jawgnzyvj8nn28m1qgwaz29v";
+       isLibrary = false;
+       isExecutable = true;
+       executableHaskellDepends = [
+         attoparsec base bytestring directory filepath foundation
+         transformers unordered-containers
+       ];
+       homepage = "https://github.com/anfelor/file-templates#readme";
+       description = "Use templates for files and directories";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "filecache" = callPackage
     ({ mkDerivation, base, directory, exceptions, hashable, hinotify
      , lens, mtl, stm, strict-base-types, temporary
@@ -67474,6 +67636,23 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "fileplow" = callPackage
+    ({ mkDerivation, base, binary-search, bytestring, hspec, mtl
+     , QuickCheck, temporary, vector
+     }:
+     mkDerivation {
+       pname = "fileplow";
+       version = "0.1.0.0";
+       sha256 = "017f3f3w69fvlhdagivb5xp72vwzmimcjd94zw9l9ylp5jv7vp4x";
+       libraryHaskellDepends = [ base binary-search bytestring vector ];
+       testHaskellDepends = [
+         base bytestring hspec mtl QuickCheck temporary
+       ];
+       homepage = "https://github.com/agrafix/fileplow#readme";
+       description = "Library to process and search large files or a collection of files";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "filestore" = callPackage
     ({ mkDerivation, base, bytestring, containers, Diff, directory
      , filepath, HUnit, mtl, old-locale, parsec, process, split, time
@@ -68838,8 +69017,8 @@ self: {
      }:
      mkDerivation {
        pname = "fltkhs";
-       version = "0.5.3.2";
-       sha256 = "0m29qcajhbzkl577xyzly82m9jrd446gzpxgg7sswvaki1wa6yv0";
+       version = "0.5.3.3";
+       sha256 = "0rl6zwamkwdjnlmn2rr0mh16idci5xqgr70qsvqarj34h1ax2idb";
        isLibrary = true;
        isExecutable = true;
        setupHaskellDepends = [ base Cabal directory filepath ];
@@ -72260,6 +72439,24 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "gen-passwd" = callPackage
+    ({ mkDerivation, base, bytestring, optparse-applicative, random
+     , vector
+     }:
+     mkDerivation {
+       pname = "gen-passwd";
+       version = "1.1.0.0";
+       sha256 = "16ql67p4knkwas4kfa1mikqqxq6kvzcnrbza5y7kk3gi0haiaj1s";
+       isLibrary = false;
+       isExecutable = true;
+       executableHaskellDepends = [
+         base bytestring optparse-applicative random vector
+       ];
+       homepage = "https://github.com/anfelor/gen-passwd#readme";
+       description = "Create wordlist-based passwords easily";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "gencheck" = callPackage
     ({ mkDerivation, base, combinat, containers, ieee754, memoize
      , random, template-haskell, transformers
@@ -75631,26 +75828,26 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "ginger_0_5_2_1" = callPackage
+  "ginger_0_5_3_0" = callPackage
     ({ mkDerivation, aeson, base, bytestring, data-default, filepath
      , http-types, mtl, parsec, safe, scientific, tasty, tasty-hunit
      , tasty-quickcheck, text, time, transformers, unordered-containers
-     , utf8-string, vector, wryte
+     , utf8-string, vector
      }:
      mkDerivation {
        pname = "ginger";
-       version = "0.5.2.1";
-       sha256 = "1axazqa84hbgrrswdmxkl5wc8kdfana9f6wzj5m83zn8pmjsixvk";
+       version = "0.5.3.0";
+       sha256 = "049ys725scrrkxc2q4wx085hbzdnjpm1jd9wqraqg5fa23vpfy34";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
          aeson base bytestring data-default filepath http-types mtl parsec
          safe scientific text time transformers unordered-containers
-         utf8-string vector wryte
+         utf8-string vector
        ];
        executableHaskellDepends = [
          aeson base bytestring data-default text transformers
-         unordered-containers wryte
+         unordered-containers
        ];
        testHaskellDepends = [
          aeson base bytestring data-default mtl tasty tasty-hunit
@@ -77583,8 +77780,8 @@ self: {
      }:
      mkDerivation {
        pname = "glue-common";
-       version = "0.4.9";
-       sha256 = "15cxrm7bnc4p6ayykpba6rgzb27d3rhd0cw437x6id5a0daxr0sc";
+       version = "0.5";
+       sha256 = "0wza8cmschfh6kk21wm2bz12ly3in7kf0cv6jma0a78fiphdwg2q";
        libraryHaskellDepends = [
          base hashable lifted-base monad-control text time transformers
          transformers-base unordered-containers
@@ -77607,8 +77804,8 @@ self: {
      }:
      mkDerivation {
        pname = "glue-core";
-       version = "0.4.9";
-       sha256 = "035x4fx4c1168gqmrgc60xyzz670pa9v7qi0qfp91vkl5xwa5i2n";
+       version = "0.5";
+       sha256 = "0x89h04j8z58nd1cx6rxn0hgjgb24kdzgl21m2xrlj7h1fp9fwfi";
        libraryHaskellDepends = [
          base glue-common hashable lifted-base monad-control text time
          transformers transformers-base unordered-containers
@@ -77631,8 +77828,8 @@ self: {
      }:
      mkDerivation {
        pname = "glue-ekg";
-       version = "0.4.9";
-       sha256 = "0gr0887dz3527xbcdrf70ww0z7mqh63733ia0d7vqgmsmj95fg1p";
+       version = "0.5";
+       sha256 = "0ckbmjizfclpdyzrc85l9hh79yl82rmbkim5gq543qnppi1pn4h6";
        libraryHaskellDepends = [
          base ekg-core glue-common hashable lifted-base monad-control text
          time transformers transformers-base unordered-containers
@@ -77654,8 +77851,8 @@ self: {
      }:
      mkDerivation {
        pname = "glue-example";
-       version = "0.4.9";
-       sha256 = "0z4pkdrzdjs6xkx8wi314jadhiyyf1nqmd2jwh3h3c422l951sib";
+       version = "0.5";
+       sha256 = "10nw8bzxbcghyy9xyb69ka3a3w66fysczhhgrshy462ihpw8p8bw";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -89233,14 +89430,14 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "haskell-tools-ast_0_7_0_0" = callPackage
+  "haskell-tools-ast_0_8_0_0" = callPackage
     ({ mkDerivation, base, ghc, mtl, references, template-haskell
      , uniplate
      }:
      mkDerivation {
        pname = "haskell-tools-ast";
-       version = "0.7.0.0";
-       sha256 = "063r92xzykhh3sr3zx161md2p98qzbsxs741ajs606bi2za52fyv";
+       version = "0.8.0.0";
+       sha256 = "15d588xnmghq116g4bg0jv10z5xzs54ln4da58dzm0d8241bmcd0";
        libraryHaskellDepends = [
          base ghc mtl references template-haskell uniplate
        ];
@@ -89323,18 +89520,18 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "haskell-tools-backend-ghc_0_7_0_0" = callPackage
-    ({ mkDerivation, base, bytestring, containers, ghc
+  "haskell-tools-backend-ghc_0_8_0_0" = callPackage
+    ({ mkDerivation, base, bytestring, containers, ghc, ghc-boot-th
      , haskell-tools-ast, mtl, references, safe, split, template-haskell
      , transformers, uniplate
      }:
      mkDerivation {
        pname = "haskell-tools-backend-ghc";
-       version = "0.7.0.0";
-       sha256 = "09f0g0wzfl6979hbcz8qyyf0wwzk88rm83dw7h84by07nglfpxzg";
+       version = "0.8.0.0";
+       sha256 = "076kb9hcjina0d5dcwslbxhkja3p2m2fyxs88ywyqlciry2wdw2n";
        libraryHaskellDepends = [
-         base bytestring containers ghc haskell-tools-ast mtl references
-         safe split template-haskell transformers uniplate
+         base bytestring containers ghc ghc-boot-th haskell-tools-ast mtl
+         references safe split template-haskell transformers uniplate
        ];
        homepage = "https://github.com/nboldi/haskell-tools";
        description = "Creating the Haskell-Tools AST from GHC's representations";
@@ -89372,7 +89569,7 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "haskell-tools-cli_0_7_0_0" = callPackage
+  "haskell-tools-cli_0_8_0_0" = callPackage
     ({ mkDerivation, aeson, base, bytestring, containers, criterion
      , directory, filepath, ghc, ghc-paths, haskell-tools-ast
      , haskell-tools-prettyprint, haskell-tools-refactor, knob, mtl
@@ -89380,8 +89577,8 @@ self: {
      }:
      mkDerivation {
        pname = "haskell-tools-cli";
-       version = "0.7.0.0";
-       sha256 = "1mnghaccwlyk4rc443ixgz760pdlfp1klj9zmhhin8gyldyh97zn";
+       version = "0.8.0.0";
+       sha256 = "02f5fhb20wb49gchqx8mjc6khdlc3g6lfawxl3v0xr8fargyyiz5";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -89430,7 +89627,7 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "haskell-tools-daemon_0_7_0_0" = callPackage
+  "haskell-tools-daemon_0_8_0_0" = callPackage
     ({ mkDerivation, aeson, base, bytestring, containers, Diff
      , directory, filepath, ghc, ghc-paths, haskell-tools-ast
      , haskell-tools-prettyprint, haskell-tools-refactor, HUnit, mtl
@@ -89438,8 +89635,8 @@ self: {
      }:
      mkDerivation {
        pname = "haskell-tools-daemon";
-       version = "0.7.0.0";
-       sha256 = "09sccrmdczqdh4qwby79sy31asrhn7jmp7hrrzq59gp02f4v0rzw";
+       version = "0.8.0.0";
+       sha256 = "0fd9pxyxsfy09ks21nsk6khx97mb73kvjk6hg3wc8qcffxng9m69";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -89480,15 +89677,15 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "haskell-tools-debug_0_7_0_0" = callPackage
+  "haskell-tools-debug_0_8_0_0" = callPackage
     ({ mkDerivation, base, filepath, ghc, ghc-paths, haskell-tools-ast
      , haskell-tools-backend-ghc, haskell-tools-prettyprint
      , haskell-tools-refactor, references, template-haskell
      }:
      mkDerivation {
        pname = "haskell-tools-debug";
-       version = "0.7.0.0";
-       sha256 = "1iqlr6zhya3gcmlhkhfbrqh9wirhsrkpn1qr6zxab1a3yx9q895i";
+       version = "0.8.0.0";
+       sha256 = "0j9gd562kmmanqx9kbs1kks68pksnxgf55rghl8ip3j8a3h93smy";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -89534,7 +89731,7 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "haskell-tools-demo_0_7_0_2" = callPackage
+  "haskell-tools-demo_0_8_0_0" = callPackage
     ({ mkDerivation, aeson, base, bytestring, containers, directory
      , filepath, ghc, ghc-paths, haskell-tools-ast
      , haskell-tools-backend-ghc, haskell-tools-prettyprint
@@ -89544,8 +89741,8 @@ self: {
      }:
      mkDerivation {
        pname = "haskell-tools-demo";
-       version = "0.7.0.2";
-       sha256 = "0r8fb1mzf2j92n6xjkxd5kxqi6l9h0haf07l3p8fazqysxdsr1pj";
+       version = "0.8.0.0";
+       sha256 = "14l8zwzi4nzx1ddq2sbazr5faf0y241ppx9df5q9n0v24aclmxd6";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -89582,14 +89779,14 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "haskell-tools-prettyprint_0_7_0_0" = callPackage
+  "haskell-tools-prettyprint_0_8_0_0" = callPackage
     ({ mkDerivation, base, containers, ghc, haskell-tools-ast, mtl
      , references, split, text, uniplate
      }:
      mkDerivation {
        pname = "haskell-tools-prettyprint";
-       version = "0.7.0.0";
-       sha256 = "0d5ar53qkxyirs1q0p0nxzg9qy8mzsrj615ad1bfqz4lx1i0amsc";
+       version = "0.8.0.0";
+       sha256 = "19bx0fzgvin78iilw32klmjr0z0c9cw1x0xx1nj8mbi44c5rcb64";
        libraryHaskellDepends = [
          base containers ghc haskell-tools-ast mtl references split text
          uniplate
@@ -89631,7 +89828,7 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "haskell-tools-refactor_0_7_0_0" = callPackage
+  "haskell-tools-refactor_0_8_0_0" = callPackage
     ({ mkDerivation, base, Cabal, containers, directory, either
      , filepath, ghc, ghc-paths, haskell-tools-ast
      , haskell-tools-backend-ghc, haskell-tools-prettyprint
@@ -89641,8 +89838,8 @@ self: {
      }:
      mkDerivation {
        pname = "haskell-tools-refactor";
-       version = "0.7.0.0";
-       sha256 = "0nivbkndwwkx32y1dzyqrpbmx8fasnxgq7c3hm7bs7plj4qsb096";
+       version = "0.8.0.0";
+       sha256 = "1k9mq164v7nm83dykdgmzxfdqmyk5p35lgzvnmw9mh43rrnnw8vd";
        libraryHaskellDepends = [
          base Cabal containers directory filepath ghc ghc-paths
          haskell-tools-ast haskell-tools-backend-ghc
@@ -89685,15 +89882,15 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "haskell-tools-rewrite_0_7_0_0" = callPackage
+  "haskell-tools-rewrite_0_8_0_0" = callPackage
     ({ mkDerivation, base, containers, directory, filepath, ghc
      , haskell-tools-ast, haskell-tools-prettyprint, mtl, references
      , tasty, tasty-hunit
      }:
      mkDerivation {
        pname = "haskell-tools-rewrite";
-       version = "0.7.0.0";
-       sha256 = "00gl4f711whfcrfv3i17ilwcj63w5zwq3p8njw8h4wcd06q0f28p";
+       version = "0.8.0.0";
+       sha256 = "076dc91swh42rs80ijbjrbzab1m9vjdzvy7z9r7znmrhy951ck5c";
        libraryHaskellDepends = [
          base containers ghc haskell-tools-ast haskell-tools-prettyprint mtl
          references
@@ -95130,8 +95327,8 @@ self: {
      }:
      mkDerivation {
        pname = "highlight";
-       version = "1.0.0.0";
-       sha256 = "1gr4aj0w605hx2mrgzicb1nwimxyxpj2jid7ca6qpwnbxvnj7ryi";
+       version = "1.0.0.1";
+       sha256 = "0xklv4fnhi4dbz33hzw7l4ng5ap1jfhn4qmkshl2k6gn2pkyaikx";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -96373,8 +96570,8 @@ self: {
     ({ mkDerivation, base, hledger-lib, text, time }:
      mkDerivation {
        pname = "hledger-diff";
-       version = "0.2.0.8";
-       sha256 = "0yvl102c1jzml2rl1jpb75x9v48v14s8gz63wc2bkm5bjm5f94g6";
+       version = "0.2.0.9";
+       sha256 = "0ajjiz6jvm45j472f0ypxk33hc47rg0zs9ylkcrkvvk9992x7lnq";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [ base hledger-lib text time ];
@@ -96394,6 +96591,8 @@ self: {
        pname = "hledger-iadd";
        version = "1.2.2";
        sha256 = "1d12fjqyrj0wy8iq096h8mq2v76j8ihc2d8j1xc5qckw2g29539a";
+       revision = "2";
+       editedCabalFile = "0yhc50km7jfhdynvyvqyqi2jwpy554kwz1l9fsvklf2scfv4c3k5";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -96439,8 +96638,8 @@ self: {
      }:
      mkDerivation {
        pname = "hledger-irr";
-       version = "0.1.1.10";
-       sha256 = "1m5dfgrs943cqm3ix7iadgyv3j4vlp65s86sas03ll390zvny44q";
+       version = "0.1.1.11";
+       sha256 = "1rxpv70xfr7z8yn65dcac1a7l4mb2p1z30ld4bw75gr34lkirb1y";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -98509,8 +98708,8 @@ self: {
      }:
      mkDerivation {
        pname = "hops";
-       version = "0.7.1";
-       sha256 = "04hgpvk7lrp1iqw02yjawnh2mvxjnp21h3cd36yzy4hw74am33sp";
+       version = "0.7.2";
+       sha256 = "16a1ygxv4isw5wiq5dhjn4xdlr67zy1ngn61mwilgwkvwj0cjxc3";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -101588,6 +101787,21 @@ self: {
        license = stdenv.lib.licenses.isc;
      }) {};
 
+  "hsinstall_1_6" = callPackage
+    ({ mkDerivation, base, directory, filepath }:
+     mkDerivation {
+       pname = "hsinstall";
+       version = "1.6";
+       sha256 = "04f86mk2304q9kz37hr18b9jcz66wk04z747xzpxbnnwig390406";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [ base directory filepath ];
+       executableHaskellDepends = [ base directory filepath ];
+       description = "Install Haskell software";
+       license = stdenv.lib.licenses.isc;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "hskeleton" = callPackage
     ({ mkDerivation, base, Cabal }:
      mkDerivation {
@@ -122775,8 +122989,8 @@ self: {
      }:
      mkDerivation {
        pname = "llvm-pretty-bc-parser";
-       version = "0.3.2.0";
-       sha256 = "0h0lxp2aavljps08afqa22sl9b73fi02nv91k9x44qy2na2pk2hr";
+       version = "0.4.0.0";
+       sha256 = "0mj4k4a8xap5gsw7zrnlg6ms65nb1cfmllxq24h7gvd7s9qs9cp8";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -124188,19 +124402,20 @@ self: {
      }) {};
 
   "loup" = callPackage
-    ({ mkDerivation, aeson, amazonka, amazonka-swf, base, bytestring
-     , conduit, lifted-async, lifted-base, optparse-generic, preamble
-     , shakers, time, turtle, unordered-containers, uuid, yaml
+    ({ mkDerivation, aeson, amazonka, amazonka-swf, base, basic-prelude
+     , bytestring, conduit, lifted-async, lifted-base, optparse-generic
+     , preamble, shakers, time, turtle, unordered-containers, uuid, yaml
      }:
      mkDerivation {
        pname = "loup";
-       version = "0.0.9";
-       sha256 = "059alaci5rqlagm7hgkk6nl9i11ynjkn2rz70haklbw6di2l9niw";
+       version = "0.0.10";
+       sha256 = "0j65vx9cpn0q1zhcz4wsk86wnqlmr2m8dkqgzy2scm7chfd2hbhv";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
-         aeson amazonka amazonka-swf base bytestring conduit lifted-async
-         lifted-base preamble time turtle unordered-containers uuid yaml
+         aeson amazonka amazonka-swf base basic-prelude bytestring conduit
+         lifted-async lifted-base preamble time turtle unordered-containers
+         uuid yaml
        ];
        executableHaskellDepends = [ base optparse-generic shakers ];
        homepage = "https://github.com/swift-nav/loup";
@@ -129743,8 +129958,8 @@ self: {
      }:
      mkDerivation {
        pname = "miso";
-       version = "0.1.0.4";
-       sha256 = "12q0jg51rlc1jsqwshxp55v1ddsb9zapq0lz9f300cyd9xg5rcvg";
+       version = "0.1.1.0";
+       sha256 = "16ww5nbjdkjlwsr3dapv3px12dvi9dxbmz9z62n3hfpz5c4v5864";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -139525,23 +139740,6 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "ombra" = callPackage
-    ({ mkDerivation, base, Boolean, gl, hashable, hashtables
-     , transformers, unordered-containers, vector-space
-     }:
-     mkDerivation {
-       pname = "ombra";
-       version = "0.3.1.0";
-       sha256 = "0nzi7pb3m0sp4s0w5k06285xx85fpgfnc464xb431ac7ppinwq1q";
-       libraryHaskellDepends = [
-         base Boolean gl hashable hashtables transformers
-         unordered-containers vector-space
-       ];
-       homepage = "https://github.com/ziocroc/Ombra";
-       description = "Render engine";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
   "omega" = callPackage
     ({ mkDerivation, array, base, containers, directory, filepath
      , pretty, time
@@ -140132,6 +140330,24 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "openexr-write" = callPackage
+    ({ mkDerivation, base, binary, bytestring, data-binary-ieee754
+     , deepseq, directory, hspec, split, vector, vector-split, zlib
+     }:
+     mkDerivation {
+       pname = "openexr-write";
+       version = "0.1.0.1";
+       sha256 = "0f45jgj08fmrj30f167xldapm5lqma4yy95y9mjx6appb7cg5qvd";
+       libraryHaskellDepends = [
+         base binary bytestring data-binary-ieee754 deepseq split vector
+         vector-split zlib
+       ];
+       testHaskellDepends = [ base bytestring directory hspec vector ];
+       homepage = "https://github.com/pavolzetor/openexr-write#readme";
+       description = "Library for writing images in OpenEXR HDR file format";
+       license = stdenv.lib.licenses.gpl3;
+     }) {};
+
   "openflow" = callPackage
     ({ mkDerivation, aeson, base, bimap, binary, bytestring, containers
      , deepseq-generics, hashable, network
@@ -141596,8 +141812,8 @@ self: {
      }:
      mkDerivation {
        pname = "overload";
-       version = "0.1.0.3";
-       sha256 = "1mx49xzhqsmlb9njplxy9rs19mpahxbcskisp0ds1ihiyf51qzfm";
+       version = "0.1.0.4";
+       sha256 = "16sry2c4wrly3y3k47gry53klxf4kvbym6fybb8f7z9hqffx18a9";
        libraryHaskellDepends = [
          base simple-effects template-haskell th-expand-syns
        ];
@@ -143987,15 +144203,15 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "path_0_6_0" = callPackage
+  "path_0_6_1" = callPackage
     ({ mkDerivation, aeson, base, bytestring, deepseq, exceptions
      , filepath, genvalidity, genvalidity-property, hashable, hspec, mtl
      , QuickCheck, template-haskell, validity
      }:
      mkDerivation {
        pname = "path";
-       version = "0.6.0";
-       sha256 = "107jkd0wz40njxbdmgvc51q6bjqz71wl0bi0sprjhvgm2bn64x2x";
+       version = "0.6.1";
+       sha256 = "0nayla4k1gb821k8y5b9miflv1bi8f0czf9rqr044nrr2dddi2sb";
        libraryHaskellDepends = [
          aeson base deepseq exceptions filepath hashable template-haskell
        ];
@@ -149028,6 +149244,8 @@ self: {
        pname = "polyvariadic";
        version = "0.3.0.0";
        sha256 = "13q6sq56gkn6gfjl9mblhjkkfk5bgi86l1x2x9yirfjms4x8445z";
+       revision = "1";
+       editedCabalFile = "0xnj571ccbpwnra5nzlvsj9qfj79aiq2cphwl8454jpl17cjnir2";
        libraryHaskellDepends = [ base containers ];
        homepage = "https://github.com/fgaz/polyvariadic";
        description = "Creation and application of polyvariadic functions";
@@ -150533,8 +150751,8 @@ self: {
      }:
      mkDerivation {
        pname = "preamble";
-       version = "0.0.40";
-       sha256 = "0g7l11nqslyqhcrm5l5k2yigd4d8gjaysm5kc6n2mm7n8c3cw1b2";
+       version = "0.0.44";
+       sha256 = "03x71m1sgq5l70xkmlvi8v3805xa39fbg9py54sqfdyk2rg56zyy";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -152347,6 +152565,32 @@ self: {
        license = stdenv.lib.licenses.asl20;
      }) {};
 
+  "prometheus-client_0_2_0" = callPackage
+    ({ mkDerivation, atomic-primops, base, bytestring, clock
+     , containers, criterion, doctest, hspec, mtl, QuickCheck, random
+     , random-shuffle, stm, transformers, utf8-string
+     }:
+     mkDerivation {
+       pname = "prometheus-client";
+       version = "0.2.0";
+       sha256 = "15iqacx6gygd5xp17i1c7sd0mvndqfxqvjjs17hndxiqjgxvlr1z";
+       libraryHaskellDepends = [
+         atomic-primops base bytestring clock containers mtl stm
+         transformers utf8-string
+       ];
+       testHaskellDepends = [
+         atomic-primops base bytestring clock containers doctest hspec mtl
+         QuickCheck random-shuffle stm transformers utf8-string
+       ];
+       benchmarkHaskellDepends = [
+         base bytestring criterion random utf8-string
+       ];
+       homepage = "https://github.com/fimad/prometheus-haskell";
+       description = "Haskell client library for http://prometheus.io.";
+       license = stdenv.lib.licenses.asl20;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "prometheus-metrics-ghc" = callPackage
     ({ mkDerivation, base, doctest, prometheus-client, utf8-string }:
      mkDerivation {
@@ -152360,6 +152604,20 @@ self: {
        license = stdenv.lib.licenses.asl20;
      }) {};
 
+  "prometheus-metrics-ghc_0_2_0" = callPackage
+    ({ mkDerivation, base, doctest, prometheus-client, utf8-string }:
+     mkDerivation {
+       pname = "prometheus-metrics-ghc";
+       version = "0.2.0";
+       sha256 = "0j3lk2khnqbf9l3lri4n7fn0riinwakp911l05h2qywjcj0v5vm0";
+       libraryHaskellDepends = [ base prometheus-client utf8-string ];
+       testHaskellDepends = [ base doctest prometheus-client ];
+       homepage = "https://github.com/fimad/prometheus-haskell";
+       description = "Metrics exposing GHC runtime information for use with prometheus-client";
+       license = stdenv.lib.licenses.asl20;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "promise" = callPackage
     ({ mkDerivation, async, base }:
      mkDerivation {
@@ -153059,6 +153317,30 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "psqueues_0_2_3_0" = callPackage
+    ({ mkDerivation, array, base, containers, criterion, deepseq
+     , fingertree-psqueue, ghc-prim, hashable, HUnit, mtl, PSQueue
+     , QuickCheck, random, tagged, test-framework, test-framework-hunit
+     , test-framework-quickcheck2, unordered-containers
+     }:
+     mkDerivation {
+       pname = "psqueues";
+       version = "0.2.3.0";
+       sha256 = "19s36xkbpa8466y56bgcmrqxz7aq1fysliyvw79k2a76bpg9bv95";
+       libraryHaskellDepends = [ base deepseq ghc-prim hashable ];
+       testHaskellDepends = [
+         array base deepseq ghc-prim hashable HUnit QuickCheck tagged
+         test-framework test-framework-hunit test-framework-quickcheck2
+       ];
+       benchmarkHaskellDepends = [
+         base containers criterion deepseq fingertree-psqueue ghc-prim
+         hashable mtl PSQueue random unordered-containers
+       ];
+       description = "Pure priority search queues";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "pstemmer" = callPackage
     ({ mkDerivation, base, text }:
      mkDerivation {
@@ -163804,6 +164086,23 @@ self: {
        license = stdenv.lib.licenses.publicDomain;
      }) {};
 
+  "safecopy-migrate" = callPackage
+    ({ mkDerivation, base, base-prelude, cereal, containers, extra
+     , haskell-src-meta, microlens, safecopy, template-haskell, uniplate
+     }:
+     mkDerivation {
+       pname = "safecopy-migrate";
+       version = "0.1.0.0";
+       sha256 = "1bs41w8zkgsidns68xv4finsnwici6wrfc6xiy9vk0la96i4wcv5";
+       libraryHaskellDepends = [
+         base base-prelude cereal containers extra haskell-src-meta
+         microlens safecopy template-haskell uniplate
+       ];
+       homepage = "http://github.com/aelve/safecopy-migrate";
+       description = "Making SafeCopy migrations easier";
+       license = stdenv.lib.licenses.publicDomain;
+     }) {};
+
   "safecopy-store" = callPackage
     ({ mkDerivation, array, base, bytestring, containers, lens
      , lens-action, old-time, QuickCheck, quickcheck-instances, store
@@ -164505,15 +164804,15 @@ self: {
   "sbp" = callPackage
     ({ mkDerivation, aeson, array, base, base64-bytestring
      , basic-prelude, binary, binary-conduit, bytestring, conduit
-     , conduit-combinators, conduit-extra, criterion
-     , data-binary-ieee754, lens, monad-loops, QuickCheck, resourcet
-     , tasty, tasty-hunit, tasty-quickcheck, template-haskell, text
-     , unordered-containers, yaml
+     , conduit-combinators, conduit-extra, data-binary-ieee754, lens
+     , monad-loops, QuickCheck, resourcet, tasty, tasty-hunit
+     , tasty-quickcheck, template-haskell, text, unordered-containers
+     , yaml
      }:
      mkDerivation {
        pname = "sbp";
-       version = "2.2.6";
-       sha256 = "0b26wd3mnpx4yx9q4nyacl43wisqjrck4b8lzykyzdn0fg7xlscc";
+       version = "2.2.7";
+       sha256 = "1dd0m01dbjfjjrv79lnm853ldqkjsmv490a66912v58p51c7qvni";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -164529,10 +164828,6 @@ self: {
          aeson base base64-bytestring basic-prelude bytestring QuickCheck
          tasty tasty-hunit tasty-quickcheck
        ];
-       benchmarkHaskellDepends = [
-         aeson base base64-bytestring basic-prelude binary bytestring
-         criterion
-       ];
        homepage = "https://github.com/swift-nav/libsbp";
        description = "SwiftNav's SBP Library";
        license = stdenv.lib.licenses.lgpl3;
@@ -165159,6 +165454,8 @@ self: {
        pname = "scientific";
        version = "0.3.4.15";
        sha256 = "1gsmpn3563k90nrai0jdjfvkxjjaxs7bxxsfbdpmw4xvbp2lmp9n";
+       revision = "2";
+       editedCabalFile = "1pxj3l4rm04l8rllv15sabspkw5nqhkhf38dsd2cyvr1n6669dd9";
        libraryHaskellDepends = [
          base binary bytestring containers deepseq ghc-prim hashable
          integer-gmp integer-logarithms text vector
@@ -169982,8 +170279,8 @@ self: {
     ({ mkDerivation, base, basic-prelude, directory, shake }:
      mkDerivation {
        pname = "shakers";
-       version = "0.0.24";
-       sha256 = "1wrn28r4w8zxay119n4lsxx2yg0n42rv2msn1px2p76k86bz03w4";
+       version = "0.0.25";
+       sha256 = "0svgrvp054vs00hx5pcdlmpc375c4r926nla4fgk1jax6ghbaw72";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [ base basic-prelude directory shake ];
@@ -170556,8 +170853,8 @@ self: {
      }:
      mkDerivation {
        pname = "shine";
-       version = "0.2.0.1";
-       sha256 = "07d990gkvgd804a6k85n0m8cxss6855gsgg7d52r341l1l706aca";
+       version = "0.2.0.2";
+       sha256 = "0r0rl65rkcdg8c8lzli87nfad8bk4xypiqvb2qs68fhhzwx1zfg2";
        libraryHaskellDepends = [
          base ghcjs-dom ghcjs-prim keycode mtl time transformers
        ];
@@ -172146,6 +172443,16 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "singnal" = callPackage
+    ({ mkDerivation, base }:
+     mkDerivation {
+       pname = "singnal";
+       version = "0.1.0.0";
+       sha256 = "099akvb0j6a7hh4g5pm8i8hy8pmsc6i33jg957zsbnbh72s0ck3d";
+       libraryHaskellDepends = [ base ];
+       license = stdenv.lib.licenses.agpl3;
+     }) {};
+
   "sink" = callPackage
     ({ mkDerivation, base }:
      mkDerivation {
@@ -172794,8 +173101,8 @@ self: {
      }:
      mkDerivation {
        pname = "sloane";
-       version = "5.0.0";
-       sha256 = "0v97lc5pvkx8q0ll1zkmc5n79p03nja9pn0bmdk5s0z6k2zl1p8d";
+       version = "5.0.1";
+       sha256 = "14ffww6vfyv32nr1i17x8c8nc3y583yhza2dy6g6cfphcjw0zwf2";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -175275,8 +175582,8 @@ self: {
      }:
      mkDerivation {
        pname = "solr";
-       version = "0.4.2";
-       sha256 = "07y7k4ilhmwy7h288djmsm9rmm2sb9zmwf7cy8fv4h0yk25wwzia";
+       version = "0.4.3";
+       sha256 = "00hq4gykcimwxa9zy3bmr4k4pxm13ryvfyq95yh4q28gy41wglk0";
        libraryHaskellDepends = [
          attoparsec-data base base-prelude bytestring
          bytestring-tree-builder case-insensitive contravariant http-client
@@ -176839,6 +177146,28 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "sqlite-simple_0_4_14_0" = callPackage
+    ({ mkDerivation, attoparsec, base, base16-bytestring, blaze-builder
+     , blaze-textual, bytestring, containers, direct-sqlite, HUnit, Only
+     , text, time, transformers
+     }:
+     mkDerivation {
+       pname = "sqlite-simple";
+       version = "0.4.14.0";
+       sha256 = "0zx4fdv6larfyj6m1d4livb5cqdx10yi06yd6px2n0wnxcmvdyj9";
+       libraryHaskellDepends = [
+         attoparsec base blaze-builder blaze-textual bytestring containers
+         direct-sqlite Only text time transformers
+       ];
+       testHaskellDepends = [
+         base base16-bytestring bytestring direct-sqlite HUnit text time
+       ];
+       homepage = "http://github.com/nurpax/sqlite-simple";
+       description = "Mid-Level SQLite client library";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "sqlite-simple-errors" = callPackage
     ({ mkDerivation, base, mtl, parsec, sqlite-simple, text }:
      mkDerivation {
@@ -177714,6 +178043,26 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "stackage-query_0_1_1" = callPackage
+    ({ mkDerivation, base, Cabal, containers, directory, filepath
+     , optparse-applicative, process, stackage-types, text, yaml
+     }:
+     mkDerivation {
+       pname = "stackage-query";
+       version = "0.1.1";
+       sha256 = "0prwl42pn3k4yy2439bjsq2m5429xybxwivx1x5ws4k4chvl81fp";
+       isLibrary = false;
+       isExecutable = true;
+       executableHaskellDepends = [
+         base Cabal containers directory filepath optparse-applicative
+         process stackage-types text yaml
+       ];
+       homepage = "https://github.com/juhp/stackage-query";
+       description = "Stackage package query";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "stackage-sandbox" = callPackage
     ({ mkDerivation, attoparsec, base, bytestring, conduit-combinators
      , conduit-extra, directory, filepath, optparse-applicative, process
@@ -179603,6 +179952,27 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "streaming-concurrency" = callPackage
+    ({ mkDerivation, base, bytestring, exceptions, hspec, lifted-async
+     , monad-control, QuickCheck, quickcheck-instances, stm, streaming
+     , streaming-bytestring, streaming-with, transformers-base
+     }:
+     mkDerivation {
+       pname = "streaming-concurrency";
+       version = "0.1.0.0";
+       sha256 = "1g2p928mvkwwdy0xbm8c6ph2cdqswj1gpi0zq6ln1bl4f3xd98rz";
+       libraryHaskellDepends = [
+         base bytestring exceptions lifted-async monad-control stm streaming
+         streaming-bytestring streaming-with transformers-base
+       ];
+       testHaskellDepends = [
+         base bytestring hspec QuickCheck quickcheck-instances streaming
+         streaming-bytestring
+       ];
+       description = "Concurrency support for the streaming ecosystem";
+       license = stdenv.lib.licenses.mit;
+     }) {};
+
   "streaming-conduit" = callPackage
     ({ mkDerivation, base, bytestring, conduit, hspec, streaming
      , streaming-bytestring, transformers
@@ -181234,14 +181604,14 @@ self: {
 
   "superrecord" = callPackage
     ({ mkDerivation, aeson, base, bookkeeper, constraints, criterion
-     , deepseq, ghc-prim, hspec, labels, primitive, text
+     , deepseq, ghc-prim, hspec, labels, mtl, text
      }:
      mkDerivation {
        pname = "superrecord";
-       version = "0.1.1.0";
-       sha256 = "04fmccpfx3lyms8xmya1yidjj9ahhyikr3ilfr3x9m59sc47vhd0";
+       version = "0.2.0.0";
+       sha256 = "0gjmh3mk5pkfqmq145h8zy9hc0vb18prhjqzv948qmihb1ixdaci";
        libraryHaskellDepends = [
-         aeson base constraints deepseq ghc-prim primitive text
+         aeson base constraints deepseq ghc-prim mtl text
        ];
        testHaskellDepends = [ aeson base hspec ];
        benchmarkHaskellDepends = [
@@ -181696,6 +182066,27 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "syfco" = callPackage
+    ({ mkDerivation, array, base, containers, convertible, directory
+     , mtl, parsec, transformers
+     }:
+     mkDerivation {
+       pname = "syfco";
+       version = "1.1.0.0";
+       sha256 = "076094ygbcwriqjmajs0xyr7zqf86b5nikfm9k0ax7hla75x9b5m";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         array base containers convertible directory mtl parsec transformers
+       ];
+       executableHaskellDepends = [
+         array base containers convertible directory mtl parsec transformers
+       ];
+       homepage = "https://github.com/reactive-systems/syfco";
+       description = "Synthesis Format Conversion Tool / Library";
+       license = stdenv.lib.licenses.mit;
+     }) {};
+
   "sylvia" = callPackage
     ({ mkDerivation, base, cairo, comonad-transformers, data-default
      , data-lens, data-lens-template, gtk, optparse-applicative, parsec
@@ -181751,16 +182142,16 @@ self: {
      }) {};
 
   "symantic" = callPackage
-    ({ mkDerivation, base, containers, ghc-prim, mono-traversable
+    ({ mkDerivation, base, containers, mono-traversable
      , symantic-document, symantic-grammar, text, transformers
      }:
      mkDerivation {
        pname = "symantic";
-       version = "6.0.0.20170623";
-       sha256 = "0g4gfy8hjdwg95hr2jka2b3jvhb5dy27m71sb8kidbk954si8fhy";
+       version = "6.3.0.20170703";
+       sha256 = "14r9jdn7pgcajdjgzgxkcn2p394wljlhfsmy6ajp9i18crhinj9y";
        libraryHaskellDepends = [
-         base containers ghc-prim mono-traversable symantic-document
-         symantic-grammar text transformers
+         base containers mono-traversable symantic-document symantic-grammar
+         text transformers
        ];
        description = "Library for Typed Tagless-Final Higher-Order Composable DSL";
        license = stdenv.lib.licenses.gpl3;
@@ -181783,8 +182174,8 @@ self: {
      }:
      mkDerivation {
        pname = "symantic-grammar";
-       version = "0.0.0.20170623";
-       sha256 = "0ds1r71n96kjsr60l5jlv4kb56v7pplrwp93bzni6hiddfm6g917";
+       version = "0.1.0.20170703";
+       sha256 = "09anbgpkh3l8mgzz0nwl65054az0026wl65vi7qmy79ncl2823yd";
        libraryHaskellDepends = [ base text ];
        testHaskellDepends = [
          base megaparsec tasty tasty-hunit text transformers
@@ -181800,8 +182191,8 @@ self: {
      }:
      mkDerivation {
        pname = "symantic-lib";
-       version = "0.0.2.20170623";
-       sha256 = "10wj4p8dj2qb3qk73gkikfazq5szg8yrhjwdhj37xks7hvsfqgsv";
+       version = "0.0.2.20170703";
+       sha256 = "0ar1ikm42a0apy222y6ii7mjd7fr7n2kpyycyhfznc902jknxk2w";
        libraryHaskellDepends = [
          base containers ghc-prim monad-classes mono-traversable symantic
          symantic-grammar text transformers
@@ -182561,6 +182952,23 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "system-linux-proc" = callPackage
+    ({ mkDerivation, attoparsec, base, bytestring, containers, errors
+     , hedgehog, text
+     }:
+     mkDerivation {
+       pname = "system-linux-proc";
+       version = "0.1.0.0";
+       sha256 = "0ij75jdkb7nan98yk6i1dznwqvw20x23krgasix33scf1yyk30ps";
+       libraryHaskellDepends = [
+         attoparsec base bytestring containers errors text
+       ];
+       testHaskellDepends = [ base hedgehog ];
+       homepage = "https://github.com/erikd/system-linux-proc";
+       description = "A library for accessing the /proc filesystem in Linux";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "system-locale" = callPackage
     ({ mkDerivation, attoparsec, base, hspec, process, text, time }:
      mkDerivation {
@@ -185815,8 +186223,8 @@ self: {
      }:
      mkDerivation {
        pname = "test-framework-sandbox";
-       version = "0.1.0";
-       sha256 = "0bfj0l189dh52dipdnxcqllk2h6g4dwcwcw5pll2my3n7r78pn7v";
+       version = "0.1.1";
+       sha256 = "0q84ijm712zn1l20hih53j4axmhzaib1gxn11w0h7pnhybc04klx";
        libraryHaskellDepends = [
          ansi-terminal base lifted-base mtl temporary test-framework
          test-sandbox transformers
@@ -185948,8 +186356,8 @@ self: {
      }:
      mkDerivation {
        pname = "test-sandbox";
-       version = "0.1.6";
-       sha256 = "08j8xa28fwmgh07ixml53w95jfrgmv5p4lb8wjv48x5pphz5x3dn";
+       version = "0.1.7";
+       sha256 = "0myrz0zs1i1360cb9dzffybakglm96kb9zjk6m8rdkdwklm94a8c";
        libraryHaskellDepends = [
          base bytestring cereal containers data-default directory filepath
          lifted-base monad-control monad-loops mtl network process random
@@ -188190,17 +188598,17 @@ self: {
      }) {};
 
   "threepenny-editors" = callPackage
-    ({ mkDerivation, base, data-default, generics-sop, profunctors
-     , threepenny-gui
+    ({ mkDerivation, base, casing, data-default, generics-sop
+     , profunctors, threepenny-gui
      }:
      mkDerivation {
        pname = "threepenny-editors";
-       version = "0.2.0.13";
-       sha256 = "159zqxcnlvn03hqyy3d1gxd7hmr2ky11x7sa3n67m5xl2in3qrjb";
+       version = "0.2.0.14";
+       sha256 = "1gw1pp2ylf3g8ijbsm7zfqmfba47hcwncnmdykzid7hb34c7zaw8";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
-         base data-default generics-sop profunctors threepenny-gui
+         base casing data-default generics-sop profunctors threepenny-gui
        ];
        homepage = "https://github.com/pepeiborra/threepenny-editors";
        description = "Composable algebraic editors";
@@ -189921,6 +190329,19 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "tls-session-manager" = callPackage
+    ({ mkDerivation, auto-update, base, clock, psqueues, time, tls }:
+     mkDerivation {
+       pname = "tls-session-manager";
+       version = "0.0.0.0";
+       sha256 = "04bci0pcky2sc3d0nb5nc2hg03k0gg04iy5rhcr7698ig02x8wvn";
+       libraryHaskellDepends = [
+         auto-update base clock psqueues time tls
+       ];
+       description = "In-memory TLS session manager";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "tmapchan" = callPackage
     ({ mkDerivation, base, containers, hashable, stm
      , unordered-containers
@@ -194842,15 +195263,15 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "unicode-transforms_0_3_0" = callPackage
+  "unicode-transforms_0_3_1" = callPackage
     ({ mkDerivation, base, bitarray, bytestring, criterion, deepseq
      , filepath, getopt-generics, optparse-applicative, path, path-io
      , QuickCheck, split, text
      }:
      mkDerivation {
        pname = "unicode-transforms";
-       version = "0.3.0";
-       sha256 = "0iajm8shb0p6kgcly8n8hzww3f993wdyz4546dl8yn8rinnmxhid";
+       version = "0.3.1";
+       sha256 = "03n9s1pqgq9gl3q6xydwjlsvwq4al6khwd8lr137941263zxx0di";
        libraryHaskellDepends = [ base bitarray bytestring text ];
        testHaskellDepends = [
          base deepseq getopt-generics QuickCheck split text
@@ -195604,6 +196025,19 @@ self: {
        license = "GPL";
      }) {};
 
+  "unmed2" = callPackage
+    ({ mkDerivation, base, storable-endian, utility-ht }:
+     mkDerivation {
+       pname = "unmed2";
+       version = "0.0";
+       sha256 = "1pmp720nhs8blwpjjfhn123miyb31nzn0s3af3ifxrr6s4rapsdg";
+       isLibrary = false;
+       isExecutable = true;
+       executableHaskellDepends = [ base storable-endian utility-ht ];
+       description = "Extract useful information from Amiga MED files";
+       license = stdenv.lib.licenses.gpl3;
+     }) {};
+
   "unordered-containers" = callPackage
     ({ mkDerivation, base, bytestring, ChasingBottoms, containers
      , criterion, deepseq, deepseq-generics, hashable, hashmap, HUnit
@@ -200852,6 +201286,43 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "warp_3_2_13" = callPackage
+    ({ mkDerivation, array, async, auto-update, base, blaze-builder
+     , bytestring, bytestring-builder, case-insensitive, containers
+     , criterion, directory, doctest, ghc-prim, hashable, hspec, HTTP
+     , http-date, http-types, http2, HUnit, iproute, lifted-base
+     , network, process, QuickCheck, silently, simple-sendfile, stm
+     , streaming-commons, text, time, transformers, unix, unix-compat
+     , vault, wai, word8
+     }:
+     mkDerivation {
+       pname = "warp";
+       version = "3.2.13";
+       sha256 = "0964l8xcbdqnrz0mnk0b732n66i7q8grwzzax96mqbh15ps5nfcj";
+       libraryHaskellDepends = [
+         array async auto-update base blaze-builder bytestring
+         bytestring-builder case-insensitive containers ghc-prim hashable
+         http-date http-types http2 iproute network simple-sendfile stm
+         streaming-commons text unix unix-compat vault wai word8
+       ];
+       testHaskellDepends = [
+         array async auto-update base blaze-builder bytestring
+         bytestring-builder case-insensitive containers directory doctest
+         ghc-prim hashable hspec HTTP http-date http-types http2 HUnit
+         iproute lifted-base network process QuickCheck silently
+         simple-sendfile stm streaming-commons text time transformers unix
+         unix-compat vault wai word8
+       ];
+       benchmarkHaskellDepends = [
+         auto-update base bytestring containers criterion hashable http-date
+         http-types network unix unix-compat
+       ];
+       homepage = "http://github.com/yesodweb/wai";
+       description = "A fast, light-weight web server for WAI applications";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "warp-dynamic" = callPackage
     ({ mkDerivation, base, data-default, dyre, http-types, wai, warp }:
      mkDerivation {
@@ -200909,6 +201380,24 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "warp-tls_3_2_4" = callPackage
+    ({ mkDerivation, base, bytestring, cryptonite, data-default-class
+     , network, streaming-commons, tls, tls-session-manager, wai, warp
+     }:
+     mkDerivation {
+       pname = "warp-tls";
+       version = "3.2.4";
+       sha256 = "05vfjlgi574nnydfmfpyp3q6mf389iyj9mv94djnm8d1izasml85";
+       libraryHaskellDepends = [
+         base bytestring cryptonite data-default-class network
+         streaming-commons tls tls-session-manager wai warp
+       ];
+       homepage = "http://github.com/yesodweb/wai";
+       description = "HTTP over TLS support for Warp via the TLS package";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "warp-tls-uid" = callPackage
     ({ mkDerivation, base, bytestring, certificate, conduit
      , crypto-random, network, network-conduit, pem, tls, tls-extra
@@ -201317,6 +201806,8 @@ self: {
        pname = "web-routes";
        version = "0.27.11";
        sha256 = "1n4cvqbbnjhliy9080fff7nfn9x073vnp8vj7mh0ja4ii96lsqj5";
+       revision = "1";
+       editedCabalFile = "1kq9x2s1z2l9ldsbmzl29b4xbpv1w3ls98ca76d8d4dnwg5va14a";
        libraryHaskellDepends = [
          base blaze-builder bytestring exceptions ghc-prim http-types mtl
          parsec split text utf8-string
@@ -201327,6 +201818,28 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "web-routes_0_27_12" = callPackage
+    ({ mkDerivation, base, blaze-builder, bytestring, exceptions
+     , ghc-prim, hspec, http-types, HUnit, mtl, parsec, QuickCheck
+     , split, text, utf8-string
+     }:
+     mkDerivation {
+       pname = "web-routes";
+       version = "0.27.12";
+       sha256 = "0c0wqr3f79gx26pfknvv4zka8g8fkfxw5fqb0qpq8zv0mv5rflba";
+       revision = "1";
+       editedCabalFile = "1pdp6x3q5423m99n24nhwlqmi0xyz0dhz02v2m8n4nkbg33lrv1q";
+       libraryHaskellDepends = [
+         base blaze-builder bytestring exceptions ghc-prim http-types mtl
+         parsec split text utf8-string
+       ];
+       testHaskellDepends = [ base hspec HUnit QuickCheck text ];
+       homepage = "http://www.happstack.com/docs/crashcourse/index.html#web-routes";
+       description = "portable, type-safe URL routing";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "web-routes-boomerang" = callPackage
     ({ mkDerivation, base, boomerang, mtl, parsec, text, web-routes }:
      mkDerivation {
@@ -203019,8 +203532,8 @@ self: {
      }:
      mkDerivation {
        pname = "wolf";
-       version = "0.3.19";
-       sha256 = "1bgwcklmxygc7f44nrcckdccdwg7f1y4s1qhfzn33ji1dkkhdp8m";
+       version = "0.3.21";
+       sha256 = "0gqiqqmm72fhkdax8p27mhpsl2f91zkqaj6xlwdhmbljfhb8ilhp";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -209456,6 +209969,28 @@ self: {
        license = stdenv.lib.licenses.gpl2;
      }) {};
 
+  "yi-rope_0_9" = callPackage
+    ({ mkDerivation, base, binary, bytestring, charsetdetect-ae
+     , criterion, data-default, deepseq, fingertree, hspec, QuickCheck
+     , quickcheck-instances, text, text-icu
+     }:
+     mkDerivation {
+       pname = "yi-rope";
+       version = "0.9";
+       sha256 = "0j9g96dgjy30zzygbrimcq6g6dz978xgk53j12kdn710ilklkhs6";
+       libraryHaskellDepends = [
+         base binary bytestring charsetdetect-ae data-default deepseq
+         fingertree text text-icu
+       ];
+       testHaskellDepends = [
+         base hspec QuickCheck quickcheck-instances text
+       ];
+       benchmarkHaskellDepends = [ base criterion deepseq text ];
+       description = "A rope data structure used by Yi";
+       license = stdenv.lib.licenses.gpl2;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "yi-snippet" = callPackage
     ({ mkDerivation, base, binary, containers, data-default, free
      , microlens-platform, mtl, tasty-hunit, tasty-th, text, vector
diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix
index c5fa05651bbe..34058c558af0 100644
--- a/pkgs/development/interpreters/python/cpython/2.7/default.nix
+++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ stdenv, hostPlatform, fetchurl
 , bzip2
 , gdbm
 , fetchpatch
@@ -69,7 +69,7 @@ let
 
       ./glibc-2.25-enosys.patch
 
-    ] ++ optionals stdenv.isCygwin [
+    ] ++ optionals hostPlatform.isCygwin [
       ./2.5.2-ctypes-util-find_library.patch
       ./2.5.2-tkinter-x11.patch
       ./2.6.2-ssl-threads.patch
@@ -110,7 +110,7 @@ let
     "--enable-shared"
     "--with-threads"
     "--enable-unicode=ucs4"
-  ] ++ optionals stdenv.isCygwin [
+  ] ++ optionals hostPlatform.isCygwin [
     "--with-system-ffi"
     "--with-system-expat"
     "ac_cv_func_bind_textdomain_codeset=yes"
@@ -118,14 +118,14 @@ let
     "--disable-toolbox-glue"
   ];
 
-  postConfigure = if stdenv.isCygwin then ''
+  postConfigure = if hostPlatform.isCygwin then ''
     sed -i Makefile -e 's,PYTHONPATH="$(srcdir),PYTHONPATH="$(abs_srcdir),'
   '' else null;
 
   buildInputs =
     optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
     [ bzip2 openssl zlib ]
-    ++ optionals stdenv.isCygwin [ expat libffi ]
+    ++ optionals hostPlatform.isCygwin [ expat libffi ]
     ++ [ db gdbm ncurses sqlite readline ]
     ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ]
     ++ optionals stdenv.isDarwin [ CF configd ];
@@ -190,6 +190,8 @@ in stdenv.mkDerivation {
         find $out -name "*.py" | $out/bin/python -m compileall -q -f -x "lib2to3" -i -
         find $out -name "*.py" | $out/bin/python -O -m compileall -q -f -x "lib2to3" -i -
         find $out -name "*.py" | $out/bin/python -OO -m compileall -q -f -x "lib2to3" -i -
+      '' + optionalString hostPlatform.isCygwin ''
+        cp libpython2.7.dll.a $out/lib
       '';
 
     passthru = let
diff --git a/pkgs/development/libraries/gdbm/default.nix b/pkgs/development/libraries/gdbm/default.nix
index de77b4c99b8b..86d9bd649881 100644
--- a/pkgs/development/libraries/gdbm/default.nix
+++ b/pkgs/development/libraries/gdbm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, lib, buildPlatform, fetchurl }:
 
 stdenv.mkDerivation rec {
   name = "gdbm-1.13";
@@ -10,9 +10,22 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
+  # Linking static stubs on cygwin requires correct ordering.
+  # Consider upstreaming this.
+
+  # Disable dbmfetch03.at test because it depends on unlink()
+  # failing on a link in a chmod -w directory, which cygwin
+  # apparently allows.
+  postPatch = lib.optionalString buildPlatform.isCygwin ''
+      substituteInPlace tests/Makefile.in --replace \
+        '_LDADD = ../src/libgdbm.la ../compat/libgdbm_compat.la' \
+        '_LDADD = ../compat/libgdbm_compat.la ../src/libgdbm.la'
+      substituteInPlace tests/testsuite.at --replace \
+        'm4_include([dbmfetch03.at])' ""
+  '';
   configureFlags = [ "--enable-libgdbm-compat" ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GNU dbm key/value database library";
 
     longDescription =
diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix
index 7d555ba4d062..d70588841045 100644
--- a/pkgs/development/libraries/gettext/default.nix
+++ b/pkgs/development/libraries/gettext/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, libiconv, xz }:
+{ stdenv, lib, hostPlatform, fetchurl, libiconv, xz }:
 
 stdenv.mkDerivation rec {
   name = "gettext-${version}";
@@ -18,15 +18,6 @@ stdenv.mkDerivation rec {
   LDFLAGS = if stdenv.isSunOS then "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec" else "";
 
   configureFlags = [ "--disable-csharp" "--with-xz" ]
-     ++ lib.optionals stdenv.isCygwin [
-            "--disable-java"
-            "--disable-native-java"
-            # Share the cache among the various `configure' runs.
-            "--config-cache"
-            "--with-included-gettext"
-            "--with-included-glib"
-            "--with-included-libcroco"
-        ]
      # avoid retaining reference to CF during stdenv bootstrap
      ++ lib.optionals stdenv.isDarwin [
             "gt_cv_func_CFPreferencesCopyAppValue=no"
@@ -38,6 +29,9 @@ stdenv.mkDerivation rec {
    substituteInPlace gettext-tools/projects/KDE/trigger --replace "/bin/pwd" pwd
    substituteInPlace gettext-tools/projects/GNOME/trigger --replace "/bin/pwd" pwd
    substituteInPlace gettext-tools/src/project-id --replace "/bin/pwd" pwd
+  '' + lib.optionalString hostPlatform.isCygwin ''
+    sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
+    sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
   '';
 
   # On cross building, gettext supposes that the wchar.h from libc
@@ -49,11 +43,9 @@ stdenv.mkDerivation rec {
       echo gl_cv_func_wcwidth_works=yes > cachefile
       configureFlags="$configureFlags --cache-file=`pwd`/cachefile"
     fi
-  '' + lib.optionalString stdenv.isCygwin ''
-    sed -i -e "s/\(am_libgettextlib_la_OBJECTS = \)error.lo/\\1/" gettext-tools/gnulib-lib/Makefile.in
   '';
 
-  nativeBuildInputs = [ xz xz.bin ] ++ stdenv.lib.optional (!stdenv.isLinux) libiconv; # HACK, see #10874 (and 14664)
+  nativeBuildInputs = [ xz xz.bin ] ++ stdenv.lib.optional (!stdenv.isLinux && !hostPlatform.isCygwin) libiconv; # HACK, see #10874 (and 14664)
 
   enableParallelBuilding = true;
 
@@ -89,14 +81,3 @@ stdenv.mkDerivation rec {
 // stdenv.lib.optionalAttrs stdenv.isDarwin {
   makeFlags = "CFLAGS=-D_FORTIFY_SOURCE=0";
 }
-
-// stdenv.lib.optionalAttrs stdenv.isCygwin {
-  patchPhase =
-   # Make sure `error.c' gets compiled and is part of `libgettextlib.la'.
-   # This fixes:
-   # gettext-0.18.1.1/gettext-tools/src/msgcmp.c:371: undefined reference to `_error_message_count'
-  '' 
-   sed -i gettext-tools/gnulib-lib/Makefile.in \
-          -e 's/am_libgettextlib_la_OBJECTS =/am_libgettextlib_la_OBJECTS = error.lo/g'
-   '';
-}
diff --git a/pkgs/development/libraries/glew/1.10.nix b/pkgs/development/libraries/glew/1.10.nix
index b2e1b26704f3..159bf47e130a 100644
--- a/pkgs/development/libraries/glew/1.10.nix
+++ b/pkgs/development/libraries/glew/1.10.nix
@@ -38,8 +38,8 @@ stdenv.mkDerivation rec {
     cp -r README.txt LICENSE.txt doc $out/share/doc/glew
   '';
 
-  makeFlags = if hostPlatform == buildPlatform then null else [
-    "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}"
+  makeFlags = [
+    "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel.name}"
   ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix
index ecf1e914a7b1..814e4496b77d 100644
--- a/pkgs/development/libraries/glew/default.nix
+++ b/pkgs/development/libraries/glew/default.nix
@@ -39,8 +39,8 @@ stdenv.mkDerivation rec {
     rm $out/lib/*.a
   '';
 
-  makeFlags = if hostPlatform == buildPlatform then null else [
-    "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}"
+  makeFlags = [
+    "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel.name}"
   ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 96175d04a4ed..84c044682779 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, gettext, perl, python
+{ stdenv, hostPlatform, fetchurl, pkgconfig, gettext, perl, python
 , libiconv, libintlOrEmpty, zlib, libffi, pcre, libelf
 # use utillinuxMinimal to avoid circular dependency (utillinux, systemd, glib)
 , utillinuxMinimal ? null
@@ -9,7 +9,7 @@
 
 with stdenv.lib;
 
-assert stdenv.isFreeBSD || stdenv.isDarwin || stdenv.cc.isGNU;
+assert stdenv.isFreeBSD || stdenv.isDarwin || stdenv.cc.isGNU || hostPlatform.isCygwin;
 assert stdenv.isLinux -> utillinuxMinimal != null;
 
 # TODO:
diff --git a/pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_AUDIT.patch b/pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_AUDIT.patch
new file mode 100644
index 000000000000..68e2798181fb
--- /dev/null
+++ b/pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_AUDIT.patch
@@ -0,0 +1,209 @@
+From ba67ba3275d47e0080f0e5f09d9f5102c000c97e Mon Sep 17 00:00:00 2001
+Message-Id: <ba67ba3275d47e0080f0e5f09d9f5102c000c97e.1495998948.git.fweimer@redhat.com>
+In-Reply-To: <cover.1495998948.git.fweimer@redhat.com>
+References: <cover.1495998948.git.fweimer@redhat.com>
+From: Florian Weimer <fweimer@redhat.com>
+Date: Sun, 28 May 2017 20:44:52 +0200
+Subject: [PATCH 3/3] rtld: Reject overly long LD_AUDIT path elements
+To: libc-alpha@sourceware.org
+
+Also only process the last LD_AUDIT entry.
+---
+ elf/rtld.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 95 insertions(+), 15 deletions(-)
+
+diff --git a/elf/rtld.c b/elf/rtld.c
+index 30f0cae..89d8573 100644
+--- a/elf/rtld.c
++++ b/elf/rtld.c
+@@ -116,13 +116,95 @@ dso_name_valid_for_suid (const char *p)
+   return *p != '\0';
+ }
+ 
+-/* List of auditing DSOs.  */
++/* LD_AUDIT variable contents.  Must be processed before the
++   audit_list below.  */
++const char *audit_list_string;
++
++/* Cyclic list of auditing DSOs.  audit_list->next is the first
++   element.  */
+ static struct audit_list
+ {
+   const char *name;
+   struct audit_list *next;
+ } *audit_list;
+ 
++/* Iterator for audit_list_string followed by audit_list.  */
++struct audit_list_iter
++{
++  /* Tail of audit_list_string still needing processing, or NULL.  */
++  const char *audit_list_tail;
++
++  /* The list element returned in the previous iteration.  NULL before
++     the first element.  */
++  struct audit_list *previous;
++
++  /* Scratch buffer for returning a name which is part of
++     audit_list_string.  */
++#ifdef PATH_MAX
++  char fname[PATH_MAX];
++#else
++  char fname[4096];
++#endif
++};
++
++/* Initialize an audit list iterator.  */
++static void
++audit_list_iter_init (struct audit_list_iter *iter)
++{
++  iter->audit_list_tail = audit_list_string;
++  iter->previous = NULL;
++}
++
++/* Iterate through both audit_list_string and audit_list.  */
++static const char *
++audit_list_iter_next (struct audit_list_iter *iter)
++{
++  if (iter->audit_list_tail != NULL)
++    {
++      /* First iterate over audit_list_string.  */
++      while (*iter->audit_list_tail != '\0')
++	{
++	  /* Split audit list at colon.  */
++	  size_t len = strcspn (iter->audit_list_tail, ":");
++	  if (len > 0 && len < sizeof(iter->fname))
++	    {
++	      memcpy (iter->fname, iter->audit_list_tail, len);
++	      iter->fname[len] = '\0';
++	    }
++	  else
++	    /* Do not return this name to the caller.  */
++	    iter->fname[0] = '\0';
++
++	  /* Skip over the substring and the following delimiter.  */
++	  iter->audit_list_tail += len;
++	  if (*iter->audit_list_tail == ':')
++	    ++iter->audit_list_tail;
++
++	  /* If the name is valid, return it.  */
++	  if (dso_name_valid_for_suid (iter->fname))
++	    return iter->fname;
++	  /* Otherwise, wrap around and try the next name.  */
++	}
++      /* Fall through to the procesing of audit_list.  */
++    }
++
++  if (iter->previous == NULL)
++    {
++      if (audit_list == NULL)
++	/* No pre-parsed audit list.  */
++	return NULL;
++      /* Start of audit list.  The first list element is at
++	 audit_list->next (cyclic list).  */
++      iter->previous = audit_list->next;
++      return iter->previous->name;
++    }
++  if (iter->previous == audit_list)
++    /* Cyclic list wrap-around.  */
++    return NULL;
++  iter->previous = iter->previous->next;
++  return iter->previous->name;
++}
++
+ #ifndef HAVE_INLINED_SYSCALLS
+ /* Set nonzero during loading and initialization of executable and
+    libraries, cleared before the executable's entry point runs.  This
+@@ -1290,11 +1368,13 @@ of this helper program; chances are you did not intend to run this program.\n\
+     GL(dl_rtld_map).l_tls_modid = _dl_next_tls_modid ();
+ 
+   /* If we have auditing DSOs to load, do it now.  */
+-  if (__glibc_unlikely (audit_list != NULL))
++  bool need_security_init = true;
++  if (__glibc_unlikely (audit_list != NULL)
++      || __glibc_unlikely (audit_list_string != NULL))
+     {
+-      /* Iterate over all entries in the list.  The order is important.  */
+       struct audit_ifaces *last_audit = NULL;
+-      struct audit_list *al = audit_list->next;
++      struct audit_list_iter al_iter;
++      audit_list_iter_init (&al_iter);
+ 
+       /* Since we start using the auditing DSOs right away we need to
+ 	 initialize the data structures now.  */
+@@ -1305,9 +1385,14 @@ of this helper program; chances are you did not intend to run this program.\n\
+ 	 use different values (especially the pointer guard) and will
+ 	 fail later on.  */
+       security_init ();
++      need_security_init = false;
+ 
+-      do
++      while (true)
+ 	{
++	  const char *name = audit_list_iter_next (&al_iter);
++	  if (name == NULL)
++	    break;
++
+ 	  int tls_idx = GL(dl_tls_max_dtv_idx);
+ 
+ 	  /* Now it is time to determine the layout of the static TLS
+@@ -1316,7 +1401,7 @@ of this helper program; chances are you did not intend to run this program.\n\
+ 	     no DF_STATIC_TLS bit is set.  The reason is that we know
+ 	     glibc will use the static model.  */
+ 	  struct dlmopen_args dlmargs;
+-	  dlmargs.fname = al->name;
++	  dlmargs.fname = name;
+ 	  dlmargs.map = NULL;
+ 
+ 	  const char *objname;
+@@ -1329,7 +1414,7 @@ of this helper program; chances are you did not intend to run this program.\n\
+ 	    not_loaded:
+ 	      _dl_error_printf ("\
+ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
+-				al->name, err_str);
++				name, err_str);
+ 	      if (malloced)
+ 		free ((char *) err_str);
+ 	    }
+@@ -1433,10 +1518,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
+ 		  goto not_loaded;
+ 		}
+ 	    }
+-
+-	  al = al->next;
+ 	}
+-      while (al != audit_list->next);
+ 
+       /* If we have any auditing modules, announce that we already
+ 	 have two objects loaded.  */
+@@ -1700,7 +1782,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
+   if (tcbp == NULL)
+     tcbp = init_tls ();
+ 
+-  if (__glibc_likely (audit_list == NULL))
++  if (__glibc_likely (need_security_init))
+     /* Initialize security features.  But only if we have not done it
+        earlier.  */
+     security_init ();
+@@ -2331,9 +2413,7 @@ process_dl_audit (char *str)
+   char *p;
+ 
+   while ((p = (strsep) (&str, ":")) != NULL)
+-    if (p[0] != '\0'
+-	&& (__builtin_expect (! __libc_enable_secure, 1)
+-	    || strchr (p, '/') == NULL))
++    if (dso_name_valid_for_suid (p))
+       {
+ 	/* This is using the local malloc, not the system malloc.  The
+ 	   memory can never be freed.  */
+@@ -2397,7 +2477,7 @@ process_envvars (enum mode *modep)
+ 	      break;
+ 	    }
+ 	  if (memcmp (envline, "AUDIT", 5) == 0)
+-	    process_dl_audit (&envline[6]);
++	    audit_list_string = &envline[6];
+ 	  break;
+ 
+ 	case 7:
+-- 
+2.9.4
+
diff --git a/pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_LIBRARY_PATH.patch b/pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_LIBRARY_PATH.patch
new file mode 100644
index 000000000000..88b1925fa126
--- /dev/null
+++ b/pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_LIBRARY_PATH.patch
@@ -0,0 +1,33 @@
+From 4d009d39ac9ede0369e268554a181b428f177a80 Mon Sep 17 00:00:00 2001
+Message-Id: <4d009d39ac9ede0369e268554a181b428f177a80.1495998948.git.fweimer@redhat.com>
+In-Reply-To: <cover.1495998948.git.fweimer@redhat.com>
+References: <cover.1495998948.git.fweimer@redhat.com>
+From: Florian Weimer <fweimer@redhat.com>
+Date: Sun, 28 May 2017 20:37:40 +0200
+Subject: [PATCH 1/3] rtld: Completely ignore LD_LIBRARY_PATH for AT_SECURE=1
+ programs
+To: libc-alpha@sourceware.org
+
+LD_LIBRARY_PATH can only be used to reorder system search paths, which
+is not useful functionality.
+---
+ elf/rtld.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/elf/rtld.c b/elf/rtld.c
+index 319ef06..824b6cf 100644
+--- a/elf/rtld.c
++++ b/elf/rtld.c
+@@ -2419,7 +2419,8 @@ process_envvars (enum mode *modep)
+ 
+ 	case 12:
+ 	  /* The library search path.  */
+-	  if (memcmp (envline, "LIBRARY_PATH", 12) == 0)
++	  if (!__libc_enable_secure
++	      && memcmp (envline, "LIBRARY_PATH", 12) == 0)
+ 	    {
+ 	      library_path = &envline[13];
+ 	      break;
+-- 
+2.9.4
+
diff --git a/pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_PRELOAD.patch b/pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_PRELOAD.patch
new file mode 100644
index 000000000000..76be2a3308f6
--- /dev/null
+++ b/pkgs/development/libraries/glibc/CVE-2017-1000366-rtld-LD_PRELOAD.patch
@@ -0,0 +1,115 @@
+From 65ff0b7a085b85271ec8fde99f542281b495e3bc Mon Sep 17 00:00:00 2001
+Message-Id: <65ff0b7a085b85271ec8fde99f542281b495e3bc.1495998948.git.fweimer@redhat.com>
+In-Reply-To: <cover.1495998948.git.fweimer@redhat.com>
+References: <cover.1495998948.git.fweimer@redhat.com>
+From: Florian Weimer <fweimer@redhat.com>
+Date: Sun, 28 May 2017 20:57:40 +0200
+Subject: [PATCH 2/3] rtld: Reject overly long LD_PRELOAD path elements
+To: libc-alpha@sourceware.org
+
+---
+ elf/rtld.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++---------------
+ 1 file changed, 53 insertions(+), 16 deletions(-)
+
+diff --git a/elf/rtld.c b/elf/rtld.c
+index 824b6cf..30f0cae 100644
+--- a/elf/rtld.c
++++ b/elf/rtld.c
+@@ -99,6 +99,22 @@ uintptr_t __pointer_chk_guard_local
+ strong_alias (__pointer_chk_guard_local, __pointer_chk_guard)
+ #endif
+ 
++/* Check that AT_SECURE=0, or that the passed name does not contain
++   directories and is not overly long.  Reject empty names
++   unconditionally.  */
++static bool
++dso_name_valid_for_suid (const char *p)
++{
++  if (__glibc_unlikely (__libc_enable_secure))
++    {
++      /* Ignore pathnames with directories for AT_SECURE=1
++	 programs, and also skip overlong names.  */
++      size_t len = strlen (p);
++      if (len >= NAME_MAX || memchr (p, '/', len) != NULL)
++	return false;
++    }
++  return *p != '\0';
++}
+ 
+ /* List of auditing DSOs.  */
+ static struct audit_list
+@@ -716,6 +732,46 @@ static const char *preloadlist attribute_relro;
+ /* Nonzero if information about versions has to be printed.  */
+ static int version_info attribute_relro;
+ 
++/* The LD_PRELOAD environment variable gives list of libraries
++   separated by white space or colons that are loaded before the
++   executable's dependencies and prepended to the global scope list.
++   (If the binary is running setuid all elements containing a '/' are
++   ignored since it is insecure.)  Return the number of preloads
++   performed.  */
++unsigned int
++handle_ld_preload (const char *preloadlist, struct link_map *main_map)
++{
++  unsigned int npreloads = 0;
++  const char *p = preloadlist;
++#ifdef PATH_MAX
++  char fname[PATH_MAX];
++#else
++  char fname[4096];
++#endif
++
++  while (*p != '\0')
++    {
++      /* Split preload list at space/colon.  */
++      size_t len = strcspn (p, " :");
++      if (len > 0 && len < sizeof(fname))
++	{
++	  memcpy (fname, p, len);
++	  fname[len] = '\0';
++	}
++      else
++	fname[0] = '\0';
++
++      /* Skip over the substring and the following delimiter.  */
++      p += len;
++      if (*p == ' ' || *p == ':')
++	++p;
++
++      if (dso_name_valid_for_suid (fname))
++	npreloads += do_preload (fname, main_map, "LD_PRELOAD");
++    }
++  return npreloads;
++}
++
+ static void
+ dl_main (const ElfW(Phdr) *phdr,
+ 	 ElfW(Word) phnum,
+@@ -1462,23 +1514,8 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
+ 
+   if (__glibc_unlikely (preloadlist != NULL))
+     {
+-      /* The LD_PRELOAD environment variable gives list of libraries
+-	 separated by white space or colons that are loaded before the
+-	 executable's dependencies and prepended to the global scope
+-	 list.  If the binary is running setuid all elements
+-	 containing a '/' are ignored since it is insecure.  */
+-      char *list = strdupa (preloadlist);
+-      char *p;
+-
+       HP_TIMING_NOW (start);
+-
+-      /* Prevent optimizing strsep.  Speed is not important here.  */
+-      while ((p = (strsep) (&list, " :")) != NULL)
+-	if (p[0] != '\0'
+-	    && (__builtin_expect (! __libc_enable_secure, 1)
+-		|| strchr (p, '/') == NULL))
+-	  npreloads += do_preload (p, main_map, "LD_PRELOAD");
+-
++      npreloads += handle_ld_preload (preloadlist, main_map);
+       HP_TIMING_NOW (stop);
+       HP_TIMING_DIFF (diff, start, stop);
+       HP_TIMING_ACCUM_NT (load_time, diff);
+-- 
+2.9.4
+
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index db80a8be299c..647a34e95dba 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -59,8 +59,16 @@ 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
+
+      /* Stack Clash */
+      ./CVE-2017-1000366-rtld-LD_LIBRARY_PATH.patch
+      ./CVE-2017-1000366-rtld-LD_PRELOAD.patch
+      ./CVE-2017-1000366-rtld-LD_AUDIT.patch
     ]
-      ++ lib.optional stdenv.isi686 ./fix-i686-memchr.patch;
+    ++ lib.optionals stdenv.isi686 [
+      ./fix-i686-memchr.patch
+      ./i686-fix-vectorized-strcspn.patch
+    ];
 
   postPatch =
     # Needed for glibc to build with the gnumake 3.82
diff --git a/pkgs/development/libraries/glibc/i686-fix-vectorized-strcspn.patch b/pkgs/development/libraries/glibc/i686-fix-vectorized-strcspn.patch
new file mode 100644
index 000000000000..ba4ec7c60cb6
--- /dev/null
+++ b/pkgs/development/libraries/glibc/i686-fix-vectorized-strcspn.patch
@@ -0,0 +1,42 @@
+From adc7e06fb412a2a1ee52f8cb788caf436335b9f3 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Wed, 14 Jun 2017 08:11:22 +0200
+Subject: [PATCH] i686: Add missing IS_IN (libc) guards to vectorized strcspn
+
+Since commit d957c4d3fa48d685ff2726c605c988127ef99395 (i386: Compile
+rtld-*.os with -mno-sse -mno-mmx -mfpmath=387), vector intrinsics can
+no longer be used in ld.so, even if the compiled code never makes it
+into the final ld.so link.  This commit adds the missing IS_IN (libc)
+guard to the SSE 4.2 strcspn implementation, so that it can be used from
+ld.so in the future.
+
+(cherry picked from commit 69052a3a95da37169a08f9e59b2cc1808312753c)
+---
+ ChangeLog                               | 5 +++++
+ sysdeps/i386/i686/multiarch/strcspn-c.c | 6 ++++--
+ sysdeps/i386/i686/multiarch/varshift.c  | 4 +++-
+ 3 files changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/sysdeps/i386/i686/multiarch/strcspn-c.c b/sysdeps/i386/i686/multiarch/strcspn-c.c
+index 6d61e19..ec230fb 100644
+--- a/sysdeps/i386/i686/multiarch/strcspn-c.c
++++ b/sysdeps/i386/i686/multiarch/strcspn-c.c
+@@ -1,2 +1,4 @@
+-#define __strcspn_sse2 __strcspn_ia32
+-#include <sysdeps/x86_64/multiarch/strcspn-c.c>
++#if IS_IN (libc)
++# define __strcspn_sse2 __strcspn_ia32
++# include <sysdeps/x86_64/multiarch/strcspn-c.c>
++#endif
+diff --git a/sysdeps/i386/i686/multiarch/varshift.c b/sysdeps/i386/i686/multiarch/varshift.c
+index 7760b96..6742a35 100644
+--- a/sysdeps/i386/i686/multiarch/varshift.c
++++ b/sysdeps/i386/i686/multiarch/varshift.c
+@@ -1 +1,3 @@
+-#include <sysdeps/x86_64/multiarch/varshift.c>
++#if IS_IN (libc)
++# include <sysdeps/x86_64/multiarch/varshift.c>
++#endif
+-- 
+2.9.3
+
diff --git a/pkgs/development/libraries/kirigami/default.nix b/pkgs/development/libraries/kirigami/default.nix
index e24ad8196ee3..1127f3e197df 100644
--- a/pkgs/development/libraries/kirigami/default.nix
+++ b/pkgs/development/libraries/kirigami/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, cmake, extra-cmake-modules, pkgconfig
-, plasma-framework, qtbase
+, plasma-framework, qtbase, qttranslations
 , qtquickcontrols ? null
 , qtquickcontrols2 ? null }:
 
@@ -15,7 +15,7 @@ let
       inherit sha256;
     };
 
-    buildInputs = [ plasma-framework qtbase qtqc ];
+    buildInputs = [ plasma-framework qtbase qtqc qttranslations ];
 
     nativeBuildInputs = [ cmake pkgconfig extra-cmake-modules ];
 
diff --git a/pkgs/development/libraries/libbsd/default.nix b/pkgs/development/libraries/libbsd/default.nix
index a1a61e336684..792a29eb1fb2 100644
--- a/pkgs/development/libraries/libbsd/default.nix
+++ b/pkgs/development/libraries/libbsd/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "libbsd-${version}";
-  version = "0.8.4";
+  version = "0.8.5";
 
   src = fetchurl {
     url = "http://libbsd.freedesktop.org/releases/${name}.tar.xz";
-    sha256 = "1cya8bv976ijv5yy1ix3pzbnmp9k2qqpgw3dx98k2w0m55jg2yi1";
+    sha256 = "0a2vq0xdhs3yyj91b0612f19fakg7a9xlqy2f993128kyhjd0ivn";
   };
 
   # darwin changes configure.ac which means we need to regenerate
diff --git a/pkgs/development/libraries/libelf/default.nix b/pkgs/development/libraries/libelf/default.nix
index dcd5d1d7a93e..5cf74164f0fb 100644
--- a/pkgs/development/libraries/libelf/default.nix
+++ b/pkgs/development/libraries/libelf/default.nix
@@ -11,9 +11,8 @@ stdenv.mkDerivation rec {
     sha256 = "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr";
   };
 
-  # TODO(@Ericson2314) Make unconditional next hash break
-  patches = if hostPlatform == buildPlatform then null else [
-    ./cross-ar.patch
+  patches = [
+    ./dont-hardcode-ar.patch
   ];
 
   doCheck = true;
diff --git a/pkgs/development/libraries/libelf/cross-ar.patch b/pkgs/development/libraries/libelf/dont-hardcode-ar.patch
index e282d9005dbb..e282d9005dbb 100644
--- a/pkgs/development/libraries/libelf/cross-ar.patch
+++ b/pkgs/development/libraries/libelf/dont-hardcode-ar.patch
diff --git a/pkgs/development/libraries/libev/default.nix b/pkgs/development/libraries/libev/default.nix
index 37e0c9b3431e..d77337c912b2 100644
--- a/pkgs/development/libraries/libev/default.nix
+++ b/pkgs/development/libraries/libev/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "libev-${version}";
-  version="4.22";
+  version="4.24";
 
   src = fetchurl {
     url = "http://dist.schmorp.de/libev/Attic/${name}.tar.gz";
-    sha256 = "1mhvy38g9947bbr0n0hzc34zwfvvfd99qgzpkbap8g2lmkl7jq3k";
+    sha256 = "08gqsza1czx0nf62nkk183jb0946yzjsymaacxbzdgcs8z9r6dcp";
   };
 
   meta = {
diff --git a/pkgs/development/libraries/libiconv/default.nix b/pkgs/development/libraries/libiconv/default.nix
index a056f148683c..899465124100 100644
--- a/pkgs/development/libraries/libiconv/default.nix
+++ b/pkgs/development/libraries/libiconv/default.nix
@@ -13,11 +13,6 @@ stdenv.mkDerivation rec {
     sha256 = "0y1ij745r4p48mxq84rax40p10ln7fc7m243p8k8sia519i3dxfc";
   };
 
-  patches = lib.optionals stdenv.isCygwin [
-    ./libiconv-1.14-reloc.patch
-    ./libiconv-1.14-wchar.patch
-  ];
-
   postPatch =
     lib.optionalString ((hostPlatform != buildPlatform && hostPlatform.libc == "msvcrt") || stdenv.cc.nativeLibc)
       ''
@@ -25,12 +20,7 @@ stdenv.mkDerivation rec {
       '';
 
   configureFlags =
-  # On Cygwin, Libtool produces a `.dll.a', which is not a "real" DLL
-  # (Windows' linker would need to be used somehow to produce an actual
-  # DLL.)  Thus, build the static library too, and this is what Gettext
-  # will actually use.
-    lib.optional stdenv.isCygwin "--enable-static"
-    ++ lib.optional stdenv.isFreeBSD "--with-pic";
+    lib.optional stdenv.isFreeBSD "--with-pic";
 
   crossAttrs = {
     # Disable stripping to avoid "libiconv.a: Archive has no index" (MinGW).
diff --git a/pkgs/development/libraries/libiconv/libiconv-1.14-reloc.patch b/pkgs/development/libraries/libiconv/libiconv-1.14-reloc.patch
deleted file mode 100644
index 005e3379d165..000000000000
--- a/pkgs/development/libraries/libiconv/libiconv-1.14-reloc.patch
+++ /dev/null
@@ -1,269 +0,0 @@
---- libiconv-1.14/lib/relocatable.c	2011-08-07 13:48:03.000000000 -0400
-+++ libiconv-1.14/lib/relocatable.c	2011-10-15 03:14:13.195133600 -0400
-@@ -2,20 +2,18 @@
-    Copyright (C) 2003-2006, 2008-2011 Free Software Foundation, Inc.
-    Written by Bruno Haible <bruno@clisp.org>, 2003.
- 
--   This program is free software; you can redistribute it and/or modify it
--   under the terms of the GNU Library General Public License as published
--   by the Free Software Foundation; either version 2, or (at your option)
--   any later version.
-+   This program is free software: you can redistribute it and/or modify
-+   it under the terms of the GNU Lesser General Public License as published by
-+   the Free Software Foundation; either version 2.1 of the License, or
-+   (at your option) any later version.
- 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Library General Public License for more details.
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU Lesser General Public License for more details.
- 
--   You should have received a copy of the GNU Library General Public
--   License along with this program; if not, write to the Free Software
--   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
--   USA.  */
-+   You should have received a copy of the GNU Lesser General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
- 
- 
- /* Tell glibc's <stdio.h> to provide a prototype for getline().
-@@ -87,6 +85,19 @@
- # define FILE_SYSTEM_PREFIX_LEN(P) 0
- #endif
- 
-+/* Whether to enable the more costly support for relocatable libraries.
-+   It allows libraries to be have been installed with a different original
-+   prefix than the program.  But it is quite costly, especially on Cygwin
-+   platforms, see below.  Therefore we enable it by default only on native
-+   Win32 platforms.  */
-+#ifndef ENABLE_COSTLY_RELOCATABLE
-+# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
-+#  define ENABLE_COSTLY_RELOCATABLE 1
-+# else
-+#  define ENABLE_COSTLY_RELOCATABLE 0
-+# endif
-+#endif
-+
- /* Original installation prefix.  */
- static char *orig_prefix;
- static size_t orig_prefix_len;
-@@ -156,7 +167,7 @@
- #endif
- }
- 
--#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
-+#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE)
- 
- /* Convenience function:
-    Computes the current installation prefix, based on the original
-@@ -286,7 +297,7 @@
- 
- #endif /* !IN_LIBRARY || PIC */
- 
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
- 
- /* Full pathname of shared library, or NULL.  */
- static char *shared_library_fullname;
-@@ -332,7 +343,9 @@
- #if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
-   /* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
-      function.
--     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.  */
-+     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.
-+     But it is costly: ca. 0.3 ms on Linux, 3 ms on Cygwin 1.5, and 5 ms on
-+     Cygwin 1.7.  */
-   FILE *fp;
- 
-   /* Open the current process' maps file.  It describes one VMA per line.  */
-@@ -405,7 +418,7 @@
- const char *
- relocate (const char *pathname)
- {
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
-   static int initialized;
- 
-   /* Initialization code for a shared library.  */
---- libiconv-1.14/libcharset/lib/relocatable.c	2011-08-07 13:48:03.000000000 -0400
-+++ libiconv-1.14/libcharset/lib/relocatable.c	2011-10-15 03:14:27.878133600 -0400
-@@ -2,20 +2,18 @@
-    Copyright (C) 2003-2006, 2008-2011 Free Software Foundation, Inc.
-    Written by Bruno Haible <bruno@clisp.org>, 2003.
- 
--   This program is free software; you can redistribute it and/or modify it
--   under the terms of the GNU Library General Public License as published
--   by the Free Software Foundation; either version 2, or (at your option)
--   any later version.
-+   This program is free software: you can redistribute it and/or modify
-+   it under the terms of the GNU Lesser General Public License as published by
-+   the Free Software Foundation; either version 2.1 of the License, or
-+   (at your option) any later version.
- 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--   Library General Public License for more details.
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU Lesser General Public License for more details.
- 
--   You should have received a copy of the GNU Library General Public
--   License along with this program; if not, write to the Free Software
--   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
--   USA.  */
-+   You should have received a copy of the GNU Lesser General Public License
-+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
- 
- 
- /* Tell glibc's <stdio.h> to provide a prototype for getline().
-@@ -87,6 +85,19 @@
- # define FILE_SYSTEM_PREFIX_LEN(P) 0
- #endif
- 
-+/* Whether to enable the more costly support for relocatable libraries.
-+   It allows libraries to be have been installed with a different original
-+   prefix than the program.  But it is quite costly, especially on Cygwin
-+   platforms, see below.  Therefore we enable it by default only on native
-+   Win32 platforms.  */
-+#ifndef ENABLE_COSTLY_RELOCATABLE
-+# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
-+#  define ENABLE_COSTLY_RELOCATABLE 1
-+# else
-+#  define ENABLE_COSTLY_RELOCATABLE 0
-+# endif
-+#endif
-+
- /* Original installation prefix.  */
- static char *orig_prefix;
- static size_t orig_prefix_len;
-@@ -156,7 +167,7 @@
- #endif
- }
- 
--#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
-+#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE)
- 
- /* Convenience function:
-    Computes the current installation prefix, based on the original
-@@ -286,7 +297,7 @@
- 
- #endif /* !IN_LIBRARY || PIC */
- 
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
- 
- /* Full pathname of shared library, or NULL.  */
- static char *shared_library_fullname;
-@@ -332,7 +343,9 @@
- #if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
-   /* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
-      function.
--     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.  */
-+     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.
-+     But it is costly: ca. 0.3 ms on Linux, 3 ms on Cygwin 1.5, and 5 ms on
-+     Cygwin 1.7.  */
-   FILE *fp;
- 
-   /* Open the current process' maps file.  It describes one VMA per line.  */
-@@ -405,7 +418,7 @@
- const char *
- relocate (const char *pathname)
- {
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
-   static int initialized;
- 
-   /* Initialization code for a shared library.  */
---- libiconv-1.14/srclib/relocatable.c	2011-08-07 09:42:06.000000000 -0400
-+++ libiconv-1.14/srclib/relocatable.c	2011-10-15 03:14:37.739133600 -0400
-@@ -3,16 +3,16 @@
-    Written by Bruno Haible <bruno@clisp.org>, 2003.
- 
-    This program is free software: you can redistribute it and/or modify
--   it under the terms of the GNU General Public License as published by
--   the Free Software Foundation; either version 3 of the License, or
-+   it under the terms of the GNU Lesser General Public License as published by
-+   the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
- 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--   GNU General Public License for more details.
-+   GNU Lesser General Public License for more details.
- 
--   You should have received a copy of the GNU General Public License
-+   You should have received a copy of the GNU Lesser General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
- 
- 
-@@ -85,6 +85,19 @@
- # define FILE_SYSTEM_PREFIX_LEN(P) 0
- #endif
- 
-+/* Whether to enable the more costly support for relocatable libraries.
-+   It allows libraries to be have been installed with a different original
-+   prefix than the program.  But it is quite costly, especially on Cygwin
-+   platforms, see below.  Therefore we enable it by default only on native
-+   Win32 platforms.  */
-+#ifndef ENABLE_COSTLY_RELOCATABLE
-+# if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
-+#  define ENABLE_COSTLY_RELOCATABLE 1
-+# else
-+#  define ENABLE_COSTLY_RELOCATABLE 0
-+# endif
-+#endif
-+
- /* Original installation prefix.  */
- static char *orig_prefix;
- static size_t orig_prefix_len;
-@@ -154,7 +167,7 @@
- #endif
- }
- 
--#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR)
-+#if !defined IN_LIBRARY || (defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE)
- 
- /* Convenience function:
-    Computes the current installation prefix, based on the original
-@@ -284,7 +297,7 @@
- 
- #endif /* !IN_LIBRARY || PIC */
- 
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
- 
- /* Full pathname of shared library, or NULL.  */
- static char *shared_library_fullname;
-@@ -330,7 +343,9 @@
- #if (defined __linux__ && (__GLIBC__ >= 2 || defined __UCLIBC__)) || defined __CYGWIN__
-   /* Linux has /proc/self/maps. glibc 2 and uClibc have the getline()
-      function.
--     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.  */
-+     Cygwin >= 1.5 has /proc/self/maps and the getline() function too.
-+     But it is costly: ca. 0.3 ms on Linux, 3 ms on Cygwin 1.5, and 5 ms on
-+     Cygwin 1.7.  */
-   FILE *fp;
- 
-   /* Open the current process' maps file.  It describes one VMA per line.  */
-@@ -403,7 +418,7 @@
- const char *
- relocate (const char *pathname)
- {
--#if defined PIC && defined INSTALLDIR
-+#if defined PIC && defined INSTALLDIR && ENABLE_COSTLY_RELOCATABLE
-   static int initialized;
- 
-   /* Initialization code for a shared library.  */
---- libiconv-1.14/srcm4/gnulib-comp.m4	2011-08-07 09:42:12.000000000 -0400
-+++ libiconv-1.14/srcm4/gnulib-comp.m4	2011-08-30 02:40:45.597317000 -0400
-@@ -164,6 +164,7 @@ gl_UNISTD_MODULE_INDICATOR([readlink])
- gl_RELOCATABLE([$gl_source_base])
- if test $RELOCATABLE = yes; then
-   AC_LIBOBJ([progreloc])
-+  AC_LIBOBJ([relocatable])
- fi
- gl_FUNC_READLINK_SEPARATE
- gl_CANONICALIZE_LGPL_SEPARATE
diff --git a/pkgs/development/libraries/libiconv/libiconv-1.14-wchar.patch b/pkgs/development/libraries/libiconv/libiconv-1.14-wchar.patch
deleted file mode 100644
index 0e4ddd931bb0..000000000000
--- a/pkgs/development/libraries/libiconv/libiconv-1.14-wchar.patch
+++ /dev/null
@@ -1,102 +0,0 @@
---- libiconv-1.14/libcharset/lib/localcharset.c	2011-02-28 17:43:35.000000000 -0500
-+++ libiconv-1.14/libcharset/lib/localcharset.c	2011-08-28 00:16:57.238000000 -0400
-@@ -54,10 +54,6 @@
- #   include <locale.h>
- #  endif
- # endif
--# ifdef __CYGWIN__
--#  define WIN32_LEAN_AND_MEAN
--#  include <windows.h>
--# endif
- #elif defined WIN32_NATIVE
- # define WIN32_LEAN_AND_MEAN
- # include <windows.h>
-@@ -124,7 +120,7 @@
-   cp = charset_aliases;
-   if (cp == NULL)
-     {
--#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__)
-+#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE)
-       const char *dir;
-       const char *base = "charset.alias";
-       char *file_name;
-@@ -309,7 +305,7 @@
-            "DECKOREAN" "\0" "EUC-KR" "\0";
- # endif
- 
--# if defined WIN32_NATIVE || defined __CYGWIN__
-+# if defined WIN32_NATIVE
-       /* To avoid the troubles of installing a separate file in the same
-          directory as the DLL and of retrieving the DLL's directory at
-          runtime, simply inline the aliases here.  */
-@@ -365,64 +361,12 @@
- 
- # if HAVE_LANGINFO_CODESET
- 
--  /* Most systems support nl_langinfo (CODESET) nowadays.  */
--  codeset = nl_langinfo (CODESET);
--
--#  ifdef __CYGWIN__
--  /* Cygwin < 1.7 does not have locales.  nl_langinfo (CODESET) always
--     returns "US-ASCII".  Return the suffix of the locale name from the
--     environment variables (if present) or the codepage as a number.  */
--  if (codeset != NULL && strcmp (codeset, "US-ASCII") == 0)
--    {
--      const char *locale;
--      static char buf[2 + 10 + 1];
--
--      locale = getenv ("LC_ALL");
--      if (locale == NULL || locale[0] == '\0')
--        {
--          locale = getenv ("LC_CTYPE");
--          if (locale == NULL || locale[0] == '\0')
--            locale = getenv ("LANG");
--        }
--      if (locale != NULL && locale[0] != '\0')
--        {
--          /* If the locale name contains an encoding after the dot, return
--             it.  */
--          const char *dot = strchr (locale, '.');
--
--          if (dot != NULL)
--            {
--              const char *modifier;
--
--              dot++;
--              /* Look for the possible @... trailer and remove it, if any.  */
--              modifier = strchr (dot, '@');
--              if (modifier == NULL)
--                return dot;
--              if (modifier - dot < sizeof (buf))
--                {
--                  memcpy (buf, dot, modifier - dot);
--                  buf [modifier - dot] = '\0';
--                  return buf;
--                }
--            }
--        }
--
--      /* Woe32 has a function returning the locale's codepage as a number:
--         GetACP().  This encoding is used by Cygwin, unless the user has set
--         the environment variable CYGWIN=codepage:oem (which very few people
--         do).
--         Output directed to console windows needs to be converted (to
--         GetOEMCP() if the console is using a raster font, or to
--         GetConsoleOutputCP() if it is using a TrueType font).  Cygwin does
--         this conversion transparently (see winsup/cygwin/fhandler_console.cc),
--         converting to GetConsoleOutputCP().  This leads to correct results,
--         except when SetConsoleOutputCP has been called and a raster font is
--         in use.  */
--      sprintf (buf, "CP%u", GetACP ());
--      codeset = buf;
--    }
--#  endif
-+  /* Most systems support nl_langinfo (CODESET) nowadays.
-+     POSIX allows that the returned pointer may point to a static area that
-+     may be overwritten by subsequent calls to setlocale or nl_langinfo. */
-+  static char codeset_buf[64];
-+  codeset_buf[0] = '\0';
-+  codeset = strncat (codeset_buf, nl_langinfo (CODESET), sizeof (codeset_buf));
- 
- # else
- 
diff --git a/pkgs/development/libraries/libmicrohttpd/default.nix b/pkgs/development/libraries/libmicrohttpd/default.nix
index 0a1fe70bd1dd..23e6a37f918c 100644
--- a/pkgs/development/libraries/libmicrohttpd/default.nix
+++ b/pkgs/development/libraries/libmicrohttpd/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, libgcrypt, curl, gnutls, pkgconfig }:
 
 stdenv.mkDerivation rec {
-  name = "libmicrohttpd-0.9.53";
+  name = "libmicrohttpd-0.9.55";
 
   src = fetchurl {
     url = "mirror://gnu/libmicrohttpd/${name}.tar.gz";
-    sha256 = "1i1c7hwjmc4n31cgmfycgi8xsnm3kyc4zzdd4dir6i0z70nyq5cv";
+    sha256 = "1y6h1slav5l6k8zyb01dpw65dscdgxxgfa3a0z9qnn7jr66sn70c";
   };
 
   outputs = [ "out" "dev" "devdoc" "info" ];
diff --git a/pkgs/development/libraries/libunwind/default.nix b/pkgs/development/libraries/libunwind/default.nix
index 474b91751507..8565bc75ff9f 100644
--- a/pkgs/development/libraries/libunwind/default.nix
+++ b/pkgs/development/libraries/libunwind/default.nix
@@ -9,6 +9,10 @@ stdenv.mkDerivation rec {
     sha256 = "1jsslwkilwrsj959dc8b479qildawz67r8m4lzxm7glcwa8cngiz";
   };
 
+  patches = [
+    ./version-1.2.1.patch
+  ];
+
   nativeBuildInputs = [ autoreconfHook ];
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/libunwind/version-1.2.1.patch b/pkgs/development/libraries/libunwind/version-1.2.1.patch
new file mode 100644
index 000000000000..63202937084c
--- /dev/null
+++ b/pkgs/development/libraries/libunwind/version-1.2.1.patch
@@ -0,0 +1,13 @@
+diff --git a/configure.ac b/configure.ac
+index a254bbe..fe0247b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,6 +1,6 @@
+ define(pkg_major, 1)
+-define(pkg_minor, 2.1)
+-define(pkg_extra, )
++define(pkg_minor, 2)
++define(pkg_extra, 1)
+ define(pkg_maintainer, libunwind-devel@nongnu.org)
+ define(mkvers, $1.$2$3)
+ dnl Process this file with autoconf to produce a configure script.
diff --git a/pkgs/development/libraries/libxslt/default.nix b/pkgs/development/libraries/libxslt/default.nix
index a9e98d41e75e..118b8af5a6f9 100644
--- a/pkgs/development/libraries/libxslt/default.nix
+++ b/pkgs/development/libraries/libxslt/default.nix
@@ -19,6 +19,12 @@ stdenv.mkDerivation rec {
 
   patches = stdenv.lib.optional stdenv.isSunOS ./patch-ah.patch;
 
+  # fixes: can't build x86_64-unknown-cygwin shared library unless -no-undefined is specified
+  postPatch = optionalString hostPlatform.isCygwin ''
+    substituteInPlace tests/plugins/Makefile.in \
+      --replace 'la_LDFLAGS =' 'la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS)'
+  '';
+
   outputs = [ "bin" "dev" "out" "doc" ] ++ stdenv.lib.optional pythonSupport "py";
 
   buildInputs = [ libxml2.dev ] ++ stdenv.lib.optionals pythonSupport [ libxml2.py python2 ];
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index d606fcd15483..e1bd4255636a 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -67,7 +67,7 @@ let
 in
 
 let
-  version = "17.1.2";
+  version = "17.1.4";
   branch  = head (splitString "." version);
   driverLink = "/run/opengl-driver" + optionalString stdenv.isi686 "-32";
 in
@@ -82,7 +82,7 @@ stdenv.mkDerivation {
       "ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz"
       "https://launchpad.net/mesa/trunk/${version}/+download/mesa-${version}.tar.xz"
     ];
-    sha256 = "0937804f43746339b1f9540d8f9c8b4a1bb3d3eec0e4020eac283b8799798239";
+    sha256 = "06f3b0e6a28f0d20b7f3391cf67fe89ae98ecd0a686cd545da76557b6cec9cad";
   };
 
   prePatch = "patchShebangs .";
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index 46283e371aa9..e6db7af6ee2d 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -46,6 +46,9 @@ stdenv.mkDerivation rec {
   buildInputs = lib.optional (mouseSupport && stdenv.isLinux) gpm;
 
   preConfigure = ''
+    # These paths end up in the default lookup chain.
+    export TERMINFO_DIRS=/etc/terminfo
+
     export PKG_CONFIG_LIBDIR="$dev/lib/pkgconfig"
     mkdir -p "$PKG_CONFIG_LIBDIR"
     configureFlagsArray+=(
@@ -61,8 +64,6 @@ stdenv.mkDerivation rec {
            -e '/CPPFLAGS="$CPPFLAGS/s/ -D_XOPEN_SOURCE_EXTENDED//' \
         configure
     CFLAGS=-D_XOPEN_SOURCE_EXTENDED
-  '' + lib.optionalString stdenv.isCygwin ''
-    sed -i -e 's,LIB_SUFFIX="t,LIB_SUFFIX=",' configure
   '';
 
   enableParallelBuilding = true;
@@ -122,7 +123,7 @@ stdenv.mkDerivation rec {
     moveToOutput "bin/tset" "$out"
   '';
 
-  preFixup = ''
+  preFixup = lib.optionalString (!hostPlatform.isCygwin) ''
     rm "$out"/lib/*.a
   '';
 
diff --git a/pkgs/development/libraries/openldap/default.nix b/pkgs/development/libraries/openldap/default.nix
index 05c03dcd8424..7155d0f48a80 100644
--- a/pkgs/development/libraries/openldap/default.nix
+++ b/pkgs/development/libraries/openldap/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, openssl, cyrus_sasl, db, groff, libtool }:
 
 stdenv.mkDerivation rec {
-  name = "openldap-2.4.44";
+  name = "openldap-2.4.45";
 
   src = fetchurl {
     url = "http://www.openldap.org/software/download/OpenLDAP/openldap-release/${name}.tgz";
-    sha256 = "0044p20hx07fwgw2mbwj1fkx04615hhs1qyx4mawj2bhqvrnppnp";
+    sha256 = "091qvwk5dkcpp17ziabcnh3rg3m7qwzw2pihfcd1d5fdxgywzmnd";
   };
 
   # TODO: separate "out" and "bin"
diff --git a/pkgs/development/libraries/openssl/1.0.1-cygwin64.patch b/pkgs/development/libraries/openssl/1.0.1-cygwin64.patch
deleted file mode 100644
index 63112abf3a39..000000000000
--- a/pkgs/development/libraries/openssl/1.0.1-cygwin64.patch
+++ /dev/null
@@ -1,136 +0,0 @@
---- openssl-1.0.1e/config      2014-10-23 15:53:23.436600000 +0200
-+++ openssl-1.0.1e/config      2014-10-23 15:55:33.837000000 +0200
-@@ -832,6 +832,7 @@
-   # these are all covered by the catchall below
-   # *-dgux) OUT="dgux" ;;
-   mips-sony-newsos4) OUT="newsos4-gcc" ;;
-+  x86_64-*-cygwin) OUT="Cygwin-x86_64" ;;
-   *-*-cygwin_pre1.3) OUT="Cygwin-pre1.3" ;;
-   *-*-cygwin) OUT="Cygwin" ;;
-   t3e-cray-unicosmk) OUT="cray-t3e" ;;
---- openssl-1.0.1e/Configure	2013-02-17 17:06:18.682058900 -0600
-+++ openssl-1.0.1e/Configure	2013-02-17 16:38:08.000000000 -0600
-@@ -550,6 +550,7 @@ my %table=(
- "Cygwin-pre1.3", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::(unknown):CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
- "Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:coff:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
- "debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
-+"Cygwin-x86_64", "gcc:-DTERMIOS -DL_ENDIAN -O3 -Wall:::CYGWIN32::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:mingw64:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
- 
- # NetWare from David Ward (dsward@novell.com)
- # requires either MetroWerks NLM development tools, or gcc / nlmconv
-@@ -1128,7 +1129,7 @@ foreach (sort @experimental)
- 
- my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
- 
--$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/);
-+$exe_ext=".exe" if ($target =~ /^Cygwin/ || $target eq "DJGPP" || $target =~ /^mingw/);
- $exe_ext=".nlm" if ($target =~ /netware/);
- $exe_ext=".pm"  if ($target =~ /vos/);
- $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
---- openssl-1.0.1e/Makefile.org	2013-02-11 09:26:04.000000000 -0600
-+++ openssl-1.0.1e/Makefile.org	2013-02-17 16:38:08.000000000 -0600
-@@ -326,9 +326,9 @@ clean-shared:
- 			done; \
- 		fi; \
- 		( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
--		if [ "$(PLATFORM)" = "Cygwin" ]; then \
-+		case "$(PLATFORM)" in Cygwin*)  \
- 			( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
--		fi; \
-+		esac; \
- 	done
- 
- link-shared:
-@@ -571,11 +571,7 @@ install_sw:
- 		do \
- 			if [ -f "$$i" -o -f "$$i.a" ]; then \
- 			(       echo installing $$i; \
--				if [ "$(PLATFORM)" != "Cygwin" ]; then \
--					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
--					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
--					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
--				else \
-+				case "$(PLATFORM)" in Cygwin*) \
- 					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
- 					cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
- 					chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
-@@ -583,7 +579,12 @@ install_sw:
- 					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
- 					chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
- 					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
--				fi ); \
-+					;; \
-+				*) \
-+					cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
-+					chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
-+					mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
-+				esac ); \
- 				if expr $(PLATFORM) : 'mingw' > /dev/null; then \
- 				(	case $$i in \
- 						*crypto*) i=libeay32.dll;; \
-@@ -643,9 +644,9 @@ install_docs:
- 	@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
- 	here="`pwd`"; \
- 	filecase=; \
--	if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \
-+	case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*) \
- 		filecase=-i; \
--	fi; \
-+	esac; \
- 	set -e; for i in doc/apps/*.pod; do \
- 		fn=`basename $$i .pod`; \
- 		sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
---- openssl-1.0.1e/engines/ccgost/Makefile	2013-02-11 09:26:04.000000000 -0600
-+++ openssl-1.0.1e/engines/ccgost/Makefile	2013-02-17 17:05:47.759290200 -0600
-@@ -45,7 +45,11 @@ install:
- 		set -e; \
- 		echo installing $(LIBNAME); \
- 		pfx=lib; \
--		if [ "$(PLATFORM)" != "Cygwin" ]; then \
-+		case "$(PLATFORM)" in Cygwin*) \
-+			sfx=".so"; \
-+			cp cyg$(LIBNAME).dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
-+			;; \
-+		*) \
- 			case "$(CFLAGS)" in \
- 			*DSO_BEOS*) sfx=".so";; \
- 			*DSO_DLFCN*) sfx=`expr "$(SHLIB_EXT)" : '.*\(\.[a-z][a-z]*\)' \| ".so"`;; \
-@@ -54,10 +58,7 @@ install:
- 			*) sfx=".bad";; \
- 			esac; \
- 			cp $${pfx}$(LIBNAME)$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
--		else \
--			sfx=".so"; \
--			cp cyg$(LIBNAME).dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
--		fi; \
-+		esac; \
- 		chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new; \
- 		mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$${pfx}$(LIBNAME)$$sfx; \
- 	fi
---- openssl-1.0.1i/engines/Makefile	2014-10-23 16:08:19.360200000 +0200
-+++ openssl-1.0.1i/engines/Makefile	2014-10-23 16:10:54.205800000 +0200
-@@ -111,7 +111,11 @@
- 		for l in $(LIBNAMES); do \
- 			( echo installing $$l; \
- 			  pfx=lib; \
--			  if [ "$(PLATFORM)" != "Cygwin" ]; then \
-+			  case "$(PLATFORM)" in Cygwin*) \
-+				sfx=".so"; \
-+				cp cyg$$l.dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
-+				;; \
-+			  *) \
- 				case "$(CFLAGS)" in \
- 				*DSO_BEOS*)	sfx=".so";;	\
- 				*DSO_DLFCN*)	sfx=`expr "$(SHLIB_EXT)" : '.*\(\.[a-z][a-z]*\)' \| ".so"`;;	\
-@@ -120,10 +124,7 @@
- 				*)		sfx=".bad";;	\
- 				esac; \
- 				cp $$pfx$$l$$sfx $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
--			  else \
--				sfx=".so"; \
--				cp cyg$$l.dll $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
--			  fi; \
-+			  esac; \
- 			  chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
- 			  mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx ); \
- 		done; \
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index b3ce2fdbbb06..2120e60ec6aa 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -24,7 +24,6 @@ let
       ++ [ ./nix-ssl-cert-file.patch ]
       ++ optional (versionOlder version "1.1.0")
           (if stdenv.isDarwin then ./use-etc-ssl-certs-darwin.patch else ./use-etc-ssl-certs.patch)
-      ++ optional stdenv.isCygwin ./1.0.1-cygwin64.patch
       ++ optional (versionOlder version "1.0.2" && hostPlatform.isDarwin)
            ./darwin-arch.patch;
 
diff --git a/pkgs/development/libraries/sqlite/default.nix b/pkgs/development/libraries/sqlite/default.nix
index a80317162302..5230df995242 100644
--- a/pkgs/development/libraries/sqlite/default.nix
+++ b/pkgs/development/libraries/sqlite/default.nix
@@ -3,11 +3,11 @@
 assert interactive -> readline != null && ncurses != null;
 
 stdenv.mkDerivation {
-  name = "sqlite-3.17.0";
+  name = "sqlite-3.19.3";
 
   src = fetchurl {
-    url = "http://sqlite.org/2017/sqlite-autoconf-3170000.tar.gz";
-    sha256 = "0k472gq0p706jq4529p60znvw02hdf172qxgbdv59q0n7anqbr54";
+    url = "http://sqlite.org/2017/sqlite-autoconf-3190300.tar.gz";
+    sha256 = "00b3l2qglpl1inx21fckiwxnfq5xf6441flc79rqg7zdvh1rq4h6";
   };
 
   outputs = [ "bin" "dev" "out" ];
diff --git a/pkgs/development/libraries/utf8proc/default.nix b/pkgs/development/libraries/utf8proc/default.nix
index 6cef26d3aada..4a40806c4eb1 100644
--- a/pkgs/development/libraries/utf8proc/default.nix
+++ b/pkgs/development/libraries/utf8proc/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "utf8proc-${version}";
-  version = "2.0.2";
+  version = "2.1.0";
 
   src = fetchurl {
     url = "https://github.com/JuliaLang/utf8proc/archive/v${version}.tar.gz";
-    sha256 = "140vib1m6n5kwzkw1n9fbsi5gl6xymbd7yndwqx1sj15aakak776";
+    sha256 = "0q1jhdkk4f9b0zb8s2ql3sba3br5nvjsmbsaybmgj064k9hwbk15";
   };
 
   makeFlags = [ "prefix=$(out)" ];
diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index 40334f0b4624..ef9f2569c45e 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -4,10 +4,9 @@
 , static ? false
 }:
 
-let version = "1.2.11"; in
-
 stdenv.mkDerivation rec {
   name = "zlib-${version}";
+  version = "1.2.11";
 
   src = fetchurl {
     urls =
@@ -17,7 +16,9 @@ stdenv.mkDerivation rec {
     sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1";
   };
 
-  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  patches = stdenv.lib.optional hostPlatform.isCygwin ./disable-cygwin-widechar.patch;
+
+  postPatch = stdenv.lib.optionalString hostPlatform.isDarwin ''
     substituteInPlace configure \
       --replace '/usr/bin/libtool' 'ar' \
       --replace 'AR="libtool"' 'AR="ar"' \
@@ -28,14 +29,6 @@ stdenv.mkDerivation rec {
   setOutputFlags = false;
   outputDoc = "dev"; # single tiny man3 page
 
-  # TODO(@Dridus) CC set by cc-wrapper setup-hook, so just empty out the preConfigure script when cross building, but leave the old incorrect script when not
-  # cross building to avoid hash breakage. Once hash breakage is acceptable, remove preConfigure entirely.
-  preConfigure = stdenv.lib.optionalString (hostPlatform == buildPlatform) ''
-    if test -n "$crossConfig"; then
-      export CC=$crossConfig-gcc
-    fi
-  '';
-
   # FIXME needs gcc 4.9 in bootstrap tools
   hardeningDisable = [ "stackprotector" ];
 
@@ -47,36 +40,41 @@ stdenv.mkDerivation rec {
     # jww (2015-01-06): Sometimes this library install as a .so, even on
     # Darwin; others time it installs as a .dylib.  I haven't yet figured out
     # what causes this difference.
-  + stdenv.lib.optionalString stdenv.isDarwin ''
+  + stdenv.lib.optionalString hostPlatform.isDarwin ''
     for file in $out/lib/*.so* $out/lib/*.dylib* ; do
       install_name_tool -id "$file" $file
     done
+  ''
+    # Non-typical naming confuses libtool which then refuses to use zlib's DLL
+    # in some cases, e.g. when compiling libpng.
+  + stdenv.lib.optionalString (hostPlatform.libc == "msvcrt") ''
+    ln -s zlib1.dll $out/bin/libz.dll
   '';
 
   # As zlib takes part in the stdenv building, we don't want references
   # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!stdenv.isDarwin) "-static-libgcc";
+  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!hostPlatform.isDarwin) "-static-libgcc";
 
-  crossAttrs = {
-    dontStrip = static;
-    configurePlatforms = [];
-  } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
-    installFlags = [
-      "BINARY_PATH=$(out)/bin"
-      "INCLUDE_PATH=$(dev)/include"
-      "LIBRARY_PATH=$(out)/lib"
-    ];
-    makeFlags = [
-      "-f" "win32/Makefile.gcc"
-      "PREFIX=${stdenv.cc.prefix}"
-    ] ++ stdenv.lib.optional (!static) "SHARED_MODE=1";
+  dontStrip = hostPlatform != buildPlatform && static;
+  configurePlatforms = [];
 
-    # Non-typical naming confuses libtool which then refuses to use zlib's DLL
-    # in some cases, e.g. when compiling libpng.
-    postInstall = postInstall + "ln -s zlib1.dll $out/bin/libz.dll";
-  };
+  installFlags = stdenv.lib.optionals (hostPlatform.libc == "msvcrt") [
+    "BINARY_PATH=$(out)/bin"
+    "INCLUDE_PATH=$(dev)/include"
+    "LIBRARY_PATH=$(out)/lib"
+  ];
+
+  makeFlags = [
+    "PREFIX=${stdenv.cc.prefix}"
+  ] ++ stdenv.lib.optionals (hostPlatform.libc == "msvcrt") [
+    "-f" "win32/Makefile.gcc"
+  ] ++ stdenv.lib.optionals (!static) [
+    "SHARED_MODE=1"
+  ];
 
-  passthru.version = version;
+  passthru = {
+    inherit version;
+  };
 
   meta = with stdenv.lib; {
     description = "Lossless data-compression library";
diff --git a/pkgs/development/libraries/zlib/disable-cygwin-widechar.patch b/pkgs/development/libraries/zlib/disable-cygwin-widechar.patch
new file mode 100644
index 000000000000..3de4978c3066
--- /dev/null
+++ b/pkgs/development/libraries/zlib/disable-cygwin-widechar.patch
@@ -0,0 +1,13 @@
+diff --git a/gzguts.h b/gzguts.h
+index 990a4d2..6378d46 100644
+--- a/gzguts.h
++++ b/gzguts.h
+@@ -39,7 +39,7 @@
+ #  include <io.h>
+ #endif
+ 
+-#if defined(_WIN32) || defined(__CYGWIN__)
++#if defined(_WIN32)
+ #  define WIDECHAR
+ #endif
+ 
diff --git a/pkgs/development/ocaml-modules/csv/default.nix b/pkgs/development/ocaml-modules/csv/default.nix
index 95199f16dcc2..4bb8f8ace9c0 100644
--- a/pkgs/development/ocaml-modules/csv/default.nix
+++ b/pkgs/development/ocaml-modules/csv/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation {
 
-  name = "ocaml-csv-1.4.2";
+  name = "ocaml-csv-1.5";
 
   src = fetchzip {
-    url = https://github.com/Chris00/ocaml-csv/releases/download/1.4.2/csv-1.4.2.tar.gz;
-    sha256 = "05s8py2qr3889c72g1q07r15pzch3j66xdphxi2sd93h5lvnpi4j";
+    url = https://github.com/Chris00/ocaml-csv/releases/download/1.5/csv-1.5.tar.gz;
+    sha256 = "1ca7jgg58j24pccs5fshis726s06fdcjshnwza5kwxpjgdbvc63g";
   };
 
   buildInputs = [ ocaml findlib ocamlbuild ];
diff --git a/pkgs/development/ocaml-modules/lwt/default.nix b/pkgs/development/ocaml-modules/lwt/default.nix
index 531378c19a4f..fc721dc4c9a3 100644
--- a/pkgs/development/ocaml-modules/lwt/default.nix
+++ b/pkgs/development/ocaml-modules/lwt/default.nix
@@ -5,6 +5,10 @@
 , version ? if stdenv.lib.versionAtLeast ocaml.version "4.02" then "2.7.1" else "2.6.0"
 }:
 
+if !stdenv.lib.versionAtLeast ocaml.version "4"
+then throw "lwt is not available for OCaml ${ocaml.version}"
+else
+
 let sha256 = {
   "3.0.0" = "0wwhnl9hppixcsdisinj1wmffx0nv6hkpm01z9qvkngkrazi3i88";
   "2.7.1" = "0w7f59havrl2fsnvs84lm7wlqpsrldg80gy5afpnpr21zkw22g8w";
diff --git a/pkgs/development/ocaml-modules/pgocaml/default.nix b/pkgs/development/ocaml-modules/pgocaml/default.nix
index a8b3ed158625..f4d1ef829bb4 100644
--- a/pkgs/development/ocaml-modules/pgocaml/default.nix
+++ b/pkgs/development/ocaml-modules/pgocaml/default.nix
@@ -1,4 +1,8 @@
-{ stdenv, fetchurl, buildOcaml, calendar, csv, re }:
+{ stdenv, fetchurl, buildOcaml, ocaml, calendar, csv, re }:
+
+if !stdenv.lib.versionAtLeast ocaml.version "4"
+then throw "pgocaml is not available for OCaml ${ocaml.version}"
+else
 
 buildOcaml {
   name = "pgocaml";
diff --git a/pkgs/development/python-modules/dogpile.cache/default.nix b/pkgs/development/python-modules/dogpile.cache/default.nix
index e4d46e011295..424be07aa616 100644
--- a/pkgs/development/python-modules/dogpile.cache/default.nix
+++ b/pkgs/development/python-modules/dogpile.cache/default.nix
@@ -14,8 +14,10 @@ buildPythonPackage rec {
 
   # Disable concurrency tests that often fail,
   # probably some kind of timing issue.
-  prePatch = ''
+  postPatch = ''
     rm tests/test_lock.py
+    # Failing tests. https://bitbucket.org/zzzeek/dogpile.cache/issues/116
+    rm tests/cache/test_memcached_backend.py
   '';
 
   buildInputs = [ pytest pytestcov mock Mako ];
diff --git a/pkgs/development/tools/analysis/flow/default.nix b/pkgs/development/tools/analysis/flow/default.nix
index 9987996c95de..e5f9fa26938c 100644
--- a/pkgs/development/tools/analysis/flow/default.nix
+++ b/pkgs/development/tools/analysis/flow/default.nix
@@ -3,14 +3,14 @@
 with lib;
 
 stdenv.mkDerivation rec {
-  version = "0.48.0";
+  version = "0.49.1";
   name = "flow-${version}";
 
   src = fetchFromGitHub {
     owner = "facebook";
     repo = "flow";
     rev = "v${version}";
-    sha256 = "13f9z4jg1v34jpaswa8kvbxkfp7flabv616vyqfvy9hafgfyisff";
+    sha256 = "1fjqdyl72srla7ysjg0694ym5d3f2rdl5gfq8r9ay4v15jcb5dg6";
   };
 
   installPhase = ''
diff --git a/pkgs/development/tools/haskell/tinc/default.nix b/pkgs/development/tools/haskell/tinc/default.nix
index 9c4b1f631488..db779ecbb0f9 100644
--- a/pkgs/development/tools/haskell/tinc/default.nix
+++ b/pkgs/development/tools/haskell/tinc/default.nix
@@ -3,16 +3,16 @@
 , hpack, hspec, HUnit, language-dot, mockery, parsec, process
 , QuickCheck, safe, stdenv, temporary, time, transformers, unix
 , unix-compat, with-location, yaml, fetchFromGitHub
-, ghc, cabal2nix, cabal-install, makeWrapper
+, cabal2nix, cabal-install, makeWrapper
 }:
 mkDerivation {
   pname = "tinc";
-  version = "20170228";
+  version = "20170624";
   src = fetchFromGitHub {
     owner = "sol";
     repo = "tinc";
-    rev = "e829926a043a68a8a4dc551485c4d666837474af";
-    sha256 = "1zdp1mqp3jn2faw0d3jlcbrkp4azgl5ahhq5pxdn24gyq70zkchc";
+    rev = "70881515693fd83d381fe045ae76d5257774f5e3";
+    sha256 = "0c6sx3vbcnq69dhqhpi01a4p4qss24rwxiz6jmw65rj73adhj4mw";
   };
   isLibrary = false;
   isExecutable = true;
@@ -30,13 +30,12 @@ mkDerivation {
   postInstall = ''
     source ${makeWrapper}/nix-support/setup-hook
     wrapProgram $out/bin/tinc \
-      --prefix PATH : '${ghc}/bin' \
       --prefix PATH : '${cabal2nix}/bin' \
       --prefix PATH : '${cabal-install}/bin'
   '';
   description = "A dependency manager for Haskell";
   homepage = "https://github.com/sol/tinc#readme";
   license = stdenv.lib.licenses.mit;
-  hydraPlatforms = stdenv.lib.platforms.none;
+  hydraPlatforms = [ "x86_64-linux" ];
   maintainers = [ stdenv.lib.maintainers.robbinch ];
 }
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index 82eb7f77bb4c..ae58c72b786d 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -8,10 +8,13 @@ let
   version = "2.28";
   basename = "binutils-${version}";
   inherit (stdenv.lib) optional optionals optionalString;
+  # The prefix prepended to binary names to allow multiple binuntils on the
+  # PATH to both be usable.
+  prefix = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
 in
 
 stdenv.mkDerivation rec {
-  name = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-" + basename;
+  name = prefix + basename;
 
   src = fetchurl {
     url = "mirror://gnu/binutils/${basename}.tar.bz2";
@@ -78,15 +81,20 @@ stdenv.mkDerivation rec {
     then "-Wno-string-plus-int -Wno-deprecated-declarations"
     else "-static-libgcc";
 
+  # TODO(@Ericson2314): Always pass "--target" and always prefix.
+  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
   configureFlags =
     [ "--enable-shared" "--enable-deterministic-archives" "--disable-werror" ]
     ++ optional (stdenv.system == "mips64el-linux") "--enable-fix-loongson2f-nop"
-    ++ optional (targetPlatform != hostPlatform) "--target=${targetPlatform.config}" # TODO: make this unconditional
     ++ optionals gold [ "--enable-gold" "--enable-plugins" ]
     ++ optional (stdenv.system == "i686-linux") "--enable-targets=x86_64-linux-gnu";
 
   enableParallelBuilding = true;
 
+  passthru = {
+    inherit prefix;
+  };
+
   meta = with stdenv.lib; {
     description = "Tools for manipulating binaries (linker, assembler, etc.)";
     longDescription = ''
diff --git a/pkgs/development/tools/misc/csmith/default.nix b/pkgs/development/tools/misc/csmith/default.nix
new file mode 100644
index 000000000000..20d149f3efe0
--- /dev/null
+++ b/pkgs/development/tools/misc/csmith/default.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchurl, m4, makeWrapper, libbsd, perl, SysCPU }:
+
+stdenv.mkDerivation rec {
+  name = "csmith-${version}";
+  version = "2.3.0";
+
+  src = fetchurl {
+    url = "http://embed.cs.utah.edu/csmith/${name}.tar.gz";
+    sha256 = "1mb5zgixsyf86slggs756k8a5ddmj980md3ic9sa1y75xl5cqizj";
+  };
+
+  nativeBuildInputs = [ m4 makeWrapper ];
+  buildInputs = [ libbsd perl SysCPU ];
+
+  postInstall = ''
+    substituteInPlace $out/bin/compiler_test.pl \
+      --replace '$CSMITH_HOME/runtime' $out/include/${name} \
+      --replace ' ''${CSMITH_HOME}/runtime' " $out/include/${name}" \
+      --replace '$CSMITH_HOME/src/csmith' $out/bin/csmith
+
+    substituteInPlace $out/bin/launchn.pl \
+      --replace '../compiler_test.pl' $out/bin/compiler_test.pl \
+      --replace '../$CONFIG_FILE' '$CONFIG_FILE'
+
+    wrapProgram $out/bin/launchn.pl --prefix PERL5LIB : "$PERL5LIB" $out/bin/launchn.pl
+
+    mkdir -p $out/share/csmith
+    mv $out/bin/compiler_test.in $out/share/csmith/
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "A random generator of C programs";
+    homepage = "https://embed.cs.utah.edu/csmith";
+    # Officially, the license is this: https://github.com/csmith-project/csmith/blob/master/COPYING
+    license = licenses.bsd2;
+    longDescription = ''
+      Csmith is a tool that can generate random C programs that statically and
+      dynamically conform to the C99 standard. It is useful for stress-testing
+      compilers, static analyzers, and other tools that process C code.
+      Csmith has found bugs in every tool that it has tested, and has been used
+      to find and report more than 400 previously unknown compiler bugs.
+    '';
+    maintainers = [ maintainers.dtzWill ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix
index 1e9cf910857c..78dd4a1e3f55 100644
--- a/pkgs/development/tools/misc/gdb/default.nix
+++ b/pkgs/development/tools/misc/gdb/default.nix
@@ -48,6 +48,9 @@ stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = "-Wno-format-nonliteral";
 
+  # TODO(@Ericson2314): Always pass "--target" and always prefix.
+  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
+
   configureFlags = with stdenv.lib; [
     "--with-gmp=${gmp.dev}" "--with-mpfr=${mpfr.dev}" "--with-system-readline"
     "--with-system-zlib" "--with-expat" "--with-libexpat-prefix=${expat.dev}"
@@ -55,8 +58,6 @@ stdenv.mkDerivation rec {
       # TODO(@Ericson2314): make this conditional on whether host platform is NixOS
       "--with-separate-debug-dir=/run/current-system/sw/lib/debug"
     ++ stdenv.lib.optional (!pythonSupport) "--without-python"
-    # TODO(@Ericson2314): This should be done in stdenv, not per-package
-    ++ stdenv.lib.optional (targetPlatform != hostPlatform) "--target=${targetPlatform.config}"
     ++ stdenv.lib.optional multitarget "--enable-targets=all";
 
   postInstall =
diff --git a/pkgs/development/tools/misc/help2man/1.40.4-cygwin-nls.patch b/pkgs/development/tools/misc/help2man/1.40.4-cygwin-nls.patch
index 20b99998154d..82f8cf1cb37b 100644
--- a/pkgs/development/tools/misc/help2man/1.40.4-cygwin-nls.patch
+++ b/pkgs/development/tools/misc/help2man/1.40.4-cygwin-nls.patch
@@ -16,8 +16,8 @@ that we're trying to help2man).
 
  install_preload: install_dirs preload
 -	$(INSTALL_PROGRAM) $(preload).so $(DESTDIR)$(pkglibdir)
-+	$(INSTALL_PROGRAM) lib/cygintl-8.dll $(DESTDIR)$(pkglibdir)
-+	ln -sf cygintl-8.dll $(DESTDIR)$(pkglibdir)/$(preload).so
++	$(INSTALL_PROGRAM) lib/cygintl-9.dll $(DESTDIR)$(pkglibdir)
++	ln -sf cygintl-9.dll $(DESTDIR)$(pkglibdir)/$(preload).so
 
  install_l10n: install_dirs msg_l10n man_l10n info_l10n
         set -e; \
@@ -27,8 +27,8 @@ that we're trying to help2man).
  $(preload).so: $(srcdir)/$(preload).c
 -	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ -fPIC -shared $? $(LIBS)
 +	mkdir -p lib
-+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o lib/cygintl-8.dll -shared $? $(LIBS)
-+	ln -sf lib/cygintl-8.dll $@
++	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o lib/cygintl-9.dll -shared $? $(LIBS)
++	ln -sf lib/cygintl-9.dll $@
 
  man: $(target).1
  $(target).1: $(srcdir)/$(target).PL $(srcdir)/$(target).h2m.PL
@@ -62,7 +62,7 @@ that we're trying to help2man).
          return;
  
 +#ifdef __CYGWIN__
-+    if (!(RTLD_NEXT = dlopen("/usr/bin/cygintl-8.dll", RTLD_LAZY)))
++    if (!(RTLD_NEXT = dlopen("/usr/bin/cygintl-9.dll", RTLD_LAZY)))
 +        die("libintl8 not found");
 +#endif
 +
diff --git a/pkgs/development/tools/misc/help2man/default.nix b/pkgs/development/tools/misc/help2man/default.nix
index 8bf3db59147b..5e2edce56f0d 100644
--- a/pkgs/development/tools/misc/help2man/default.nix
+++ b/pkgs/development/tools/misc/help2man/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, gettext, LocaleGettext, makeWrapper }:
+{ stdenv, hostPlatform, fetchurl, perl, gettext, LocaleGettext, makeWrapper }:
 
 stdenv.mkDerivation rec {
   name = "help2man-1.47.4";
@@ -12,11 +12,12 @@ stdenv.mkDerivation rec {
 
   doCheck = false;                                # target `check' is missing
 
-  patches = if stdenv.isCygwin then [ ./1.40.4-cygwin-nls.patch ] else null;
+  patches = if hostPlatform.isCygwin then [ ./1.40.4-cygwin-nls.patch ] else null;
 
   postInstall =
     '' wrapProgram "$out/bin/help2man" \
-         --prefix PERL5LIB : "$(echo ${LocaleGettext}/lib/perl*/site_perl)"
+         --prefix PERL5LIB : "$(echo ${LocaleGettext}/lib/perl*/site_perl)" \
+         ${stdenv.lib.optionalString hostPlatform.isCygwin "--prefix PATH : ${gettext}/bin"}
     '';
 
 
diff --git a/pkgs/development/tools/misc/pkgconfig/2.36.3-not-win32.patch b/pkgs/development/tools/misc/pkgconfig/2.36.3-not-win32.patch
index 246173d465af..c1dd808e6008 100644
--- a/pkgs/development/tools/misc/pkgconfig/2.36.3-not-win32.patch
+++ b/pkgs/development/tools/misc/pkgconfig/2.36.3-not-win32.patch
@@ -309,3 +309,16 @@
  # else
  
    /* On old systems which lack it, use setlocale or getenv.  */
+diff --git a/glib/gtypes.h b/glib/gtypes.h
+index c18e0bf..816685a 100644
+--- a/glib/glib/gtypes.h
++++ b/glib/glib/gtypes.h
+@@ -462,7 +462,7 @@ G_END_DECLS
+  * properly get exported in Windows DLLs.
+  */
+ #ifndef GLIB_VAR
+-#  ifdef G_PLATFORM_WIN32
++#  ifdef G_OS_WIN32
+ #    ifdef GLIB_STATIC_COMPILATION
+ #      define GLIB_VAR extern
+ #    else /* !GLIB_STATIC_COMPILATION */
diff --git a/pkgs/development/tools/misc/pkgconfig/default.nix b/pkgs/development/tools/misc/pkgconfig/default.nix
index 10358df69c22..5be42855a9c7 100644
--- a/pkgs/development/tools/misc/pkgconfig/default.nix
+++ b/pkgs/development/tools/misc/pkgconfig/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
   configureFlags = [ "--with-internal-glib" ]
     ++ optional (stdenv.isSunOS) [ "--with-libiconv=gnu" "--with-system-library-path" "--with-system-include-path" "CFLAGS=-DENABLE_NLS" ];
 
-  postInstall = ''rm "$out"/bin/*-pkg-config''; # clean the duplicate file
+  postInstall = ''rm -f "$out"/bin/*-pkg-config''; # clean the duplicate file
 
   meta = {
     description = "A tool that allows packages to find out information about other packages";
diff --git a/pkgs/games/uqm/default.nix b/pkgs/games/uqm/default.nix
index d6bcb787d60c..d1416b0685a7 100644
--- a/pkgs/games/uqm/default.nix
+++ b/pkgs/games/uqm/default.nix
@@ -18,7 +18,7 @@ let
     inherit stdenv requireFile writeText fetchurl haskellPackages;
   };
 
-  remixPacks = imap (num: sha256: fetchurl rec {
+  remixPacks = imap1 (num: sha256: fetchurl rec {
     name = "uqm-remix-disc${toString num}.uqm";
     url = "mirror://sourceforge/sc2/${name}";
     inherit sha256;
diff --git a/pkgs/os-specific/darwin/binutils/default.nix b/pkgs/os-specific/darwin/binutils/default.nix
index f88f761f65a3..933e7558dbbf 100644
--- a/pkgs/os-specific/darwin/binutils/default.nix
+++ b/pkgs/os-specific/darwin/binutils/default.nix
@@ -2,11 +2,12 @@
 , hostPlatform, targetPlatform
 }:
 
-let
-  prefix = stdenv.lib.optionalString
-    (targetPlatform != hostPlatform)
-    "${targetPlatform.config}-";
+# Make sure both underlying packages claim to have prepended their binaries
+# with the same prefix.
+assert binutils-raw.prefix == cctools.prefix;
 
+let
+  inherit (binutils-raw) prefix;
   cmds = [
     "ar" "ranlib" "as" "dsymutil" "install_name_tool"
     "ld" "strip" "otool" "lipo" "nm" "strings" "size"
@@ -50,4 +51,8 @@ stdenv.mkDerivation {
 
     ln -s ${cctools}/libexec $out/libexec
   '';
+
+  passthru = {
+    inherit prefix;
+  };
 }
diff --git a/pkgs/os-specific/darwin/cctools/port.nix b/pkgs/os-specific/darwin/cctools/port.nix
index 222c51603fdd..9fdb00d66be9 100644
--- a/pkgs/os-specific/darwin/cctools/port.nix
+++ b/pkgs/os-specific/darwin/cctools/port.nix
@@ -1,10 +1,12 @@
 { stdenv, fetchFromGitHub, makeWrapper, autoconf, automake, libtool_2
 , llvm, libcxx, libcxxabi, clang, libuuid
 , libobjc ? null, maloader ? null, xctoolchain ? null
-, buildPlatform, hostPlatform, targetPlatform
+, hostPlatform, targetPlatform
 }:
 
 let
+  # The prefix prepended to binary names to allow multiple binuntils on the
+  # PATH to both be usable.
   prefix = stdenv.lib.optionalString
     (targetPlatform != hostPlatform)
     "${targetPlatform.config}-";
@@ -38,13 +40,10 @@ let
 
     enableParallelBuilding = true;
 
+    # TODO(@Ericson2314): Always pass "--target" and always prefix.
+    configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
     configureFlags = stdenv.lib.optionals (!stdenv.isDarwin) [
       "CXXFLAGS=-I${libcxx}/include/c++/v1"
-    ] ++ stdenv.lib.optionals (targetPlatform != buildPlatform) [
-      # TODO make unconditional next hash break
-      "--build=${buildPlatform.config}"
-      "--host=${hostPlatform.config}"
-      "--target=${targetPlatform.config}"
     ];
 
     postPatch = ''
@@ -104,6 +103,10 @@ let
         done
       '';
 
+    passthru = {
+      inherit prefix;
+    };
+
     meta = {
       homepage = "http://www.opensource.apple.com/source/cctools/";
       description = "Mac OS X Compiler Tools (cross-platform port)";
diff --git a/pkgs/os-specific/linux/alsa-lib/default.nix b/pkgs/os-specific/linux/alsa-lib/default.nix
index 3205275ff93a..8a6eb77e6b1e 100644
--- a/pkgs/os-specific/linux/alsa-lib/default.nix
+++ b/pkgs/os-specific/linux/alsa-lib/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "alsa-lib-1.1.2";
+  name = "alsa-lib-1.1.4.1";
 
   src = fetchurl {
     urls = [
      "ftp://ftp.alsa-project.org/pub/lib/${name}.tar.bz2"
      "http://alsa.cybermirror.org/lib/${name}.tar.bz2"
     ];
-    sha256 = "1mk1v2av6ibyydgr6f2mxrwy7clgnf0c68s9y2zvh1ibi7csr3fk";
+    sha256 = "0xjvi381105gldhv0z872a0x58sghznyx19j45lw5iyi2h68gfwi";
   };
 
   patches = [
diff --git a/pkgs/os-specific/linux/alsa-plugins/default.nix b/pkgs/os-specific/linux/alsa-plugins/default.nix
index 7f065a1b9b06..ae0aaa3cb638 100644
--- a/pkgs/os-specific/linux/alsa-plugins/default.nix
+++ b/pkgs/os-specific/linux/alsa-plugins/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchurl, lib, pkgconfig, alsaLib, libogg, libpulseaudio ? null, libjack2 ? null }:
 
 stdenv.mkDerivation rec {
-  name = "alsa-plugins-1.1.1";
+  name = "alsa-plugins-1.1.4";
 
   src = fetchurl {
     urls = [
       "ftp://ftp.alsa-project.org/pub/plugins/${name}.tar.bz2"
       "http://alsa.cybermirror.org/plugins/${name}.tar.bz2"
     ];
-    sha256 = "1w81z5jlwqhd1l2m7qrq69lc4k9dnrg1wn52jsl2hrf3hbhd394f";
+    sha256 = "12hsvm6rpinjkg06pa9hzndkdrbfw6wk6yk00cm8y1gbv8xiq3ak";
   };
 
   # ToDo: a52, etc.?
diff --git a/pkgs/os-specific/linux/alsa-tools/default.nix b/pkgs/os-specific/linux/alsa-tools/default.nix
index 51a60a27431b..23e1f430dec3 100644
--- a/pkgs/os-specific/linux/alsa-tools/default.nix
+++ b/pkgs/os-specific/linux/alsa-tools/default.nix
@@ -4,14 +4,14 @@
 
 stdenv.mkDerivation rec {
   name = "alsa-tools-${version}";
-  version = "1.1.0";
+  version = "1.1.3";
 
   src = fetchurl {
     urls = [
       "ftp://ftp.alsa-project.org/pub/tools/${name}.tar.bz2"
       "http://alsa.cybermirror.org/tools/${name}.tar.bz2"
     ];
-    sha256 = "0ldbaz3qr7z0639xg37ba7cmrb512rrjavap6r5jjl0ab665ad3x";
+    sha256 = "02b75fyfmm9m2iz59d3xa97cas4f697a4pzdxn1i64kjd36iv3yq";
   };
 
   buildInputs = [ alsaLib pkgconfig gtk2 gtk3 fltk13 ];
diff --git a/pkgs/os-specific/linux/alsa-utils/default.nix b/pkgs/os-specific/linux/alsa-utils/default.nix
index 3c2b53e0e3f1..4cb4af5ca724 100644
--- a/pkgs/os-specific/linux/alsa-utils/default.nix
+++ b/pkgs/os-specific/linux/alsa-utils/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   name = "alsa-utils-${version}";
-  version = "1.1.2";
+  version = "1.1.4";
 
   src = fetchurl {
     urls = [
       "ftp://ftp.alsa-project.org/pub/utils/${name}.tar.bz2"
       "http://alsa.cybermirror.org/utils/${name}.tar.bz2"
     ];
-    sha256 = "0wcha78c2sm8qqk5r3w83cvm8fp6fb1zpd35kmcm24kxhz007xks";
+    sha256 = "17cxih9ibjp1193dyd79j50pyfa9dvrs6r9kpwrvzicjvr2110x7";
   };
 
   patchPhase = ''
diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix
index e1ea8fa8fdd2..815e2e0f6ef6 100644
--- a/pkgs/os-specific/linux/busybox/default.nix
+++ b/pkgs/os-specific/linux/busybox/default.nix
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
     CONFIG_DEFAULT_SETFONT_DIR "/etc/kbd"
 
     ${extraConfig}
-    $extraCrossConfig
+    CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.prefix}"
     EOF
 
     make oldconfig
@@ -79,10 +79,6 @@ stdenv.mkDerivation rec {
 
   buildInputs = lib.optionals (enableStatic && !useMusl) [ stdenv.cc.libc stdenv.cc.libc.static ];
 
-  extraCrossConfig = if hostPlatform == buildPlatform then null else ''
-    CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.prefix}"
-  '';
-
   enableParallelBuilding = true;
 
   meta = with stdenv.lib; {
diff --git a/pkgs/os-specific/linux/iw/default.nix b/pkgs/os-specific/linux/iw/default.nix
index 53aa15ec62e6..2a6294e3b5b9 100644
--- a/pkgs/os-specific/linux/iw/default.nix
+++ b/pkgs/os-specific/linux/iw/default.nix
@@ -1,11 +1,11 @@
 {stdenv, fetchurl, libnl, pkgconfig}:
 
 stdenv.mkDerivation rec {
-  name = "iw-4.3";
+  name = "iw-4.9";
 
   src = fetchurl {
     url = "https://www.kernel.org/pub/software/network/iw/${name}.tar.xz";
-    sha256 = "085jyvrxzarvn5jl0fk618jjxy50nqx7ifngszc4jxk6a4ddibd6";
+    sha256 = "1klpvv98bnx1zm6aqalnri2vd7w80scmdaxr2qnblb6mz82whk1j";
   };
 
   buildInputs = [ libnl pkgconfig ];
diff --git a/pkgs/os-specific/linux/procps-ng/default.nix b/pkgs/os-specific/linux/procps-ng/default.nix
index bccae52c3675..2fcf6dbf3c00 100644
--- a/pkgs/os-specific/linux/procps-ng/default.nix
+++ b/pkgs/os-specific/linux/procps-ng/default.nix
@@ -23,6 +23,6 @@ stdenv.mkDerivation rec {
     description = "Utilities that give information about processes using the /proc filesystem";
     priority = 10; # less than coreutils, which also provides "kill" and "uptime"
     license = lib.licenses.gpl2;
-    platforms = lib.platforms.linux;
+    platforms = lib.platforms.linux ++ lib.platforms.cygwin;
   };
 }
diff --git a/pkgs/os-specific/linux/psmisc/default.nix b/pkgs/os-specific/linux/psmisc/default.nix
index 7209c44ff3c1..edc7220d6586 100644
--- a/pkgs/os-specific/linux/psmisc/default.nix
+++ b/pkgs/os-specific/linux/psmisc/default.nix
@@ -3,11 +3,11 @@
 assert stdenv.isLinux;
 
 stdenv.mkDerivation rec {
-  name = "psmisc-23.0";
+  name = "psmisc-23.1";
 
   src = fetchurl {
     url = "mirror://sourceforge/psmisc/${name}.tar.xz";
-    sha256 = "0k7hafh9388s3hh9j943jy1qk9g1c43j02nyk0xis0ngbs632lvm";
+    sha256 = "0c5s94hqpwfmyswx2f96gifa6wdbpxxpkyxcrlzbxpvmrxsd911f";
   };
 
   buildInputs = [ncurses];
diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix
index 79f63f8c27a3..8e16a3165f67 100644
--- a/pkgs/os-specific/linux/util-linux/default.nix
+++ b/pkgs/os-specific/linux/util-linux/default.nix
@@ -4,8 +4,8 @@
 let
   version = lib.concatStringsSep "." ([ majorVersion ]
     ++ lib.optional (patchVersion != "") patchVersion);
-  majorVersion = "2.29";
-  patchVersion = "2";
+  majorVersion = "2.30";
+  patchVersion = "";
 
   fstrimPatch = fetchpatch {
     url = "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/patch/?id=155d48f590a50bb5dc265162ff2f9a971daed543";
@@ -16,7 +16,7 @@ in stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://kernel/linux/utils/util-linux/v${majorVersion}/${name}.tar.xz";
-    sha256 = "1qz81w8vzrmy8xn9yx7ls4amkbgwx6vr62pl6kv9g7r0g3ba9kmc";
+    sha256 = "13d0ax8bcapga8phj2nclx86w57ddqxbr98ajibpzjq6d7zs8262";
   };
 
   patches = [
diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix
index 8a6d727a6964..50f4e6f2b410 100644
--- a/pkgs/os-specific/linux/zfs/default.nix
+++ b/pkgs/os-specific/linux/zfs/default.nix
@@ -123,7 +123,7 @@ in
     # to be adapted
     zfsStable = common {
       # comment/uncomment if breaking kernel versions are known
-      incompatibleKernelVersion = "4.12";
+      incompatibleKernelVersion = null;
 
       version = "0.6.5.10";
 
@@ -139,7 +139,7 @@ in
     };
     zfsUnstable = common {
       # comment/uncomment if breaking kernel versions are known
-      incompatibleKernelVersion = null;
+      incompatibleKernelVersion = "4.12";
 
       version = "0.7.0-rc4";
 
diff --git a/pkgs/servers/gpm/default.nix b/pkgs/servers/gpm/default.nix
index ac5e0b7c1b1c..e260ccfb761b 100644
--- a/pkgs/servers/gpm/default.nix
+++ b/pkgs/servers/gpm/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     homepage = http://www.nico.schottelius.org/software/gpm/;
     description = "A daemon that provides mouse support on the Linux console";
     license = licenses.gpl2;
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.cygwin;
     maintainers = with maintainers; [ eelco wkennington ];
   };
 }
diff --git a/pkgs/servers/mail/exim/default.nix b/pkgs/servers/mail/exim/default.nix
index bf7b5d8d6ed1..d503a4d7b571 100644
--- a/pkgs/servers/mail/exim/default.nix
+++ b/pkgs/servers/mail/exim/default.nix
@@ -1,4 +1,4 @@
-{ coreutils, fetchurl, db, openssl, pcre, perl, pkgconfig, stdenv }:
+{ coreutils, fetchurl, db, openssl, pcre, perl, pkgconfig, stdenv, fetchpatch }:
 
 stdenv.mkDerivation rec {
   name = "exim-4.89";
@@ -8,6 +8,14 @@ stdenv.mkDerivation rec {
     sha256 = "09lndv34jsxwglq5zsh9y4xaqj5g37g9ca4x0zb25fvvm4f0lj8c";
   };
 
+  patches = [
+    (fetchpatch {
+      name = "CVE-2017-1000369.patch";
+      url = "https://anonscm.debian.org/git/pkg-exim4/exim4.git/plain/debian/patches/79_CVE-2017-1000369.patch?h=4.89-2%2bdeb9u1";
+      sha256 = "0v46zywgkv1rdqhybqqrd0rwkdaj6q1f4x0a3vm9p0wz8vad3023";
+    })
+  ];
+
   buildInputs = [ coreutils db openssl pcre perl pkgconfig ];
 
   preBuild = ''
diff --git a/pkgs/servers/mail/postfix/default.nix b/pkgs/servers/mail/postfix/default.nix
index 9c72aa018989..bfdea71c5d78 100644
--- a/pkgs/servers/mail/postfix/default.nix
+++ b/pkgs/servers/mail/postfix/default.nix
@@ -3,6 +3,7 @@
 , withPgSQL ? false, postgresql
 , withMySQL ? false, libmysql
 , withSQLite ? false, sqlite
+, withLDAP ? false, openldap
 }:
 
 let
@@ -11,12 +12,14 @@ let
     "-DHAS_DB_BYPASS_MAKEDEFS_CHECK"
    ] ++ lib.optional withPgSQL "-DHAS_PGSQL"
      ++ lib.optionals withMySQL [ "-DHAS_MYSQL" "-I${lib.getDev libmysql}/include/mysql" ]
-     ++ lib.optional withSQLite "-DHAS_SQLITE");
+     ++ lib.optional withSQLite "-DHAS_SQLITE"
+     ++ lib.optional withLDAP "-DHAS_LDAP");
    auxlibs = lib.concatStringsSep " " ([
      "-ldb" "-lnsl" "-lresolv" "-lsasl2" "-lcrypto" "-lssl"
    ] ++ lib.optional withPgSQL "-lpq"
      ++ lib.optional withMySQL "-lmysqlclient"
-     ++ lib.optional withSQLite "-lsqlite3");
+     ++ lib.optional withSQLite "-lsqlite3"
+     ++ lib.optional withLDAP "-lldap");
 
 in stdenv.mkDerivation rec {
 
@@ -32,7 +35,8 @@ in stdenv.mkDerivation rec {
   buildInputs = [ makeWrapper gnused db openssl cyrus_sasl icu pcre ]
                 ++ lib.optional withPgSQL postgresql
                 ++ lib.optional withMySQL libmysql
-                ++ lib.optional withSQLite sqlite;
+                ++ lib.optional withSQLite sqlite
+                ++ lib.optional withLDAP openldap;
 
   hardeningDisable = [ "format" ];
   hardeningEnable = [ "pie" ];
diff --git a/pkgs/servers/unifi/default.nix b/pkgs/servers/unifi/default.nix
index 2ce0ba1d5f5c..7237bbdcd968 100644
--- a/pkgs/servers/unifi/default.nix
+++ b/pkgs/servers/unifi/default.nix
@@ -6,11 +6,11 @@
 
 stdenv.mkDerivation rec {
   name = "unifi-controller-${version}";
-  version = "5.5.11";
+  version = "5.5.19";
 
   src = fetchurl {
-    url = "https://www.ubnt.com/downloads/unifi/5.5.11-5107276ec2/unifi_sysvinit_all.deb";
-    sha256 = "1jsixz7g7h7fdwb512flcwk0vblrsxpg4i9jdz7r72bkmvnxk7mm";
+    url = "https://www.ubnt.com/downloads/unifi/${version}/unifi_sysvinit_all.deb";
+    sha256 = "0bsfq48xjp230ir8pm9wpa5p4dh88zfy51lbi2xwpr454371ixcl";
   };
 
   buildInputs = [ dpkg ];
diff --git a/pkgs/shells/bash/4.4.nix b/pkgs/shells/bash/4.4.nix
index e2defc2bf373..dba31e41ca37 100644
--- a/pkgs/shells/bash/4.4.nix
+++ b/pkgs/shells/bash/4.4.nix
@@ -23,7 +23,7 @@ let
     in
       import ./bash-4.4-patches.nix patch;
 
-  inherit (stdenv.lib) optional optionals;
+  inherit (stdenv.lib) optional optionals optionalString;
 in
 
 stdenv.mkDerivation rec {
@@ -52,8 +52,9 @@ stdenv.mkDerivation rec {
 
   patchFlags = "-p0";
 
-  patches = upstreamPatches
-      ++ optional hostPlatform.isCygwin ./cygwin-bash-4.3.33-1.src.patch;
+  patches = upstreamPatches;
+
+  postPatch = optionalString hostPlatform.isCygwin "patch -p2 < ${./cygwin-bash-4.4.11-2.src.patch}";
 
   configureFlags = [
     (if interactive then "--with-installed-readline" else "--disable-readline")
@@ -79,6 +80,11 @@ stdenv.mkDerivation rec {
   # build `version.h'.
   enableParallelBuilding = false;
 
+  makeFlags = optional hostPlatform.isCygwin [
+    "LOCAL_LDFLAGS=-Wl,--export-all,--out-implib,libbash.dll.a"
+    "SHOBJ_LIBS=-lbash"
+  ];
+
   postInstall = ''
     ln -s bash "$out/bin/sh"
     rm $out/lib/bash/Makefile.inc
diff --git a/pkgs/shells/bash/cygwin-bash-4.3.33-1.src.patch b/pkgs/shells/bash/cygwin-bash-4.3.33-1.src.patch
deleted file mode 100644
index e0959d0446a6..000000000000
--- a/pkgs/shells/bash/cygwin-bash-4.3.33-1.src.patch
+++ /dev/null
@@ -1,1393 +0,0 @@
---- bashline.c	2015-02-06 17:12:55.823275600 -0700
-+++ bashline.c	2015-02-06 17:14:11.000103800 -0700
-@@ -71,6 +71,16 @@
- #  include "pcomplete.h"
- #endif
- 
-+#if __CYGWIN__
-+#  ifdef __x86_64__
-+#    define IMP(x) __imp_##x
-+#  else
-+#    define IMP(x) _imp__##x
-+#  endif
-+#else
-+#  define IMP(x) x
-+#endif
-+
- /* These should agree with the defines for emacs_mode and vi_mode in
-    rldefs.h, even though that's not a public readline header file. */
- #ifndef EMACS_EDITING_MODE
-@@ -264,6 +274,11 @@ int no_empty_command_completion;
-    are the only possible matches, even if FIGNORE says to. */
- int force_fignore = 1;
- 
-+#if __CYGWIN__
-+/* If set, shorten "foo.exe" to "foo" when they are the same file.  */
-+int completion_strip_exe;
-+#endif /* __CYGWIN__ */
-+
- /* Perform spelling correction on directory names during word completion */
- int dircomplete_spelling = 0;
- 
-@@ -491,11 +506,12 @@ initialize_readline ()
-   kseq[0] = CTRL('J');
-   kseq[1] = '\0';
-   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
--  if (func == rl_vi_editing_mode)
-+  extern rl_command_func_t *IMP(rl_vi_editing_mode);
-+  if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode))
-     rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap);
-   kseq[0] = CTRL('M');
-   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
--  if (func == rl_vi_editing_mode)
-+  if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode))
-     rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap);
- #if defined (VI_MODE)
-   rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap);
-@@ -514,7 +530,8 @@ initialize_readline ()
-   kseq[0] = '~';
-   kseq[1] = '\0';
-   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
--  if (func == 0 || func == rl_tilde_expand)
-+  extern rl_command_func_t *IMP(rl_tilde_expand);
-+  if (func == 0 || func == rl_tilde_expand || func == IMP(rl_tilde_expand))
-     rl_bind_keyseq_in_map (kseq, bash_complete_username, emacs_meta_keymap);
- 
-   rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap);
-@@ -537,7 +554,8 @@ initialize_readline ()
-   kseq[0] = TAB;
-   kseq[1] = '\0';
-   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
--  if (func == 0 || func == rl_tab_insert)
-+  extern rl_command_func_t *IMP(rl_tab_insert);
-+  if (func == 0 || func == rl_tab_insert || func == IMP(rl_tab_insert))
-     rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap);
- 
-   /* Tell the completer that we want a crack first. */
-@@ -2109,6 +2127,21 @@ globword:
- 
-       if (match && executable_completion ((searching_path ? val : cval), searching_path))
- 	{
-+#if __CYGWIN__
-+          if (completion_strip_exe)
-+            {
-+              size_t val_len = strlen (val);
-+              char *candidate;
-+              if (val_len > 4 && !strcasecmp (&val[val_len - 4], ".exe")
-+                  && (candidate = strdup (val)))
-+                {
-+                  candidate[val_len - 4] = '\0';
-+                  if (same_file (val, candidate, NULL, NULL))
-+                    temp[strlen (temp) - 4] = '\0';
-+                  free (candidate);
-+                }
-+            }
-+#endif
- 	  if (cval != val)
- 	    free (cval);
- 	  free (val);
-@@ -2844,6 +2877,17 @@ test_for_directory (name)
-   int r;
- 
-   fn = bash_tilde_expand (name, 0);
-+#if __CYGWIN__
-+  /* stat("//server") can only be successful as a directory, but takes
-+     a several-second timeout to fail.  It is much faster to assume
-+     that //server is a valid name than it is to wait for the stat,
-+     even though it gives false positives on bad names.  */
-+  if (fn[0] == '/' && fn[1] == '/' && ! strchr (&fn[2], '/'))
-+    {
-+      free (fn);
-+      return 1;
-+    }
-+#endif /* __CYGWIN__ */
-   r = file_isdir (fn);
-   free (fn);
- 
---- builtins/evalstring.c	2015-02-06 17:12:55.682776800 -0700
-+++ builtins/evalstring.c	2015-02-06 17:14:11.015662800 -0700
-@@ -195,7 +195,7 @@ parse_and_execute (string, from_file, fl
-   int code, lreset;
-   volatile int should_jump_to_top_level, last_result;
-   COMMAND *volatile command;
--  volatile sigset_t pe_sigmask;
-+  sigset_t pe_sigmask;
- 
-   parse_prologue (string, flags, PE_TAG);
- 
-@@ -451,7 +451,7 @@ parse_string (string, from_file, flags,
-   volatile int should_jump_to_top_level;
-   COMMAND *volatile command, *oglobal;
-   char *ostring;
--  volatile sigset_t ps_sigmask;
-+  sigset_t ps_sigmask;
- 
-   parse_prologue (string, flags, PS_TAG);
- 
---- builtins/set.def	2013-04-19 05:20:34.000000000 -0600
-+++ builtins/set.def	2015-02-06 17:14:11.015662800 -0700
-@@ -56,6 +56,13 @@ extern int dont_save_function_defs;
- #if defined (READLINE)
- extern int no_line_editing;
- #endif /* READLINE */
-+#if __CYGWIN__
-+extern int igncr;
-+static int set_minus_o_option_maybe (int, const char *, int);
-+#  define INTERACTIVE_ONLY ,1
-+#else /* ! __CYGWIN__ */
-+#  define INTERACTIVE_ONLY
-+#endif
- 
- $BUILTIN set
- $FUNCTION set_builtin
-@@ -92,6 +99,9 @@ Options:
- #if defined (HISTORY)
-           history      enable command history
- #endif
-+#if __CYGWIN__
-+          igncr        on cygwin, ignore \r in line endings
-+#endif
-           ignoreeof    the shell will not exit upon reading EOF
-           interactive-comments
-                        allow comments to appear in interactive commands
-@@ -188,29 +198,41 @@ const struct {
-   int *variable;
-   setopt_set_func_t *set_func;
-   setopt_get_func_t *get_func;
-+#if __CYGWIN__
-+  /* Cygwin users have taken to exporting SHELLOPTS for the
-+     cygwin-specific igncr.  As a result, we need to make sure
-+     SHELLOPTS parsing does not turn on interactive options when
-+     exported from an interactive shell, but parsed in a
-+     non-interactive setting, since some interactive options violate
-+     POSIX /bin/sh rules.  */
-+  int interactive_only;
-+#endif /* __CYGWIN__ */
- } o_options[] = {
-   { "allexport",  'a', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
- #if defined (BRACE_EXPANSION)
-   { "braceexpand",'B', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
- #endif
- #if defined (READLINE)
--  { "emacs",     '\0', (int *)NULL, set_edit_mode, get_edit_mode },
-+  { "emacs",     '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY},
- #endif
-   { "errexit",	  'e', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
-   { "errtrace",	  'E', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
-   { "functrace",  'T', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
-   { "hashall",    'h', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
- #if defined (BANG_HISTORY)
--  { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
-+  { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY},
- #endif /* BANG_HISTORY */
- #if defined (HISTORY)
--  { "history",   '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL },
-+  { "history",   '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL INTERACTIVE_ONLY},
-+#endif
-+#if __CYGWIN__
-+  { "igncr", '\0', &igncr, NULL, (setopt_get_func_t *)NULL },
- #endif
-   { "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL },
-   { "interactive-comments", '\0', &interactive_comments, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
-   { "keyword",    'k', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
- #if defined (JOB_CONTROL)
--  { "monitor",	  'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
-+  { "monitor",	  'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY},
- #endif
-   { "noclobber",  'C', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
-   { "noexec",	  'n', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
-@@ -229,7 +251,7 @@ const struct {
-   { "privileged", 'p', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
-   { "verbose",	  'v', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
- #if defined (READLINE)
--  { "vi",        '\0', (int *)NULL, set_edit_mode, get_edit_mode },
-+  { "vi",        '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY},
- #endif
-   { "xtrace",	  'x', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
-   {(char *)NULL, 0 , (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
-@@ -416,6 +438,15 @@ int
- set_minus_o_option (on_or_off, option_name)
-      int on_or_off;
-      char *option_name;
-+#if __CYGWIN__
-+{
-+  /* See cygwin comments above.  */
-+  return set_minus_o_option_maybe (on_or_off, option_name, 0);
-+}
-+static int
-+set_minus_o_option_maybe (int on_or_off, const char *option_name,
-+			  int avoid_interactive)
-+#endif /* __CYGWIN__ */
- {
-   register int i;
- 
-@@ -423,6 +454,10 @@ set_minus_o_option (on_or_off, option_na
-     {
-       if (STREQ (option_name, o_options[i].name))
- 	{
-+#if __CYGWIN__
-+	  if (o_options[i].interactive_only && avoid_interactive)
-+	    return EXECUTION_SUCCESS;
-+#endif /* __CYGWIN__ */
- 	  if (o_options[i].letter == 0)
- 	    {
- 	      SET_BINARY_O_OPTION_VALUE (i, on_or_off, option_name);
-@@ -548,7 +583,11 @@ parse_shellopts (value)
-   vptr = 0;
-   while (vname = extract_colon_unit (value, &vptr))
-     {
-+#if __CYGWIN__
-+      set_minus_o_option_maybe (FLAG_ON, vname, !interactive_shell);
-+#else /* !__CYGWIN__ */
-       set_minus_o_option (FLAG_ON, vname);
-+#endif
-       free (vname);
-     }
- }
---- builtins/shopt.def	2013-02-27 07:43:20.000000000 -0700
-+++ builtins/shopt.def	2015-02-06 17:14:11.015662800 -0700
-@@ -91,6 +91,11 @@ extern int glob_star;
- extern int glob_asciirange;
- extern int lastpipe_opt;
- 
-+#if __CYGWIN__
-+extern int completion_strip_exe;
-+#endif
-+
-+
- #if defined (EXTENDED_GLOB)
- extern int extended_glob;
- #endif
-@@ -161,6 +166,9 @@ static struct {
-   { "compat40", &shopt_compat40, set_compatibility_level },
-   { "compat41", &shopt_compat41, set_compatibility_level },
-   { "compat42", &shopt_compat41, set_compatibility_level },
-+#if __CYGWIN__
-+  { "completion_strip_exe", &completion_strip_exe, NULL },
-+#endif
- #if defined (READLINE)
-   { "complete_fullquote", &complete_fullquote, (shopt_set_func_t *)NULL},
-   { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand },
---- config-top.h	2012-08-18 18:51:30.000000000 -0600
-+++ config-top.h	2015-02-06 17:14:11.015662800 -0700
-@@ -80,10 +80,10 @@
- #define KSH_COMPATIBLE_SELECT
- 
- /* System-wide .bashrc file for interactive shells. */
--/* #define SYS_BASHRC "/etc/bash.bashrc" */
-+#define SYS_BASHRC "/etc/bash.bashrc"
- 
- /* System-wide .bash_logout for login shells. */
--/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
-+#define SYS_BASH_LOGOUT "/etc/bash.bash_logout"
- 
- /* Define this to make non-interactive shells begun with argv[0][0] == '-'
-    run the startup files when not in posix mode. */
-@@ -93,7 +93,7 @@
-    sshd and source the .bashrc if so (like the rshd behavior).  This checks
-    for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment,
-    which can be fooled under certain not-uncommon circumstances. */
--/* #define SSH_SOURCE_BASHRC */
-+#define SSH_SOURCE_BASHRC
- 
- /* Define if you want the case-capitalizing operators (~[~]) and the
-    `capcase' variable attribute (declare -c). */
---- doc/Makefile.in	2013-10-30 14:18:12.000000000 -0600
-+++ doc/Makefile.in	2015-02-06 17:14:11.015662800 -0700
-@@ -176,7 +176,7 @@ bashref.html: $(BASHREF_FILES) $(HSUSER)
- 	$(TEXI2HTML) -menu -monolithic -I $(TEXINPUTDIR) $(srcdir)/bashref.texi
- 
- bash.info: bashref.info
--	${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \
-+	${SHELL} ${INFOPOST} < bashref.info > $@ ; \
- 
- bash.txt: bash.1
- bash.ps: bash.1
-@@ -237,9 +237,9 @@ install: info installdirs bash.info
- 	-$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext}
- 	-$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
- # uncomment the next lines to install the builtins man page
--#	sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
--#	-$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
--#	-$(RM) $${TMPDIR:-/var/tmp}/builtins.1
-+	sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
-+	-$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
-+	-$(RM) $${TMPDIR:-/var/tmp}/builtins.1
- 	-if test -f bash.info; then d=.; else d=$(srcdir); fi; \
- 	  $(INSTALL_DATA) $$d/bash.info $(DESTDIR)$(infodir)/bash.info
- # run install-info if it is present to update the info directory
---- doc/bash.1	2014-02-06 07:03:52.000000000 -0700
-+++ doc/bash.1	2015-02-06 17:14:11.015662800 -0700
-@@ -1658,6 +1658,14 @@ subsequently reset.
- Expands to the effective user ID of the current user, initialized at
- shell startup.  This variable is readonly.
- .TP
-+.B EXECIGNORE
-+A colon-separated list of extended glob (see \fBPattern Matching\fP)
-+patterns. Files with full paths matching one of these patterns are
-+not considered executable for the purposes of completion and PATH
-+searching, but the \fB[\fP, \fB[[\fP, and \fBtest\fP builtins are not
-+affected. Use this variable to deal with systems that set the
-+executable bit on files that are not actually executable.
-+.TP
- .B FUNCNAME
- An array variable containing the names of all shell functions
- currently in the execution call stack.
-@@ -3308,6 +3316,10 @@ the character
- .B ``.''
- at the start of a name or immediately following a slash
- must be matched explicitly, unless the shell option
-+.B completion_strip_exe
-+If set, whenever bash sees `foo.exe' during completion, it checks if
-+`foo' is the same file and strips the suffix.
-+.TP 8
- .B dotglob
- is set.
- When matching a pathname, the slash character must always be
---- doc/bashref.texi	2014-02-22 11:20:36.000000000 -0700
-+++ doc/bashref.texi	2015-02-06 17:14:11.015662800 -0700
-@@ -4992,6 +4992,10 @@ filenames.
- This variable is set by default, which is the default Bash behavior in
- versions through 4.2.
- 
-+@item completion_strip_exe
-+If set, whenever bash sees `foo.exe' during completion, it checks if
-+`foo' is the same file and strips the suffix.
-+
- @item direxpand
- If set, Bash
- replaces directory names with the results of word expansion when performing
-@@ -5578,6 +5582,14 @@ Similar to @code{BASH_ENV}; used when th
- The numeric effective user id of the current user.  This variable
- is readonly.
- 
-+@item EXECIGNORE
-+A colon-separated list of extended glob ((@pxref{Pattern Matching})
-+patterns. Files with full paths matching one of these patterns are
-+not considered executable for the purposes of completion and PATH
-+searching, but the @code{[}, @code{[[}, and @code{test} builtins are
-+not affected. Use this variable to deal with systems that set the
-+executable bit on files that are not actually executable.
-+
- @item FCEDIT
- The editor used as a default by the @option{-e} option to the @code{fc}
- builtin command.
---- doc/builtins.1	2012-02-21 12:32:05.000000000 -0700
-+++ doc/builtins.1	2015-02-06 17:14:11.031260100 -0700
-@@ -19,6 +19,6 @@ shift, shopt, source, suspend, test, tim
- ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1)
- .SH BASH BUILTIN COMMANDS
- .nr zZ 1
--.so bash.1
-+.so man1/bash.1
- .SH SEE ALSO
- bash(1), sh(1)
---- execute_cmd.c	2015-02-06 17:12:55.261573700 -0700
-+++ execute_cmd.c	2015-02-06 17:14:11.031260100 -0700
-@@ -58,6 +58,7 @@ extern int errno;
- #endif
- 
- #define NEED_FPURGE_DECL
-+#define NEED_SH_SETLINEBUF_DECL		/* used in externs.h */
- 
- #include "bashansi.h"
- #include "bashintl.h"
---- expr.c	2014-01-03 06:55:00.000000000 -0700
-+++ expr.c	2015-02-06 17:14:11.031260100 -0700
-@@ -83,6 +83,7 @@
- 
- #include "shell.h"
- #include "typemax.h"		/* INTMAX_MAX, INTMAX_MIN */
-+#define exp2 exp2_
- 
- /* Because of the $((...)) construct, expressions may include newlines.
-    Here is a macro which accepts newlines, tabs and spaces as whitespace. */
---- findcmd.c	2012-10-15 05:45:04.000000000 -0600
-+++ findcmd.c	2015-02-06 17:14:11.031260100 -0700
-@@ -48,6 +48,8 @@
- extern int errno;
- #endif
- 
-+#include <glob/strmatch.h>
-+
- extern int posixly_correct;
- extern int last_command_exit_value;
- 
-@@ -77,6 +79,38 @@ int check_hashed_filenames;
-    containing the file of interest. */
- int dot_found_in_search = 0;
- 
-+static struct ignorevar execignore =
-+{
-+  "EXECIGNORE",
-+  (struct ign *)0,
-+  0,
-+  (char *)0,
-+  (sh_iv_item_func_t *)0,
-+};
-+
-+void
-+setup_exec_ignore (char *varname)
-+{
-+  setup_ignore_patterns (&execignore);
-+}
-+
-+/* Return whether we should never consider file executable
-+ * even if the system tells us it is. */
-+static int
-+is_on_exec_blacklist (char *name)
-+{
-+  struct ign *p;
-+  int flags = FNM_EXTMATCH | FNM_CASEFOLD;
-+
-+  for (p = execignore.ignores; p && p->val; p++)
-+    {
-+      if (strmatch (p->val, (char *)name, flags) != FNM_NOMATCH)
-+      return (1);
-+    }
-+
-+  return (0);
-+}
-+
- /* Return some flags based on information about this file.
-    The EXISTS bit is non-zero if the file is found.
-    The EXECABLE bit is non-zero the file is executble.
-@@ -104,7 +138,7 @@ file_status (name)
-      file access mechanisms into account.  eaccess uses the effective
-      user and group IDs, not the real ones.  We could use sh_eaccess,
-      but we don't want any special treatment for /dev/fd. */
--  if (eaccess (name, X_OK) == 0)
-+  if (!is_on_exec_blacklist (name) && eaccess (name, X_OK) == 0)
-     r |= FS_EXECABLE;
-   if (eaccess (name, R_OK) == 0)
-     r |= FS_READABLE;
---- findcmd.h	2012-01-14 16:56:25.000000000 -0700
-+++ findcmd.h	2015-02-06 17:14:11.031260100 -0700
-@@ -31,5 +31,6 @@ extern char *find_user_command __P((cons
- extern char *find_path_file __P((const char *));
- extern char *search_for_command __P((const char *, int));
- extern char *user_command_matches __P((const char *, int, int));
-+extern void setup_exec_ignore __P((char *));
- 
- #endif /* _FINDCMD_H_ */
---- general.c	2014-01-30 14:46:15.000000000 -0700
-+++ general.c	2015-02-06 17:14:11.031260100 -0700
-@@ -44,6 +44,10 @@
- 
- #include <tilde/tilde.h>
- 
-+#ifdef __CYGWIN__
-+# include <sys/cygwin.h>
-+#endif
-+
- #if !defined (errno)
- extern int errno;
- #endif /* !errno */
-@@ -632,7 +636,8 @@ make_absolute (string, dot_path)
-     {
-       char pathbuf[PATH_MAX + 1];
- 
--      cygwin_conv_to_full_posix_path (string, pathbuf);
-+      cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, string, pathbuf,
-+			sizeof pathbuf);
-       result = savestring (pathbuf);
-     }
- #else
---- include/chartypes.h	2011-04-11 12:30:52.000000000 -0600
-+++ include/chartypes.h	2015-02-06 17:14:11.031260100 -0700
-@@ -40,6 +40,7 @@
- #else
- #  define IN_CTYPE_DOMAIN(c) isascii(c)
- #endif
-+#define to_uchar(c) ((unsigned char)(c))
- 
- #if !defined (isspace) && !defined (HAVE_ISSPACE)
- #  define isspace(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\f')
-@@ -67,16 +68,16 @@
- 
- #undef ISPRINT
- 
--#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
--#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
--#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
--#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
--#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
--#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
--#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c))
--#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
--#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
--#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
-+#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (to_uchar (c)))
-+#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit (to_uchar (c)))
-+#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (to_uchar (c)))
-+#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (to_uchar (c)))
-+#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (to_uchar (c)))
-+#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (to_uchar (c)))
-+#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (to_uchar (c)))
-+#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (to_uchar (c)))
-+#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (to_uchar (c)))
-+#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (to_uchar (c)))
- 
- #define ISLETTER(c)	(ISALPHA(c))
- 
---- include/posixjmp.h	2012-12-23 20:20:50.000000000 -0700
-+++ include/posixjmp.h	2015-02-06 17:14:11.031260100 -0700
-@@ -27,13 +27,13 @@
- 
- #if defined (HAVE_POSIX_SIGSETJMP)
- #  define procenv_t	sigjmp_buf
--#  if !defined (__OPENNT)
-+#  if !defined (__OPENNT) && !defined __CYGWIN__
- #    undef setjmp
- #    define setjmp(x)	sigsetjmp((x), 1)
--#    define setjmp_nosigs(x)	sigsetjmp((x), 0)
- #    undef longjmp
- #    define longjmp(x, n)	siglongjmp((x), (n))
- #  endif /* !__OPENNT */
-+#  define setjmp_nosigs(x)	sigsetjmp((x), 0)
- #else
- #  define procenv_t	jmp_buf
- #  define setjmp_nosigs	setjmp
---- input.c	2014-02-07 07:13:08.000000000 -0700
-+++ input.c	2015-02-06 17:14:11.031260100 -0700
-@@ -44,6 +44,10 @@
- #include "quit.h"
- #include "trap.h"
- 
-+#if __CYGWIN__
-+int igncr;
-+#endif
-+
- #if !defined (errno)
- extern int errno;
- #endif /* !errno */
-@@ -561,6 +565,19 @@ buffered_getchar ()
- {
-   CHECK_TERMSIG;
- 
-+#if __CYGWIN__
-+  /* shopt igncr means to discard carriage returns from input stream.
-+     If cr is the only character in the buffer, then recurse to pick
-+     up the next character; otherwise flatten the buffer.  */
-+  if (igncr)
-+    {
-+      int ch;
-+      while ((ch = bufstream_getc (buffers[bash_input.location.buffered_fd]))
-+	     == '\r')
-+	;
-+      return ch;
-+    }
-+#endif /* __CYGWIN__ */
- #if !defined (DJGPP)
-   return (bufstream_getc (buffers[bash_input.location.buffered_fd]));
- #else
---- lib/readline/bind.c	2013-04-06 15:46:38.000000000 -0600
-+++ lib/readline/bind.c	2015-02-06 17:14:11.031260100 -0700
-@@ -452,7 +452,7 @@ rl_translate_keyseq (seq, array, len)
- {
-   register int i, c, l, temp;
- 
--  for (i = l = 0; c = seq[i]; i++)
-+  for (i = l = 0; (c = seq[i]); i++)
-     {
-       if (c == '\\')
- 	{
-@@ -1210,7 +1210,7 @@ _rl_skip_to_delim (string, start, delim)
- {
-   int i, c, passc;
- 
--  for (i = start,passc = 0; c = string[i]; i++)
-+  for (i = start,passc = 0; (c = string[i]); i++)
-     {
-       if (passc)
- 	{
-@@ -1297,7 +1297,6 @@ rl_parse_and_bind (string)
-   if (_rl_stricmp (string, "set") == 0)
-     {
-       char *var, *value, *e;
--      int s;
- 
-       var = string + i;
-       /* Make VAR point to start of variable name. */
-@@ -2198,7 +2197,7 @@ rl_function_dumper (print_readably)
- 
-   fprintf (rl_outstream, "\n");
- 
--  for (i = 0; name = names[i]; i++)
-+  for (i = 0; (name = names[i]); i++)
-     {
-       rl_command_func_t *function;
-       char **invokers;
---- lib/readline/chardefs.h	2011-07-25 19:47:56.000000000 -0600
-+++ lib/readline/chardefs.h	2015-02-06 17:14:11.046889800 -0700
-@@ -71,6 +71,7 @@
- #else
- #  define IN_CTYPE_DOMAIN(c) isascii(c)
- #endif
-+#define to_uchar(c) ((unsigned char)(c))
- 
- #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus)
- #  define isxdigit(c)   (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
-@@ -87,13 +88,13 @@
- 
- /* Beware:  these only work with single-byte ASCII characters. */
- 
--#define ISALNUM(c)	(IN_CTYPE_DOMAIN (c) && isalnum (c))
--#define ISALPHA(c)	(IN_CTYPE_DOMAIN (c) && isalpha (c))
--#define ISDIGIT(c)	(IN_CTYPE_DOMAIN (c) && isdigit (c))
--#define ISLOWER(c)	(IN_CTYPE_DOMAIN (c) && islower (c))
--#define ISPRINT(c)	(IN_CTYPE_DOMAIN (c) && isprint (c))
--#define ISUPPER(c)	(IN_CTYPE_DOMAIN (c) && isupper (c))
--#define ISXDIGIT(c)	(IN_CTYPE_DOMAIN (c) && isxdigit (c))
-+#define ISALNUM(c)	(IN_CTYPE_DOMAIN (c) && isalnum (to_uchar (c)))
-+#define ISALPHA(c)	(IN_CTYPE_DOMAIN (c) && isalpha (to_uchar (c)))
-+#define ISDIGIT(c)	(IN_CTYPE_DOMAIN (c) && isdigit (to_uchar (c)))
-+#define ISLOWER(c)	(IN_CTYPE_DOMAIN (c) && islower (to_uchar (c)))
-+#define ISPRINT(c)	(IN_CTYPE_DOMAIN (c) && isprint (to_uchar (c)))
-+#define ISUPPER(c)	(IN_CTYPE_DOMAIN (c) && isupper (to_uchar (c)))
-+#define ISXDIGIT(c)	(IN_CTYPE_DOMAIN (c) && isxdigit (to_uchar (c)))
- 
- #define _rl_lowercase_p(c)	(NON_NEGATIVE(c) && ISLOWER(c))
- #define _rl_uppercase_p(c)	(NON_NEGATIVE(c) && ISUPPER(c))
---- lib/readline/complete.c	2013-10-14 07:27:10.000000000 -0600
-+++ lib/readline/complete.c	2015-02-06 17:14:11.046889800 -0700
-@@ -1082,7 +1082,7 @@ _rl_find_completion_word (fp, dp)
-       /* We didn't find an unclosed quoted substring upon which to do
-          completion, so use the word break characters to find the
-          substring on which to complete. */
--      while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
-+      while ((rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)))
- 	{
- 	  scan = rl_line_buffer[rl_point];
- 
-@@ -2116,7 +2116,7 @@ rl_completion_matches (text, entry_funct
-   match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
-   match_list[1] = (char *)NULL;
- 
--  while (string = (*entry_function) (text, matches))
-+  while ((string = (*entry_function) (text, matches)))
-     {
-       if (RL_SIG_RECEIVED ())
- 	{
-@@ -2190,7 +2190,7 @@ rl_username_completion_function (text, s
-     }
- 
- #if defined (HAVE_GETPWENT)
--  while (entry = getpwent ())
-+  while ((entry = getpwent ()))
-     {
-       /* Null usernames should result in all users as possible completions. */
-       if (namelen == 0 || (STREQN (username, entry->pw_name, namelen)))
-@@ -2723,7 +2723,7 @@ rl_menu_complete (count, ignore)
-   static int full_completion = 0;	/* set to 1 if menu completion should reinitialize on next call */
-   static int orig_start, orig_end;
-   static char quote_char;
--  static int delimiter, cstate;
-+  static int delimiter;
- 
-   /* The first time through, we generate the list of matches and set things
-      up to insert them. */
---- lib/readline/display.c	2015-02-06 17:12:54.793574600 -0700
-+++ lib/readline/display.c	2015-02-06 17:14:11.046889800 -0700
-@@ -66,7 +66,6 @@ extern char *strchr (), *strrchr ();
- static void update_line PARAMS((char *, char *, int, int, int, int));
- static void space_to_eol PARAMS((int));
- static void delete_chars PARAMS((int));
--static void insert_some_chars PARAMS((char *, int, int));
- static void open_some_spaces PARAMS((int));
- static void cr PARAMS((void));
- 
-@@ -1314,7 +1313,7 @@ update_line (old, new, current_line, oma
-      int current_line, omax, nmax, inv_botlin;
- {
-   register char *ofd, *ols, *oe, *nfd, *nls, *ne;
--  int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
-+  int temp, lendiff, wsatend, od, nd, o_cpos;
-   int current_invis_chars;
-   int col_lendiff, col_temp;
-   int bytes_to_insert;
-@@ -2485,6 +2484,7 @@ _rl_clear_screen ()
- #endif /* __DJGPP__ */
- }
- 
-+#if 0
- /* Insert COUNT characters from STRING to the output stream at column COL. */
- static void
- insert_some_chars (string, count, col)
-@@ -2494,6 +2494,7 @@ insert_some_chars (string, count, col)
-   open_some_spaces (col);
-   _rl_output_some_chars (string, count);
- }
-+#endif
- 
- /* Insert COL spaces, keeping the cursor at the same position.  We follow the
-    ncurses documentation and use either im/ei with explicit spaces, or IC/ic
---- lib/readline/histexpand.c	2013-12-02 07:22:30.000000000 -0700
-+++ lib/readline/histexpand.c	2015-02-06 17:14:11.046889800 -0700
-@@ -204,7 +204,7 @@ get_history_event (string, caller_index,
-     }
- 
-   /* Only a closing `?' or a newline delimit a substring search string. */
--  for (local_index = i; c = string[i]; i++)
-+  for (local_index = i; (c = string[i]); i++)
-     {
- #if defined (HANDLE_MULTIBYTE)
-       if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
-@@ -677,7 +677,7 @@ history_expand_internal (string, start,
- 	case 's':
- 	  {
- 	    char *new_event;
--	    int delimiter, failed, si, l_temp, ws, we;
-+	    int delimiter, failed, si, l_temp, we;
- 
- 	    if (c == 's')
- 	      {
-@@ -776,7 +776,6 @@ history_expand_internal (string, start,
- 		  {
- 		    for (; temp[si] && whitespace (temp[si]); si++)
- 		      ;
--		    ws = si;
- 		    we = history_tokenize_word (temp, si);
- 		  }
- 
---- lib/readline/histfile.c	2013-07-19 06:17:17.000000000 -0600
-+++ lib/readline/histfile.c	2015-02-06 17:14:11.046889800 -0700
-@@ -104,7 +104,7 @@ int history_write_timestamps = 0;
- 
- /* Does S look like the beginning of a history timestamp entry?  Placeholder
-    for more extensive tests. */
--#define HIST_TIMESTAMP_START(s)		(*(s) == history_comment_char && isdigit ((s)[1]) )
-+#define HIST_TIMESTAMP_START(s)		(*(s) == history_comment_char && isdigit ((unsigned char) (s)[1]) )
- 
- /* Return the string that should be used in the place of this
-    filename.  This only matters when you don't specify the
---- lib/readline/input.c	2015-02-06 17:12:55.027577800 -0700
-+++ lib/readline/input.c	2015-02-06 17:14:11.046889800 -0700
-@@ -431,7 +431,7 @@ rl_read_key ()
-   else
-     {
-       /* If input is coming from a macro, then use that. */
--      if (c = _rl_next_macro_key ())
-+      if ((c = _rl_next_macro_key ()))
- 	return (c);
- 
-       /* If the user has an event function, then call it periodically. */
---- lib/readline/isearch.c	2013-10-14 07:08:40.000000000 -0600
-+++ lib/readline/isearch.c	2015-02-06 17:14:11.046889800 -0700
-@@ -740,7 +740,7 @@ rl_search_history (direction, invoking_k
-      int direction, invoking_key;
- {
-   _rl_search_cxt *cxt;		/* local for now, but saved globally */
--  int c, r;
-+  int r;
- 
-   RL_SETSTATE(RL_STATE_ISEARCH);
-   cxt = _rl_isearch_init (direction);
-@@ -755,7 +755,7 @@ rl_search_history (direction, invoking_k
-   r = -1;
-   for (;;)
-     {
--      c = _rl_search_getchar (cxt);
-+      _rl_search_getchar (cxt);
-       /* We might want to handle EOF here (c == 0) */
-       r = _rl_isearch_dispatch (cxt, cxt->lastc);
-       if (r <= 0)
-@@ -778,9 +778,9 @@ int
- _rl_isearch_callback (cxt)
-      _rl_search_cxt *cxt;
- {
--  int c, r;
-+  int r;
- 
--  c = _rl_search_getchar (cxt);
-+  _rl_search_getchar (cxt);
-   /* We might want to handle EOF here */
-   r = _rl_isearch_dispatch (cxt, cxt->lastc);
- 
---- lib/readline/misc.c	2015-02-06 17:12:55.230384200 -0700
-+++ lib/readline/misc.c	2015-02-06 17:14:11.046889800 -0700
-@@ -455,7 +455,7 @@ _rl_revert_all_lines ()
-   entry = (hpos == history_length) ? previous_history () : current_history ();
-   while (entry)
-     {
--      if (ul = (UNDO_LIST *)entry->data)
-+      if ((ul = (UNDO_LIST *)entry->data))
- 	{
- 	  if (ul == saved_undo_list)
- 	    saved_undo_list = 0;
-@@ -502,7 +502,7 @@ rl_clear_history ()
-   for (i = 0; i < history_length; i++)
-     {
-       hent = hlist[i];
--      if (ul = (UNDO_LIST *)hent->data)
-+      if ((ul = (UNDO_LIST *)hent->data))
- 	{
- 	  if (ul == saved_undo_list)
- 	    saved_undo_list = 0;
---- lib/readline/nls.c	2013-03-09 12:51:10.000000000 -0700
-+++ lib/readline/nls.c	2015-02-06 17:14:11.046889800 -0700
-@@ -80,7 +80,7 @@ static char *legal_lang_values[] =
- static char *normalize_codeset PARAMS((char *));
- #endif /* !HAVE_SETLOCALE */
- 
--static char *find_codeset PARAMS((char *, size_t *));
-+static char *find_codeset PARAMS((char *, size_t *)) __attribute__ ((__unused__));
- 
- static char *_rl_get_locale_var PARAMS((const char *));
- 
-@@ -104,12 +104,13 @@ utf8locale (lspec)
-      char *lspec;
- {
-   char *cp;
--  size_t len;
- 
- #if HAVE_LANGINFO_CODESET
-   cp = nl_langinfo (CODESET);
-   return (STREQ (cp, "UTF-8") || STREQ (cp, "utf8"));
- #else
-+  size_t len;
-+
-   cp = find_codeset (lspec, &len);
- 
-   if (cp == 0 || len < 4 || len > 5)
---- lib/readline/parens.c	2009-04-19 11:12:06.000000000 -0600
-+++ lib/readline/parens.c	2015-02-06 17:14:11.046889800 -0700
-@@ -106,7 +106,7 @@ rl_insert_close (count, invoking_key)
-   else
-     {
- #if defined (HAVE_SELECT)
--      int orig_point, match_point, ready;
-+      int orig_point, match_point;
-       struct timeval timer;
-       fd_set readfds;
- 
-@@ -126,7 +126,7 @@ rl_insert_close (count, invoking_key)
-       orig_point = rl_point;
-       rl_point = match_point;
-       (*rl_redisplay_function) ();
--      ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
-+      select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
-       rl_point = orig_point;
- #else /* !HAVE_SELECT */
-       _rl_insert_char (count, invoking_key);
---- lib/readline/posixjmp.h	2012-12-23 20:20:50.000000000 -0700
-+++ lib/readline/posixjmp.h	2015-02-06 17:14:11.046889800 -0700
-@@ -27,13 +27,13 @@
- 
- #if defined (HAVE_POSIX_SIGSETJMP)
- #  define procenv_t	sigjmp_buf
--#  if !defined (__OPENNT)
-+#  if !defined (__OPENNT) && !defined __CYGWIN__
- #    undef setjmp
- #    define setjmp(x)	sigsetjmp((x), 1)
--#    define setjmp_nosigs(x)	sigsetjmp((x), 0)
- #    undef longjmp
- #    define longjmp(x, n)	siglongjmp((x), (n))
- #  endif /* !__OPENNT */
-+#  define setjmp_nosigs(x)	sigsetjmp((x), 0)
- #else
- #  define procenv_t	jmp_buf
- #  define setjmp_nosigs	setjmp
---- lib/readline/readline.c	2015-02-06 17:12:54.310964200 -0700
-+++ lib/readline/readline.c	2015-02-06 17:14:11.046889800 -0700
-@@ -95,7 +95,7 @@ static void bind_arrow_keys_internal PAR
- static void bind_arrow_keys PARAMS((void));
- 
- static void readline_default_bindings PARAMS((void));
--static void reset_default_bindings PARAMS((void));
-+//static void reset_default_bindings PARAMS((void));
- 
- static int _rl_subseq_result PARAMS((int, Keymap, int, int));
- static int _rl_subseq_getchar PARAMS((int));
-@@ -522,7 +522,7 @@ readline_internal_char ()
- readline_internal_charloop ()
- #endif
- {
--  static int lastc, eof_found;
-+  static int lastc, eof_found __attribute__((unused));
-   int c, code, lk;
- 
-   lastc = -1;
-@@ -1204,6 +1204,7 @@ readline_default_bindings ()
-     rl_tty_set_default_bindings (_rl_keymap);
- }
- 
-+#if 0
- /* Reset the default bindings for the terminal special characters we're
-    interested in back to rl_insert and read the new ones. */
- static void
-@@ -1215,6 +1216,7 @@ reset_default_bindings ()
-       rl_tty_set_default_bindings (_rl_keymap);
-     }
- }
-+#endif
- 
- /* Bind some common arrow key sequences in MAP. */
- static void
---- lib/readline/rltty.c	2013-08-25 14:57:05.000000000 -0600
-+++ lib/readline/rltty.c	2015-02-06 17:14:11.062454900 -0700
-@@ -30,6 +30,7 @@
- #include <signal.h>
- #include <errno.h>
- #include <stdio.h>
-+#include <sys/ioctl.h>
- 
- #if defined (HAVE_UNISTD_H)
- #  include <unistd.h>
---- lib/readline/shell.c	2013-03-13 08:17:00.000000000 -0600
-+++ lib/readline/shell.c	2015-02-06 17:14:11.062454900 -0700
-@@ -123,8 +123,10 @@ sh_single_quote (string)
- /* Set the environment variables LINES and COLUMNS to lines and cols,
-    respectively. */
- static char setenv_buf[INT_STRLEN_BOUND (int) + 1];
-+#  if !defined (HAVE_SETENV) && defined (HAVE_PUTENV)
- static char putenv_buf1[INT_STRLEN_BOUND (int) + 6 + 1];	/* sizeof("LINES=") == 6 */
- static char putenv_buf2[INT_STRLEN_BOUND (int) + 8 + 1];	/* sizeof("COLUMNS=") == 8 */
-+#  endif
- 
- void
- sh_set_lines_and_columns (lines, cols)
---- lib/readline/signals.c	2014-01-10 13:06:48.000000000 -0700
-+++ lib/readline/signals.c	2015-02-06 17:14:11.062454900 -0700
-@@ -576,7 +576,6 @@ rl_free_line_state ()
- /* **************************************************************** */
- 
- #if defined (HAVE_POSIX_SIGNALS)
--static sigset_t sigint_set, sigint_oset;
- static sigset_t sigwinch_set, sigwinch_oset;
- #else /* !HAVE_POSIX_SIGNALS */
- #  if defined (HAVE_BSD_SIGNALS)
---- lib/readline/terminal.c	2013-09-18 07:12:01.000000000 -0600
-+++ lib/readline/terminal.c	2015-02-06 17:14:11.062454900 -0700
-@@ -31,6 +31,7 @@
- #if defined (HAVE_SYS_FILE_H)
- #  include <sys/file.h>
- #endif /* HAVE_SYS_FILE_H */
-+#include <sys/ioctl.h>
- 
- #if defined (HAVE_UNISTD_H)
- #  include <unistd.h>
---- lib/readline/text.c	2013-10-14 07:25:05.000000000 -0600
-+++ lib/readline/text.c	2015-02-06 17:14:11.062454900 -0700
-@@ -859,11 +859,10 @@ _rl_overwrite_char (count, c)
-   int i;
- #if defined (HANDLE_MULTIBYTE)
-   char mbkey[MB_LEN_MAX];
--  int k;
- 
-   /* Read an entire multibyte character sequence to insert COUNT times. */
-   if (count > 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0)
--    k = _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
-+    _rl_read_mbstring (c, mbkey, MB_LEN_MAX);
- #endif
- 
-   rl_begin_undo_group ();
---- lib/readline/tilde.c	2010-07-25 15:42:13.000000000 -0600
-+++ lib/readline/tilde.c	2015-02-06 17:14:11.062454900 -0700
-@@ -196,7 +196,7 @@ tilde_expand (string)
-   int result_size, result_index;
- 
-   result_index = result_size = 0;
--  if (result = strchr (string, '~'))
-+  if ((result = strchr (string, '~')))
-     result = (char *)xmalloc (result_size = (strlen (string) + 16));
-   else
-     result = (char *)xmalloc (result_size = (strlen (string) + 1));
---- lib/readline/undo.c	2014-02-02 13:47:46.000000000 -0700
-+++ lib/readline/undo.c	2015-02-06 17:14:11.062454900 -0700
-@@ -124,7 +124,7 @@ _rl_free_undo_list (ul)
- void
- rl_free_undo_list ()
- {
--  UNDO_LIST *release, *orig_list;
-+  UNDO_LIST *orig_list;
- 
-   orig_list = rl_undo_list;
-   _rl_free_undo_list (rl_undo_list);
---- lib/readline/vi_mode.c	2012-09-01 16:55:30.000000000 -0600
-+++ lib/readline/vi_mode.c	2015-02-06 17:14:11.062454900 -0700
-@@ -1089,7 +1089,7 @@ static int
- rl_domove_motion_callback (m)
-      _rl_vimotion_cxt *m;
- {
--  int c, save, r;
-+  int c, r;
-   int old_end;
- 
-   _rl_vi_last_motion = c = m->motion;
-@@ -1257,7 +1257,6 @@ int
- rl_vi_domove (x, ignore)
-      int x, *ignore;
- {
--  int r;
-   _rl_vimotion_cxt *m;
- 
-   m = _rl_vimvcxt;
---- lib/sh/pathphys.c	2013-05-28 13:33:58.000000000 -0600
-+++ lib/sh/pathphys.c	2015-02-06 17:14:11.062454900 -0700
-@@ -35,6 +35,7 @@
- #include <stdio.h>
- #include <chartypes.h>
- #include <errno.h>
-+#include <stdlib.h>
- 
- #include "shell.h"
- 
-@@ -76,6 +77,10 @@ sh_physpath (path, flags)
-      char *path;
-      int flags;
- {
-+#if __CYGWIN__
-+  /* realpath does this correctly without all the hassle */
-+  return realpath (path, NULL);
-+#else
-   char tbuf[PATH_MAX+1], linkbuf[PATH_MAX+1];
-   char *result, *p, *q, *qsave, *qbase, *workpath;
-   int double_slash_path, linklen, nlink;
-@@ -214,11 +219,7 @@ error:
- 	    {
- 	      q = result;
- 	      /* Duplicating some code here... */
--#if defined (__CYGWIN__)
--	      qbase = (ISALPHA((unsigned char)workpath[0]) && workpath[1] == ':') ? workpath + 3 : workpath + 1;
--#else
- 	      qbase = workpath + 1;
--#endif
- 	      double_slash_path = DOUBLE_SLASH (workpath);
- 	      qbase += double_slash_path;
-     
-@@ -249,6 +250,7 @@ error:
-     }
- 
-   return (result);
-+#endif /* ! __CYGWIN__ */
- }
- 
- char *
---- lib/sh/tmpfile.c	2013-12-18 15:50:13.000000000 -0700
-+++ lib/sh/tmpfile.c	2015-02-06 17:14:11.062454900 -0700
-@@ -96,7 +96,7 @@ get_tmpdir (flags)
-   if (tdir && (file_iswdir (tdir) == 0 || strlen (tdir) > PATH_MAX))
-     tdir = 0;
- 
--  if (tdir == 0)
-+  if (tdir == 0 || !file_iswdir (tdir))
-     tdir = get_sys_tmpdir ();
- 
- #if defined (HAVE_PATHCONF) && defined (_PC_NAME_MAX)
-@@ -118,14 +118,15 @@ sh_mktmpname (nameroot, flags)
-   struct stat sb;
-   int r, tdlen;
- 
--  filename = (char *)xmalloc (PATH_MAX + 1);
-+  filename = NULL;
-   tdir = get_tmpdir (flags);
-   tdlen = strlen (tdir);
- 
-   lroot = nameroot ? nameroot : DEFAULT_NAMEROOT;
- 
- #ifdef USE_MKTEMP
--  sprintf (filename, "%s/%s.XXXXXX", tdir, lroot);
-+  if (asprintf (&filename, "%s/%s.XXXXXX", tdir, lroot) < 0)
-+    return NULL;
-   if (mktemp (filename) == 0)
-     {
-       free (filename);
-@@ -138,7 +139,9 @@ sh_mktmpname (nameroot, flags)
- 		(unsigned long) time ((time_t *)0) ^
- 		(unsigned long) dollar_dollar_pid ^
- 		(unsigned long) ((flags & MT_USERANDOM) ? random () : ntmpfiles++);
--      sprintf (filename, "%s/%s-%lu", tdir, lroot, filenum);
-+      free (filename);
-+      if (asprintf (&filename, "%s/%s-%lu", tdir, lroot, filenum) < 0)
-+	return NULL;
-       if (tmpnamelen > 0 && tmpnamelen < 32)
- 	filename[tdlen + 1 + tmpnamelen] = '\0';
- #  ifdef HAVE_LSTAT
-@@ -163,14 +166,19 @@ sh_mktmpfd (nameroot, flags, namep)
-   char *filename, *tdir, *lroot;
-   int fd, tdlen;
- 
--  filename = (char *)xmalloc (PATH_MAX + 1);
-+  filename = NULL;
-   tdir = get_tmpdir (flags);
-   tdlen = strlen (tdir);
- 
-   lroot = nameroot ? nameroot : DEFAULT_NAMEROOT;
- 
- #ifdef USE_MKSTEMP
--  sprintf (filename, "%s/%s.XXXXXX", tdir, lroot);
-+  if (asprintf (&filename, "%s/%s.XXXXXX", tdir, lroot) < 0)
-+    {
-+      if (namep)
-+	*namep = NULL;
-+      return -1;
-+    }
-   fd = mkstemp (filename);
-   if (fd < 0 || namep == 0)
-     {
-@@ -187,7 +195,13 @@ sh_mktmpfd (nameroot, flags, namep)
- 		(unsigned long) time ((time_t *)0) ^
- 		(unsigned long) dollar_dollar_pid ^
- 		(unsigned long) ((flags & MT_USERANDOM) ? random () : ntmpfiles++);
--      sprintf (filename, "%s/%s-%lu", tdir, lroot, filenum);
-+      free (filename);
-+      if (asprintf (&filename, "%s/%s-%lu", tdir, lroot, filenum) < 0)
-+	{
-+	  if (namep)
-+	    *namep = NULL;
-+	  return -1;
-+	}
-       if (tmpnamelen > 0 && tmpnamelen < 32)
- 	filename[tdlen + 1 + tmpnamelen] = '\0';
-       fd = open (filename, BASEOPENFLAGS | ((flags & MT_READWRITE) ? O_RDWR : O_WRONLY), 0600);
---- mksyntax.c	2012-07-29 17:48:38.000000000 -0600
-+++ mksyntax.c	2015-02-06 17:14:11.062454900 -0700
-@@ -29,13 +29,13 @@
- 
- #ifdef HAVE_UNISTD_H
- #  include <unistd.h>
-+#else
-+extern int optind;
-+extern char *optarg;
- #endif
- 
- #include "syntax.h"
- 
--extern int optind;
--extern char *optarg;
--
- #ifndef errno
- extern int errno;
- #endif
---- parse.y	2015-02-06 17:12:55.682776800 -0700
-+++ parse.y	2015-02-06 17:14:11.062454900 -0700
-@@ -1531,14 +1531,20 @@ yy_string_get ()
-   string = bash_input.location.string;
- 
-   /* If the string doesn't exist, or is empty, EOF found. */
--  if (string && *string)
-+  while (string && *string)
-     {
-       c = *string++;
-       bash_input.location.string = string;
-+#if __CYGWIN__
-+      {
-+	extern int igncr;
-+	if (igncr && c == '\r')
-+	  continue;
-+      }
-+#endif
-       return (c);
-     }
--  else
--    return (EOF);
-+  return (EOF);
- }
- 
- static int
-@@ -2305,7 +2311,7 @@ shell_getc (remove_quoted_newline)
- 	      if (n <= 2)	/* we have to save 1 for the newline added below */
- 		{
- 		  if (truncating == 0)
--		    internal_warning("shell_getc: shell_input_line_size (%zu) exceeds SIZE_MAX (%llu): line truncated", shell_input_line_size, SIZE_MAX);
-+		    internal_warning("shell_getc: shell_input_line_size (%zu) exceeds SIZE_MAX (%zu): line truncated", shell_input_line_size, SIZE_MAX);
- 		  shell_input_line[i] = '\0';
- 		  truncating = 1;
- 		}
-@@ -3582,7 +3588,6 @@ parse_comsub (qc, open, close, lenp, fla
- 
-   while (count)
-     {
--comsub_readchar:
-       ch = shell_getc (qc != '\'' && (tflags & (LEX_INCOMMENT|LEX_PASSNEXT)) == 0);
- 
-       if (ch == EOF)
---- pathexp.h	2009-01-04 12:32:40.000000000 -0700
-+++ pathexp.h	2015-02-06 17:14:11.062454900 -0700
-@@ -86,7 +86,7 @@ struct ign {
- typedef int sh_iv_item_func_t __P((struct ign *));
- 
- struct ignorevar {
--  char *varname;	/* FIGNORE or GLOBIGNORE */
-+  char *varname;	/* FIGNORE or GLOBIGNORE or EXECIGNORE */
-   struct ign *ignores;	/* Store the ignore strings here */
-   int num_ignores;	/* How many are there? */
-   char *last_ignoreval;	/* Last value of variable - cached for speed */
---- redir.c	2013-10-14 07:19:59.000000000 -0600
-+++ redir.c	2015-02-06 17:14:11.078059300 -0700
-@@ -156,7 +156,6 @@ redirection_error (temp, error)
- #endif
-   else if (expandable_redirection_filename (temp))
-     {
--expandable_filename:
-       oflags = temp->redirectee.filename->flags;
-       if (posixly_correct && interactive_shell == 0)
- 	temp->redirectee.filename->flags |= W_NOGLOB;
---- subst.c	2015-02-06 17:12:55.370841100 -0700
-+++ subst.c	2015-02-06 17:14:11.078059300 -0700
-@@ -41,6 +41,7 @@
- #include "posixstat.h"
- #include "bashintl.h"
- 
-+#define NEED_SH_SETLINEBUF_DECL		/* used in externs.h */
- #include "shell.h"
- #include "parser.h"
- #include "flags.h"
-@@ -5268,6 +5269,13 @@ read_comsub (fd, quoted, rflag)
- #endif
- 	  continue;
- 	}
-+#if __CYGWIN__
-+      {
-+	extern int igncr;
-+	if (igncr && c == '\r')
-+	  continue;
-+      }
-+#endif /* __CYGWIN__ */
- 
-       /* Add the character to ISTRING, possibly after resizing it. */
-       RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE);
-@@ -5385,6 +5393,28 @@ command_substitute (string, quoted)
-       goto error_exit;
-     }
- 
-+#if __CYGWIN__
-+  /* Passing a pipe through std fds can cause hangs when talking to a
-+     non-cygwin child.  Move it.  */
-+  if (fildes[0] < 3)
-+    {
-+      int fd = fcntl (fildes[0], F_DUPFD, 3);
-+      close (fildes[0]);
-+      fildes[0] = fd;
-+    }
-+  if (fildes[1] < 3)
-+    {
-+      int fd = fcntl (fildes[1], F_DUPFD, 3);
-+      close (fildes[1]);
-+      fildes[1] = fd;
-+    }
-+  if (fildes[0] < 0 || fildes[1] < 0)
-+    {
-+      sys_error (_("cannot make pipe for command substitution"));
-+      goto error_exit;
-+    }
-+#endif /* __CYGWIN__ */
-+
-   old_pid = last_made_pid;
- #if defined (JOB_CONTROL)
-   old_pipeline_pgrp = pipeline_pgrp;
---- support/bashversion.c	2008-09-09 07:31:53.000000000 -0600
-+++ support/bashversion.c	2015-02-06 17:14:11.078059300 -0700
-@@ -26,6 +26,9 @@
- 
- #if defined (HAVE_UNISTD_H)
- #  include <unistd.h>
-+#else
-+extern int optind;
-+extern char *optarg;
- #endif
- 
- #include "bashansi.h"
-@@ -41,9 +44,6 @@
- #define LFLAG	0x0020
- #define XFLAG	0x0040
- 
--extern int optind;
--extern char *optarg;
--
- extern char *dist_version;
- extern int patch_level;
- 
-@@ -65,7 +65,7 @@ main (argc, argv)
-      char **argv;
- {
-   int opt, oflags;
--  char dv[128], *rv;
-+  char dv[128], *rv = NULL;
- 
-   if (progname = strrchr (argv[0], '/'))
-     progname++;
---- support/mkversion.sh	2008-08-13 06:25:57.000000000 -0600
-+++ support/mkversion.sh	2015-02-06 17:14:11.078059300 -0700
-@@ -29,7 +29,7 @@ source_dir="."
- while [ $# -gt 0 ]; do
- 	case "$1" in
- 	-o)	shift; OUTFILE=$1; shift ;;
--	-b)	shift; inc_build=yes ;;
-+	-b)	shift; ;;# inc_build=yes ;; # hacked out for cygport
- 	-s)	shift; rel_status=$1; shift ;;
- 	-p)	shift; patch_level=$1; shift ;;
- 	-d)	shift; dist_version=$1; shift ;;
---- variables.c	2015-02-06 17:12:55.729569600 -0700
-+++ variables.c	2015-02-06 17:14:11.078059300 -0700
-@@ -2526,9 +2526,9 @@ bind_variable_internal (name, value, tab
- 
-   newname = 0;
- #if defined (ARRAY_VARS)
--  if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference (name))
-+  if ((aflags & ASS_FROMREF) && (hflags & HASH_NOSRCH) == 0 && valid_array_reference ((char *)name))
-     {
--      newname = array_variable_name (name, &subp, &sublen);
-+      newname = array_variable_name ((char*)name, &subp, &sublen);
-       if (newname == 0)
- 	return (SHELL_VAR *)NULL;	/* XXX */
-       entry = hash_lookup (newname, table);
-@@ -2573,13 +2573,13 @@ bind_variable_internal (name, value, tab
-       entry = make_new_array_variable (newname);	/* indexed array by default */
-       if (entry == 0)
- 	return entry;
--      ind = array_expand_index (name, subp, sublen);
-+      ind = array_expand_index (entry, subp, sublen);
-       bind_array_element (entry, ind, value, aflags);
-     }
- #endif
-   else if (entry == 0)
-     {
--      entry = make_new_variable (name, table);
-+      entry = make_new_variable ((char*)name, table);
-       var_setvalue (entry, make_variable_value (entry, value, 0)); /* XXX */
-     }
-   else if (entry->assign_func)	/* array vars have assign functions now */
-@@ -4679,6 +4679,8 @@ static struct name_and_function special_
-   { "COMP_WORDBREAKS", sv_comp_wordbreaks },
- #endif
- 
-+  { "EXECIGNORE", sv_execignore },
-+
-   { "FUNCNEST", sv_funcnest },
- 
-   { "GLOBIGNORE", sv_globignore },
-@@ -4877,6 +4879,13 @@ sv_globignore (name)
-     setup_glob_ignore (name);
- }
- 
-+/* What to do when EXECIGNORE changes. */
-+void
-+sv_execignore (char *name)
-+{
-+  setup_exec_ignore (name);
-+}
-+
- #if defined (READLINE)
- void
- sv_comp_wordbreaks (name)
-@@ -4950,7 +4959,7 @@ sv_winsize (name)
- /* Update the value of HOME in the export environment so tilde expansion will
-    work on cygwin. */
- #if defined (__CYGWIN__)
--sv_home (name)
-+void sv_home (name)
-      char *name;
- {
-   array_needs_making = 1;
---- variables.h	2014-01-08 13:33:29.000000000 -0700
-+++ variables.h	2015-02-06 17:14:11.078059300 -0700
-@@ -372,6 +372,7 @@ extern void sv_ifs __P((char *));
- extern void sv_path __P((char *));
- extern void sv_mail __P((char *));
- extern void sv_funcnest __P((char *));
-+extern void sv_execignore __P((char *));
- extern void sv_globignore __P((char *));
- extern void sv_ignoreeof __P((char *));
- extern void sv_strict_posix __P((char *));
diff --git a/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch b/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch
new file mode 100644
index 000000000000..c854e8828aea
--- /dev/null
+++ b/pkgs/shells/bash/cygwin-bash-4.4.11-2.src.patch
@@ -0,0 +1,607 @@
+--- origsrc/bash-4.4/bashline.c	2017-01-23 13:28:06.955247200 -0600
++++ src/bash-4.4/bashline.c	2017-01-23 13:55:07.992877600 -0600
+@@ -76,6 +76,16 @@
+ #  include "pcomplete.h"
+ #endif
+ 
++#if __CYGWIN__
++#  ifdef __x86_64__
++#    define IMP(x) __imp_##x
++#  else
++#    define IMP(x) _imp__##x
++#  endif
++#else
++#  define IMP(x) x
++#endif
++
+ /* These should agree with the defines for emacs_mode and vi_mode in
+    rldefs.h, even though that's not a public readline header file. */
+ #ifndef EMACS_EDITING_MODE
+@@ -271,6 +281,11 @@ int no_empty_command_completion;
+    are the only possible matches, even if FIGNORE says to. */
+ int force_fignore = 1;
+ 
++#if __CYGWIN__
++/* If set, shorten "foo.exe" to "foo" when they are the same file.  */
++int completion_strip_exe;
++#endif /* __CYGWIN__ */
++
+ /* Perform spelling correction on directory names during word completion */
+ int dircomplete_spelling = 0;
+ 
+@@ -498,11 +513,12 @@ initialize_readline ()
+   kseq[0] = CTRL('J');
+   kseq[1] = '\0';
+   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
+-  if (func == rl_vi_editing_mode)
++  extern rl_command_func_t *IMP(rl_vi_editing_mode);
++  if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode))
+     rl_unbind_key_in_map (CTRL('J'), emacs_meta_keymap);
+   kseq[0] = CTRL('M');
+   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
+-  if (func == rl_vi_editing_mode)
++  if (func == rl_vi_editing_mode || func == IMP(rl_vi_editing_mode))
+     rl_unbind_key_in_map (CTRL('M'), emacs_meta_keymap);
+ #if defined (VI_MODE)
+   rl_unbind_key_in_map (CTRL('E'), vi_movement_keymap);
+@@ -521,7 +537,8 @@ initialize_readline ()
+   kseq[0] = '~';
+   kseq[1] = '\0';
+   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
+-  if (func == 0 || func == rl_tilde_expand)
++  extern rl_command_func_t *IMP(rl_tilde_expand);
++  if (func == 0 || func == rl_tilde_expand || func == IMP(rl_tilde_expand))
+     rl_bind_keyseq_in_map (kseq, bash_complete_username, emacs_meta_keymap);
+ 
+   rl_bind_key_if_unbound_in_map ('~', bash_possible_username_completions, emacs_ctlx_keymap);
+@@ -544,7 +561,8 @@ initialize_readline ()
+   kseq[0] = TAB;
+   kseq[1] = '\0';
+   func = rl_function_of_keyseq (kseq, emacs_meta_keymap, (int *)NULL);
+-  if (func == 0 || func == rl_tab_insert)
++  extern rl_command_func_t *IMP(rl_tab_insert);
++  if (func == 0 || func == rl_tab_insert || func == IMP(rl_tab_insert))
+     rl_bind_key_in_map (TAB, dynamic_complete_history, emacs_meta_keymap);
+ 
+   /* Tell the completer that we want a crack first. */
+@@ -2194,6 +2212,21 @@ globword:
+ 
+       if (match && executable_completion ((searching_path ? val : cval), searching_path))
+ 	{
++#if __CYGWIN__
++	  if (completion_strip_exe)
++	    {
++	      size_t val_len = strlen (val);
++	      char *candidate;
++	      if (val_len > 4 && !strcasecmp (&val[val_len - 4], ".exe")
++		  && (candidate = strdup (val)))
++		{
++		  candidate[val_len - 4] = '\0';
++		  if (same_file (val, candidate, NULL, NULL))
++		    temp[strlen (temp) - 4] = '\0';
++		  free (candidate);
++		}
++	    }
++#endif
+ 	  if (cval != val)
+ 	    free (cval);
+ 	  free (val);
+@@ -2929,6 +2962,17 @@ test_for_directory (name)
+   int r;
+ 
+   fn = bash_tilde_expand (name, 0);
++#if __CYGWIN
++  /* stat("//server") can only be successful as a directory, but can take
++     seconds to time out on failure.  It is much faster to assume that
++     "//server" is a valid name than it is to wait for a stat, even if it
++     gives false positives on bad names.  */
++  if (fn[0] == '/' && fn[1] == '/' && ! strchr (&fn[2], '/'))
++    {
++      free (fn);
++      return 1;
++    }
++#endif
+   r = file_isdir (fn);
+   free (fn);
+ 
+--- origsrc/bash-4.4/builtins/read.def	2017-01-23 13:28:07.017686500 -0600
++++ src/bash-4.4/builtins/read.def	2017-01-23 13:55:07.992877600 -0600
+@@ -85,7 +85,6 @@ $END
+ 
+ #ifdef __CYGWIN__
+ #  include <fcntl.h>
+-#  include <io.h>
+ #endif
+ 
+ #include "../bashintl.h"
+@@ -530,10 +529,6 @@ read_builtin (list)
+       fflush (stderr);
+     }
+ 
+-#if defined (__CYGWIN__) && defined (O_TEXT)
+-  setmode (0, O_TEXT);
+-#endif
+-
+   ps2 = 0;
+   for (print_ps2 = eof = retval = 0;;)
+     {
+@@ -664,6 +659,14 @@ read_builtin (list)
+       if (c == '\0' && delim != '\0')
+ 	continue;		/* skip NUL bytes in input */
+ 
++#ifdef __CYGWIN__
++      {
++        extern igncr;
++	if (igncr && c == '\r' && delim != '\r')
++	  continue; /* skip carriage return */
++      }
++#endif
++
+       if ((skip_ctlesc == 0 && c == CTLESC) || (skip_ctlnul == 0 && c == CTLNUL))
+ 	{
+ 	  saw_escape++;
+--- origsrc/bash-4.4/builtins/set.def	2016-06-02 19:10:10.000000000 -0500
++++ src/bash-4.4/builtins/set.def	2017-01-23 13:55:07.992877600 -0600
+@@ -56,6 +56,13 @@ extern int dont_save_function_defs;
+ #if defined (READLINE)
+ extern int no_line_editing;
+ #endif /* READLINE */
++#ifdef __CYGWIN__
++extern int igncr;
++static int set_minus_o_option_maybe (int, const char *, int);
++#  define INTERACTIVE_ONLY ,1
++#else
++#  define INTERACTIVE_ONLY
++#endif
+ 
+ $BUILTIN set
+ $FUNCTION set_builtin
+@@ -92,6 +99,9 @@ Options:
+ #if defined (HISTORY)
+           history      enable command history
+ #endif
++#ifdef __CYGWIN__
++          igncr        on Cygwin, ignore \r in line endings
++#endif
+           ignoreeof    the shell will not exit upon reading EOF
+           interactive-comments
+                        allow comments to appear in interactive commands
+@@ -192,29 +202,39 @@ const struct {
+   int *variable;
+   setopt_set_func_t *set_func;
+   setopt_get_func_t *get_func;
++#ifdef __CYGWIN__
++  /* Cygwin users have taken to exporting SHELLOPTS for the cygwin-specific
++     igncr. As a result, we want to ensure SHELLOPTS parsing does not turn
++     on interactive options when exported from an interactive shell, but
++     parse in a non-interactive setting, so as not to break POSIX /bin/sh */
++  int interactive_only;
++#endif
+ } o_options[] = {
+   { "allexport",  'a', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
+ #if defined (BRACE_EXPANSION)
+   { "braceexpand",'B', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+ #endif
+ #if defined (READLINE)
+-  { "emacs",     '\0', (int *)NULL, set_edit_mode, get_edit_mode },
++  { "emacs",     '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY },
+ #endif
+   { "errexit",	  'e', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   { "errtrace",	  'E', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   { "functrace",  'T', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   { "hashall",    'h', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+ #if defined (BANG_HISTORY)
+-  { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
++  { "histexpand", 'H', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY },
+ #endif /* BANG_HISTORY */
+ #if defined (HISTORY)
+-  { "history",   '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL },
++  { "history",   '\0', &enable_history_list, bash_set_history, (setopt_get_func_t *)NULL INTERACTIVE_ONLY },
++#endif
++#ifdef __CYGWIN__
++  { "igncr", '\0', &igncr, NULL, (setopt_get_func_t *)NULL },
+ #endif
+   { "ignoreeof", '\0', &ignoreeof, set_ignoreeof, (setopt_get_func_t *)NULL },
+   { "interactive-comments", '\0', &interactive_comments, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
+   { "keyword",    'k', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+ #if defined (JOB_CONTROL)
+-  { "monitor",	  'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
++  { "monitor",	  'm', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL INTERACTIVE_ONLY },
+ #endif
+   { "noclobber",  'C', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   { "noexec",	  'n', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+@@ -233,7 +253,7 @@ const struct {
+   { "privileged", 'p', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   { "verbose",	  'v', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+ #if defined (READLINE)
+-  { "vi",        '\0', (int *)NULL, set_edit_mode, get_edit_mode },
++  { "vi",        '\0', (int *)NULL, set_edit_mode, get_edit_mode INTERACTIVE_ONLY },
+ #endif
+   { "xtrace",	  'x', (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL  },
+   {(char *)NULL, 0 , (int *)NULL, (setopt_set_func_t *)NULL, (setopt_get_func_t *)NULL },
+@@ -455,6 +475,15 @@ int
+ set_minus_o_option (on_or_off, option_name)
+      int on_or_off;
+      char *option_name;
++#ifdef __CYGWIN__
++{
++  /* See Cygwin comments above. */
++  return set_minus_o_option_maybe (on_or_off, option_name, 0);
++}
++static int
++set_minus_o_option_maybe (int on_or_off, const char *option_name,
++                          int avoid_interactive)
++#endif /* __CYGWIN__ */
+ {
+   register int i;
+ 
+@@ -462,6 +491,10 @@ set_minus_o_option (on_or_off, option_na
+     {
+       if (STREQ (option_name, o_options[i].name))
+ 	{
++#ifdef __CYGWIN__
++	  if (o_options[i].interactive_only && avoid_interactive)
++	    return EXECUTION_SUCCESS;
++#endif
+ 	  if (o_options[i].letter == 0)
+ 	    {
+ 	      previous_option_value = GET_BINARY_O_OPTION_VALUE (i, o_options[i].name);
+@@ -588,7 +621,11 @@ parse_shellopts (value)
+   vptr = 0;
+   while (vname = extract_colon_unit (value, &vptr))
+     {
++#ifdef __CYGWIN__
++      set_minus_o_option_maybe (FLAG_ON, vname, !interactive_shell);
++#else
+       set_minus_o_option (FLAG_ON, vname);
++#endif
+       free (vname);
+     }
+ }
+--- origsrc/bash-4.4/builtins/shopt.def	2016-05-06 14:00:02.000000000 -0500
++++ src/bash-4.4/builtins/shopt.def	2017-01-23 13:55:07.992877600 -0600
+@@ -92,6 +92,10 @@ extern int glob_asciirange;
+ extern int lastpipe_opt;
+ extern int inherit_errexit;
+ 
++#ifdef __CYGWIN__
++extern int completion_strip_exe;
++#endif
++
+ #if defined (EXTENDED_GLOB)
+ extern int extended_glob;
+ #endif
+@@ -169,6 +173,9 @@ static struct {
+   { "compat41", &shopt_compat41, set_compatibility_level },
+   { "compat42", &shopt_compat42, set_compatibility_level },
+   { "compat43", &shopt_compat43, set_compatibility_level },
++#ifdef __CYGWIN__
++  { "completion_strip_exe", &completion_strip_exe, NULL },
++#endif
+ #if defined (READLINE)
+   { "complete_fullquote", &complete_fullquote, (shopt_set_func_t *)NULL},
+   { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand },
+--- origsrc/bash-4.4/config-top.h	2016-05-19 13:34:02.000000000 -0500
++++ src/bash-4.4/config-top.h	2017-01-23 13:55:07.992877600 -0600
+@@ -87,10 +87,10 @@
+ #define DEFAULT_BASHRC "~/.bashrc"
+ 
+ /* System-wide .bashrc file for interactive shells. */
+-/* #define SYS_BASHRC "/etc/bash.bashrc" */
++#define SYS_BASHRC "/etc/bash.bashrc"
+ 
+ /* System-wide .bash_logout for login shells. */
+-/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
++#define SYS_BASH_LOGOUT "/etc/bash.bash_logout"
+ 
+ /* Define this to make non-interactive shells begun with argv[0][0] == '-'
+    run the startup files when not in posix mode. */
+@@ -100,7 +100,7 @@
+    sshd and source the .bashrc if so (like the rshd behavior).  This checks
+    for the presence of SSH_CLIENT or SSH2_CLIENT in the initial environment,
+    which can be fooled under certain not-uncommon circumstances. */
+-/* #define SSH_SOURCE_BASHRC */
++#define SSH_SOURCE_BASHRC
+ 
+ /* Define if you want the case-capitalizing operators (~[~]) and the
+    `capcase' variable attribute (declare -c). */
+--- origsrc/bash-4.4/doc/Makefile.in	2015-12-06 18:55:56.000000000 -0600
++++ src/bash-4.4/doc/Makefile.in	2017-01-23 13:55:07.992877600 -0600
+@@ -189,7 +189,7 @@ bashref.html: $(BASHREF_FILES) $(HSUSER)
+ 	$(MAKEINFO) --html --no-split -I$(TEXINPUTDIR) $(srcdir)/bashref.texi
+ 
+ bash.info: bashref.info
+-	${SHELL} ${INFOPOST} < $(srcdir)/bashref.info > $@ ; \
++	${SHELL} ${INFOPOST} < bashref.info > $@ ; \
+ 
+ bash.txt: bash.1
+ bash.ps: bash.1
+@@ -252,9 +252,9 @@ install: info installdirs
+ 	-$(INSTALL_DATA) $(srcdir)/bashbug.1 $(DESTDIR)$(man1dir)/bashbug${man1ext}
+ 	-$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
+ # uncomment the next lines to install the builtins man page
+-#	sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
+-#	-$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
+-#	-$(RM) $${TMPDIR:-/var/tmp}/builtins.1
++	sed 's:bash\.1:man1/&:' $(srcdir)/builtins.1 > $${TMPDIR:-/var/tmp}/builtins.1
++	-$(INSTALL_DATA) $${TMPDIR:-/var/tmp}/builtins.1 $(DESTDIR)$(man1dir)/bash_builtins${man1ext}
++	-$(RM) $${TMPDIR:-/var/tmp}/builtins.1
+ 	-if test -f bash.info; then d=.; else d=$(srcdir); fi; \
+ 	  $(INSTALL_DATA) $$d/bash.info $(DESTDIR)$(infodir)/bash.info
+ # run install-info if it is present to update the info directory
+--- origsrc/bash-4.4/doc/bash.1	2016-08-26 08:45:17.000000000 -0500
++++ src/bash-4.4/doc/bash.1	2017-01-23 13:55:08.008447700 -0600
+@@ -9607,6 +9607,10 @@ filenames.
+ This variable is set by default, which is the default bash behavior in
+ versions through 4.2.
+ .TP 8
++.B completion_strip_exe
++If set, whenever bash sees \fIfoo.exe\fP during completion, it checks if
++\fIfoo\fP is the same file and strips the suffix.
++.TP 8
+ .B direxpand
+ If set,
+ .B bash
+--- origsrc/bash-4.4/doc/bashref.texi	2016-09-07 16:13:36.000000000 -0500
++++ src/bash-4.4/doc/bashref.texi	2017-01-23 13:55:08.008447700 -0600
+@@ -5123,6 +5123,10 @@ filenames.
+ This variable is set by default, which is the default Bash behavior in
+ versions through 4.2.
+ 
++@item completion_strip_exe
++If set, whenever bash sees @file{foo.exe} during completion, it checks if
++@file{foo} is the same file and strips the suffix.
++
+ @item direxpand
+ If set, Bash
+ replaces directory names with the results of word expansion when performing
+--- origsrc/bash-4.4/doc/builtins.1	2012-02-21 13:32:05.000000000 -0600
++++ src/bash-4.4/doc/builtins.1	2017-01-23 13:55:08.008447700 -0600
+@@ -19,6 +19,6 @@ shift, shopt, source, suspend, test, tim
+ ulimit, umask, unalias, unset, wait \- bash built-in commands, see \fBbash\fR(1)
+ .SH BASH BUILTIN COMMANDS
+ .nr zZ 1
+-.so bash.1
++.so man1/bash.1
+ .SH SEE ALSO
+ bash(1), sh(1)
+--- origsrc/bash-4.4/general.c	2016-08-11 10:16:56.000000000 -0500
++++ src/bash-4.4/general.c	2017-01-23 13:55:08.008447700 -0600
+@@ -48,6 +48,10 @@
+ 
+ #include <tilde/tilde.h>
+ 
++#ifdef __CYGWIN__
++# include <sys/cygwin.h>
++#endif
++
+ #if !defined (errno)
+ extern int errno;
+ #endif /* !errno */
+@@ -718,7 +722,8 @@ make_absolute (string, dot_path)
+     {
+       char pathbuf[PATH_MAX + 1];
+ 
+-      cygwin_conv_to_full_posix_path (string, pathbuf);
++      cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, string, pathbuf,
++			sizeof pathbuf);
+       result = savestring (pathbuf);
+     }
+ #else
+--- origsrc/bash-4.4/input.c	2015-09-24 18:49:23.000000000 -0500
++++ src/bash-4.4/input.c	2017-01-23 13:55:08.008447700 -0600
+@@ -44,6 +44,10 @@
+ #include "quit.h"
+ #include "trap.h"
+ 
++#ifdef __CYGWIN__
++int igncr;
++#endif
++
+ #if !defined (errno)
+ extern int errno;
+ #endif /* !errno */
+@@ -561,6 +565,19 @@ buffered_getchar ()
+ {
+   CHECK_TERMSIG;
+ 
++#ifdef __CYGWIN__
++  /* shopt igncr discards carriage returns from the input stream.
++     If cr is the only character left in the buffer, recurse to pick
++     up the next byte; otherwise flatten the buffer.  */
++  if (igncr)
++    {
++      int ch;
++      while ((ch = bufstream_getc (buffers[bash_input.location.buffered_fd]))
++	     == '\r')
++	;
++      return ch;
++    }
++#endif
+ #if !defined (DJGPP)
+   return (bufstream_getc (buffers[bash_input.location.buffered_fd]));
+ #else
+--- origsrc/bash-4.4/lib/sh/pathphys.c	2013-05-28 14:33:58.000000000 -0500
++++ src/bash-4.4/lib/sh/pathphys.c	2017-01-23 13:55:08.008447700 -0600
+@@ -35,6 +35,7 @@
+ #include <stdio.h>
+ #include <chartypes.h>
+ #include <errno.h>
++#include <stdlib.h>
+ 
+ #include "shell.h"
+ 
+@@ -76,6 +77,9 @@ sh_physpath (path, flags)
+      char *path;
+      int flags;
+ {
++#ifdef __CYGWIN__
++  return realpath (path, NULL);
++#endif
+   char tbuf[PATH_MAX+1], linkbuf[PATH_MAX+1];
+   char *result, *p, *q, *qsave, *qbase, *workpath;
+   int double_slash_path, linklen, nlink;
+@@ -214,11 +218,7 @@ error:
+ 	    {
+ 	      q = result;
+ 	      /* Duplicating some code here... */
+-#if defined (__CYGWIN__)
+-	      qbase = (ISALPHA((unsigned char)workpath[0]) && workpath[1] == ':') ? workpath + 3 : workpath + 1;
+-#else
+ 	      qbase = workpath + 1;
+-#endif
+ 	      double_slash_path = DOUBLE_SLASH (workpath);
+ 	      qbase += double_slash_path;
+     
+--- origsrc/bash-4.4/lib/sh/tmpfile.c	2016-08-11 10:05:58.000000000 -0500
++++ src/bash-4.4/lib/sh/tmpfile.c	2017-01-23 13:55:08.008447700 -0600
+@@ -101,7 +101,7 @@ get_tmpdir (flags)
+   if (tdir && (file_iswdir (tdir) == 0 || strlen (tdir) > PATH_MAX))
+     tdir = 0;
+ 
+-  if (tdir == 0)
++  if (tdir == 0 || !file_iswdir (tdir))
+     tdir = get_sys_tmpdir ();
+ 
+ #if defined (HAVE_PATHCONF) && defined (_PC_NAME_MAX)
+--- origsrc/bash-4.4/mksyntax.c	2012-07-29 18:48:38.000000000 -0500
++++ src/bash-4.4/mksyntax.c	2017-01-23 13:55:08.008447700 -0600
+@@ -29,13 +29,13 @@
+ 
+ #ifdef HAVE_UNISTD_H
+ #  include <unistd.h>
++#else
++extern int optind;
++extern char *optarg;
+ #endif
+ 
+ #include "syntax.h"
+ 
+-extern int optind;
+-extern char *optarg;
+-
+ #ifndef errno
+ extern int errno;
+ #endif
+--- origsrc/bash-4.4/parse.y	2016-09-11 10:31:46.000000000 -0500
++++ src/bash-4.4/parse.y	2017-01-23 13:55:08.008447700 -0600
+@@ -1539,14 +1539,20 @@ yy_string_get ()
+   string = bash_input.location.string;
+ 
+   /* If the string doesn't exist, or is empty, EOF found. */
+-  if (string && *string)
++  while (string && *string)
+     {
+       c = *string++;
+       bash_input.location.string = string;
++#ifdef __CYGWIN__
++      {
++	extern int igncr;
++	if (igncr && c == '\r')
++	  continue;
++      }
++#endif
+       return (c);
+     }
+-  else
+-    return (EOF);
++  return (EOF);
+ }
+ 
+ static int
+--- origsrc/bash-4.4/subst.c	2017-01-23 13:28:06.955247200 -0600
++++ src/bash-4.4/subst.c	2017-01-23 13:55:08.008447700 -0600
+@@ -43,6 +43,7 @@
+ #include "posixstat.h"
+ #include "bashintl.h"
+ 
++#define NEED_SH_SETLINEBUF_DECL
+ #include "shell.h"
+ #include "parser.h"
+ #include "flags.h"
+@@ -5964,6 +5965,13 @@ read_comsub (fd, quoted, rflag)
+ #endif
+ 	  continue;
+ 	}
++#ifdef __CYGWIN__
++      {
++	extern int igncr;
++	if (igncr && c == '\r')
++	  continue;
++      }
++#endif
+ 
+       /* Add the character to ISTRING, possibly after resizing it. */
+       RESIZE_MALLOCED_BUFFER (istring, istring_index, 2, istring_size, DEFAULT_ARRAY_SIZE);
+@@ -6088,6 +6096,28 @@ command_substitute (string, quoted)
+       goto error_exit;
+     }
+ 
++#ifdef __CYGWIN__
++  /* Passing a pipe through std fds can cause hangs when talking to a
++     non-cygwin child.  Move it.  */
++  if (fildes[0] < 3)
++    {
++      int fd = fcntl (fildes[0], F_DUPFD, 3);
++      close (fildes[0]);
++      fildes[0] = fd;
++    }
++  if (fildes[1] < 3)
++    {
++      int fd = fcntl (fildes[1], F_DUPFD, 3);
++      close (fildes[1]);
++      fildes[1] = fd;
++    }
++  if (fildes[0] < 0 || fildes[1] < 0)
++    {
++      sys_error (_("cannot make pipe for command substitution"));
++      goto error_exit;
++    }
++#endif /* __CYGWIN__ */
++
+   old_pid = last_made_pid;
+ #if defined (JOB_CONTROL)
+   old_pipeline_pgrp = pipeline_pgrp;
+--- origsrc/bash-4.4/support/bashversion.c	2008-09-09 08:31:53.000000000 -0500
++++ src/bash-4.4/support/bashversion.c	2017-01-23 13:55:08.024037200 -0600
+@@ -26,6 +26,9 @@
+ 
+ #if defined (HAVE_UNISTD_H)
+ #  include <unistd.h>
++#else
++extern int optind;
++extern char *optarg;
+ #endif
+ 
+ #include "bashansi.h"
+@@ -41,9 +44,6 @@
+ #define LFLAG	0x0020
+ #define XFLAG	0x0040
+ 
+-extern int optind;
+-extern char *optarg;
+-
+ extern char *dist_version;
+ extern int patch_level;
+ 
+--- origsrc/bash-4.4/support/mkversion.sh	2008-08-13 07:25:57.000000000 -0500
++++ src/bash-4.4/support/mkversion.sh	2017-01-23 13:55:08.024037200 -0600
+@@ -29,7 +29,7 @@ source_dir="."
+ while [ $# -gt 0 ]; do
+ 	case "$1" in
+ 	-o)	shift; OUTFILE=$1; shift ;;
+-	-b)	shift; inc_build=yes ;;
++	-b)	shift; ;; # inc_build=yes ;; # hacked out for cygport
+ 	-s)	shift; rel_status=$1; shift ;;
+ 	-p)	shift; patch_level=$1; shift ;;
+ 	-d)	shift; dist_version=$1; shift ;;
+--- origsrc/bash-4.4/variables.c	2016-06-15 15:05:52.000000000 -0500
++++ src/bash-4.4/variables.c	2017-01-23 13:55:08.024037200 -0600
+@@ -5239,6 +5239,7 @@ sv_winsize (name)
+ /* Update the value of HOME in the export environment so tilde expansion will
+    work on cygwin. */
+ #if defined (__CYGWIN__)
++void
+ sv_home (name)
+      char *name;
+ {
diff --git a/pkgs/stdenv/booter.nix b/pkgs/stdenv/booter.nix
index d459deb6ab54..a1055708f995 100644
--- a/pkgs/stdenv/booter.nix
+++ b/pkgs/stdenv/booter.nix
@@ -73,7 +73,7 @@ stageFuns: let
   # Take the list and disallow custom overrides in all but the final stage,
   # and allow it in the final flag. Only defaults this boolean field if it
   # isn't already set.
-  withAllowCustomOverrides = lib.lists.imap
+  withAllowCustomOverrides = lib.lists.imap1
     (index: stageFun: prevStage:
       # So true by default for only the first element because one
       # 1-indexing. Since we reverse the list, this means this is true
diff --git a/pkgs/stdenv/cygwin/rebase-i686.sh b/pkgs/stdenv/cygwin/rebase-i686.sh
index e97dc66c0ad6..091c9044d93f 100644
--- a/pkgs/stdenv/cygwin/rebase-i686.sh
+++ b/pkgs/stdenv/cygwin/rebase-i686.sh
@@ -1,10 +1,10 @@
-postFixupHooks+=(_cygwinFixAutoImageBase)
+fixupOutputHooks+=(_cygwinFixAutoImageBase)
 
 _cygwinFixAutoImageBase() {
-    if [ "$dontRebase" == 1 ]; then
+    if [ "$dontRebase" == 1 ] || [ ! -d "$prefix" ]; then
         return
     fi
-    find $out -name "*.dll" | while read DLL; do
+    find "$prefix" -name "*.dll" -type f | while read DLL; do
         if [ -f /etc/rebasenix.nextbase ]; then
             NEXTBASE="$(</etc/rebasenix.nextbase)"
         fi
diff --git a/pkgs/stdenv/cygwin/rebase-x86_64.sh b/pkgs/stdenv/cygwin/rebase-x86_64.sh
index a79c62574606..77adc52d53b6 100644
--- a/pkgs/stdenv/cygwin/rebase-x86_64.sh
+++ b/pkgs/stdenv/cygwin/rebase-x86_64.sh
@@ -1,10 +1,10 @@
-postFixupHooks+=(_cygwinFixAutoImageBase)
+fixupOutputHooks+=(_cygwinFixAutoImageBase)
 
 _cygwinFixAutoImageBase() {
-    if [ "$dontRebase" == 1 ]; then
+    if [ "$dontRebase" == 1 ] || [ ! -d "$prefix" ]; then
         return
     fi
-    find $out -name "*.dll" | while read DLL; do
+    find "$prefix" -name "*.dll" -type f | while read DLL; do
         if [ -f /etc/rebasenix.nextbase ]; then
             NEXTBASE="$(</etc/rebasenix.nextbase)"
         fi
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index bce332b67616..03a815109c25 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -235,11 +235,11 @@ in rec {
       libcxxabi libcxx ncurses libffi zlib gmp pcre gnugrep
       coreutils findutils diffutils patchutils;
 
-    llvmPackages = let llvmOverride = llvmPackages.llvm.override { enableManpages = false; inherit libcxxabi; }; in
-      super.llvmPackages // {
-        llvm = llvmOverride;
-        clang-unwrapped = llvmPackages.clang-unwrapped.override { enableManpages = false; llvm = llvmOverride; };
-      };
+     llvmPackages = let llvmOverride = llvmPackages.llvm.override { inherit libcxxabi; };
+     in super.llvmPackages // {
+       llvm = llvmOverride;
+       clang-unwrapped = llvmPackages.clang-unwrapped.override { llvm = llvmOverride; };
+     };
 
     darwin = super.darwin // {
       inherit (darwin) dyld Libsystem libiconv locale;
diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix
index b21da1cd522b..31973c2cdc50 100644
--- a/pkgs/stdenv/native/default.nix
+++ b/pkgs/stdenv/native/default.nix
@@ -102,7 +102,7 @@ let
 
       fetchurlBoot = fetchurl;
 
-      inherit system shell cc overrides config;
+      inherit shell cc overrides config;
     };
 
 in
diff --git a/pkgs/tools/admin/cli53/default.nix b/pkgs/tools/admin/cli53/default.nix
index 4e284c461932..23c35dab57c0 100644
--- a/pkgs/tools/admin/cli53/default.nix
+++ b/pkgs/tools/admin/cli53/default.nix
@@ -1,27 +1,21 @@
-{ stdenv, buildGoPackage, fetchFromGitHub }:
+{ lib, python2Packages, fetchurl }:
 
-buildGoPackage rec {
+python2Packages.buildPythonApplication rec {
   name = "cli53-${version}";
-  version = "0.8.8";
+  version = "0.4.4";
 
-  goPackagePath = "github.com/barnybug/cli53";
-
-  src = fetchFromGitHub {
-    owner = "barnybug";
-    repo = "cli53";
-    rev = version;
-    sha256 = "1hbx64rn25qzp2xlfwv8xaqyfcax9b6pl30j9vciw7cb346i84gc";
+  src = fetchurl {
+    url = "mirror://pypi/c/cli53/${name}.tar.gz";
+    sha256 = "0s9jzigq6a16m2c3qklssx2lz16cf13g5zh80vh24kxazaxqzbig";
   };
 
-  buildPhase = ''
-    pushd go/src/${goPackagePath}/cmd/cli53
-    go get .
-    popd
-  '';
-
-  goDeps = ./deps.nix;
+  propagatedBuildInputs = with python2Packages; [
+    argparse
+    boto
+    dns
+  ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "CLI tool for the Amazon Route 53 DNS service";
     homepage = https://github.com/barnybug/cli53;
     license = licenses.mit;
diff --git a/pkgs/tools/archivers/unzip/default.nix b/pkgs/tools/archivers/unzip/default.nix
index ad484b3d4d97..896cdd50973c 100644
--- a/pkgs/tools/archivers/unzip/default.nix
+++ b/pkgs/tools/archivers/unzip/default.nix
@@ -1,7 +1,6 @@
 { stdenv, fetchurl
 , bzip2
 , enableNLS ? false, libnatspec
-, buildPlatform, hostPlatform
 }:
 
 stdenv.mkDerivation {
@@ -23,13 +22,13 @@ stdenv.mkDerivation {
     ./CVE-2015-7697.diff
     ./CVE-2014-9913.patch
     ./CVE-2016-9844.patch
+    ./dont-hardcode-cc.patch
   ] ++ stdenv.lib.optional enableNLS
     (fetchurl {
       url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/unzip/files/unzip-6.0-natspec.patch?revision=1.1";
       name = "unzip-6.0-natspec.patch";
       sha256 = "67ab260ae6adf8e7c5eda2d1d7846929b43562943ec4aff629bd7018954058b1";
-    })
-    ++ stdenv.lib.optional (hostPlatform != buildPlatform) ./cross-cc.patch;
+    });
 
   nativeBuildInputs = [ bzip2 ];
   buildInputs = [ bzip2 ] ++ stdenv.lib.optional enableNLS libnatspec;
diff --git a/pkgs/tools/archivers/unzip/cross-cc.patch b/pkgs/tools/archivers/unzip/dont-hardcode-cc.patch
index 3d38ffdef6e3..15dbbfe4c533 100644
--- a/pkgs/tools/archivers/unzip/cross-cc.patch
+++ b/pkgs/tools/archivers/unzip/dont-hardcode-cc.patch
@@ -1,12 +1,14 @@
 --- a/unix/Makefile
 +++ b/unix/Makefile
-@@ -42,9 +42,7 @@
+@@ -42,9 +42,9 @@
  # such as -DDOSWILD).
  
  # UnZip flags
 -CC = cc#	try using "gcc" target rather than changing this (CC and LD
++CC ?= cc#	try using "gcc" target rather than changing this (CC and LD
  LD = $(CC)#	must match, else "unresolved symbol:  ___main" is possible)
 -AS = as
++AS ?= as
  LOC = $(D_USE_BZ2) $(LOCAL_UNZIP)
  AF = $(LOC)
  CFLAGS = -O
diff --git a/pkgs/tools/compression/gzip/default.nix b/pkgs/tools/compression/gzip/default.nix
index 5a27d336c291..cb7dc65c710d 100644
--- a/pkgs/tools/compression/gzip/default.nix
+++ b/pkgs/tools/compression/gzip/default.nix
@@ -15,10 +15,6 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ xz.bin ];
 
-  preConfigure = if stdenv.isCygwin then ''
-    sed -i lib/fpending.h -e 's,include <stdio_ext.h>,,'
-  '' else null;
-
   # In stdenv-linux, prevent a dependency on bootstrap-tools.
   makeFlags = "SHELL=/bin/sh GREP=grep";
 
diff --git a/pkgs/tools/filesystems/ntfs-3g/default.nix b/pkgs/tools/filesystems/ntfs-3g/default.nix
index a96612c28041..0cf439c9fe95 100644
--- a/pkgs/tools/filesystems/ntfs-3g/default.nix
+++ b/pkgs/tools/filesystems/ntfs-3g/default.nix
@@ -2,7 +2,7 @@
 , crypto ? false, libgcrypt, gnutls, pkgconfig}:
 
 stdenv.mkDerivation rec {
-  pname = "ntfs-3g";
+  pname = "ntfs3g";
   version = "2017.3.23";
   name = "${pname}-${version}";
 
diff --git a/pkgs/tools/misc/coreutils/default.nix b/pkgs/tools/misc/coreutils/default.nix
index 71fc791872f8..9a988a2b4311 100644
--- a/pkgs/tools/misc/coreutils/default.nix
+++ b/pkgs/tools/misc/coreutils/default.nix
@@ -32,6 +32,9 @@ stdenv.mkDerivation rec {
     sed '2i echo Skipping cp sparse test && exit 0' -i ./tests/cp/sparse.sh
     sed '2i echo Skipping rm deep-2 test && exit 0' -i ./tests/rm/deep-2.sh
     sed '2i echo Skipping du long-from-unreadable test && exit 0' -i ./tests/du/long-from-unreadable.sh
+    sed '2i echo Skipping chmod setgid test && exit 0' -i ./tests/chmod/setgid.sh
+    substituteInPlace ./tests/install/install-C.sh \
+      --replace 'mode3=2755' 'mode3=1755'
   '';
 
   outputs = [ "out" "info" ];
@@ -67,7 +70,7 @@ stdenv.mkDerivation rec {
     && builtins.storeDir == "/nix/store";
 
   # Prevents attempts of running 'help2man' on cross-built binaries.
-  ${if hostPlatform == buildPlatform then null else "PERL"} = "missing";
+  PERL = if hostPlatform == buildPlatform then null else "missing";
 
   # Saw random failures like ‘help2man: can't get '--help' info from
   # man/sha512sum.td/sha512sum’.
@@ -80,11 +83,11 @@ stdenv.mkDerivation rec {
 
   # Works around a bug with 8.26:
   # Makefile:3440: *** Recursive variable 'INSTALL' references itself (eventually).  Stop.
-  ${if hostPlatform == buildPlatform then null else "preInstall"} = ''
+  preInstall = optionalString (hostPlatform != buildPlatform) ''
     sed -i Makefile -e 's|^INSTALL =.*|INSTALL = ${buildPackages.coreutils}/bin/install -c|'
   '';
 
-  ${if hostPlatform == buildPlatform then null else "postInstall"} = ''
+  postInstall = optionalString (hostPlatform != buildPlatform) ''
     rm $out/share/man/man1/*
     cp ${buildPackages.coreutils}/share/man/man1/* $out/share/man/man1
   '';
diff --git a/pkgs/tools/misc/cpuminer/default.nix b/pkgs/tools/misc/cpuminer/default.nix
index 375aa999e3b9..b4abb3097b98 100644
--- a/pkgs/tools/misc/cpuminer/default.nix
+++ b/pkgs/tools/misc/cpuminer/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "cpuminer-${version}";
-  version = "2.4.5";
+  version = "2.5.0";
 
   src = fetchurl {
     url = "mirror://sourceforge/cpuminer/pooler-${name}.tar.gz";
-    sha256 = "130ab6vcbm9azl9w8n97fzjnjbakm0k2n3wc1bcgy5y5c8s0220h";
+    sha256 = "1xalrfrk5hvh1jh9kbqhib2an82ypd46vl9glaxhz3rbjld7c5pa";
   };
 
   patchPhase = if stdenv.cc.isClang then "${perl}/bin/perl ./nomacro.pl" else null;
diff --git a/pkgs/tools/misc/partition-manager/default.nix b/pkgs/tools/misc/partition-manager/default.nix
index 52183a3fff35..af5a45902bb4 100644
--- a/pkgs/tools/misc/partition-manager/default.nix
+++ b/pkgs/tools/misc/partition-manager/default.nix
@@ -1,7 +1,7 @@
 { mkDerivation, fetchurl, lib
 , extra-cmake-modules, kdoctools, wrapGAppsHook
 , kconfig, kinit, kpmcore
-, eject, libatasmart }:
+, kcrash, eject, libatasmart }:
 
 let
   pname = "partitionmanager";
@@ -22,5 +22,5 @@ in mkDerivation rec {
   nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook ];
   # refer to kpmcore for the use of eject
   buildInputs = [ eject libatasmart ];
-  propagatedBuildInputs = [ kconfig kinit kpmcore ];
+  propagatedBuildInputs = [ kconfig kcrash kinit kpmcore ];
 }
diff --git a/pkgs/tools/misc/tlp/default.nix b/pkgs/tools/misc/tlp/default.nix
index 9a2f9b65e8c2..ff69fb01cea7 100644
--- a/pkgs/tools/misc/tlp/default.nix
+++ b/pkgs/tools/misc/tlp/default.nix
@@ -14,13 +14,13 @@ let
 
 in stdenv.mkDerivation rec {
   name = "tlp-${version}";
-  version = "0.9";
+  version = "1.0";
 
   src = fetchFromGitHub {
         owner = "linrunner";
         repo = "TLP";
         rev = "${version}";
-        sha256 = "1gwi0h9klhdvqfqvmn297l1vyhj4g9dqvf50lcbswry02mvnd2vn";
+        sha256 = "0gq1y1qnzwyv7cw32g4ymlfssi2ayrbnd04y4l242k6n41d05bij";
       };
 
   makeFlags = [ "DESTDIR=$(out)"
diff --git a/pkgs/tools/networking/iperf/3.nix b/pkgs/tools/networking/iperf/3.nix
index 0d1e3194bd87..a86e3e04530d 100644
--- a/pkgs/tools/networking/iperf/3.nix
+++ b/pkgs/tools/networking/iperf/3.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "iperf-3.1.7";
+  name = "iperf-3.2";
 
   src = fetchurl {
     url = "http://downloads.es.net/pub/iperf/${name}.tar.gz";
-    sha256 = "0kvk8d0a3dcxc8fisyprbn01y8akxj4sx8ld5dh508p9dx077vx4";
+    sha256 = "07cwrl9q5pmfjlh6ilpk7hm25lpkcaf917zhpmfq918lhrpv61zj";
   };
 
   postInstall = ''
diff --git a/pkgs/tools/networking/ucspi-tcp/default.nix b/pkgs/tools/networking/ucspi-tcp/default.nix
index 0bcd35b21ef9..fc46c6a15bc5 100644
--- a/pkgs/tools/networking/ucspi-tcp/default.nix
+++ b/pkgs/tools/networking/ucspi-tcp/default.nix
@@ -14,6 +14,7 @@ stdenv.mkDerivation rec {
       url = "http://ftp.de.debian.org/debian/pool/main/u/ucspi-tcp/ucspi-tcp_0.88-3.diff.gz";
       sha256 = "0mzmhz8hjkrs0khmkzs5i0s1kgmgaqz07h493bd5jj5fm5njxln6";
     })
+    ./remove-setuid.patch
   ];
 
   # Apply Debian patches
diff --git a/pkgs/tools/networking/ucspi-tcp/remove-setuid.patch b/pkgs/tools/networking/ucspi-tcp/remove-setuid.patch
new file mode 100644
index 000000000000..dd6933208046
--- /dev/null
+++ b/pkgs/tools/networking/ucspi-tcp/remove-setuid.patch
@@ -0,0 +1,15 @@
+diff --git a/hier.c b/hier.c
+index 5663ada..1d73b84 100644
+--- a/hier.c
++++ b/hier.c
+@@ -2,8 +2,8 @@
+ 
+ void hier()
+ {
+-  h(auto_home,-1,-1,02755);
+-  d(auto_home,"bin",-1,-1,02755);
++  h(auto_home,-1,-1,0755);
++  d(auto_home,"bin",-1,-1,0755);
+ 
+   c(auto_home,"bin","tcpserver",-1,-1,0755);
+   c(auto_home,"bin","tcprules",-1,-1,0755);
diff --git a/pkgs/tools/security/afl/default.nix b/pkgs/tools/security/afl/default.nix
index 1d6307f807c5..92fd6cd1be03 100644
--- a/pkgs/tools/security/afl/default.nix
+++ b/pkgs/tools/security/afl/default.nix
@@ -9,11 +9,11 @@ let
 in
 stdenv.mkDerivation rec {
   name    = "afl-${version}";
-  version = "2.43b";
+  version = "2.44b";
 
   src = fetchurl {
     url    = "http://lcamtuf.coredump.cx/afl/releases/${name}.tgz";
-    sha256 = "1jv2y9b53k3p8hngm78ikakhcf4vv3yyz6ip17jhg5gsis29gdwx";
+    sha256 = "0wvx4ibr5hhav9mld1gncdvfzb4iky85gam3x8a43ispjddyya6m";
   };
 
   # Note: libcgroup isn't needed for building, just for the afl-cgroup
diff --git a/pkgs/tools/security/hologram/default.nix b/pkgs/tools/security/hologram/default.nix
index abdcd5d2d3eb..911c1b12562a 100644
--- a/pkgs/tools/security/hologram/default.nix
+++ b/pkgs/tools/security/hologram/default.nix
@@ -15,6 +15,10 @@ buildGoPackage rec {
 
   goDeps = ./deps.nix;
 
+  preConfigure = ''
+    sed -i 's|cacheTimeout != 3600|cacheTimeout != 0|' cmd/hologram-server/main.go
+  '';
+
   meta = with stdenv.lib; {
     homepage = https://github.com/AdRoll/hologram/;
     description = "Easy, painless AWS credentials on developer laptops.";
diff --git a/pkgs/tools/security/jd-gui/default.nix b/pkgs/tools/security/jd-gui/default.nix
index 106fbf0a150a..32bc1a4d7119 100644
--- a/pkgs/tools/security/jd-gui/default.nix
+++ b/pkgs/tools/security/jd-gui/default.nix
@@ -1,8 +1,22 @@
-{ stdenv, fetchurl, gtk2, atk, gdk_pixbuf, pango, makeWrapper }:
+{ stdenv, fetchurl, gtk2, atk, gdk_pixbuf, glib, pango, fontconfig, zlib, xorg, upx, patchelf }:
 
 let
   dynlibPath = stdenv.lib.makeLibraryPath
-    [ gtk2 atk gdk_pixbuf pango ];
+    ([ gtk2 atk gdk_pixbuf glib pango fontconfig zlib stdenv.cc.cc.lib ]
+    ++ (with xorg; [
+      libX11
+      libXext
+      libXrender
+      libXrandr
+      libSM
+      libXfixes
+      libXdamage
+      libXcursor
+      libXinerama
+      libXi
+      libXcomposite
+      libXxf86vm
+    ]));
 in
 stdenv.mkDerivation rec {
   name    = "jd-gui-${version}";
@@ -13,14 +27,18 @@ stdenv.mkDerivation rec {
     sha256 = "0jrvzs2s836yvqi41c7fq0gfiwf187qg765b9r1il2bjc0mb3dqv";
   };
 
-  buildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ upx patchelf ];
 
   phases = "unpackPhase installPhase";
   unpackPhase = "tar xf ${src}";
   installPhase = ''
-    mkdir -p $out/bin && mv jd-gui $out/bin
-    wrapProgram $out/bin/jd-gui \
-      --prefix LD_LIBRARY_PATH ":" "${dynlibPath}"
+    mkdir -p $out/bin
+    upx -d jd-gui -o $out/bin/jd-gui
+
+    patchelf \
+      --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
+      --set-rpath ${dynlibPath} \
+      $out/bin/jd-gui
   '';
 
   meta = {
diff --git a/pkgs/tools/security/vulnix/requirements.nix b/pkgs/tools/security/vulnix/requirements.nix
index c1cbf9c4d3b0..280fc2279b47 100644
--- a/pkgs/tools/security/vulnix/requirements.nix
+++ b/pkgs/tools/security/vulnix/requirements.nix
@@ -26,7 +26,7 @@ rec {
       url = "https://pypi.python.org/packages/52/b3/a96d62711a26d8cfbe546519975dc9ed54d2eb50b3238d2e6de045764796/ZConfig-3.1.0.tar.gz";
       sha256 = "c21fa3a073a56925a8098036d46717392994a92cffea1b3cda3176b70c0a842e";
     };
-    propagatedBuildInputs = [ pythonPackages.zope_testrunner ];
+    propagatedBuildInputs = with pythonPackages; [ zope_testrunner ];
     meta = with stdenv.lib; {
       homepage = "";
       license = licenses.zpt21;
diff --git a/pkgs/tools/system/ddrescue/default.nix b/pkgs/tools/system/ddrescue/default.nix
index 0b94f328b84a..5f439ccdb530 100644
--- a/pkgs/tools/system/ddrescue/default.nix
+++ b/pkgs/tools/system/ddrescue/default.nix
@@ -17,11 +17,6 @@ stdenv.mkDerivation rec {
 
   doCheck = hostPlatform == buildPlatform;
 
-  ${if hostPlatform != buildPlatform then "crossPlatforms" else null} = [ ];
-  ${if hostPlatform != buildPlatform then "configureFlags" else null} = [
-    "CXX=${stdenv.cc.prefix}c++"
-  ];
-
   meta = with stdenv.lib; {
     description = "GNU ddrescue, a data recovery tool";
 
diff --git a/pkgs/tools/text/gnupatch/default.nix b/pkgs/tools/text/gnupatch/default.nix
index 57543eb303b0..13579b57e796 100644
--- a/pkgs/tools/text/gnupatch/default.nix
+++ b/pkgs/tools/text/gnupatch/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = stdenv.lib.optional doCheck ed;
 
-  configureFlags = if hostPlatform == buildPlatform then null else [
+  configureFlags = stdenv.lib.optionals (hostPlatform != buildPlatform) [
     "ac_cv_func_strnlen_working=yes"
   ];
 
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index b9a55eb84cf5..209520097f04 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -763,7 +763,6 @@ with pkgs;
     isLibrary = false;
     enableSharedExecutables = false;
     executableToolDepends = [ makeWrapper ];
-    doCheck = stdenv.is64bit;  # https://github.com/NixOS/cabal2nix/issues/272
     postInstall = ''
       exe=$out/libexec/${drv.pname}-${drv.version}/${drv.pname}
       install -D $out/bin/${drv.pname} $exe
@@ -3323,6 +3322,8 @@ with pkgs;
 
   ngrok = callPackage ../tools/networking/ngrok { };
 
+  noice = callPackage ../applications/misc/noice { };
+
   noip = callPackage ../tools/networking/noip { };
 
   nomad = callPackage ../applications/networking/cluster/nomad { };
@@ -4530,6 +4531,8 @@ with pkgs;
 
   uriparser = callPackage ../development/libraries/uriparser {};
 
+  urlscan = callPackage ../applications/misc/urlscan { };
+
   urlview = callPackage ../applications/misc/urlview {};
 
   usbmuxd = callPackage ../tools/misc/usbmuxd {};
@@ -5473,9 +5476,10 @@ with pkgs;
   psc-package = haskell.lib.justStaticExecutables
     (haskellPackages.callPackage ../development/compilers/purescript/psc-package { });
 
-  inherit (ocamlPackages) haxe;
-
-  hxcpp = callPackage ../development/compilers/haxe/hxcpp.nix { };
+  inherit (ocamlPackages.haxe) haxe_3_2 haxe_3_4;
+  haxe = haxe_3_4;
+  haxePackages = recurseIntoAttrs (callPackage ./haxe-packages.nix { });
+  inherit (haxePackages) hxcpp;
 
   hhvm = callPackage ../development/compilers/hhvm {
     boost = boost160;
@@ -6664,6 +6668,13 @@ with pkgs;
 
   cscope = callPackage ../development/tools/misc/cscope { };
 
+  csmith = callPackage ../development/tools/misc/csmith {
+    inherit (perlPackages) perl SysCPU;
+    # Workaround optional dependency on libbsd that's
+    # currently broken on Darwin.
+    libbsd = if stdenv.isDarwin then null else libbsd;
+  };
+
   csslint = callPackage ../development/web/csslint { };
 
   libcxx = llvmPackages.libcxx;
@@ -12957,6 +12968,8 @@ with pkgs;
 
   paper-icon-theme = callPackage ../data/icons/paper-icon-theme { };
 
+  papirus-icon-theme = callPackage ../data/icons/papirus-icon-theme { };
+
   pecita = callPackage ../data/fonts/pecita {};
 
   paratype-pt-mono = callPackage ../data/fonts/paratype-pt/mono.nix {};
@@ -13643,6 +13656,8 @@ with pkgs;
 
   doodle = callPackage ../applications/search/doodle { };
 
+  dr14_tmeter = callPackage ../applications/audio/dr14_tmeter { };
+
   draftsight = callPackage ../applications/graphics/draftsight { };
 
   droopy = callPackage ../applications/networking/droopy {
@@ -17585,6 +17600,7 @@ with pkgs;
   gnomeExtensions = {
     caffeine = callPackage ../desktops/gnome-3/extensions/caffeine { };
     dash-to-dock = callPackage ../desktops/gnome-3/extensions/dash-to-dock { };
+    topicons-plus = callPackage ../desktops/gnome-3/extensions/topicons-plus { };
   };
 
   hsetroot = callPackage ../tools/X11/hsetroot { };
@@ -18719,10 +18735,10 @@ with pkgs;
   inherit (callPackage ../applications/networking/cluster/terraform {})
     terraform_0_8_5
     terraform_0_8_8
-    terraform_0_9_10;
+    terraform_0_9_11;
 
   terraform_0_8 = terraform_0_8_8;
-  terraform_0_9 = terraform_0_9_10;
+  terraform_0_9 = terraform_0_9_11;
   terraform = terraform_0_9;
 
   terraform-inventory = callPackage ../applications/networking/cluster/terraform-inventory {};
diff --git a/pkgs/top-level/haxe-packages.nix b/pkgs/top-level/haxe-packages.nix
new file mode 100644
index 000000000000..5a85dc3433ba
--- /dev/null
+++ b/pkgs/top-level/haxe-packages.nix
@@ -0,0 +1,120 @@
+{ stdenv, fetchzip, fetchFromGitHub, newScope, haxe, neko, nodejs, wine, php, python3, jdk, mono, haskellPackages, fetchpatch }:
+
+let
+  self = haxePackages;
+  callPackage = newScope self;
+  haxePackages = with self; {
+
+    withCommas = stdenv.lib.replaceChars ["."] [","];
+
+    # simulate "haxelib dev $libname ."
+    simulateHaxelibDev = libname: ''
+      devrepo=$(mktemp -d)
+      mkdir -p "$devrepo/${withCommas libname}"
+      echo $(pwd) > "$devrepo/${withCommas libname}/.dev"
+      export HAXELIB_PATH="$HAXELIB_PATH:$devrepo"
+    '';
+
+    installLibHaxe = { libname, version, files ? "*" }: ''
+      mkdir -p "$out/lib/haxe/${withCommas libname}/${withCommas version}"
+      echo -n "${version}" > $out/lib/haxe/${withCommas libname}/.current
+      cp -dpR ${files} "$out/lib/haxe/${withCommas libname}/${withCommas version}/"
+    '';
+
+    buildHaxeLib = {
+      libname,
+      version,
+      sha256,
+      meta,
+      ...
+    } @ attrs:
+      stdenv.mkDerivation (attrs // {
+        name = "${libname}-${version}";
+
+        buildInputs = (attrs.buildInputs or []) ++ [ haxe neko ]; # for setup-hook.sh to work
+        src = fetchzip rec {
+          name = "${libname}-${version}";
+          url = "http://lib.haxe.org/files/3.0/${withCommas name}.zip";
+          inherit sha256;
+          stripRoot = false;
+        };
+
+        installPhase = attrs.installPhase or ''
+          runHook preInstall
+          (
+            if [ $(ls $src | wc -l) == 1 ]; then
+              cd $src/* || cd $src
+            else
+              cd $src
+            fi
+            ${installLibHaxe { inherit libname version; }}
+          )
+          runHook postInstall
+        '';
+
+        meta = {
+          homepage = "http://lib.haxe.org/p/${libname}";
+          license = stdenv.lib.licenses.bsd2;
+          platforms = stdenv.lib.platforms.all;
+          description = throw "please write meta.description";
+        } // attrs.meta;
+      });
+
+    hxcpp = buildHaxeLib rec {
+      libname = "hxcpp";
+      version = "3.4.64";
+      sha256 = "04gyjm6wqmsm0ifcfkxmq1yv8xrfzys3z5ajqnvvjrnks807mw8q";
+      postFixup = ''
+        for f in $out/lib/haxe/${withCommas libname}/${withCommas version}/{,project/libs/nekoapi/}bin/Linux{,64}/*; do
+          chmod +w "$f"
+          patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker)   "$f" || true
+          patchelf --set-rpath ${ stdenv.lib.makeLibraryPath [ stdenv.cc.cc ] }  "$f" || true
+        done
+      '';
+      meta.description = "Runtime support library for the Haxe C++ backend";
+    };
+
+    hxjava = buildHaxeLib {
+      libname = "hxjava";
+      version = "3.2.0";
+      sha256 = "1vgd7qvsdxlscl3wmrrfi5ipldmr4xlsiwnj46jz7n6izff5261z";
+      meta.description = "Support library for the Java backend of the Haxe compiler";
+      propagatedBuildInputs = [ jdk ];
+    };
+
+    hxcs = buildHaxeLib {
+      libname = "hxcs";
+      version = "3.4.0";
+      sha256 = "0f5vgp2kqnpsbbkn2wdxmjf7xkl0qhk9lgl9kb8d5wdy89nac6q6";
+      meta.description = "Support library for the C# backend of the Haxe compiler";
+      propagatedBuildInputs = [ mono ];
+    };
+
+    hxnodejs_4 = buildHaxeLib {
+      libname = "hxnodejs";
+      version = "4.0.9";
+      sha256 = "0b7ck48nsxs88sy4fhhr0x1bc8h2ja732zzgdaqzxnh3nir0bajm";
+      meta.description = "Extern definitions for node.js 4.x";
+    };
+
+    hxnodejs_6 = let
+      libname = "hxnodejs";
+      version = "6.9.0";
+    in stdenv.mkDerivation rec {
+      name = "${libname}-${version}";
+      src = fetchFromGitHub {
+        owner = "HaxeFoundation";
+        repo = "hxnodejs";
+        rev = "cf80c6a";
+        sha256 = "0mdiacr5b2m8jrlgyd2d3vp1fha69lcfb67x4ix7l7zfi8g460gs";
+      };
+      installPhase = installLibHaxe { inherit libname version; };
+      meta = {
+        homepage = "http://lib.haxe.org/p/${libname}";
+        license = stdenv.lib.licenses.bsd2;
+        platforms = stdenv.lib.platforms.all;
+        description = "Extern definitions for node.js 6.9";
+      };
+    };
+  };
+in self
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index fa4caa25a54b..1e772e406205 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -7754,6 +7754,7 @@ let self = _self // overrides; _self = with self; {
       url = mirror://cpan/authors/id/P/PV/PVANDRY/gettext-1.05.tar.gz;
       sha256 = "15262a00vx714szpx8p2z52wxkz46xp7acl72znwjydyq4ypydi7";
     };
+    LANG="C";
   };
 
   LocaleMaketext = buildPerlPackage {
@@ -12622,6 +12623,15 @@ let self = _self // overrides; _self = with self; {
     };
   };
 
+  SysCPU = buildPerlPackage rec {
+    name = "Sys-CPU-0.61";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/M/MZ/MZSANFORD/${name}.tar.gz";
+      sha256 = "1r6976bs86j7zp51m5vh42xlyah951jgdlkimv202413kjvqc2i5";
+    };
+    buildInputs = stdenv.lib.optional stdenv.isDarwin pkgs.darwin.apple_sdk.frameworks.Carbon;
+  };
+
   SysHostnameLong = buildPerlPackage rec {
     name = "Sys-Hostname-Long-1.4";
     src = fetchurl {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 9ba65b8a41bc..232f0693ab90 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -7062,6 +7062,18 @@ in {
     };
   };
 
+  google-compute-engine = buildPythonPackage rec {
+    version = "2.3.0";
+    name    = "google-compute-engine-${version}";
+
+    src = pkgs.fetchurl {
+      url    = "mirror://pypi/g/google-compute-engine/google-compute-engine-${version}.tar.gz";
+      sha256 = "1pjj95b3l61h8xz5kjfcgnql066cr8bq5wl480a6dxd2inw8mynf";
+    };
+
+    propagatedBuildInputs = with self; [ boto ];
+  };
+
   googlecl = buildPythonPackage rec {
     version = "0.9.14";
     name    = "googlecl-${version}";
@@ -30308,8 +30320,6 @@ EOF
 
   uranium = callPackage ../development/python-modules/uranium { };
 
-  urlscan = callPackage ../applications/misc/urlscan { };
-
   vine = buildPythonPackage rec {
     name = "vine-${version}";
     version = "1.1.3";