summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/multiple-output.xml4
-rw-r--r--nixos/modules/testing/minimal-kernel.nix2
-rw-r--r--pkgs/applications/audio/flac/default.nix2
-rw-r--r--pkgs/applications/graphics/meh/default.nix2
-rw-r--r--pkgs/applications/misc/calibre/default.nix14
-rw-r--r--pkgs/applications/misc/moonlight-embedded/default.nix2
-rw-r--r--pkgs/applications/misc/mupdf/default.nix2
-rw-r--r--pkgs/applications/misc/xrq/default.nix2
-rw-r--r--pkgs/applications/networking/irc/weechat/default.nix2
-rw-r--r--pkgs/applications/networking/mailreaders/thunderbird/default.nix2
-rw-r--r--pkgs/applications/networking/mailreaders/thunderbird/gcc6.patch75
-rw-r--r--pkgs/applications/window-managers/ratpoison/default.nix2
-rw-r--r--pkgs/build-support/cc-wrapper/cc-wrapper.sh29
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix9
-rw-r--r--pkgs/build-support/cc-wrapper/ld-wrapper.sh32
-rw-r--r--pkgs/build-support/cc-wrapper/setup-hook.sh1
-rw-r--r--pkgs/build-support/cc-wrapper/utils.sh2
-rw-r--r--pkgs/build-support/setup-hooks/make-wrapper.sh8
-rw-r--r--pkgs/build-support/setup-hooks/multiple-outputs.sh4
-rw-r--r--pkgs/data/misc/tzdata/default.nix2
-rw-r--r--pkgs/desktops/gnome-2/platform/GConf/default.nix2
-rw-r--r--pkgs/desktops/gnome-3/3.22/core/gjs/default.nix4
-rw-r--r--pkgs/desktops/gnome-3/3.22/core/gjs/src.nix6
-rw-r--r--pkgs/development/compilers/gcc/4.5/default.nix3
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/5/default.nix10
-rw-r--r--pkgs/development/compilers/gcc/6/default.nix15
-rw-r--r--pkgs/development/compilers/gcc/7/default.nix15
-rw-r--r--pkgs/development/compilers/gcc/snapshot/default.nix2
-rw-r--r--pkgs/development/compilers/ghc/8.0.2.nix2
-rw-r--r--pkgs/development/compilers/openjdk/8.nix24
-rw-r--r--pkgs/development/compilers/rust/rustc.nix2
-rw-r--r--pkgs/development/interpreters/guile/default.nix2
-rw-r--r--pkgs/development/interpreters/python/cpython/3.4/default.nix1
-rw-r--r--pkgs/development/interpreters/python/cpython/3.5/default.nix1
-rw-r--r--pkgs/development/interpreters/python/cpython/3.6/default.nix1
-rw-r--r--pkgs/development/interpreters/spidermonkey/24.nix62
-rw-r--r--pkgs/development/libraries/aalib/default.nix2
-rw-r--r--pkgs/development/libraries/acl/default.nix2
-rw-r--r--pkgs/development/libraries/attr/default.nix2
-rw-r--r--pkgs/development/libraries/clucene-core/default.nix4
-rw-r--r--pkgs/development/libraries/clucene-core/gcc6.patch146
-rw-r--r--pkgs/development/libraries/dbus/default.nix4
-rw-r--r--pkgs/development/libraries/ffmpeg/generic.nix2
-rw-r--r--pkgs/development/libraries/fftw/default.nix2
-rw-r--r--pkgs/development/libraries/flann/default.nix2
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/default.nix6
-rw-r--r--pkgs/development/libraries/gettext/default.nix2
-rw-r--r--pkgs/development/libraries/glibc/avoid-semver-on-common.patch65
-rw-r--r--pkgs/development/libraries/glibc/common.nix3
-rw-r--r--pkgs/development/libraries/gtk+/3.x.nix4
-rw-r--r--pkgs/development/libraries/harfbuzz/default.nix4
-rw-r--r--pkgs/development/libraries/kyotocabinet/default.nix6
-rw-r--r--pkgs/development/libraries/libao/default.nix2
-rw-r--r--pkgs/development/libraries/libdrm/default.nix4
-rw-r--r--pkgs/development/libraries/libffi/default.nix2
-rw-r--r--pkgs/development/libraries/libjpeg-turbo/default.nix2
-rw-r--r--pkgs/development/libraries/libksba/default.nix2
-rw-r--r--pkgs/development/libraries/libmbim/default.nix2
-rw-r--r--pkgs/development/libraries/libsndfile/default.nix2
-rw-r--r--pkgs/development/libraries/libtiff/default.nix2
-rw-r--r--pkgs/development/libraries/libxml2/default.nix2
-rw-r--r--pkgs/development/libraries/libxslt/default.nix2
-rw-r--r--pkgs/development/libraries/mesa/default.nix4
-rw-r--r--pkgs/development/libraries/motif/Do-not-compile-demos.patch11
-rw-r--r--pkgs/development/libraries/motif/default.nix13
-rw-r--r--pkgs/development/libraries/mpfr/default.nix2
-rw-r--r--pkgs/development/libraries/pango/default.nix4
-rw-r--r--pkgs/development/libraries/readline/6.3.nix2
-rw-r--r--pkgs/development/libraries/readline/7.0.nix2
-rw-r--r--pkgs/development/libraries/slang/default.nix2
-rw-r--r--pkgs/development/libraries/sqlite/default.nix6
-rw-r--r--pkgs/development/libraries/strigi/default.nix4
-rw-r--r--pkgs/development/libraries/strigi/gcc6.patch45
-rw-r--r--pkgs/development/libraries/ucl/default.nix3
-rw-r--r--pkgs/development/libraries/wayland/protocols.nix4
-rw-r--r--pkgs/development/libraries/xapian/default.nix2
-rw-r--r--pkgs/development/libraries/zziplib/default.nix6
-rw-r--r--pkgs/development/python-modules/html5-parser/default.nix23
-rw-r--r--pkgs/development/tools/build-managers/gnumake/4.2/default.nix2
-rw-r--r--pkgs/development/tools/misc/automake/automake-1.15.x.nix4
-rw-r--r--pkgs/development/tools/misc/binutils/default.nix19
-rw-r--r--pkgs/development/tools/misc/binutils/elf-check-orphan-input.patch99
-rw-r--r--pkgs/development/tools/misc/binutils/elf-check-orphan-placement.patch161
-rw-r--r--pkgs/development/tools/misc/gdb/default.nix7
-rw-r--r--pkgs/development/tools/misc/intel-gpu-tools/default.nix4
-rw-r--r--pkgs/games/warmux/gcc-fix.patch2
-rw-r--r--pkgs/misc/ghostscript/default.nix2
-rw-r--r--pkgs/os-specific/linux/audit/default.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/generic.nix2
-rw-r--r--pkgs/os-specific/linux/kernel/manual-config.nix4
-rw-r--r--pkgs/os-specific/linux/libcap/default.nix2
-rw-r--r--pkgs/os-specific/linux/udisks/2-default.nix2
-rw-r--r--pkgs/servers/http/apache-httpd/2.4.nix2
-rw-r--r--pkgs/servers/uftp/default.nix6
-rw-r--r--pkgs/servers/x11/xorg/overrides.nix6
-rw-r--r--pkgs/shells/bash/4.4.nix7
-rw-r--r--pkgs/stdenv/generic/check-meta.nix4
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix34
-rw-r--r--pkgs/stdenv/linux/default.nix23
-rw-r--r--pkgs/tools/cd-dvd/cdrdao/default.nix3
-rw-r--r--pkgs/tools/compression/lzop/default.nix8
-rw-r--r--pkgs/tools/filesystems/e2fsprogs/default.nix6
-rw-r--r--pkgs/tools/graphics/pfstools/default.nix2
-rw-r--r--pkgs/tools/misc/colord/default.nix13
-rw-r--r--pkgs/tools/misc/findutils/default.nix9
-rw-r--r--pkgs/tools/networking/dnsperf/default.nix2
-rw-r--r--pkgs/tools/networking/tinc/pre.nix2
-rw-r--r--pkgs/tools/text/diffutils/default.nix8
-rw-r--r--pkgs/tools/text/groff/default.nix2
-rw-r--r--pkgs/tools/typesetting/tex/texlive/bin.nix3
-rw-r--r--pkgs/top-level/all-packages.nix11
-rw-r--r--pkgs/top-level/perl-packages.nix21
-rw-r--r--pkgs/top-level/python-packages.nix6
-rw-r--r--pkgs/top-level/release-lib.nix2
-rw-r--r--pkgs/top-level/release.nix7
117 files changed, 614 insertions, 652 deletions
diff --git a/doc/multiple-output.xml b/doc/multiple-output.xml
index a81ad6ca9eb..a2acc91e55a 100644
--- a/doc/multiple-output.xml
+++ b/doc/multiple-output.xml
@@ -73,7 +73,7 @@
 
       <varlistentry><term><varname>
         $outputMan</varname></term><listitem><para>
-        is for man pages (except for section 3). They go to <varname>man</varname> or <varname>doc</varname> or <varname>$outputBin</varname> by default.
+        is for man pages (except for section 3). They go to <varname>man</varname> or <varname>$outputBin</varname> by default.
       </para></listitem></varlistentry>
 
       <varlistentry><term><varname>
@@ -83,7 +83,7 @@
 
       <varlistentry><term><varname>
         $outputInfo</varname></term><listitem><para>
-        is for info pages. They go to <varname>info</varname> or <varname>doc</varname> or <varname>$outputMan</varname> by default.
+        is for info pages. They go to <varname>info</varname> or <varname>$outputBin</varname> by default.
       </para></listitem></varlistentry>
 
     </variablelist>
diff --git a/nixos/modules/testing/minimal-kernel.nix b/nixos/modules/testing/minimal-kernel.nix
index a463cb803ad..7c2b9c05cf9 100644
--- a/nixos/modules/testing/minimal-kernel.nix
+++ b/nixos/modules/testing/minimal-kernel.nix
@@ -6,7 +6,7 @@ let
   );
 
   origKernel = pkgs.buildLinux {
-    inherit (pkgs.linux) src version;
+    inherit (pkgs.linux) src version stdenv;
     inherit configfile;
     allowImportFromDerivation = true;
     kernelPatches = [ pkgs.kernelPatches.cifs_timeout_2_6_38 ];
diff --git a/pkgs/applications/audio/flac/default.nix b/pkgs/applications/audio/flac/default.nix
index 9805232316e..425b2b866a5 100644
--- a/pkgs/applications/audio/flac/default.nix
+++ b/pkgs/applications/audio/flac/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   #doCheck = true; # takes lots of time
 
-  outputs = [ "bin" "dev" "out" "doc" ];
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
 
   meta = with stdenv.lib; {
     homepage = https://xiph.org/flac/;
diff --git a/pkgs/applications/graphics/meh/default.nix b/pkgs/applications/graphics/meh/default.nix
index 1b5fbc2271b..ac2a194b7ca 100644
--- a/pkgs/applications/graphics/meh/default.nix
+++ b/pkgs/applications/graphics/meh/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     make PREFIX=$out install
   '';
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" ];
 
   buildInputs = [ libXext libX11 libjpeg libpng giflib ];
 
diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix
index 8341898fa23..6ca457cc1d3 100644
--- a/pkgs/applications/misc/calibre/default.nix
+++ b/pkgs/applications/misc/calibre/default.nix
@@ -5,12 +5,12 @@
 }:
 
 stdenv.mkDerivation rec {
-  version = "3.3.0";
+  version = "3.5.0";
   name = "calibre-${version}";
 
   src = fetchurl {
     url = "https://download.calibre-ebook.com/${version}/${name}.tar.xz";
-    sha256 = "1zq3aihnyxdczdz8b0w02xfw4b0l9i23f6ljpmsmm69jyh4j3m0c";
+    sha256 = "1al0vy11zvlxlrf03i631p6b419hy47pbzmgydswrii4prndj4xv";
   };
 
   patches = [
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
 
     # Remove unneeded files and libs
     rm -rf resources/calibre-portable.* \
-           src/{chardet,cherrypy,html5lib,odf,routes}
+           src/odf
   '';
 
   dontUseQmakeConfigure = true;
@@ -49,12 +49,11 @@ stdenv.mkDerivation rec {
     poppler_utils libpng imagemagick libjpeg
     fontconfig podofo qtbase chmlib icu sqlite libusb1 libmtp xdg_utils wrapGAppsHook
   ] ++ (with python2Packages; [
-    html5lib_0_9999999 # needs to be before mechanize ?
-    apsw cssselect cssutils dateutil lxml mechanize netifaces pillow
+    apsw cssselect cssutils dateutil html5-parser lxml mechanize netifaces pillow
     python pyqt5 sip
     regex msgpack
     # the following are distributed with calibre, but we use upstream instead
-    chardet cherrypy odfpy routes
+    odfpy
   ]);
 
   installPhase = ''
@@ -91,6 +90,9 @@ stdenv.mkDerivation rec {
       substituteAllInPlace $entry
     done
 
+    mkdir -p $out/share
+    cp -a man-pages $out/share/man
+
     runHook postInstall
   '';
 
diff --git a/pkgs/applications/misc/moonlight-embedded/default.nix b/pkgs/applications/misc/moonlight-embedded/default.nix
index 894751571ec..c95f935b855 100644
--- a/pkgs/applications/misc/moonlight-embedded/default.nix
+++ b/pkgs/applications/misc/moonlight-embedded/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     sha256 = "0khdbwfclvpjgyk5ar1fs4j66zsjikaj422wlvrvqhyzi1v5arpr";
   };
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" ];
 
   nativeBuildInputs = [ cmake perl ];
   buildInputs = [
diff --git a/pkgs/applications/misc/mupdf/default.nix b/pkgs/applications/misc/mupdf/default.nix
index 914dc335145..da5f3c3bf12 100644
--- a/pkgs/applications/misc/mupdf/default.nix
+++ b/pkgs/applications/misc/mupdf/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   makeFlags = [ "prefix=$(out)" ];
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ zlib libX11 libXcursor libXext harfbuzz mesa libXrandr libXinerama freetype libjpeg jbig2dec openjpeg ];
-  outputs = [ "bin" "dev" "out" "doc" ];
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
 
   preConfigure = ''
     # Don't remove mujs because upstream version is incompatible
diff --git a/pkgs/applications/misc/xrq/default.nix b/pkgs/applications/misc/xrq/default.nix
index c0c5616db79..fe65004b32a 100644
--- a/pkgs/applications/misc/xrq/default.nix
+++ b/pkgs/applications/misc/xrq/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     make PREFIX=$out install
   '';
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" ];
 
   buildInputs = [ libX11 ];
 
diff --git a/pkgs/applications/networking/irc/weechat/default.nix b/pkgs/applications/networking/irc/weechat/default.nix
index e1a9640bc23..e9484044fcc 100644
--- a/pkgs/applications/networking/irc/weechat/default.nix
+++ b/pkgs/applications/networking/irc/weechat/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     sha256 = "0xfnhaxmvxdxs3ic0qs5lwq3yl4pi5ib99p0p5lv3v2vldqlm4lc";
   };
 
-  outputs = [ "out" ]; # "doc" was here but was not produced
+  outputs = [ "out" "man" ];
 
   enableParallelBuilding = true;
   cmakeFlags = with stdenv.lib; [
diff --git a/pkgs/applications/networking/mailreaders/thunderbird/default.nix b/pkgs/applications/networking/mailreaders/thunderbird/default.nix
index 51d90d11707..0bcf1f4ceb7 100644
--- a/pkgs/applications/networking/mailreaders/thunderbird/default.nix
+++ b/pkgs/applications/networking/mailreaders/thunderbird/default.nix
@@ -29,6 +29,8 @@ in stdenv.mkDerivation rec {
     sha512 = "10e6495d207328aae325a797be1de5e535b5d967df929b0af9d7554d0473b5a7931c8f9cb1793e843b1913f441f790169dd4ac1ad9e0e53e66bc8e1c1dd60e66";
   };
 
+  patches = [ ./gcc6.patch ];
+
   # New sed no longer tolerates this mistake.
   postPatch = ''
     for f in mozilla/{js/src,}/configure; do
diff --git a/pkgs/applications/networking/mailreaders/thunderbird/gcc6.patch b/pkgs/applications/networking/mailreaders/thunderbird/gcc6.patch
new file mode 100644
index 00000000000..bd102220285
--- /dev/null
+++ b/pkgs/applications/networking/mailreaders/thunderbird/gcc6.patch
@@ -0,0 +1,75 @@
+
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1457596445 -32400
+# Node ID 55212130f19da3079167a6b0a5a0ed6689c9a71d
+# Parent  27c94617d7064d566c24a42e11cd4c7ef725923d
+Bug 1245076 - Don't include mozalloc.h from the cstdlib wrapper. r=froydnj
+
+Our STL wrappers do various different things, one of which is including
+mozalloc.h for infallible operator new. mozalloc.h includes stdlib.h,
+which, in libstdc++ >= 6 is now itself a wrapper around cstdlib, which
+circles back to our STL wrapper.
+
+But of the things our STL wrappers do, including mozalloc.h is not one
+that is necessary for cstdlib. So skip including mozalloc.h in our
+cstdlib wrapper.
+
+Additionally, some C++ sources (in media/mtransport) are including
+headers in an extern "C" block, which end up including stdlib.h, which
+ends up including cstdlib because really, this is all C++, and our
+wrapper pre-includes <new> for mozalloc.h, which fails because templates
+don't work inside extern "C". So, don't pre-include <new> when we're not
+including mozalloc.h.
+
+
+diff --git a/mozilla/config/gcc-stl-wrapper.template.h b/mozilla/config/gcc-stl-wrapper.template.h
+--- a/mozilla/config/gcc-stl-wrapper.template.h
++++ b/mozilla/config/gcc-stl-wrapper.template.h
+@@ -12,33 +12,40 @@
+ // compiling ObjC.
+ #if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
+ #  error "STL code can only be used with -fno-exceptions"
+ #endif
+ 
+ // Silence "warning: #include_next is a GCC extension"
+ #pragma GCC system_header
+ 
++// Don't include mozalloc for cstdlib. See bug 1245076.
++#ifndef moz_dont_include_mozalloc_for_cstdlib
++#  define moz_dont_include_mozalloc_for_cstdlib
++#endif
++#ifndef moz_dont_include_mozalloc_for_${HEADER}
+ // mozalloc.h wants <new>; break the cycle by always explicitly
+ // including <new> here.  NB: this is a tad sneaky.  Sez the gcc docs:
+ //
+ //    `#include_next' does not distinguish between <file> and "file"
+ //    inclusion, nor does it check that the file you specify has the
+ //    same name as the current file. It simply looks for the file
+ //    named, starting with the directory in the search path after the
+ //    one where the current file was found.
+-#include_next <new>
++#  include_next <new>
+ 
+ // See if we're in code that can use mozalloc.  NB: this duplicates
+ // code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+ // can't build with that being included before base/basictypes.h.
+-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+-#  include "mozilla/mozalloc.h"
+-#else
+-#  error "STL code can only be used with infallible ::operator new()"
++#  if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
++#    include "mozilla/mozalloc.h"
++#  else
++#    error "STL code can only be used with infallible ::operator new()"
++#  endif
++
+ #endif
+ 
+ #if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
+ // Enable checked iterators and other goodies
+ //
+ // FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
+ // Figure out how to resolve this with -fno-rtti.  Maybe build with
+ // -frtti in DEBUG builds?
+
diff --git a/pkgs/applications/window-managers/ratpoison/default.nix b/pkgs/applications/window-managers/ratpoison/default.nix
index 9879ffd64df..ced8e2e0b9d 100644
--- a/pkgs/applications/window-managers/ratpoison/default.nix
+++ b/pkgs/applications/window-managers/ratpoison/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "1wfir1gvh5h7izgvx2kd1pr2k7wlncd33zq7qi9s9k2y0aza93yr";
   };
 
-  outputs = [ "out" "contrib" "doc" "info" ];
+  outputs = [ "out" "contrib" "man" "doc" "info" ];
 
   configureFlags = [
     # >=1.4.9 requires this even with readline in inputs
diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
index e5a3a581851..1c654ea4756 100644
--- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh
+++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
@@ -34,7 +34,7 @@ cppInclude=1
 expandResponseParams "$@"
 declare -i n=0
 nParams=${#params[@]}
-while [ "$n" -lt "$nParams" ]; do
+while (( "$n" < "$nParams" )); do
     p=${params[n]}
     p2=${params[n+1]:-} # handle `p` being last one
     if [ "$p" = -c ]; then
@@ -83,7 +83,7 @@ if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "$NIX_STORE" ]]; then
     rest=()
     nParams=${#params[@]}
     declare -i n=0
-    while [ "$n" -lt "$nParams" ]; do
+    while (( "$n" < "$nParams" )); do
         p=${params[n]}
         p2=${params[n+1]:-} # handle `p` being last one
         if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
@@ -101,21 +101,24 @@ if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "$NIX_STORE" ]]; then
         fi
         n+=1
     done
-    params=("${rest[@]}")
+    # Old bash empty array hack
+    params=(${rest+"${rest[@]}"})
 fi
 
 
 # Clear march/mtune=native -- they bring impurity.
 if [ "$NIX_@infixSalt@_ENFORCE_NO_NATIVE" = 1 ]; then
     rest=()
-    for p in "${params[@]}"; do
+    # Old bash empty array hack
+    for p in ${params+"${params[@]}"}; do
         if [[ "$p" = -m*=native ]]; then
             skip "$p"
         else
             rest+=("$p")
         fi
     done
-    params=("${rest[@]}")
+    # Old bash empty array hack
+    params=(${rest+"${rest[@]}"})
 fi
 
 if [[ "$isCpp" = 1 ]]; then
@@ -163,14 +166,13 @@ fi
 
 # Optionally print debug info.
 if [ -n "${NIX_DEBUG:-}" ]; then
-    set +u # Old bash workaround, see ld-wrapper for explanation.
+    # Old bash workaround, see ld-wrapper for explanation.
     echo "extra flags before to @prog@:" >&2
-    printf "  %q\n" "${extraBefore[@]}"  >&2
+    printf "  %q\n" ${extraBefore+"${extraBefore[@]}"}  >&2
     echo "original flags to @prog@:" >&2
-    printf "  %q\n" "${params[@]}" >&2
+    printf "  %q\n" ${params+"${params[@]}"} >&2
     echo "extra flags after to @prog@:" >&2
-    printf "  %q\n" "${extraAfter[@]}" >&2
-    set -u
+    printf "  %q\n" ${extraAfter+"${extraAfter[@]}"} >&2
 fi
 
 if [ -n "$NIX_CC_WRAPPER_@infixSalt@_EXEC_HOOK" ]; then
@@ -178,5 +180,8 @@ if [ -n "$NIX_CC_WRAPPER_@infixSalt@_EXEC_HOOK" ]; then
 fi
 
 PATH="$path_backup"
-set +u # Old bash workaround, see above.
-exec @prog@ "${extraBefore[@]}" "${params[@]}" "${extraAfter[@]}"
+# Old bash workaround, see above.
+exec @prog@ \
+    ${extraBefore+"${extraBefore[@]}"} \
+    ${params+"${params[@]}"} \
+    ${extraAfter+"${extraAfter[@]}"}
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index 905135e7adc..502362514eb 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -84,6 +84,8 @@ let
       # Work around "stdenv-darwin-boot-2 is not allowed to refer to path /nix/store/...-expand-response-params.c"
       cp "$src" expand-response-params.c
       "$CC" -std=c99 -O3 -o "$out" expand-response-params.c
+      strip -S $out
+      ${optionalString hostPlatform.isLinux "patchelf --shrink-rpath $out"}
     '';
   } else "";
 
@@ -102,6 +104,8 @@ stdenv.mkDerivation {
   binPrefix = prefix;
   inherit infixSalt;
 
+  outputs = [ "out" "man" ];
+
   passthru = {
     inherit libc nativeTools nativeLibc nativePrefix isGNU isClang default_cxx_stdlib_compile
             prefix;
@@ -120,7 +124,7 @@ stdenv.mkDerivation {
 
   buildCommand =
     ''
-      mkdir -p $out/bin $out/nix-support
+      mkdir -p $out/bin $out/nix-support $man/nix-support
 
       wrap() {
         local dst="$1"
@@ -231,7 +235,8 @@ stdenv.mkDerivation {
       # Propagate the wrapped cc so that if you install the wrapper,
       # you get tools like gcov, the manpages, etc. as well (including
       # for binutils and Glibc).
-      printWords ${cc} ${cc.man or ""} ${binutils_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages
+      printWords ${cc} ${binutils_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages
+      printWords ${cc.man or ""}  > $man/nix-support/propagated-user-env-packages
 
       printWords ${toString extraPackages} > $out/nix-support/propagated-native-build-inputs
     ''
diff --git a/pkgs/build-support/cc-wrapper/ld-wrapper.sh b/pkgs/build-support/cc-wrapper/ld-wrapper.sh
index d0a1d5a0ddb..d5fdc837cf5 100644
--- a/pkgs/build-support/cc-wrapper/ld-wrapper.sh
+++ b/pkgs/build-support/cc-wrapper/ld-wrapper.sh
@@ -28,7 +28,7 @@ if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "${NIX_STORE:-}"
     rest=()
     nParams=${#params[@]}
     declare -i n=0
-    while [ "$n" -lt "$nParams" ]; do
+    while (( "$n" < "$nParams" )); do
         p=${params[n]}
         p2=${params[n+1]:-} # handle `p` being last one
         if [ "${p:0:3}" = -L/ ] && badPath "${p:2}"; then
@@ -51,7 +51,8 @@ if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "${NIX_STORE:-}"
         fi
         n+=1
     done
-    params=("${rest[@]}")
+    # Old bash empty array hack
+    params=(${rest+"${rest[@]}"})
 fi
 
 source @out@/nix-support/add-hardening.sh
@@ -73,11 +74,12 @@ relocatable=
 # Find all -L... switches for rpath, and relocatable flags for build id.
 if [ "$NIX_@infixSalt@_DONT_SET_RPATH" != 1 ] || [ "$NIX_@infixSalt@_SET_BUILD_ID" = 1 ]; then
     prev=
-    # Old bash thinks empty arrays are undefined, ugh, so temporarily disable
-    # `set -u`.
-    set +u
-    for p in "${extraBefore[@]}" "${params[@]}" "${extraAfter[@]}"; do
-        set -u
+    # Old bash thinks empty arrays are undefined, ugh.
+    for p in \
+        ${extraBefore+"${extraBefore[@]}"} \
+        ${params+"${params[@]}"} \
+        ${extraAfter+"${extraAfter[@]}"}
+    do
         case "$prev" in
             -L)
                 libDirs+=("$p")
@@ -155,14 +157,13 @@ fi
 
 # Optionally print debug info.
 if [ -n "${NIX_DEBUG:-}" ]; then
-    set +u # Old bash workaround, see above.
+    # Old bash workaround, see above.
     echo "extra flags before to @prog@:" >&2
-    printf "  %q\n" "${extraBefore[@]}"  >&2
+    printf "  %q\n" ${extraBefore+"${extraBefore[@]}"}  >&2
     echo "original flags to @prog@:" >&2
-    printf "  %q\n" "${params[@]}" >&2
+    printf "  %q\n" ${params+"${params[@]}"} >&2
     echo "extra flags after to @prog@:" >&2
-    printf "  %q\n" "${extraAfter[@]}" >&2
-    set -u
+    printf "  %q\n" ${extraAfter+"${extraAfter[@]}"} >&2
 fi
 
 if [ -n "$NIX_LD_WRAPPER_@infixSalt@_EXEC_HOOK" ]; then
@@ -170,5 +171,8 @@ if [ -n "$NIX_LD_WRAPPER_@infixSalt@_EXEC_HOOK" ]; then
 fi
 
 PATH="$path_backup"
-set +u # Old bash workaround, see above.
-exec @prog@ "${extraBefore[@]}" "${params[@]}" "${extraAfter[@]}"
+# Old bash workaround, see above.
+exec @prog@ \
+    ${extraBefore+"${extraBefore[@]}"} \
+    ${params+"${params[@]}"} \
+    ${extraAfter+"${extraAfter[@]}"}
diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh
index c6abd6281d2..e43c1609edb 100644
--- a/pkgs/build-support/cc-wrapper/setup-hook.sh
+++ b/pkgs/build-support/cc-wrapper/setup-hook.sh
@@ -139,7 +139,6 @@ export ${role}CC=@named_cc@
 export ${role}CXX=@named_cxx@
 
 for CMD in \
-    cpp \
     ar as nm objcopy ranlib strip strings size ld windres
 do
     if
diff --git a/pkgs/build-support/cc-wrapper/utils.sh b/pkgs/build-support/cc-wrapper/utils.sh
index 5a70c2d9ccf..7e9979f10ae 100644
--- a/pkgs/build-support/cc-wrapper/utils.sh
+++ b/pkgs/build-support/cc-wrapper/utils.sh
@@ -24,7 +24,7 @@ badPath() {
 }
 
 expandResponseParams() {
-    declare -g params=("$@")
+    declare -ga params=("$@")
     local arg
     for arg in "$@"; do
         if [[ "$arg" == @* ]]; then
diff --git a/pkgs/build-support/setup-hooks/make-wrapper.sh b/pkgs/build-support/setup-hooks/make-wrapper.sh
index cde28fbbcaf..f9d435df655 100644
--- a/pkgs/build-support/setup-hooks/make-wrapper.sh
+++ b/pkgs/build-support/setup-hooks/make-wrapper.sh
@@ -3,8 +3,8 @@
 # assertExecutable FILE
 assertExecutable() {
     local file="$1"
-    [[ -f "${file}" && -x "${file}" ]] || \
-        die "Cannot wrap ${file} because it is not an executable file"
+    [[ -f "$file" && -x "$file" ]] || \
+        die "Cannot wrap '$file' because it is not an executable file"
 }
 
 # construct an executable file that wraps the actual executable
@@ -33,7 +33,7 @@ makeWrapper() {
     local params varName value command separator n fileNames
     local argv0 flagsBefore flags
 
-    assertExecutable "${original}"
+    assertExecutable "$original"
 
     mkdir -p "$(dirname "$wrapper")"
 
@@ -131,7 +131,7 @@ wrapProgram() {
     local prog="$1"
     local hidden
 
-    assertExecutable "${prog}"
+    assertExecutable "$prog"
 
     hidden="$(dirname "$prog")/.$(basename "$prog")"-wrapped
     while [ -e "$hidden" ]; do
diff --git a/pkgs/build-support/setup-hooks/multiple-outputs.sh b/pkgs/build-support/setup-hooks/multiple-outputs.sh
index 62a6491b8dc..60d4ccf99ed 100644
--- a/pkgs/build-support/setup-hooks/multiple-outputs.sh
+++ b/pkgs/build-support/setup-hooks/multiple-outputs.sh
@@ -40,9 +40,9 @@ _overrideFirst outputLib "lib" "out"
 _overrideFirst outputDoc "doc" "out"
 _overrideFirst outputDevdoc "devdoc" REMOVE # documentation for developers
 # man and info pages are small and often useful to distribute with binaries
-_overrideFirst outputMan "man" "doc" "$outputBin"
+_overrideFirst outputMan "man" "$outputBin"
 _overrideFirst outputDevman "devman" "devdoc" "$outputMan"
-_overrideFirst outputInfo "info" "doc" "$outputMan"
+_overrideFirst outputInfo "info" "$outputBin"
 
 
 # Add standard flags to put files into the desired outputs.
diff --git a/pkgs/data/misc/tzdata/default.nix b/pkgs/data/misc/tzdata/default.nix
index 7784e59e4b2..843055a2c45 100644
--- a/pkgs/data/misc/tzdata/default.nix
+++ b/pkgs/data/misc/tzdata/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     "TZDIR=$(out)/share/zoneinfo"
     "ETCDIR=$(TMPDIR)/etc"
     "LIBDIR=$(dev)/lib"
-    "MANDIR=$(man)/man"
+    "MANDIR=$(man)/share/man"
     "AWK=awk"
     "CFLAGS=-DHAVE_LINK=0"
   ];
diff --git a/pkgs/desktops/gnome-2/platform/GConf/default.nix b/pkgs/desktops/gnome-2/platform/GConf/default.nix
index d1f748c993d..afa27a93bad 100644
--- a/pkgs/desktops/gnome-2/platform/GConf/default.nix
+++ b/pkgs/desktops/gnome-2/platform/GConf/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
     sha256 = "09ch709cb9fniwc4221xgkq0jf0x0lxs814sqig8p2dcll0llvzk";
   };
 
-  outputs = [ "out" "dev" "doc" ];
+  outputs = [ "out" "dev" "man" ];
 
   buildInputs = [ ORBit2 dbus_libs dbus_glib libxml2 ]
     # polkit requires pam, which requires shadow.h, which is not available on
diff --git a/pkgs/desktops/gnome-3/3.22/core/gjs/default.nix b/pkgs/desktops/gnome-3/3.22/core/gjs/default.nix
index ac5572decb8..1141db03c40 100644
--- a/pkgs/desktops/gnome-3/3.22/core/gjs/default.nix
+++ b/pkgs/desktops/gnome-3/3.22/core/gjs/default.nix
@@ -1,12 +1,12 @@
 { fetchurl, stdenv, pkgconfig, gnome3, gtk3, gobjectIntrospection
-, spidermonkey_24, pango, readline, glib, libxml2, dbus }:
+, spidermonkey_31, pango, readline, glib, libxml2, dbus }:
 
 stdenv.mkDerivation rec {
   inherit (import ./src.nix fetchurl) name src;
 
   buildInputs = [ libxml2 gobjectIntrospection pkgconfig gtk3 glib pango readline dbus ];
 
-  propagatedBuildInputs = [ spidermonkey_24 ];
+  propagatedBuildInputs = [ spidermonkey_31 ];
 
   postInstall = ''
     sed 's|-lreadline|-L${readline.out}/lib -lreadline|g' -i $out/lib/libgjs.la
diff --git a/pkgs/desktops/gnome-3/3.22/core/gjs/src.nix b/pkgs/desktops/gnome-3/3.22/core/gjs/src.nix
index 1f4ef08f9b1..7af8d7c531b 100644
--- a/pkgs/desktops/gnome-3/3.22/core/gjs/src.nix
+++ b/pkgs/desktops/gnome-3/3.22/core/gjs/src.nix
@@ -1,11 +1,11 @@
 # Autogenerated by maintainers/scripts/gnome.sh update
 
 fetchurl: rec {
-  name = "gjs-${major}.0";
-  major = "1.46";
+  name = "gjs-${major}.4";
+  major = "1.47";
 
   src = fetchurl {
     url = "mirror://gnome/sources/gjs/${major}/${name}.tar.xz";
-    sha256 = "2283591fa70785443793e1d7db66071b36052d707075f229baeb468d8dd25ad4";
+    sha256 = "05x9yk3h53wn9fpwbcxl8yz71znhwhzwy7412di77x88ghkxi2c1";
   };
 }
diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix
index 01ce4bde096..971726b8ab9 100644
--- a/pkgs/development/compilers/gcc/4.5/default.nix
+++ b/pkgs/development/compilers/gcc/4.5/default.nix
@@ -344,8 +344,7 @@ stdenv.mkDerivation ({
 
     # On GNU/Hurd glibc refers to Mach & Hurd
     # headers.
-    ++ optionals (libcCross != null &&
-                  hasAttr "propagatedBuildInputs" libcCross)
+    ++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
                  libcCross.propagatedBuildInputs);
 
   LIBRARY_PATH = makeLibraryPath ([]
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 38ff23f86a6..ee7ddccced7 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -467,7 +467,7 @@ stdenv.mkDerivation ({
 
     # On GNU/Hurd glibc refers to Mach & Hurd
     # headers.
-    ++ optionals (libcCross != null && libcCross ? "propagatedBuildInputs" )
+    ++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
                  libcCross.propagatedBuildInputs);
 
   LIBRARY_PATH = makeLibraryPath ([]
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index 04e67e44f77..1380d36725a 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -473,7 +473,7 @@ stdenv.mkDerivation ({
 
     # On GNU/Hurd glibc refers to Mach & Hurd
     # headers.
-    ++ optionals (libcCross != null && libcCross ? "propagatedBuildInputs" )
+    ++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
                  libcCross.propagatedBuildInputs);
 
   LIBRARY_PATH = makeLibraryPath ([]
diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix
index c9780077835..57b68d1a11f 100644
--- a/pkgs/development/compilers/gcc/5/default.nix
+++ b/pkgs/development/compilers/gcc/5/default.nix
@@ -325,13 +325,7 @@ stdenv.mkDerivation ({
 
   NIX_LDFLAGS = stdenv.lib.optionalString  hostPlatform.isSunOS "-lm -ldl";
 
-  preConfigure =
-    # Not sure why this is causing problems, now that the stdenv
-    # exports CPP=cpp the build fails with strange errors on darwin.
-    # https://github.com/NixOS/nixpkgs/issues/27889
-    stdenv.lib.optionalString stdenv.cc.isClang ''
-    unset CPP
-  '' + stdenv.lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
+  preConfigure = stdenv.lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
     export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
     export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
     export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
@@ -497,7 +491,7 @@ stdenv.mkDerivation ({
 
     # On GNU/Hurd glibc refers to Mach & Hurd
     # headers.
-    ++ optionals (libcCross != null && libcCross ? "propagatedBuildInputs" )
+    ++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
                  libcCross.propagatedBuildInputs);
 
   LIBRARY_PATH = makeLibraryPath ([]
diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix
index b091fd1ae37..fa42bb5b851 100644
--- a/pkgs/development/compilers/gcc/6/default.nix
+++ b/pkgs/development/compilers/gcc/6/default.nix
@@ -226,6 +226,19 @@ stdenv.mkDerivation ({
 
   hardeningDisable = [ "format" ];
 
+  # This should kill all the stdinc frameworks that gcc and friends like to
+  # insert into default search paths.
+  prePatch = stdenv.lib.optionalString hostPlatform.isDarwin ''
+    substituteInPlace gcc/config/darwin-c.c \
+      --replace 'if (stdinc)' 'if (0)'
+
+    substituteInPlace libgcc/config/t-slibgcc-darwin \
+      --replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name $lib/lib/\$(SHLIB_INSTALL_NAME)"
+
+    substituteInPlace libgfortran/configure \
+      --replace "-install_name \\\$rpath/\\\$soname" "-install_name $lib/lib/\\\$soname"
+  '';
+
   postPatch =
     if (hostPlatform.isHurd
         || (libcCross != null                  # e.g., building `gcc.crossDrv'
@@ -468,7 +481,7 @@ stdenv.mkDerivation ({
 
     # On GNU/Hurd glibc refers to Mach & Hurd
     # headers.
-    ++ optionals (libcCross != null && libcCross ? "propagatedBuildInputs")
+    ++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
                  libcCross.propagatedBuildInputs);
 
   LIBRARY_PATH = makeLibraryPath ([]
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix
index 5d3126ea0e9..67b7dee446f 100644
--- a/pkgs/development/compilers/gcc/7/default.nix
+++ b/pkgs/development/compilers/gcc/7/default.nix
@@ -228,6 +228,19 @@ stdenv.mkDerivation ({
 
   hardeningDisable = [ "format" ];
 
+  # This should kill all the stdinc frameworks that gcc and friends like to
+  # insert into default search paths.
+  prePatch = stdenv.lib.optionalString hostPlatform.isDarwin ''
+    substituteInPlace gcc/config/darwin-c.c \
+      --replace 'if (stdinc)' 'if (0)'
+
+    substituteInPlace libgcc/config/t-slibgcc-darwin \
+      --replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name $lib/lib/\$(SHLIB_INSTALL_NAME)"
+
+    substituteInPlace libgfortran/configure \
+      --replace "-install_name \\\$rpath/\\\$soname" "-install_name $lib/lib/\\\$soname"
+  '';
+
   postPatch =
     if (hostPlatform.isHurd
         || (libcCross != null                  # e.g., building `gcc.crossDrv'
@@ -470,7 +483,7 @@ stdenv.mkDerivation ({
 
     # On GNU/Hurd glibc refers to Mach & Hurd
     # headers.
-    ++ optionals (libcCross != null && libcCross ? "propagatedBuildInputs")
+    ++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
                  libcCross.propagatedBuildInputs);
 
   LIBRARY_PATH = makeLibraryPath ([]
diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix
index f3d8d27d90c..518ee5c7054 100644
--- a/pkgs/development/compilers/gcc/snapshot/default.nix
+++ b/pkgs/development/compilers/gcc/snapshot/default.nix
@@ -470,7 +470,7 @@ stdenv.mkDerivation ({
 
     # On GNU/Hurd glibc refers to Mach & Hurd
     # headers.
-    ++ optionals (libcCross != null && libcCross ? "propagatedBuildInputs")
+    ++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
                  libcCross.propagatedBuildInputs);
 
   LIBRARY_PATH = makeLibraryPath ([]
diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix
index 354091fb646..e50a8df7352 100644
--- a/pkgs/development/compilers/ghc/8.0.2.nix
+++ b/pkgs/development/compilers/ghc/8.0.2.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" "doc" ];
 
   preConfigure = ''
     sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
diff --git a/pkgs/development/compilers/openjdk/8.nix b/pkgs/development/compilers/openjdk/8.nix
index d0344347969..3355304b3bb 100644
--- a/pkgs/development/compilers/openjdk/8.nix
+++ b/pkgs/development/compilers/openjdk/8.nix
@@ -21,42 +21,42 @@ let
     else
       throw "openjdk requires i686-linux or x86_64 linux";
 
-  update = "141";
-  build = "15";
+  update = "152";
+  build = "04";
   baseurl = "http://hg.openjdk.java.net/jdk8u/jdk8u";
   repover = "jdk8u${update}-b${build}";
   paxflags = if stdenv.isi686 then "msp" else "m";
   jdk8 = fetchurl {
              url = "${baseurl}/archive/${repover}.tar.gz";
-             sha256 = "0b2nf1x2wcjn0ijyxhnrhcap4vq43sbblh5kf0qcqmx83cs3z6yh";
+             sha256 = "1hnpbx0v89jmbg58ym4zm255da11zf5jq8y5s58zj4x2z6b1fpxi";
           };
   langtools = fetchurl {
              url = "${baseurl}/langtools/archive/${repover}.tar.gz";
-             sha256 = "1mirjjywv7mnirrxj5sx3zg6j2864vjvphkn9mxx1pad49by7157";
+             sha256 = "060q01msfyspn14c9mkf9x0l8sprki9n8zb3cwlgglhnr2d4gfbr";
           };
   hotspot = fetchurl {
              url = "${baseurl}/hotspot/archive/${repover}.tar.gz";
-             sha256 = "0hhvsrclx58i7ns2v7la2wncnndblppwjncniwcvhnhgl5zhpp31";
+             sha256 = "0705667y6llsmszvdcbhbxzbn1csv1f2rlyghwggx5xnaq46dhx6";
           };
   corba = fetchurl {
              url = "${baseurl}/corba/archive/${repover}.tar.gz";
-             sha256 = "1brr72rlpaz70ihymdyp808vw433cr8b11l5qdc76aic2ywbwjyp";
+             sha256 = "13f4h43lw9q1292fymn2d7whwvccpkcqraasdhvzf904101xcpsl";
           };
   jdk = fetchurl {
              url = "${baseurl}/jdk/archive/${repover}.tar.gz";
-             sha256 = "1d4q531jswzk00kdskzfkgr0f4qmxpc7pg9w8p1gq84yz93wz11k";
+             sha256 = "16wqinqv0aqyf6jg3nsn6rj5s7ggq82wvx86zm584g56011vkgf6";
           };
   jaxws = fetchurl {
              url = "${baseurl}/jaxws/archive/${repover}.tar.gz";
-             sha256 = "0haw5095p45w33m8pafnp5r5j2lif8c1271chad5sp4gbbk40ai4";
+             sha256 = "0japl4nyb8y3w1mpfpkxn5vkf8fap1rg340vjnb6qm6fpqvl964f";
           };
   jaxp = fetchurl {
              url = "${baseurl}/jaxp/archive/${repover}.tar.gz";
-             sha256 = "0pm2cccy31d9rnkgc2hcxbpjjhf4wbayx18qn736nncvwcwa76bj";
+             sha256 = "024zphx9r92ws9xjihvhyrbbbamfl7js0s24ff577v5z5gdb1lly";
           };
   nashorn = fetchurl {
              url = "${baseurl}/nashorn/archive/${repover}.tar.gz";
-             sha256 = "1g05vfggjjg51dki28zby27pnd4z1b23fv9kyc3hdmc4bcj306x0";
+             sha256 = "1crnbjjv1s6ndqpllcrggcpsxvqcnpr58zp51y0hjz3m3gpsxwcq";
           };
   openjdk8 = stdenv.mkDerivation {
     name = "openjdk-8u${update}b${build}";
@@ -98,6 +98,10 @@ let
       substituteInPlace configure --replace /bin/bash "$shell"
       substituteInPlace hotspot/make/linux/adlc_updater --replace /bin/sh "$shell"
       substituteInPlace hotspot/make/linux/makefiles/dtrace.make --replace /usr/include/sys/sdt.h "/no-such-path"
+    ''
+    # https://bugzilla.redhat.com/show_bug.cgi?id=1306558
+    + stdenv.lib.optionalString stdenv.cc.isGNU ''
+      NIX_CFLAGS_COMPILE+=" -fno-lifetime-dse -fno-delete-null-pointer-checks"
     '';
 
     configureFlags = [
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index c5767541a02..f5bcc73fd6d 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -124,7 +124,7 @@ stdenv.mkDerivation {
   buildInputs = [ ncurses ] ++ targetToolchains
     ++ optional (!forceBundledLLVM) llvmShared;
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" "doc" ];
   setOutputFlags = false;
 
   # Disable codegen units for the tests.
diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix
index 19217476b14..fe9f94beed1 100644
--- a/pkgs/development/interpreters/guile/default.nix
+++ b/pkgs/development/interpreters/guile/default.nix
@@ -22,8 +22,8 @@
 
   nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
   buildInputs = [ readline libtool libunistring libffi ];
-  propagatedBuildInputs = [ gmp boehmgc ]
 
+  propagatedBuildInputs = [ gmp boehmgc ]
     # XXX: These ones aren't normally needed here, but since
     # `libguile-2.0.la' reads `-lltdl -lunistring', adding them here will add
     # the needed `-L' flags.  As for why the `.la' file lacks the `-L' flags,
diff --git a/pkgs/development/interpreters/python/cpython/3.4/default.nix b/pkgs/development/interpreters/python/cpython/3.4/default.nix
index e188e7ff48a..5799e319ba0 100644
--- a/pkgs/development/interpreters/python/cpython/3.4/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.4/default.nix
@@ -127,7 +127,6 @@ in stdenv.mkDerivation {
 
     # Use Python3 as default python
     ln -s "$out/bin/idle3" "$out/bin/idle"
-    ln -s "$out/bin/pip3" "$out/bin/pip"
     ln -s "$out/bin/pydoc3" "$out/bin/pydoc"
     ln -s "$out/bin/python3" "$out/bin/python"
     ln -s "$out/bin/python3-config" "$out/bin/python-config"
diff --git a/pkgs/development/interpreters/python/cpython/3.5/default.nix b/pkgs/development/interpreters/python/cpython/3.5/default.nix
index 32bc0e22d1d..1b71dba42c4 100644
--- a/pkgs/development/interpreters/python/cpython/3.5/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.5/default.nix
@@ -125,7 +125,6 @@ in stdenv.mkDerivation {
 
     # Use Python3 as default python
     ln -s "$out/bin/idle3" "$out/bin/idle"
-    ln -s "$out/bin/pip3" "$out/bin/pip"
     ln -s "$out/bin/pydoc3" "$out/bin/pydoc"
     ln -s "$out/bin/python3" "$out/bin/python"
     ln -s "$out/bin/python3-config" "$out/bin/python-config"
diff --git a/pkgs/development/interpreters/python/cpython/3.6/default.nix b/pkgs/development/interpreters/python/cpython/3.6/default.nix
index 7e05a0ce61c..0b0f9c8be6a 100644
--- a/pkgs/development/interpreters/python/cpython/3.6/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.6/default.nix
@@ -125,7 +125,6 @@ in stdenv.mkDerivation {
 
     # Use Python3 as default python
     ln -s "$out/bin/idle3" "$out/bin/idle"
-    ln -s "$out/bin/pip3" "$out/bin/pip"
     ln -s "$out/bin/pydoc3" "$out/bin/pydoc"
     ln -s "$out/bin/python3" "$out/bin/python"
     ln -s "$out/bin/python3-config" "$out/bin/python-config"
diff --git a/pkgs/development/interpreters/spidermonkey/24.nix b/pkgs/development/interpreters/spidermonkey/24.nix
deleted file mode 100644
index 6e354c54296..00000000000
--- a/pkgs/development/interpreters/spidermonkey/24.nix
+++ /dev/null
@@ -1,62 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, nspr, perl, python2, zip, libffi, readline, icu }:
-
-stdenv.mkDerivation rec {
-  version = "24.2.0";
-  name = "spidermonkey-${version}";
-
-  src = fetchurl {
-    url = "mirror://mozilla/js/mozjs-${version}.tar.bz2";
-    sha256 = "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6";
-  };
-
-  outputs = [ "out" "dev" "lib" ];
-
-  propagatedBuildInputs = [ nspr ];
-
-  buildInputs = [ pkgconfig perl python2 zip libffi readline icu ];
-
-  postPatch = ''
-    # Fixes an issue with version detection under perl 5.22.x
-    sed -i 's/(defined\((@TEMPLATE_FILE)\))/\1/' config/milestone.pl
-  '';
-
-  postUnpack = "sourceRoot=\${sourceRoot}/js/src";
-
-  preConfigure = ''
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${nspr.dev}/include/nspr"
-    export LIBXUL_DIST=$out
-  '';
-
-  setOutputFlags = false;
-  configureFlags = [
-    "--libdir=$(lib)/lib"
-    "--includedir=$(dev)/include"
-    "--enable-threadsafe"
-    "--with-system-icu"
-    "--with-system-nspr"
-    "--with-system-ffi"
-    "--enable-readline"
-  ];
-
-  # hack around a make problem, see https://github.com/NixOS/nixpkgs/issues/1279#issuecomment-29547393
-  preBuild = "touch -- {.,shell,jsapi-tests}/{-lpthread,-ldl}";
-
-  enableParallelBuilding = true;
-
-  doCheck = true;
-  preCheck = "rm jit-test/tests/sunspider/check-date-format-tofte.js"; # https://bugzil.la/600522
-
-  postInstall = ''
-    rm "$lib"/lib/*.a # halve the output size
-    moveToOutput "bin/js*-config" "$dev" # break the cycle
-  '';
-
-  meta = with stdenv.lib; {
-    description = "Mozilla's JavaScript engine written in C/C++";
-    homepage = https://developer.mozilla.org/en/SpiderMonkey;
-    # TODO: MPL/GPL/LGPL tri-license.
-    maintainers = [ maintainers.goibhniu ];
-    platforms = platforms.linux;
-  };
-}
-
diff --git a/pkgs/development/libraries/aalib/default.nix b/pkgs/development/libraries/aalib/default.nix
index 2615cac7b90..69d736d4476 100644
--- a/pkgs/development/libraries/aalib/default.nix
+++ b/pkgs/development/libraries/aalib/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation {
     sha256 = "1vkh19gb76agvh4h87ysbrgy82hrw88lnsvhynjf4vng629dmpgv";
   };
 
-  outputs = [ "bin" "dev" "out" "doc" ];
+  outputs = [ "bin" "dev" "out" "man" "info" ];
   setOutputFlags = false; # Doesn't support all the flags
 
   patches = stdenv.lib.optionals stdenv.isDarwin [ ./darwin.patch ];
diff --git a/pkgs/development/libraries/acl/default.nix b/pkgs/development/libraries/acl/default.nix
index b29a12e6f41..dc9e4e6ff18 100644
--- a/pkgs/development/libraries/acl/default.nix
+++ b/pkgs/development/libraries/acl/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "08qd9s3wfhv0ajswsylnfwr5h0d7j9d4rgip855nrh400nxp940p";
   };
 
-  outputs = [ "bin" "dev" "out" "doc" ];
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
 
   nativeBuildInputs = [ gettext ];
   buildInputs = [ attr ];
diff --git a/pkgs/development/libraries/attr/default.nix b/pkgs/development/libraries/attr/default.nix
index 7cab14a8e10..6a94cb0c0e2 100644
--- a/pkgs/development/libraries/attr/default.nix
+++ b/pkgs/development/libraries/attr/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0nd8y0m6awc9ahv0ciiwf8gy54c8d3j51pw9xg7f7cn579jjyxr5";
   };
 
-  outputs = [ "bin" "dev" "out" "doc" ];
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
 
   nativeBuildInputs = [ gettext ];
 
diff --git a/pkgs/development/libraries/clucene-core/default.nix b/pkgs/development/libraries/clucene-core/default.nix
index 90cfbb1865c..b65e794a92a 100644
--- a/pkgs/development/libraries/clucene-core/default.nix
+++ b/pkgs/development/libraries/clucene-core/default.nix
@@ -7,7 +7,9 @@ stdenv.mkDerivation rec {
     url = "mirror://sourceforge/clucene/${name}.tar.bz2";
     sha256 = "202ee45af747f18642ae0a088d7c4553521714a511a1a9ec99b8144cf9928317";
   };
-  
+
+  patches = [ ./gcc6.patch ];
+
   meta = {
     description = "Core library for full-featured text search engine";
     longDescription = ''
diff --git a/pkgs/development/libraries/clucene-core/gcc6.patch b/pkgs/development/libraries/clucene-core/gcc6.patch
new file mode 100644
index 00000000000..f78b26d24f6
--- /dev/null
+++ b/pkgs/development/libraries/clucene-core/gcc6.patch
@@ -0,0 +1,146 @@
+https://bugzilla.redhat.com/show_bug.cgi?id=998477
+
+diff -up clucene-core-0.9.21b/src/CLucene/debug/lucenebase.h.gcc48 clucene-core-0.9.21b/src/CLucene/debug/lucenebase.h
+--- clucene-core-0.9.21b/src/CLucene/debug/lucenebase.h.gcc48	2008-10-23 12:44:35.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/debug/lucenebase.h	2013-08-27 13:17:35.754234297 -0500
+@@ -58,7 +58,7 @@ public:
+ 		__cl_refcount--;
+ 		return __cl_refcount;
+ 	}
+-    virtual ~LuceneBase(){};
++    virtual ~LuceneBase() throw(CLuceneError&) {};
+ };
+ 
+ class LuceneVoidBase{
+diff -up clucene-core-0.9.21b/src/CLucene/index/CompoundFile.cpp.gcc48 clucene-core-0.9.21b/src/CLucene/index/CompoundFile.cpp
+--- clucene-core-0.9.21b/src/CLucene/index/CompoundFile.cpp.gcc48	2013-08-27 13:17:35.754234297 -0500
++++ clucene-core-0.9.21b/src/CLucene/index/CompoundFile.cpp	2013-08-27 13:18:02.844949386 -0500
+@@ -94,7 +94,7 @@ CompoundFileReader::CompoundFileReader(D
+    )
+ }
+ 
+-CompoundFileReader::~CompoundFileReader(){
++CompoundFileReader::~CompoundFileReader() throw(CLuceneError&) {
+ 	close();
+ }
+ 
+diff -up clucene-core-0.9.21b/src/CLucene/index/CompoundFile.h.gcc48 clucene-core-0.9.21b/src/CLucene/index/CompoundFile.h
+--- clucene-core-0.9.21b/src/CLucene/index/CompoundFile.h.gcc48	2008-10-23 12:44:37.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/index/CompoundFile.h	2013-08-27 13:17:35.755234286 -0500
+@@ -95,7 +95,7 @@ protected:
+ 
+ public:
+ 	CompoundFileReader(CL_NS(store)::Directory* dir, char* name);
+-	~CompoundFileReader();
++	~CompoundFileReader() throw(CLuceneError&);
+ 	CL_NS(store)::Directory* getDirectory();
+ 	const char* getName() const;
+ 
+diff -up clucene-core-0.9.21b/src/CLucene/index/Term.cpp.gcc48 clucene-core-0.9.21b/src/CLucene/index/Term.cpp
+--- clucene-core-0.9.21b/src/CLucene/index/Term.cpp.gcc48	2008-10-23 12:44:37.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/index/Term.cpp	2013-08-27 13:17:35.755234286 -0500
+@@ -81,7 +81,7 @@ Term::Term(const TCHAR* fld, const TCHAR
+     set(fld,txt);
+ }
+ 
+-Term::~Term(){
++Term::~Term() throw (CLuceneError&) {
+ //Func - Destructor.
+ //Pre  - true
+ //Post - The instance has been destroyed. field and text have been deleted if pre(intrn) is false
+diff -up clucene-core-0.9.21b/src/CLucene/index/Term.h.gcc48 clucene-core-0.9.21b/src/CLucene/index/Term.h
+--- clucene-core-0.9.21b/src/CLucene/index/Term.h.gcc48	2008-10-23 12:44:37.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/index/Term.h	2013-08-27 13:17:35.755234286 -0500
+@@ -68,7 +68,7 @@ class Term:LUCENE_REFBASE {
+ 	Term(const TCHAR* fld, const TCHAR* txt);
+ 	
+ 	///Destructor.
+-	~Term();
++	~Term() throw(CLuceneError&);
+ 
+ 	///Returns the field of this term, an interned string. The field indicates
+ 	///the part of a document which this term came from. 
+diff -up clucene-core-0.9.21b/src/CLucene/store/Directory.h.gcc48 clucene-core-0.9.21b/src/CLucene/store/Directory.h
+--- clucene-core-0.9.21b/src/CLucene/store/Directory.h.gcc48	2008-10-23 12:44:36.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/Directory.h	2013-08-27 13:17:35.756234276 -0500
+@@ -41,7 +41,7 @@ CL_NS_DEF(store)
+ 	public:
+ 		DEFINE_MUTEX(THIS_LOCK)
+ 	   
+-		virtual ~Directory(){ };
++		virtual ~Directory() throw(CLuceneError&) { };
+ 
+ 		// Returns an null terminated array of strings, one for each file in the directory. 
+ 		char** list() const{
+diff -up clucene-core-0.9.21b/src/CLucene/store/FSDirectory.cpp.gcc48 clucene-core-0.9.21b/src/CLucene/store/FSDirectory.cpp
+--- clucene-core-0.9.21b/src/CLucene/store/FSDirectory.cpp.gcc48	2008-10-23 13:01:52.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/FSDirectory.cpp	2013-08-27 13:17:35.756234276 -0500
+@@ -368,7 +368,7 @@ void FSDirectory::FSIndexInput::readInte
+       strcat(buffer,name);
+   }
+ 
+-  FSDirectory::~FSDirectory(){
++  FSDirectory::~FSDirectory() throw(CLuceneError&) {
+   }
+ 
+   void FSDirectory::list(vector<string>* names) const{ //todo: fix this, ugly!!!
+diff -up clucene-core-0.9.21b/src/CLucene/store/FSDirectory.h.gcc48 clucene-core-0.9.21b/src/CLucene/store/FSDirectory.h
+--- clucene-core-0.9.21b/src/CLucene/store/FSDirectory.h.gcc48	2008-10-23 13:00:43.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/FSDirectory.h	2013-08-27 13:17:35.756234276 -0500
+@@ -155,7 +155,7 @@
+ 	  ///Destructor - only call this if you are sure the directory
+ 	  ///is not being used anymore. Otherwise use the ref-counting
+ 	  ///facilities of _CLDECDELETE
+-		~FSDirectory();
++		~FSDirectory() throw(CLuceneError&);
+ 
+ 		/// Get a list of strings, one for each file in the directory. 
+ 		void list(vector<string>* names) const;
+diff -up clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.cpp.gcc48 clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.cpp
+--- clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.cpp.gcc48	2008-10-23 12:44:36.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.cpp	2013-08-27 13:17:35.757234265 -0500
+@@ -219,7 +219,7 @@ CL_NS_DEF(store)
+   {
+   }
+   
+-  RAMDirectory::~RAMDirectory(){
++  RAMDirectory::~RAMDirectory() throw(CLuceneError&) {
+    //todo: should call close directory?
+   }
+ 
+diff -up clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.h.gcc48 clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.h
+--- clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.h.gcc48	2008-10-23 12:44:36.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/RAMDirectory.h	2013-08-27 13:17:35.757234265 -0500
+@@ -131,7 +131,7 @@ CL_NS_DEF(store)
+ 	  ///Destructor - only call this if you are sure the directory
+ 	  ///is not being used anymore. Otherwise use the ref-counting
+ 	  ///facilities of dir->close
+-		virtual ~RAMDirectory();
++		virtual ~RAMDirectory() throw(CLuceneError&);
+ 		RAMDirectory(Directory* dir);
+ 		
+ 	  /**
+diff -up clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.cpp.gcc48 clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.cpp
+--- clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.cpp.gcc48	2008-10-23 12:44:36.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.cpp	2013-08-27 13:17:35.757234265 -0500
+@@ -16,7 +16,7 @@ CL_NS_USE(util)
+   {
+     transOpen = false;
+   }
+-  TransactionalRAMDirectory::~TransactionalRAMDirectory(){
++  TransactionalRAMDirectory::~TransactionalRAMDirectory() throw(CLuceneError&) {
+   }
+ 
+   bool TransactionalRAMDirectory::archiveOrigFileIfNecessary(const char* name) {
+diff -up clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.h.gcc48 clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.h
+--- clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.h.gcc48	2008-10-23 12:44:36.000000000 -0500
++++ clucene-core-0.9.21b/src/CLucene/store/TransactionalRAMDirectory.h	2013-08-27 13:17:35.757234265 -0500
+@@ -44,7 +44,7 @@ CL_NS_DEF(store)
+ 
+   public:
+     TransactionalRAMDirectory();
+-    virtual ~TransactionalRAMDirectory();
++    virtual ~TransactionalRAMDirectory() throw(CLuceneError&);
+ 
+     bool transIsOpen() const;
+     void transStart();
diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix
index 5fe13d86f2d..17a5c65376b 100644
--- a/pkgs/development/libraries/dbus/default.nix
+++ b/pkgs/development/libraries/dbus/default.nix
@@ -6,8 +6,8 @@ assert x11Support -> libX11 != null
                   && libSM != null;
 
 let
-  version = "1.10.20";
-  sha256 = "0j0b8rn9fvh1m4nndp9fzq09xw50grp5kfvkv7jgs9al1dwbjx75";
+  version = "1.10.22";
+  sha256 = "15vv9gz5i4f5l7h0d045qz5iyvl89hjk2k83lb4vbizd7qg41cg2";
 
 self = stdenv.mkDerivation {
     name = "dbus-${version}";
diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix
index a34b378552a..1bd8b739260 100644
--- a/pkgs/development/libraries/ffmpeg/generic.nix
+++ b/pkgs/development/libraries/ffmpeg/generic.nix
@@ -75,7 +75,7 @@ stdenv.mkDerivation rec {
   postPatch = ''patchShebangs .'';
   inherit patches;
 
-  outputs = [ "bin" "dev" "out" ]
+  outputs = [ "bin" "dev" "out" "man" ]
     ++ optional (reqMin "1.0") "doc" ; # just dev-doc
   setOutputFlags = false; # doesn't accept all and stores configureFlags in libs!
 
diff --git a/pkgs/development/libraries/fftw/default.nix b/pkgs/development/libraries/fftw/default.nix
index 4bbc515831e..d4d8c7f8aee 100644
--- a/pkgs/development/libraries/fftw/default.nix
+++ b/pkgs/development/libraries/fftw/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     sha256 = "0g8qk98lgq770ixdf7n36yd5xjsgm2v3wzvnphwmhy6r4y2amx0y";
   };
 
-  outputs = [ "out" "dev" "doc" ]; # it's dev-doc only
+  outputs = [ "out" "dev" "man" "info" ]; # it's dev-doc only
   outputBin = "dev"; # fftw-wisdom
 
   configureFlags =
diff --git a/pkgs/development/libraries/flann/default.nix b/pkgs/development/libraries/flann/default.nix
index eda18bc432c..3cc518fee50 100644
--- a/pkgs/development/libraries/flann/default.nix
+++ b/pkgs/development/libraries/flann/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, unzip, cmake, python}:
+{ stdenv, fetchFromGitHub, unzip, cmake, python }:
 
 stdenv.mkDerivation {
   name = "flann-1.9.1";
diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix
index f40ebf00590..38c1b6197a5 100644
--- a/pkgs/development/libraries/gdk-pixbuf/default.nix
+++ b/pkgs/development/libraries/gdk-pixbuf/default.nix
@@ -3,14 +3,16 @@
 
 let
   ver_maj = "2.36";
-  ver_min = "6";
+  ver_min = "7";
+  # TODO: since 2.36.8 gdk-pixbuf gets configured to use mime-type sniffing,
+  # which apparently requires access to shared_mime_info files during runtime.
 in
 stdenv.mkDerivation rec {
   name = "gdk-pixbuf-${ver_maj}.${ver_min}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/gdk-pixbuf/${ver_maj}/${name}.tar.xz";
-    sha256 = "455eb90c09ed1b71f95f3ebfe1c904c206727e0eeb34fc94e5aaf944663a820c";
+    sha256 = "1b6e5eef09d98f05f383014ecd3503e25dfb03d7e5b5f5904e5a65b049a6a4d8";
   };
 
   outputs = [ "out" "dev" "devdoc" ];
diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix
index d7058884104..b96c4599994 100644
--- a/pkgs/development/libraries/gettext/default.nix
+++ b/pkgs/development/libraries/gettext/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   };
   patches = [ ./absolute-paths.diff ];
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" "doc" "info" ];
 
   # FIXME stackprotector needs gcc 4.9 in bootstrap tools
   hardeningDisable = [ "format" "stackprotector" ];
diff --git a/pkgs/development/libraries/glibc/avoid-semver-on-common.patch b/pkgs/development/libraries/glibc/avoid-semver-on-common.patch
deleted file mode 100644
index 966325d6f18..00000000000
--- a/pkgs/development/libraries/glibc/avoid-semver-on-common.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From 0edeadc0d396aa713b808ae50a0058aca5d3837e Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Wed, 26 Jul 2017 10:08:46 -0700
-Subject: [PATCH] Avoid .symver on common symbols [BZ #21666]
-
-The .symver directive on common symbol just creates a new common symbol,
-not an alias and the newer assembler with the bug fix for
-
-https://sourceware.org/bugzilla/show_bug.cgi?id=21661
-
-will issue an error.  Before the fix, we got
-
-$ readelf -sW libc.so | grep "loc[12s]"
-  5109: 00000000003a0608     8 OBJECT  LOCAL  DEFAULT   36 loc1
-  5188: 00000000003a0610     8 OBJECT  LOCAL  DEFAULT   36 loc2
-  5455: 00000000003a0618     8 OBJECT  LOCAL  DEFAULT   36 locs
-  6575: 00000000003a05f0     8 OBJECT  GLOBAL DEFAULT   36 locs@GLIBC_2.2.5
-  7156: 00000000003a05f8     8 OBJECT  GLOBAL DEFAULT   36 loc1@GLIBC_2.2.5
-  7312: 00000000003a0600     8 OBJECT  GLOBAL DEFAULT   36 loc2@GLIBC_2.2.5
-
-in libc.so.  The versioned loc1, loc2 and locs have the wrong addresses.
-After the fix, we got
-
-$ readelf -sW libc.so | grep "loc[12s]"
-  6570: 000000000039e3b8     8 OBJECT  GLOBAL DEFAULT   34 locs@GLIBC_2.2.5
-  7151: 000000000039e3c8     8 OBJECT  GLOBAL DEFAULT   34 loc1@GLIBC_2.2.5
-  7307: 000000000039e3c0     8 OBJECT  GLOBAL DEFAULT   34 loc2@GLIBC_2.2.5
-
-	[BZ #21666]
-	* misc/regexp.c (loc1): Add __attribute__ ((nocommon));
-	(loc2): Likewise.
-	(locs): Likewise.
-
-(cherry picked from commit 388b4f1a02f3a801965028bbfcd48d905638b797)
----
- ChangeLog     | 7 +++++++
- misc/regexp.c | 9 +++++----
- 2 files changed, 12 insertions(+), 4 deletions(-)
-
-diff --git a/misc/regexp.c b/misc/regexp.c
-index 19d76c0..eaea7c3 100644
---- a/misc/regexp.c
-+++ b/misc/regexp.c
-@@ -29,14 +29,15 @@
-
- #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
-
--/* Define the variables used for the interface.  */
--char *loc1;
--char *loc2;
-+/* Define the variables used for the interface.  Avoid .symver on common
-+   symbol, which just creates a new common symbol, not an alias.  */
-+char *loc1 __attribute__ ((nocommon));
-+char *loc2 __attribute__ ((nocommon));
- compat_symbol (libc, loc1, loc1, GLIBC_2_0);
- compat_symbol (libc, loc2, loc2, GLIBC_2_0);
-
- /* Although we do not support the use we define this variable as well.  */
--char *locs;
-+char *locs __attribute__ ((nocommon));
- compat_symbol (libc, locs, locs, GLIBC_2_0);
-
-
---
-2.9.3
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index d1c5446e807..1b53acf12b1 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -64,9 +64,6 @@ stdenv.mkDerivation ({
       ./CVE-2017-1000366-rtld-LD_LIBRARY_PATH.patch
       ./CVE-2017-1000366-rtld-LD_PRELOAD.patch
       ./CVE-2017-1000366-rtld-LD_AUDIT.patch
-
-      /* https://sourceware.org/bugzilla/show_bug.cgi?id=21666 */
-      ./avoid-semver-on-common.patch
     ]
     ++ lib.optionals stdenv.isi686 [
       ./fix-i686-memchr.patch
diff --git a/pkgs/development/libraries/gtk+/3.x.nix b/pkgs/development/libraries/gtk+/3.x.nix
index 82df6e135d0..1071af61448 100644
--- a/pkgs/development/libraries/gtk+/3.x.nix
+++ b/pkgs/development/libraries/gtk+/3.x.nix
@@ -13,7 +13,7 @@ with stdenv.lib;
 
 let
   ver_maj = "3.22";
-  ver_min = "16";
+  ver_min = "18";
   version = "${ver_maj}.${ver_min}";
 in
 stdenv.mkDerivation rec {
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://gnome/sources/gtk+/${ver_maj}/gtk+-${version}.tar.xz";
-    sha256 = "3e0c3ad01f3c8c5c9b1cc1ae00852bd55164c8e5a9c1f90ba5e07f14f175fe2c";
+    sha256 = "b64b1c2ec20adf128ac08ee704d1f4e7b0a8d3df097d51f62edb271c7bb1bf69";
   };
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix
index 191d3365d6c..8885f2a2c43 100644
--- a/pkgs/development/libraries/harfbuzz/default.nix
+++ b/pkgs/development/libraries/harfbuzz/default.nix
@@ -5,7 +5,7 @@
 }:
 
 let
-  version = "1.4.6";
+  version = "1.4.8";
   inherit (stdenv.lib) optional optionals optionalString;
 in
 
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-${version}.tar.bz2";
-    sha256 = "21a78b81cd20cbffdb04b59ac7edfb410e42141869f637ae1d6778e74928d293";
+    sha256 = "ccec4930ff0bb2d0c40aee203075447954b64a8c2695202413cc5e428c907131";
   };
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/kyotocabinet/default.nix b/pkgs/development/libraries/kyotocabinet/default.nix
index 8e7971d8087..11388f25a99 100644
--- a/pkgs/development/libraries/kyotocabinet/default.nix
+++ b/pkgs/development/libraries/kyotocabinet/default.nix
@@ -20,6 +20,12 @@ stdenv.mkDerivation rec {
     substituteInPlace configure --replace stdc++ c++
   '';
 
+  patches = [(fetchurl {
+    name = "gcc6.patch";
+    url = "http://pkgs.fedoraproject.org/rpms/kyotocabinet/raw/master/f/kyotocabinet-1.2.76-gcc6.patch";
+    sha256 = "1h5k38mkiq7lz8nd2gbn7yvimcz49g3z7phn1cr560bzjih8rz23";
+  })];
+
   buildInputs = [ zlib ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/libao/default.nix b/pkgs/development/libraries/libao/default.nix
index de4aaf9fdee..3a1c8938405 100644
--- a/pkgs/development/libraries/libao/default.nix
+++ b/pkgs/development/libraries/libao/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "1bwwv1g9lchaq6qmhvj1pp3hnyqr64ydd4j38x94pmprs4d27b83";
   };
 
-  outputs = [ "out" "dev" "doc" ];
+  outputs = [ "out" "dev" "man" "doc" ];
 
   buildInputs =
     [ pkgconfig ] ++
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index 17d09366a9d..96d346ad77e 100644
--- a/pkgs/development/libraries/libdrm/default.nix
+++ b/pkgs/development/libraries/libdrm/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, pkgconfig, libpthreadstubs, libpciaccess, valgrind-light }:
 
 stdenv.mkDerivation rec {
-  name = "libdrm-2.4.81";
+  name = "libdrm-2.4.82";
 
   src = fetchurl {
     url = "http://dri.freedesktop.org/libdrm/${name}.tar.bz2";
-    sha256 = "8cc05c195ac8708199979a94c4e4d1a928c14ec338ecbcb38ead09f54dae11ae";
+    sha256 = "43fa2dbd422d6d41ac141272cc9855360ce4d08c7cf7f2c7bb55dfe449c4ce1c";
   };
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/libffi/default.nix b/pkgs/development/libraries/libffi/default.nix
index ca149bd3db3..284705e88d3 100644
--- a/pkgs/development/libraries/libffi/default.nix
+++ b/pkgs/development/libraries/libffi/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   patches = stdenv.lib.optional stdenv.isCygwin ./3.2.1-cygwin.patch;
 
-  outputs = [ "out" "dev" "doc" ];
+  outputs = [ "out" "dev" "man" "info" ];
 
   buildInputs = stdenv.lib.optional doCheck dejagnu;
 
diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix
index d1181966815..1023c8ae505 100644
--- a/pkgs/development/libraries/libjpeg-turbo/default.nix
+++ b/pkgs/development/libraries/libjpeg-turbo/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     stdenv.lib.optional (hostPlatform.libc or null == "msvcrt")
       ./mingw-boolean.patch;
 
-  outputs = [ "bin" "dev" "out" "doc" ];
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
 
   nativeBuildInputs = [ nasm ];
 
diff --git a/pkgs/development/libraries/libksba/default.nix b/pkgs/development/libraries/libksba/default.nix
index 9e1d4b58a92..8bff5a21cd0 100644
--- a/pkgs/development/libraries/libksba/default.nix
+++ b/pkgs/development/libraries/libksba/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0h53q4sns1jz1pkmhcz5wp9qrfn9f5g9i3vjv6dafwzzlvblyi21";
   };
 
-  outputs = [ "out" "dev" "doc" ];
+  outputs = [ "out" "dev" "info" ];
 
   propagatedBuildInputs = [ libgpgerror ];
 
diff --git a/pkgs/development/libraries/libmbim/default.nix b/pkgs/development/libraries/libmbim/default.nix
index c40e54e09cb..f1625e6a33f 100644
--- a/pkgs/development/libraries/libmbim/default.nix
+++ b/pkgs/development/libraries/libmbim/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0nxb4x8l092xckk4dy84cn5qhviif8akzy0miypapjqqbalm53fa";
   };
 
-  outputs = [ "out" "dev" "doc" ];
+  outputs = [ "out" "dev" "man" ];
 
   preConfigure = ''
     patchShebangs .
diff --git a/pkgs/development/libraries/libsndfile/default.nix b/pkgs/development/libraries/libsndfile/default.nix
index 597f74feb54..21710375ed7 100644
--- a/pkgs/development/libraries/libsndfile/default.nix
+++ b/pkgs/development/libraries/libsndfile/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  outputs = [ "bin" "dev" "out" "doc" ];
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
 
   # need headers from the Carbon.framework in /System/Library/Frameworks to
   # compile this on darwin -- not sure how to handle
diff --git a/pkgs/development/libraries/libtiff/default.nix b/pkgs/development/libraries/libtiff/default.nix
index 7f6faa996bd..b64a578f0cc 100644
--- a/pkgs/development/libraries/libtiff/default.nix
+++ b/pkgs/development/libraries/libtiff/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
       patches="$patches $(cat debian/patches/series | sed 's|^|debian/patches/|')"
     '';
 
-  outputs = [ "bin" "dev" "out" "doc" ];
+  outputs = [ "bin" "dev" "out" "man" "doc" ];
 
   nativeBuildInputs = [ pkgconfig ];
 
diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix
index 10dd4ee5dbe..37057295672 100644
--- a/pkgs/development/libraries/libxml2/default.nix
+++ b/pkgs/development/libraries/libxml2/default.nix
@@ -26,7 +26,7 @@ in stdenv.mkDerivation rec {
     })
   ];
 
-  outputs = [ "bin" "dev" "out" "doc" ]
+  outputs = [ "bin" "dev" "out" "man" "doc" ]
     ++ lib.optional pythonSupport "py";
   propagatedBuildOutputs = "out bin" + lib.optionalString pythonSupport " py";
 
diff --git a/pkgs/development/libraries/libxslt/default.nix b/pkgs/development/libraries/libxslt/default.nix
index 07f96fad33e..1c27b6e3233 100644
--- a/pkgs/development/libraries/libxslt/default.nix
+++ b/pkgs/development/libraries/libxslt/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
       --replace 'la_LDFLAGS =' 'la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS)'
   '';
 
-  outputs = [ "bin" "dev" "out" "doc" ] ++ stdenv.lib.optional pythonSupport "py";
+  outputs = [ "bin" "dev" "out" "man" "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 45819a8f3a6..f23838cb956 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.5";
+  version = "17.1.6";
   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 = "378516b171712687aace4c7ea8b37c85895231d7a6d61e1e27362cf6034fded9";
+    sha256 = "0686deadde1f126b20aa67e47e8c50502043eee4ecdf60d5009ffda3cebfee50";
   };
 
   prePatch = "patchShebangs .";
diff --git a/pkgs/development/libraries/motif/Do-not-compile-demos.patch b/pkgs/development/libraries/motif/Do-not-compile-demos.patch
deleted file mode 100644
index 1b8df94d007..00000000000
--- a/pkgs/development/libraries/motif/Do-not-compile-demos.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -27,7 +27,6 @@ SUBDIRS   = bindings bitmaps \
-              include \
-              tools \
-              clients \
--             doc \
--             demos
-+             doc
- AUTOMAKE_OPTIONS = 1.4
- ACLOCAL_AMFLAGS = -I .
diff --git a/pkgs/development/libraries/motif/default.nix b/pkgs/development/libraries/motif/default.nix
index 1f86af0a2e8..c57353ccbd4 100644
--- a/pkgs/development/libraries/motif/default.nix
+++ b/pkgs/development/libraries/motif/default.nix
@@ -3,7 +3,7 @@
 , expat, libjpeg, libpng, libiconv
 , flex
 , libXp, libXau
-, demoSupport ? false, autoconf, automake
+, demoSupport ? false
 }:
 # refer to the gentoo package
 
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     expat libjpeg libpng libiconv
   ];
 
-  nativeBuildInputs = [ pkgconfig flex ] ++ stdenv.lib.optionals (!demoSupport) [ autoconf automake ];
+  nativeBuildInputs = [ pkgconfig flex ];
 
   propagatedBuildInputs = [ libXp libXau ];
 
@@ -30,13 +30,16 @@ stdenv.mkDerivation rec {
 
   makeFlags = [ "CFLAGS=-fno-strict-aliasing" ];
 
-  prePatch = ''rm lib/Xm/Xm.h'';
+  prePatch = ''
+    rm lib/Xm/Xm.h
+  '' + stdenv.lib.optionalString (!demoSupport) ''
+    sed '/^SUBDIRS =,^$/s/\<demos\>//' -i Makefile.{am,in}
+  '';
 
   patches = [ ./Remove-unsupported-weak-refs-on-darwin.patch
               ./Use-correct-header-for-malloc.patch
               ./Add-X.Org-to-bindings-file.patch
-            ]
-            ++ stdenv.lib.optional (!demoSupport) ./Do-not-compile-demos.patch;
+            ];
 
   meta = with stdenv.lib; {
     homepage = http://motif.ics.com;
diff --git a/pkgs/development/libraries/mpfr/default.nix b/pkgs/development/libraries/mpfr/default.nix
index 4f9a9fb9bd0..360ad66b7ce 100644
--- a/pkgs/development/libraries/mpfr/default.nix
+++ b/pkgs/development/libraries/mpfr/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./upstream.patch ];
 
-  outputs = [ "out" "dev" "doc" ];
+  outputs = [ "out" "dev" "doc" "info" ];
 
   # mpfr.h requires gmp.h
   propagatedBuildInputs = [ gmp ];
diff --git a/pkgs/development/libraries/pango/default.nix b/pkgs/development/libraries/pango/default.nix
index 9b396261fcc..29a69bee0c7 100644
--- a/pkgs/development/libraries/pango/default.nix
+++ b/pkgs/development/libraries/pango/default.nix
@@ -6,14 +6,14 @@ with stdenv.lib;
 
 let
   ver_maj = "1.40";
-  ver_min = "6";
+  ver_min = "9";
 in
 stdenv.mkDerivation rec {
   name = "pango-${ver_maj}.${ver_min}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/pango/${ver_maj}/${name}.tar.xz";
-    sha256 = "ca152b7383a1e9f7fd74ae96023dc6770dc5043414793bfe768ff06b6759e573";
+    sha256 = "9faea6535312fe4436b93047cf7a04af544eb52a079179bd3a33821aacce7e16";
   };
 
   outputs = [ "bin" "dev" "out" "devdoc" ];
diff --git a/pkgs/development/libraries/readline/6.3.nix b/pkgs/development/libraries/readline/6.3.nix
index 822ce7b0055..1183f46b8db 100644
--- a/pkgs/development/libraries/readline/6.3.nix
+++ b/pkgs/development/libraries/readline/6.3.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "0hzxr9jxqqx5sxsv9vmlxdnvlr9vi4ih1avjb869hbs6p5qn1fjn";
   };
 
-  outputs = [ "out" "dev" "doc" ];
+  outputs = [ "out" "dev" "man" "doc" "info" ];
 
   propagatedBuildInputs = [ncurses];
 
diff --git a/pkgs/development/libraries/readline/7.0.nix b/pkgs/development/libraries/readline/7.0.nix
index c40dfc1025a..a7306010a8b 100644
--- a/pkgs/development/libraries/readline/7.0.nix
+++ b/pkgs/development/libraries/readline/7.0.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "0d13sg9ksf982rrrmv5mb6a2p4ys9rvg9r71d6il0vr8hmql63bm";
   };
 
-  outputs = [ "out" "dev" "doc" ];
+  outputs = [ "out" "dev" "man" "doc" "info" ];
 
   propagatedBuildInputs = [ncurses];
 
diff --git a/pkgs/development/libraries/slang/default.nix b/pkgs/development/libraries/slang/default.nix
index 553ddb7d3b7..70e9d6181d9 100644
--- a/pkgs/development/libraries/slang/default.nix
+++ b/pkgs/development/libraries/slang/default.nix
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
     sha256 = "0dlcy0hn0j6cj9qj5x6hpb0axifnvzzmv5jqq0wq14fygw0c7w2l";
   };
 
-  outputs = [ "out" "dev" "doc" ];
+  outputs = [ "out" "dev" "man" "doc" ];
 
   # Fix some wrong hardcoded paths
   preConfigure = ''
diff --git a/pkgs/development/libraries/sqlite/default.nix b/pkgs/development/libraries/sqlite/default.nix
index 21d89c49e7c..6dc09ddd39f 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.19.3";
+  name = "sqlite-3.20.0";
 
   src = fetchurl {
-    url = "http://sqlite.org/2017/sqlite-autoconf-3190300.tar.gz";
-    sha256 = "00b3l2qglpl1inx21fckiwxnfq5xf6441flc79rqg7zdvh1rq4h6";
+    url = "http://sqlite.org/2017/sqlite-autoconf-3200000.tar.gz";
+    sha256 = "1876dapm1xx5aqd2d8l7ymmkd2z9rybh99rp5f5rd4zz57vcc51q";
   };
 
   outputs = [ "bin" "dev" "out" ];
diff --git a/pkgs/development/libraries/strigi/default.nix b/pkgs/development/libraries/strigi/default.nix
index 1961160cbc9..362881a2f42 100644
--- a/pkgs/development/libraries/strigi/default.nix
+++ b/pkgs/development/libraries/strigi/default.nix
@@ -16,11 +16,11 @@ stdenv.mkDerivation rec {
   CLUCENE_HOME = clucene_core;
 
   buildInputs =
-    [ zlib bzip2 stdenv.cc.libc libxml2 qt4 exiv2 clucene_core fam dbus_tools ];
+    [ zlib bzip2 libxml2 qt4 exiv2 clucene_core fam dbus_tools ];
 
   nativeBuildInputs = [ cmake pkgconfig perl ];
 
-  patches = [ ./export_bufferedstream.patch ];
+  patches = [ ./export_bufferedstream.patch ./gcc6.patch ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/strigi/gcc6.patch b/pkgs/development/libraries/strigi/gcc6.patch
new file mode 100644
index 00000000000..b46f6c52b82
--- /dev/null
+++ b/pkgs/development/libraries/strigi/gcc6.patch
@@ -0,0 +1,45 @@
+https://sourceforge.net/p/strigi/patches/4/
+
+and a fix for
+
+/tmp/nix-build-strigi-0.7.8.drv-0/strigi-0.7.8/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexreader.cpp:325:37: error: no matching function for call to 'make_pair(std::__cxx11::string, std::__cxx11::string&)'
+             wchartoutf8(name), value));
+
+diff -Naur strigi-0.7.8.old/libstreamanalyzer/cmake/MacroCheckGccVisibility.cmake strigi-0.7.8/libstreamanalyzer/cmake/MacroCheckGccVisibility.cmake
+--- strigi-0.7.8.old/libstreamanalyzer/cmake/MacroCheckGccVisibility.cmake	2013-02-05 16:34:52.000000000 -0500
++++ strigi-0.7.8/libstreamanalyzer/cmake/MacroCheckGccVisibility.cmake	2016-05-14 11:39:54.586260564 -0400
+@@ -15,7 +15,7 @@
+    # get the gcc version
+    exec_program(${CMAKE_C_COMPILER} ARGS ${CMAKE_C_COMPILER_ARG1} --version OUTPUT_VARIABLE _gcc_version_info)
+ 
+-   string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
++   string (REGEX MATCH "[3456789]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
+    # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here:
+    if (NOT _gcc_version)
+       string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
+diff -Naur strigi-0.7.8.old/libstreams/cmake/MacroCheckGccVisibility.cmake strigi-0.7.8/libstreams/cmake/MacroCheckGccVisibility.cmake
+--- strigi-0.7.8.old/libstreams/cmake/MacroCheckGccVisibility.cmake	2013-02-05 16:34:57.000000000 -0500
++++ strigi-0.7.8/libstreams/cmake/MacroCheckGccVisibility.cmake	2016-05-14 11:40:11.340134414 -0400
+@@ -15,7 +15,7 @@
+    # get the gcc version
+    exec_program(${CMAKE_C_COMPILER} ARGS ${CMAKE_C_COMPILER_ARG1} --version OUTPUT_VARIABLE _gcc_version_info)
+ 
+-   string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
++   string (REGEX MATCH "[3456789]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
+    # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here:
+    if (NOT _gcc_version)
+       string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
+
+diff -ru strigi-0.7.8-orig/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexreader.cpp strigi-0.7.8/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexreader.cpp
+--- strigi-0.7.8-orig/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexreader.cpp	2013-02-05 22:34:52.000000000 +0100
++++ strigi-0.7.8/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexreader.cpp	2017-07-31 10:56:27.067902643 +0200
+@@ -321,8 +321,7 @@
+         string size = value;
+         doc.size = atoi(size.c_str());
+     } else {
+-        doc.properties.insert(make_pair<const string, string>(
+-            wchartoutf8(name), value));
++        doc.properties.emplace(wchartoutf8(name), value);
+     }
+ }
+ Variant
diff --git a/pkgs/development/libraries/ucl/default.nix b/pkgs/development/libraries/ucl/default.nix
index c9133b64846..ceb97b6088b 100644
--- a/pkgs/development/libraries/ucl/default.nix
+++ b/pkgs/development/libraries/ucl/default.nix
@@ -7,6 +7,9 @@ stdenv.mkDerivation {
     sha256 = "b865299ffd45d73412293369c9754b07637680e5c826915f097577cd27350348";
   };
 
+  # needed to successfully compile with gcc 6
+  NIX_CFLAGS_COMPILE = "-std=c90 -fPIC";
+
   meta = {
     homepage = http://www.oberhumer.com/opensource/ucl/;
     description = "Portable lossless data compression library";
diff --git a/pkgs/development/libraries/wayland/protocols.nix b/pkgs/development/libraries/wayland/protocols.nix
index dda1bd36976..436de5609e5 100644
--- a/pkgs/development/libraries/wayland/protocols.nix
+++ b/pkgs/development/libraries/wayland/protocols.nix
@@ -4,11 +4,11 @@
 
 stdenv.mkDerivation rec {
   name = "wayland-protocols-${version}";
-  version = "1.7";
+  version = "1.10";
 
   src = fetchurl {
     url = "http://wayland.freedesktop.org/releases/${name}.tar.xz";
-    sha256 = "07qw166s6bm81zfnhf4lmww6wj0il960fm3vp7n1z3rign9jlpv3";
+    sha256 = "5719c51d7354864983171c5083e93a72ac99229e2b460c4bb10513de08839c0a";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/development/libraries/xapian/default.nix b/pkgs/development/libraries/xapian/default.nix
index 764200c89f5..23fee81e0a5 100644
--- a/pkgs/development/libraries/xapian/default.nix
+++ b/pkgs/development/libraries/xapian/default.nix
@@ -11,7 +11,7 @@ let
       inherit sha256;
     };
 
-    outputs = [ "out" "doc" ];
+    outputs = [ "out" "man" "doc" ];
 
     buildInputs = [ libuuid zlib ];
     nativeBuildInputs = [ autoreconfHook ];
diff --git a/pkgs/development/libraries/zziplib/default.nix b/pkgs/development/libraries/zziplib/default.nix
index 98215aa0c74..07a6f7ef088 100644
--- a/pkgs/development/libraries/zziplib/default.nix
+++ b/pkgs/development/libraries/zziplib/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "zziplib-${version}";
-  version = "0.13.66";
+  version = "0.13.67";
 
   src = fetchurl {
-    url = "mirror://sourceforge/zziplib/zziplib13/${version}/${name}.tar.gz";
-    sha256 = "0zdx0s19slzv79xplnr6jx0xjb01dd71jzpscf6vlj6k9ry8rcar";
+    url = "https://github.com/gdraheim/zziplib/archive/v${version}.tar.gz";
+    sha256 = "0802kdxwxx9zanpwb4w4wfi3blwhv0ri05mzdgd35j5sva5ify0j";
   };
 
   patchPhase = ''
diff --git a/pkgs/development/python-modules/html5-parser/default.nix b/pkgs/development/python-modules/html5-parser/default.nix
new file mode 100644
index 00000000000..549dcb89bf7
--- /dev/null
+++ b/pkgs/development/python-modules/html5-parser/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, buildPythonPackage, fetchPypi, pkgs, pkgconfig, chardet, lxml }:
+
+buildPythonPackage rec {
+  pname = "html5-parser";
+  version = "0.4.3";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "173vzg214x7qfq201m4b09wg5nszdgwjw5q02v23k54iqm3kcpnx";
+  };
+
+  buildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ chardet lxml pkgs.libxml2 ];
+
+  doCheck = false; # No such file or directory: 'run_tests.py'
+
+  meta = with stdenv.lib; {
+    description = "Fast C based HTML 5 parsing for python";
+    homepage = https://html5-parser.readthedocs.io;
+    license = licenses.asl20;
+  };
+}
diff --git a/pkgs/development/tools/build-managers/gnumake/4.2/default.nix b/pkgs/development/tools/build-managers/gnumake/4.2/default.nix
index 323f33d7d6c..56d4b831460 100644
--- a/pkgs/development/tools/build-managers/gnumake/4.2/default.nix
+++ b/pkgs/development/tools/build-managers/gnumake/4.2/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
 
   configureFlags = stdenv.lib.optional guileSupport "--with-guile";
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" "info" ];
 
   meta = with stdenv.lib; {
     homepage = http://www.gnu.org/software/make/;
diff --git a/pkgs/development/tools/misc/automake/automake-1.15.x.nix b/pkgs/development/tools/misc/automake/automake-1.15.x.nix
index 49978e9739d..d6399e128a3 100644
--- a/pkgs/development/tools/misc/automake/automake-1.15.x.nix
+++ b/pkgs/development/tools/misc/automake/automake-1.15.x.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, perl, autoconf, makeWrapper, doCheck ? false }:
 
 stdenv.mkDerivation rec {
-  name = "automake-1.15";
+  name = "automake-1.15.1";
 
   src = fetchurl {
     url = "mirror://gnu/automake/${name}.tar.xz";
-    sha256 = "0dl6vfi2lzz8alnklwxzfz624b95hb1ipjvd3mk177flmddcf24r";
+    sha256 = "1bzd9g32dfm4rsbw93ld9x7b5nc1y6i4m6zp032qf1i28a8s6sxg";
   };
 
   buildInputs = [ perl autoconf ];
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index 04911e4cc56..e02cf1667cd 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -5,7 +5,10 @@
 }:
 
 let
-  version = "2.29";
+  # Note to whoever is upgrading this: 2.29 is broken.
+  # ('nix-build pkgs/stdenv/linux/make-bootstrap-tools.nix -A test' segfaults on aarch64)
+  # Also glibc might need patching, see commit 733e20fee4a6700510f71fbe1a58ac23ea202f6a.
+  version = "2.28.1";
   basename = "binutils-${version}";
   inherit (stdenv.lib) optional optionals optionalString;
   # The prefix prepended to binary names to allow multiple binuntils on the
@@ -18,7 +21,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://gnu/binutils/${basename}.tar.bz2";
-    sha256 = "1gqfyksdnj3iir5gzyvlp785mnk60g1pll6zbzbslfchhr4rb8i9";
+    sha256 = "1sj234nd05cdgga1r36zalvvdkvpfbr12g5mir2n8i1dwsdrj939";
   };
 
   patches = [
@@ -45,18 +48,8 @@ stdenv.mkDerivation rec {
     # there) and causes a cycle between the lib and bin outputs, so
     # get rid of it.
     ./no-plugins.patch
-
-    # remove after 2.29.1/2.30
-    (fetchurl {
-      url = "https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=patch;h=c6b78c965a96fb152fbd58926edccb5dee2707a5";
-      sha256 = "0rkbq5pf7ffgcggfk4czkxin1091bqjj92an9wxnqkgqwq6cx5yr";
-      name = "readelf-empty-sections.patch";
-    })
-    ./elf-check-orphan-input.patch
-    ./elf-check-orphan-placement.patch
   ];
 
-  # TODO: all outputs on all platform
   outputs = [ "out" ]
     ++ optional (targetPlatform == hostPlatform && !hostPlatform.isDarwin) "lib" # problems in Darwin stdenv
     ++ [ "info" ]
@@ -91,7 +84,7 @@ stdenv.mkDerivation rec {
     else "-static-libgcc";
 
   # TODO(@Ericson2314): Always pass "--target" and always prefix.
-  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
+  configurePlatforms = stdenv.lib.optionals (targetPlatform != hostPlatform) [ "build" "host" "target" ];
   configureFlags =
     [ "--enable-shared" "--enable-deterministic-archives" "--disable-werror" ]
     ++ optional (stdenv.system == "mips64el-linux") "--enable-fix-loongson2f-nop"
diff --git a/pkgs/development/tools/misc/binutils/elf-check-orphan-input.patch b/pkgs/development/tools/misc/binutils/elf-check-orphan-input.patch
deleted file mode 100644
index 2ec90128347..00000000000
--- a/pkgs/development/tools/misc/binutils/elf-check-orphan-input.patch
+++ /dev/null
@@ -1,99 +0,0 @@
-From a388b7afeffad6411686d39dc1c62294da48a814 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Wed, 2 Aug 2017 05:10:29 -0700
-Subject: [PATCH] Check ELF section header only for ELF output
-
-When placing an orphan input section, check ELF section header only for
-ELF output.
-
-	PR ld/21884
-	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Check
-	ELF section header only for ELF output.
-	* testsuite/ld-elf/pr21884.d: New test.
-	* testsuite/ld-elf/pr21884.t: Likewise.
-	* testsuite/ld-elf/pr21884a.s: Likewise.
-	* testsuite/ld-elf/pr21884b.s: Likewise.
-
-(cherry picked from commit db99ecc08f5b66fbe9cb72e90352c7f77ec71a6e)
----
- ld/ChangeLog                   | 10 ++++++++++
- ld/emultempl/elf32.em          |  3 ++-
- ld/testsuite/ld-elf/pr21884.d  | 11 +++++++++++
- ld/testsuite/ld-elf/pr21884.t  |  7 +++++++
- ld/testsuite/ld-elf/pr21884a.s |  5 +++++
- ld/testsuite/ld-elf/pr21884b.s |  5 +++++
- 6 files changed, 40 insertions(+), 1 deletion(-)
- create mode 100644 ld/testsuite/ld-elf/pr21884.d
- create mode 100644 ld/testsuite/ld-elf/pr21884.t
- create mode 100644 ld/testsuite/ld-elf/pr21884a.s
- create mode 100644 ld/testsuite/ld-elf/pr21884b.s
-
-diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
-index d2551b6..75ded12 100644
---- a/ld/emultempl/elf32.em
-+++ b/ld/emultempl/elf32.em
-@@ -2136,7 +2136,8 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
-     }
- 
-   /* Look through the script to see where to place this section.  */
--  if (constraint == 0)
-+  if (constraint == 0
-+      && link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour)
-     for (os = lang_output_section_find (secname);
- 	 os != NULL;
- 	 os = next_matching_output_section_statement (os, 0))
-diff --git a/ld/testsuite/ld-elf/pr21884.d b/ld/testsuite/ld-elf/pr21884.d
-new file mode 100644
-index 0000000..52cd2c1
---- /dev/null
-+++ b/ld/testsuite/ld-elf/pr21884.d
-@@ -0,0 +1,11 @@
-+#source: pr21884a.s
-+#source: pr21884b.s
-+#ld: -T pr21884.t
-+#objdump: -b binary -s
-+#notarget: aarch64*-*-* arm*-*-* nds32*-*-*
-+# Skip targets which can't change output format to binary.
-+
-+.*:     file format binary
-+
-+Contents of section .data:
-+#pass
-diff --git a/ld/testsuite/ld-elf/pr21884.t b/ld/testsuite/ld-elf/pr21884.t
-new file mode 100644
-index 0000000..d483911
---- /dev/null
-+++ b/ld/testsuite/ld-elf/pr21884.t
-@@ -0,0 +1,7 @@
-+OUTPUT_FORMAT("binary")
-+
-+ENTRY(_main);
-+SECTIONS {
-+	. = 0;
-+	.setup : { *(.setup) }
-+}
-diff --git a/ld/testsuite/ld-elf/pr21884a.s b/ld/testsuite/ld-elf/pr21884a.s
-new file mode 100644
-index 0000000..a3361b2
---- /dev/null
-+++ b/ld/testsuite/ld-elf/pr21884a.s
-@@ -0,0 +1,5 @@
-+	.text
-+	.globl	_main
-+	.type _main,%function
-+_main:
-+	.dc.a bar
-diff --git a/ld/testsuite/ld-elf/pr21884b.s b/ld/testsuite/ld-elf/pr21884b.s
-new file mode 100644
-index 0000000..e533837
---- /dev/null
-+++ b/ld/testsuite/ld-elf/pr21884b.s
-@@ -0,0 +1,5 @@
-+	.text
-+	.globl	bar
-+	.type bar,%function
-+bar:
-+	.byte 0
--- 
-2.9.3
-
diff --git a/pkgs/development/tools/misc/binutils/elf-check-orphan-placement.patch b/pkgs/development/tools/misc/binutils/elf-check-orphan-placement.patch
deleted file mode 100644
index 7e7566aec43..00000000000
--- a/pkgs/development/tools/misc/binutils/elf-check-orphan-placement.patch
+++ /dev/null
@@ -1,161 +0,0 @@
-From 36088682f447540fd8666a2c437fa232064044a7 Mon Sep 17 00:00:00 2001
-From: Alan Modra <amodra@gmail.com>
-Date: Thu, 3 Aug 2017 14:01:34 +0930
-Subject: [PATCH] ELF checks for orphan placement
-
-The loop checking for previous orphan placement should run even when
-the output is non-ELF.
-
-	PR ld/21884
-	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Revert
-	last change.  Rename iself to elfinput.  Expand comments.  Condition
-	ELF checks on having both input and output ELF files.  Extract..
-	(elf_orphan_compatible): ..this new function.
----
- ld/ChangeLog          |  8 ++++++
- ld/emultempl/elf32.em | 76 +++++++++++++++++++++++++++++++--------------------
- 2 files changed, 55 insertions(+), 29 deletions(-)
-
-diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
-index 75ded12..9ac1840 100644
---- a/ld/emultempl/elf32.em
-+++ b/ld/emultempl/elf32.em
-@@ -2008,6 +2008,29 @@ output_rel_find (asection *sec, int isdyn)
-   return last;
- }
- 
-+/* Return whether IN is suitable to be part of OUT.  */
-+
-+static bfd_boolean
-+elf_orphan_compatible (asection *in, asection *out)
-+{
-+  /* Non-zero sh_info implies a section with SHF_INFO_LINK with
-+     unknown semantics for the generic linker, or a SHT_REL/SHT_RELA
-+     section where sh_info specifies a symbol table.  (We won't see
-+     SHT_GROUP, SHT_SYMTAB or SHT_DYNSYM sections here.)  We clearly
-+     can't merge SHT_REL/SHT_RELA using differing symbol tables, and
-+     shouldn't merge sections with differing unknown semantics.  */
-+  if (elf_section_data (out)->this_hdr.sh_info
-+      != elf_section_data (in)->this_hdr.sh_info)
-+    return FALSE;
-+  /* We can't merge two sections with differing SHF_EXCLUDE when doing
-+     a relocatable link.  */
-+  if (bfd_link_relocatable (&link_info)
-+      && ((elf_section_flags (out) ^ elf_section_flags (in)) & SHF_EXCLUDE) != 0)
-+    return FALSE;
-+  return _bfd_elf_match_sections_by_type (link_info.output_bfd, out,
-+					  in->owner, in);
-+}
-+
- /* Place an orphan section.  We use this to put random SHF_ALLOC
-    sections in the right segment.  */
- 
-@@ -2064,8 +2087,9 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
-   lang_output_section_statement_type *os;
-   lang_output_section_statement_type *match_by_name = NULL;
-   int isdyn = 0;
--  int iself = s->owner->xvec->flavour == bfd_target_elf_flavour;
--  unsigned int sh_type = iself ? elf_section_type (s) : SHT_NULL;
-+  int elfinput = s->owner->xvec->flavour == bfd_target_elf_flavour;
-+  int elfoutput = link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour;
-+  unsigned int sh_type = elfinput ? elf_section_type (s) : SHT_NULL;
-   flagword flags;
-   asection *nexts;
- 
-@@ -2073,7 +2097,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
-       && link_info.combreloc
-       && (s->flags & SEC_ALLOC))
-     {
--      if (iself)
-+      if (elfinput)
- 	switch (sh_type)
- 	  {
- 	  case SHT_RELA:
-@@ -2095,6 +2119,8 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
-     }
- 
-   if (!bfd_link_relocatable (&link_info)
-+      && elfinput
-+      && elfoutput
-       && (s->flags & SEC_ALLOC) != 0
-       && (elf_section_flags (s) & SHF_GNU_MBIND) != 0)
-     {
-@@ -2135,9 +2161,11 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
- 	secname = ".mbind.text";
-     }
- 
--  /* Look through the script to see where to place this section.  */
--  if (constraint == 0
--      && link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour)
-+  /* Look through the script to see where to place this section.  The
-+     script includes entries added by previous lang_insert_orphan
-+     calls, so this loop puts multiple compatible orphans of the same
-+     name into a single output section.  */
-+  if (constraint == 0)
-     for (os = lang_output_section_find (secname);
- 	 os != NULL;
- 	 os = next_matching_output_section_statement (os, 0))
-@@ -2146,29 +2174,19 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
- 	   lang_insert_orphan to create a new output section.  */
- 	constraint = SPECIAL;
- 
--	/* SEC_EXCLUDE is cleared when doing a relocatable link.  But
--	   we can't merge 2 input sections with the same name when only
--	   one of them has SHF_EXCLUDE.  Don't merge 2 sections with
--	   different sh_info.  */
-+	/* Check to see if we already have an output section statement
-+	   with this name, and its bfd section has compatible flags.
-+	   If the section already exists but does not have any flags
-+	   set, then it has been created by the linker, possibly as a
-+	   result of a --section-start command line switch.  */
- 	if (os->bfd_section != NULL
--	    && (elf_section_data (os->bfd_section)->this_hdr.sh_info
--		== elf_section_data (s)->this_hdr.sh_info)
- 	    && (os->bfd_section->flags == 0
--		|| ((!bfd_link_relocatable (&link_info)
--		     || (iself && (((elf_section_flags (s)
--				     ^ elf_section_flags (os->bfd_section))
--				    & SHF_EXCLUDE) == 0)))
--		    && ((s->flags ^ os->bfd_section->flags)
-+		|| (((s->flags ^ os->bfd_section->flags)
- 		     & (SEC_LOAD | SEC_ALLOC)) == 0
--		    && _bfd_elf_match_sections_by_type (link_info.output_bfd,
--							os->bfd_section,
--							s->owner, s))))
-+		    && (!elfinput
-+			|| !elfoutput
-+			|| elf_orphan_compatible (s, os->bfd_section)))))
- 	  {
--	    /* We already have an output section statement with this
--	       name, and its bfd section has compatible flags.
--	       If the section already exists but does not have any flags
--	       set, then it has been created by the linker, probably as a
--	       result of a --section-start command line switch.  */
- 	    lang_add_section (&os->children, s, NULL, os);
- 	    return os;
- 	  }
-@@ -2244,8 +2262,8 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
-   else if ((flags & SEC_ALLOC) == 0)
-     ;
-   else if ((flags & SEC_LOAD) != 0
--	   && ((iself && sh_type == SHT_NOTE)
--	       || (!iself && CONST_STRNEQ (secname, ".note"))))
-+	   && ((elfinput && sh_type == SHT_NOTE)
-+	       || (!elfinput && CONST_STRNEQ (secname, ".note"))))
-     place = &hold[orphan_interp];
-   else if ((flags & (SEC_LOAD | SEC_HAS_CONTENTS | SEC_THREAD_LOCAL)) == 0)
-     place = &hold[orphan_bss];
-@@ -2255,8 +2273,8 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
-     place = &hold[orphan_tdata];
-   else if ((flags & SEC_READONLY) == 0)
-     place = &hold[orphan_data];
--  else if (((iself && (sh_type == SHT_RELA || sh_type == SHT_REL))
--	    || (!iself && CONST_STRNEQ (secname, ".rel")))
-+  else if (((elfinput && (sh_type == SHT_RELA || sh_type == SHT_REL))
-+	    || (!elfinput && CONST_STRNEQ (secname, ".rel")))
- 	   && (flags & SEC_LOAD) != 0)
-     place = &hold[orphan_rel];
-   else if ((flags & SEC_CODE) == 0)
--- 
-2.9.3
-
diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix
index 410fd36ef25..02ff52155b1 100644
--- a/pkgs/development/tools/misc/gdb/default.nix
+++ b/pkgs/development/tools/misc/gdb/default.nix
@@ -66,13 +66,6 @@ stdenv.mkDerivation rec {
     ++ stdenv.lib.optional (!pythonSupport) "--without-python"
     ++ stdenv.lib.optional multitarget "--enable-targets=all";
 
-  preConfigure =
-    # Not sure why this is causing problems, now that the stdenv
-    # exports CPP=cpp the build fails with strange errors on darwin.
-    stdenv.lib.optionalString stdenv.cc.isClang ''
-      unset CPP
-    '';
-
   postInstall =
     '' # Remove Info files already provided by Binutils and other packages.
        rm -v $out/share/info/bfd.info
diff --git a/pkgs/development/tools/misc/intel-gpu-tools/default.nix b/pkgs/development/tools/misc/intel-gpu-tools/default.nix
index d1aef990230..ed3f1b46947 100644
--- a/pkgs/development/tools/misc/intel-gpu-tools/default.nix
+++ b/pkgs/development/tools/misc/intel-gpu-tools/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, pkgconfig, libdrm, libpciaccess, cairo, dri2proto, udev
 , libX11, libXext, libXv, libXrandr, glib, bison, libunwind, python3, kmod
-, procps, autoconf, automake }:
+, procps, autoreconfHook, utilmacros }:
 
 stdenv.mkDerivation rec {
   name = "intel-gpu-tools-1.19";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "1wdhwf3im6ids95qw5r9hjj9hvp0qhzgi4llrlriy723q3kqm754";
   };
 
-  nativeBuildInputs = [ pkgconfig autoconf automake ];
+  nativeBuildInputs = [ pkgconfig autoreconfHook utilmacros ];
   buildInputs = [ libdrm libpciaccess cairo dri2proto udev libX11 kmod
     libXext libXv libXrandr glib bison libunwind python3 procps ];
 
diff --git a/pkgs/games/warmux/gcc-fix.patch b/pkgs/games/warmux/gcc-fix.patch
index 6b683aa782f..913b912af7d 100644
--- a/pkgs/games/warmux/gcc-fix.patch
+++ b/pkgs/games/warmux/gcc-fix.patch
@@ -45,7 +45,7 @@ Author: Robin Gloster <mail@glob.in>
  {
    if (!show)
 -    return false;
-+    return NULL;
++    return nullptr;
    const std::vector<PolygonItem *>& items = poly->GetItem();
    WeaponMenuItem * tmp;
    Interface::GetInstance()->SetCurrentOverflyWeapon(NULL);
diff --git a/pkgs/misc/ghostscript/default.nix b/pkgs/misc/ghostscript/default.nix
index 57c87b57731..524121a898e 100644
--- a/pkgs/misc/ghostscript/default.nix
+++ b/pkgs/misc/ghostscript/default.nix
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
     inherit sha256;
   };
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" "doc" ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/os-specific/linux/audit/default.nix b/pkgs/os-specific/linux/audit/default.nix
index a912e6de965..e433deff90c 100644
--- a/pkgs/os-specific/linux/audit/default.nix
+++ b/pkgs/os-specific/linux/audit/default.nix
@@ -5,11 +5,11 @@
 assert enablePython -> python != null;
 
 stdenv.mkDerivation rec {
-  name = "audit-2.7.6";
+  name = "audit-2.7.7";
 
   src = fetchurl {
     url = "http://people.redhat.com/sgrubb/audit/${name}.tar.gz";
-    sha256 = "1rqlj15kbyfw4z88z8whf1q2rcg17vs439fvzdds55fwzyf2hrgs";
+    sha256 = "1vvqw5xgirap0jdmajw7l3pq563aycvy3hlqvj3k2cac8i4jbqlq";
   };
 
   outputs = [ "bin" "dev" "out" "man" "plugins" ];
diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix
index bbe86792692..379d3cad970 100644
--- a/pkgs/os-specific/linux/kernel/generic.nix
+++ b/pkgs/os-specific/linux/kernel/generic.nix
@@ -103,7 +103,7 @@ let
   };
 
   kernel = buildLinux {
-    inherit version modDirVersion src kernelPatches;
+    inherit version modDirVersion src kernelPatches stdenv;
 
     configfile = configfile.nativeDrv or configfile;
 
diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix
index 70544ff9294..8227475f1b1 100644
--- a/pkgs/os-specific/linux/kernel/manual-config.nix
+++ b/pkgs/os-specific/linux/kernel/manual-config.nix
@@ -1,4 +1,4 @@
-{ stdenv, runCommand, nettools, bc, perl, gmp, libmpc, mpfr, kmod, openssl
+{ runCommand, nettools, bc, perl, gmp, libmpc, mpfr, kmod, openssl
 , writeTextFile, ubootChooser
 , hostPlatform
 }:
@@ -14,6 +14,8 @@ let
     echo "}" >> $out
   '').outPath;
 in {
+  # Allow overriding stdenv on each buildLinux call
+  stdenv,
   # The kernel version
   version,
   # The version of the kernel module directory
diff --git a/pkgs/os-specific/linux/libcap/default.nix b/pkgs/os-specific/linux/libcap/default.nix
index 088d2ae234c..1cc8ab60d75 100644
--- a/pkgs/os-specific/linux/libcap/default.nix
+++ b/pkgs/os-specific/linux/libcap/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "0qjiqc5pknaal57453nxcbz3mn1r4hkyywam41wfcglq3v2qlg39";
   };
 
-  outputs = [ "out" "dev" "lib" "doc" ]
+  outputs = [ "out" "dev" "lib" "man" "doc" ]
     ++ stdenv.lib.optional (pam != null) "pam";
 
   nativeBuildInputs = [ perl ];
diff --git a/pkgs/os-specific/linux/udisks/2-default.nix b/pkgs/os-specific/linux/udisks/2-default.nix
index 35873b3a062..a265395f96e 100644
--- a/pkgs/os-specific/linux/udisks/2-default.nix
+++ b/pkgs/os-specific/linux/udisks/2-default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "0spl155k0g2l2hvqf8xyjv08i68gfyhzpjva6cwlzxx0bz4gbify";
   };
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" ];
 
   patches = [ ./force-path.patch ];
 
diff --git a/pkgs/servers/http/apache-httpd/2.4.nix b/pkgs/servers/http/apache-httpd/2.4.nix
index 30f8fbef119..3393d0cf58b 100644
--- a/pkgs/servers/http/apache-httpd/2.4.nix
+++ b/pkgs/servers/http/apache-httpd/2.4.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   };
 
   # FIXME: -dev depends on -doc
-  outputs = [ "out" "dev" "doc" ];
+  outputs = [ "out" "dev" "man" "doc" ];
   setOutputFlags = false; # it would move $out/modules, etc.
 
   buildInputs = [perl] ++
diff --git a/pkgs/servers/uftp/default.nix b/pkgs/servers/uftp/default.nix
index 22cc5646f8b..2e32f75c867 100644
--- a/pkgs/servers/uftp/default.nix
+++ b/pkgs/servers/uftp/default.nix
@@ -11,16 +11,16 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ openssl ];
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" ];
 
   patchPhase = ''
     substituteInPlace makefile --replace gcc cc
   '';
 
   installPhase = ''
-    mkdir -p $out/bin $doc/share/man/man1
+    mkdir -p $out/bin $man/share/man/man1
     cp {uftp,uftpd,uftp_keymgt,uftpproxyd} $out/bin/
-    cp {uftp.1,uftpd.1,uftp_keymgt.1,uftpproxyd.1} $doc/share/man/man1
+    cp {uftp.1,uftpd.1,uftp_keymgt.1,uftpproxyd.1} $man/share/man/man1
   '';
 
   meta = {
diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix
index 8317bd7ce6f..2f2270d536d 100644
--- a/pkgs/servers/x11/xorg/overrides.nix
+++ b/pkgs/servers/x11/xorg/overrides.nix
@@ -73,7 +73,7 @@ in
   libxcb = attrs : attrs // {
     nativeBuildInputs = [ args.python ];
     configureFlags = "--enable-xkb --enable-xinput";
-    outputs = [ "out" "dev" "doc" ];
+    outputs = [ "out" "dev" "man" "doc" ];
   };
 
   xcbproto = attrs : attrs // {
@@ -177,7 +177,7 @@ in
   };
 
   libXext = attrs: attrs // {
-    outputs = [ "out" "dev" "doc" ];
+    outputs = [ "out" "dev" "man" "doc" ];
     propagatedBuildInputs = [ xorg.xproto xorg.libXau ];
     preConfigure = setMalloc0ReturnsNullCrossCompiling;
   };
@@ -187,7 +187,7 @@ in
   };
 
   libXi = attrs: attrs // {
-    outputs = [ "out" "dev" "doc" ];
+    outputs = [ "out" "dev" "man" "doc" ];
     propagatedBuildInputs = [ xorg.libXfixes ];
   };
 
diff --git a/pkgs/shells/bash/4.4.nix b/pkgs/shells/bash/4.4.nix
index dba31e41ca3..b4a2ba55388 100644
--- a/pkgs/shells/bash/4.4.nix
+++ b/pkgs/shells/bash/4.4.nix
@@ -36,10 +36,9 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  outputs = [ "out" "dev" "doc" "info" ];
-
-  # the man pages are small and useful enough
-  outputMan = if interactive then "out" else null;
+  outputs = [ "out" "dev" "doc" "info" ]
+    # the man pages are small and useful enough, so include them in $out in interactive builds
+    ++ stdenv.lib.optional (!interactive) "man";
 
   NIX_CFLAGS_COMPILE = ''
     -DSYS_BASHRC="/etc/bashrc"
diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix
index 8b2cf01f169..8544d932f81 100644
--- a/pkgs/stdenv/generic/check-meta.nix
+++ b/pkgs/stdenv/generic/check-meta.nix
@@ -40,6 +40,8 @@ let
 
   allowBroken = config.allowBroken or false || builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
 
+  allowUnsupportedSystem = config.allowUnsupportedSystem or false;
+
   isUnfree = licenses: lib.lists.any (l:
     !l.free or true || l == "unfree" || l == "unfree-redistributable") licenses;
 
@@ -177,7 +179,7 @@ let
       { valid = false; reason = "blacklisted"; errormsg = "has a blacklisted license (‘${showLicense attrs.meta.license}’)"; }
     else if !allowBroken && attrs.meta.broken or false then
       { valid = false; reason = "broken"; errormsg = "is marked as broken"; }
-    else if !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem system attrs.meta.platforms then
+    else if !allowUnsupportedSystem && !allowBroken && attrs.meta.platforms or null != null && !lib.lists.elem system attrs.meta.platforms then
       { valid = false; reason = "broken"; errormsg = "is not supported on ‘${system}’"; }
     else if !(hasAllowedInsecure attrs) then
       { valid = false; reason = "insecure"; errormsg = "is marked as insecure"; }
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index be271daf8c8..74d387e353c 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -43,29 +43,21 @@ rec {
     , propagatedSandboxProfile ? ""
     , ... } @ attrs:
     let
-      dependencies = [
-        (map (drv: drv.nativeDrv or drv) nativeBuildInputs)
+      dependencies = map lib.chooseDevOutputs [
+        (map (drv: drv.nativeDrv or drv) nativeBuildInputs
+           ++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh
+           ++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh)
         (map (drv: drv.crossDrv or drv) buildInputs)
       ];
-      propagatedDependencies = [
+      propagatedDependencies = map lib.chooseDevOutputs [
         (map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs)
         (map (drv: drv.crossDrv or drv) propagatedBuildInputs)
       ];
-    in let
 
       outputs' =
         outputs ++
         (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []);
 
-      dependencies' = let
-          justMap = map lib.chooseDevOutputs dependencies;
-          nativeBuildInputs = lib.head justMap
-            ++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh
-            ++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh;
-        in [ nativeBuildInputs ] ++ lib.tail justMap;
-
-      propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies;
-
       derivationArg =
         (removeAttrs attrs
           ["meta" "passthru" "crossAttrs" "pos"
@@ -73,13 +65,13 @@ rec {
            "sandboxProfile" "propagatedSandboxProfile"])
         // (let
           computedSandboxProfile =
-            lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies');
+            lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies);
           computedPropagatedSandboxProfile =
-            lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists propagatedDependencies');
+            lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists propagatedDependencies);
           computedImpureHostDeps =
-            lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies'));
+            lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies));
           computedPropagatedImpureHostDeps =
-            lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists propagatedDependencies'));
+            lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists propagatedDependencies));
         in
         {
           name = name + lib.optionalString
@@ -92,11 +84,11 @@ rec {
           userHook = config.stdenv.userHook or null;
           __ignoreNulls = true;
 
-          nativeBuildInputs = lib.elemAt dependencies' 0;
-          buildInputs = lib.elemAt dependencies' 1;
+          nativeBuildInputs = lib.elemAt dependencies 0;
+          buildInputs = lib.elemAt dependencies 1;
 
-          propagatedNativeBuildInputs = lib.elemAt propagatedDependencies' 0;
-          propagatedBuildInputs = lib.elemAt propagatedDependencies' 1;
+          propagatedNativeBuildInputs = lib.elemAt propagatedDependencies 0;
+          propagatedBuildInputs = lib.elemAt propagatedDependencies 1;
 
           # This parameter is sometimes a string, sometimes null, and sometimes a list, yuck
           configureFlags = let inherit (lib) optional elem; in
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index c475d2d1e92..61262e1a64e 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -299,13 +299,22 @@ in
         shellPackage = prevStage.bash;
       };
 
-      /* outputs TODO
-      allowedRequisites = with prevStage;
-        [ gzip bzip2 xz bash binutils coreutils diffutils findutils gawk
-          glibc gnumake gnused gnutar gnugrep gnupatch patchelf attr acl
-          paxctl zlib pcre linuxHeaders ed gcc gcc.cc libsigsegv
-        ] ++ lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
-        */
+      # Mainly avoid reference to bootstrap tools
+      allowedRequisites = with prevStage; with lib;
+        # Simple executable tools
+        concatMap (p: [ (getBin p) (getLib p) ])
+          [ gzip bzip2 xz bash binutils coreutils diffutils findutils gawk
+            gnumake gnused gnutar gnugrep gnupatch patchelf ed paxctl
+          ]
+        # Library dependencies
+        ++ map getLib [ attr acl zlib pcre libsigsegv ]
+        # More complicated cases
+        ++ [
+            glibc.out glibc.dev glibc.bin/*propagated from .dev*/ linuxHeaders
+            gcc gcc.cc gcc.cc.lib gcc.expandResponseParams
+          ]
+          ++ lib.optionals (system == "aarch64-linux")
+            [ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ];
 
       overrides = self: super: {
         inherit (prevStage)
diff --git a/pkgs/tools/cd-dvd/cdrdao/default.nix b/pkgs/tools/cd-dvd/cdrdao/default.nix
index caf37ccbe1d..95dd58a59b4 100644
--- a/pkgs/tools/cd-dvd/cdrdao/default.nix
+++ b/pkgs/tools/cd-dvd/cdrdao/default.nix
@@ -24,6 +24,9 @@ stdenv.mkDerivation {
     sed -i 's,linux/../,,g' dao/sg_err.h
   '';
 
+  # Needed on gcc >= 6.
+  NIX_CFLAGS_COMPILE = "-Wno-narrowing";
+
   meta = {
     description = "A tool for recording audio or data CD-Rs in disk-at-once (DAO) mode";
     homepage = http://cdrdao.sourceforge.net/;
diff --git a/pkgs/tools/compression/lzop/default.nix b/pkgs/tools/compression/lzop/default.nix
index a929ca4dfd7..72be1d28d24 100644
--- a/pkgs/tools/compression/lzop/default.nix
+++ b/pkgs/tools/compression/lzop/default.nix
@@ -1,10 +1,10 @@
 {stdenv, fetchurl, lzo}:
 
-stdenv.mkDerivation {
-  name = "lzop-1.03";
+stdenv.mkDerivation rec {
+  name = "lzop-1.04";
   src = fetchurl {
-    url = http://www.lzop.org/download/lzop-1.03.tar.gz;
-    sha256 = "1jdjvc4yjndf7ihmlcsyln2rbnbaxa86q4jskmkmm7ylfy65nhn1";
+    url = "http://www.lzop.org/download/${name}.tar.gz";
+    sha256 = "0h9gb8q7y54m9mvy3jvsmxf21yx8fc3ylzh418hgbbv0i8mbcwky";
   };
 
   buildInputs = [ lzo ];
diff --git a/pkgs/tools/filesystems/e2fsprogs/default.nix b/pkgs/tools/filesystems/e2fsprogs/default.nix
index 8703e81fb1d..7c3ab92fa88 100644
--- a/pkgs/tools/filesystems/e2fsprogs/default.nix
+++ b/pkgs/tools/filesystems/e2fsprogs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, libuuid, gettext }:
+{ stdenv, fetchurl, pkgconfig, libuuid, gettext, texinfo }:
 
 stdenv.mkDerivation rec {
   name = "e2fsprogs-1.43.4";
@@ -8,9 +8,9 @@ stdenv.mkDerivation rec {
     sha256 = "a648a90a513f1b25113c7f981af978b8a19f832b3a32bd10707af3ff682ba66d";
   };
 
-  outputs = [ "bin" "dev" "out" "man" ];
+  outputs = [ "bin" "dev" "out" "man" "info" ];
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig texinfo ];
   buildInputs = [ libuuid ] ++ stdenv.lib.optional (!stdenv.isLinux) gettext;
 
   crossAttrs = {
diff --git a/pkgs/tools/graphics/pfstools/default.nix b/pkgs/tools/graphics/pfstools/default.nix
index 53f77d097c5..7e6b3523ed8 100644
--- a/pkgs/tools/graphics/pfstools/default.nix
+++ b/pkgs/tools/graphics/pfstools/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "1fyc2c7jzr7k797c2dqyyvapzc3szxwcp48r382yxz2yq558xgd9";
   };
 
-  outputs = [ "out" "dev" "doc"];
+  outputs = [ "out" "dev" "man"];
 
   cmakeFlags = ''
     -DWITH_MATLAB=false 
diff --git a/pkgs/tools/misc/colord/default.nix b/pkgs/tools/misc/colord/default.nix
index 6dc2c371e46..222b04db0d0 100644
--- a/pkgs/tools/misc/colord/default.nix
+++ b/pkgs/tools/misc/colord/default.nix
@@ -1,14 +1,14 @@
-{ stdenv, fetchzip, fetchgit, bash-completion
+{ stdenv, fetchurl, bash-completion
 , glib, polkit, pkgconfig, intltool, gusb, libusb1, lcms2, sqlite, systemd, dbus
-, automake, autoconf, libtool, gtk_doc, which, gobjectIntrospection, argyllcms
+, gtk_doc, gobjectIntrospection, argyllcms
 , libgudev, sane-backends }:
 
 stdenv.mkDerivation rec {
   name = "colord-1.2.12";
 
-  src = fetchzip {
+  src = fetchurl {
     url = "http://www.freedesktop.org/software/colord/releases/${name}.tar.xz";
-    sha256 = "0rvvbpxd5x479v4p6pck317mlf3j29s154i1n8hlx8n4znhwrb0k";
+    sha256 = "0flcsr148xshjbff030pgyk9ar25an901m9q1pjgjdvaq5j1h96m";
   };
 
   enableParallelBuilding = true;
@@ -23,12 +23,11 @@ stdenv.mkDerivation rec {
 
   # don't touch /var at install time, colord creates what it needs at runtime
   postPatch = ''
-    sed -i -e "s|if test -w .*;|if false;|" src/Makefile.in
-    sed -i -e "s|if test -w .*;|if false;|" src/Makefile.am
+    sed -e "s|if test -w .*;|if false;|" -i src/Makefile.{am,in}
   '';
 
   buildInputs = [ glib polkit pkgconfig intltool gusb libusb1 lcms2 sqlite systemd dbus gobjectIntrospection
-                  bash-completion argyllcms automake autoconf libgudev sane-backends ];
+                  bash-completion argyllcms libgudev sane-backends ];
 
   postInstall = ''
     mkdir -p $out/etc/bash_completion.d
diff --git a/pkgs/tools/misc/findutils/default.nix b/pkgs/tools/misc/findutils/default.nix
index 06a140fed50..4eef3f7a9d5 100644
--- a/pkgs/tools/misc/findutils/default.nix
+++ b/pkgs/tools/misc/findutils/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./memory-leak.patch ./no-install-statedir.patch ];
 
-  buildInputs = optionals (hostPlatform == buildPlatform) [ coreutils ]; # bin/updatedb script needs to call sort
+  buildInputs = [ coreutils ]; # bin/updatedb script needs to call sort
 
   # Since glibc-2.25 the i686 tests hang reliably right after test-sleep.
   doCheck
@@ -25,7 +25,12 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "info" ];
 
-  configureFlags = [ "--localstatedir=/var/cache" ];
+  configureFlags = [
+    # "sort" need not be on the PATH as a run-time dep, so we need to tell
+    # configure where it is. Covers the cross and native case alike.
+    "SORT=${coreutils}/bin/sort"
+    "--localstatedir=/var/cache"
+  ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/tools/networking/dnsperf/default.nix b/pkgs/tools/networking/dnsperf/default.nix
index c65e47a88b0..b021201a4d4 100644
--- a/pkgs/tools/networking/dnsperf/default.nix
+++ b/pkgs/tools/networking/dnsperf/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "03kfc65s5a9csa5i7xjsv0psq144k8d9yw7xlny61bg1h2kg1db4";
   };
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" "doc" ];
 
   buildInputs = [ bind libseccomp zlib ];
 
diff --git a/pkgs/tools/networking/tinc/pre.nix b/pkgs/tools/networking/tinc/pre.nix
index 1d80db68991..38ba5accbb3 100644
--- a/pkgs/tools/networking/tinc/pre.nix
+++ b/pkgs/tools/networking/tinc/pre.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "05an2vj0a3wjv5w672wgzyixbydin5jpja5zv6x81bc72dms0ymc";
   };
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" "info" ];
 
   nativeBuildInputs = [ autoreconfHook texinfo ];
   buildInputs = [ ncurses readline zlib lzo openssl ];
diff --git a/pkgs/tools/text/diffutils/default.nix b/pkgs/tools/text/diffutils/default.nix
index 787750c8ecf..cd64bd1566b 100644
--- a/pkgs/tools/text/diffutils/default.nix
+++ b/pkgs/tools/text/diffutils/default.nix
@@ -10,8 +10,14 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "info" ];
 
+  nativeBuildInputs = [ xz.bin ];
   /* If no explicit coreutils is given, use the one from stdenv. */
-  nativeBuildInputs = [ xz.bin coreutils ];
+  buildInputs = [ coreutils ];
+
+  configureFlags =
+    # "pr" need not be on the PATH as a run-time dep, so we need to tell
+    # configure where it is. Covers the cross and native case alike.
+    stdenv.lib.optional (coreutils != null) "PR_PROGRAM=${coreutils}/bin/pr";
 
   meta = {
     homepage = http://www.gnu.org/software/diffutils/diffutils.html;
diff --git a/pkgs/tools/text/groff/default.nix b/pkgs/tools/text/groff/default.nix
index fc6b1abf24d..2f37f6394ba 100644
--- a/pkgs/tools/text/groff/default.nix
+++ b/pkgs/tools/text/groff/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "1998v2kcs288d3y7kfxpvl369nqi06zbbvjzafyvyl3pr7bajj1s";
   };
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" "doc" "info" ];
 
   enableParallelBuilding = false;
 
diff --git a/pkgs/tools/typesetting/tex/texlive/bin.nix b/pkgs/tools/typesetting/tex/texlive/bin.nix
index 34520e92a9a..c15f165013b 100644
--- a/pkgs/tools/typesetting/tex/texlive/bin.nix
+++ b/pkgs/tools/typesetting/tex/texlive/bin.nix
@@ -132,8 +132,7 @@ core = stdenv.mkDerivation rec {
         '')
   + /* doc location identical with individual TeX pkgs */ ''
     mkdir -p "$doc/doc"
-    mv "$doc"/share/{man,info} "$doc"/doc
-    rmdir "$doc"/share
+    mv "$out"/share/{man,info} "$doc"/doc
   '' + cleanBrokenLinks;
 
   setupHook = ./setup-hook.sh; # TODO: maybe texmf-nix -> texmf (and all references)
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6684d0accd0..372d346aeec 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5268,7 +5268,7 @@ with pkgs;
   gambit = callPackage ../development/compilers/gambit { };
   gerbil = callPackage ../development/compilers/gerbil { };
 
-  gcc = gcc5;
+  gcc = gcc6;
   gcc-unwrapped = gcc.cc;
 
   wrapCCMulti = cc:
@@ -6469,7 +6469,6 @@ with pkgs;
 
   spidermonkey_1_8_5 = callPackage ../development/interpreters/spidermonkey/1.8.5.nix { };
   spidermonkey_17 = callPackage ../development/interpreters/spidermonkey/17.nix { };
-  spidermonkey_24 = callPackage ../development/interpreters/spidermonkey/24.nix { };
   spidermonkey_31 = callPackage ../development/interpreters/spidermonkey/31.nix { };
   spidermonkey_38 = callPackage ../development/interpreters/spidermonkey/38.nix { };
   spidermonkey = spidermonkey_31;
@@ -11774,7 +11773,7 @@ with pkgs;
 
   darwin = let
     apple-source-releases = callPackage ../os-specific/darwin/apple-source-releases { };
-  in apple-source-releases // rec {
+  in recurseIntoAttrs (apple-source-releases // rec {
     cctools = callPackage ../os-specific/darwin/cctools/port.nix {
       inherit libobjc;
       stdenv = if stdenv.isDarwin then stdenv else libcxxStdenv;
@@ -11818,7 +11817,7 @@ with pkgs;
     usr-include = callPackage ../os-specific/darwin/usr-include {};
 
     DarwinTools = callPackage ../os-specific/darwin/DarwinTools {};
-  };
+  });
 
   devicemapper = lvm2;
 
@@ -12126,6 +12125,8 @@ with pkgs;
                       kernelPatches.genksyms_fix_segfault
                       kernelPatches.DCCP_double_free_vulnerability_CVE-2017-6074
                     ];
+    # compiler-gcc.h:107:30: fatal error: linux/compiler-gcc6.h: No such file or directory
+    stdenv = overrideCC stdenv gcc5;
   };
 
   linux_chromiumos_latest = linux_chromiumos_3_18;
@@ -12288,7 +12289,7 @@ with pkgs;
 
   linuxPackages_custom = { version, src, configfile }:
     recurseIntoAttrs (linuxPackagesFor (pkgs.linuxManualConfig {
-      inherit version src configfile;
+      inherit version src configfile stdenv;
       allowImportFromDerivation = true;
     }));
 
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index bffa8a6677f..f23ed5a9b5c 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -30,7 +30,7 @@ let self = _self // overrides; _self = with self; {
       url = "mirror://cpan/authors/id/P/PE/PETDANCE/${name}.tar.gz";
       sha256 = "0ifbmbfvagfi76i7vjpggs2hrbqqisd14f5zizan6cbdn8dl5z2g";
     };
-    outputs = ["out" "doc"];
+    outputs = ["out" "man"];
     # use gnused so that the preCheck command passes
     buildInputs = stdenv.lib.optional stdenv.isDarwin gnused;
     propagatedBuildInputs = [ FileNext ];
@@ -13577,6 +13577,18 @@ let self = _self // overrides; _self = with self; {
     };
   };
 
+  TestNeeds = buildPerlPackage rec {
+    name = "Test-Needs-0.002005";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/H/HA/HAARG/${name}.tar.gz";
+      sha256 = "5a4f33983586edacdbe00a3b429a9834190140190dab28d0f873c394eb7df399";
+    };
+    meta = {
+      description = "Skip tests when modules not available";
+      license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
+    };
+  };
+
   TestNoTabs = buildPerlPackage {
     name = "Test-NoTabs-1.3";
     src = fetchurl {
@@ -15143,15 +15155,16 @@ let self = _self // overrides; _self = with self; {
   };
 
   URI = buildPerlPackage rec {
-    name = "URI-1.71";
+    name = "URI-1.72";
     src = fetchurl {
       url = "mirror://cpan/authors/id/E/ET/ETHER/${name}.tar.gz";
-      sha256 = "9c8eca0d7f39e74bbc14706293e653b699238eeb1a7690cc9c136fb8c2644115";
+      sha256 = "35f14431d4b300de4be1163b0b5332de2d7fbda4f05ff1ed198a8e9330d40a32";
     };
+    buildInputs = [ TestNeeds ];
     meta = {
+      homepage = https://github.com/libwww-perl/URI;
       description = "Uniform Resource Identifiers (absolute and relative)";
       license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
-      maintainers = [ maintainers.rycee ];
     };
   };
 
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index f808de45db2..6c4bcfb041f 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -2085,6 +2085,8 @@ in {
     };
   };
 
+  html5-parser = callPackage ../development/python-modules/html5-parser {};
+
   httpserver = callPackage ../development/python-modules/httpserver {};
 
   bleach = buildPythonPackage rec {
@@ -12223,11 +12225,11 @@ in {
 
 
   lxml = buildPythonPackage ( rec {
-    name = "lxml-3.7.2";
+    name = "lxml-3.8.0";
 
     src = pkgs.fetchurl {
       url = "mirror://pypi/l/lxml/${name}.tar.gz";
-      sha256 = "02j1wf3sh2qmswcz3rh0xvsb8jm63ifaiz2bkng93hyvc1iignar";
+      sha256 = "15nvf6n285n282682qyw3wihsncb0x5amdhyi4b83bfa2nz74vvk";
     };
 
     buildInputs = with self; [ pkgs.libxml2 pkgs.libxslt ];
diff --git a/pkgs/top-level/release-lib.nix b/pkgs/top-level/release-lib.nix
index ddc449ae59c..c852ace7d7c 100644
--- a/pkgs/top-level/release-lib.nix
+++ b/pkgs/top-level/release-lib.nix
@@ -13,7 +13,7 @@ rec {
 
   allPackages = args: packageSet (args // nixpkgsArgs);
 
-  pkgs = pkgsFor "x86_64-linux";
+  pkgs = packageSet (lib.recursiveUpdate { system = "x86_64-linux"; config.allowUnsupportedSystem = true; } nixpkgsArgs);
   inherit lib;
 
 
diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix
index e73f6f4f112..41ab5da8067 100644
--- a/pkgs/top-level/release.nix
+++ b/pkgs/top-level/release.nix
@@ -109,8 +109,11 @@ let
       ocamlPackages = { };
       perlPackages = { };
 
-      # hack around broken eval of non-linux packages for now.
-      tests.macOSSierraShared = darwin;
+      darwin = packagePlatforms pkgs.darwin // {
+        cf-private = {};
+        osx_private_sdk = {};
+        xcode = {};
+      };
     } ));
 
 in jobs