summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorFrederik Rietdijk <freddyrietdijk@fridh.nl>2018-10-02 18:22:18 +0200
committerGitHub <noreply@github.com>2018-10-02 18:22:18 +0200
commit4d1abc44199c8957105f538119c2d19d67aee26f (patch)
treeb38dcdc8763d2d5ab0068851a0765d09136a6af7 /pkgs/development/libraries
parentfbc1fb78e37cc29eadee4ad8687e8777eba3cf0e (diff)
parentfe970a82ece66e08d5400c22eebd2c2ec19b5457 (diff)
downloadnixpkgs-4d1abc44199c8957105f538119c2d19d67aee26f.tar
nixpkgs-4d1abc44199c8957105f538119c2d19d67aee26f.tar.gz
nixpkgs-4d1abc44199c8957105f538119c2d19d67aee26f.tar.bz2
nixpkgs-4d1abc44199c8957105f538119c2d19d67aee26f.tar.lz
nixpkgs-4d1abc44199c8957105f538119c2d19d67aee26f.tar.xz
nixpkgs-4d1abc44199c8957105f538119c2d19d67aee26f.tar.zst
nixpkgs-4d1abc44199c8957105f538119c2d19d67aee26f.zip
Merge pull request #47604 from NixOS/staging-next
Staging next
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/boehm-gc/default.nix4
-rw-r--r--pkgs/development/libraries/cyrus-sasl/default.nix16
-rw-r--r--pkgs/development/libraries/epoxy/default.nix4
-rw-r--r--pkgs/development/libraries/epoxy/libgl-path.patch25
-rw-r--r--pkgs/development/libraries/ffmpeg/generic.nix10
-rw-r--r--pkgs/development/libraries/gdbm/default.nix6
-rw-r--r--pkgs/development/libraries/gettext/default.nix1
-rw-r--r--pkgs/development/libraries/gpgme/default.nix4
-rw-r--r--pkgs/development/libraries/libatomic_ops/default.nix4
-rw-r--r--pkgs/development/libraries/libdaemon/default.nix14
-rw-r--r--pkgs/development/libraries/libdrm/default.nix4
-rw-r--r--pkgs/development/libraries/libgsf/default.nix4
-rw-r--r--pkgs/development/libraries/libinput/default.nix10
-rw-r--r--pkgs/development/libraries/libinput/udev-absolute-path.patch2
-rw-r--r--pkgs/development/libraries/libsndfile/default.nix5
-rw-r--r--pkgs/development/libraries/libunistring/default.nix14
-rw-r--r--pkgs/development/libraries/libuv/default.nix2
-rw-r--r--pkgs/development/libraries/mesa-darwin/default.nix73
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch147
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch33
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch28
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch29
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch28
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch40
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch30
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch55
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch69
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/patch-src-mapi-vgapi-Makefile.diff11
-rw-r--r--pkgs/development/libraries/mesa/darwin-clock-gettime.patch76
-rw-r--r--pkgs/development/libraries/mesa/default.nix84
-rw-r--r--pkgs/development/libraries/mesa/missing-includes.patch10
-rw-r--r--pkgs/development/libraries/newt/default.nix7
-rw-r--r--pkgs/development/libraries/nspr/default.nix4
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/default.nix1
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch330
-rw-r--r--pkgs/development/libraries/science/math/openblas/default.nix21
36 files changed, 523 insertions, 682 deletions
diff --git a/pkgs/development/libraries/boehm-gc/default.nix b/pkgs/development/libraries/boehm-gc/default.nix
index da71e40187f..012c1d123b6 100644
--- a/pkgs/development/libraries/boehm-gc/default.nix
+++ b/pkgs/development/libraries/boehm-gc/default.nix
@@ -4,14 +4,14 @@
 
 stdenv.mkDerivation rec {
   name = "boehm-gc-${version}";
-  version = "7.6.6";
+  version = "7.6.8";
 
   src = fetchurl {
     urls = [
       "http://www.hboehm.info/gc/gc_source/gc-${version}.tar.gz"
       "https://github.com/ivmai/bdwgc/releases/download/v${version}/gc-${version}.tar.gz"
     ];
-    sha256 = "1p1r015a7jbpvkkbgzv1y8nxrbbp6dg0mq3ksi6ji0qdz3wfss79";
+    sha256 = "0n720a0i584ghcwmdsjiq6bl9ig0p9mrja29rp4cgsqvpz6wa2h4";
   };
 
   buildInputs = [ libatomic_ops ];
diff --git a/pkgs/development/libraries/cyrus-sasl/default.nix b/pkgs/development/libraries/cyrus-sasl/default.nix
index 87752867c35..cec7e1a2d51 100644
--- a/pkgs/development/libraries/cyrus-sasl/default.nix
+++ b/pkgs/development/libraries/cyrus-sasl/default.nix
@@ -36,15 +36,15 @@ stdenv.mkDerivation rec {
 
   configureFlags = [
     "--with-openssl=${openssl.dev}"
+    "--with-plugindir=${placeholder "out"}/lib/sasl2"
+    "--with-saslauthd=/run/saslauthd"
+    "--enable-login"
+    "--enable-shared"
   ] ++ lib.optional enableLdap "--with-ldap=${openldap.dev}";
 
-  # Set this variable at build-time to make sure $out can be evaluated.
-  preConfigure = ''
-    configureFlagsArray=( --with-plugindir=$out/lib/sasl2
-                          --with-saslauthd=/run/saslauthd
-                          --enable-login
-                        )
-  '';
+  # Avoid triggering regenerating using broken autoconf/libtool bits.
+  # (many distributions carry patches to remove/replace, but this works for now)
+  dontUpdateAutotoolsGnuConfigScripts = if stdenv.hostPlatform.isMusl then true else null;
 
   installFlags = lib.optional stdenv.isDarwin [ "framedir=$(out)/Library/Frameworks/SASL2.framework" ];
 
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
   '';
 
   meta = {
-    homepage = http://cyrusimap.web.cmu.edu/;
+    homepage = https://www.cyrusimap.org/sasl;
     description = "Library for adding authentication support to connection-based protocols";
     platforms = platforms.unix;
     license = licenses.bsdOriginal;
diff --git a/pkgs/development/libraries/epoxy/default.nix b/pkgs/development/libraries/epoxy/default.nix
index cc62b2776ed..7c3dd19a479 100644
--- a/pkgs/development/libraries/epoxy/default.nix
+++ b/pkgs/development/libraries/epoxy/default.nix
@@ -6,13 +6,13 @@ with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "epoxy-${version}";
-  version = "1.5.1";
+  version = "1.5.2";
 
   src = fetchFromGitHub {
     owner = "anholt";
     repo = "libepoxy";
     rev = "${version}";
-    sha256 = "1811agxr7g9wd832np8sw152j468kg3qydmfkc564v54ncfcgaci";
+    sha256 = "0frs42s7d3ff2wlw0jns6vb3myx2bhz9m5nkzbnfyn436s2qqls3";
   };
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/epoxy/libgl-path.patch b/pkgs/development/libraries/epoxy/libgl-path.patch
index 6f50b9d262b..8f38ee27174 100644
--- a/pkgs/development/libraries/epoxy/libgl-path.patch
+++ b/pkgs/development/libraries/epoxy/libgl-path.patch
@@ -1,20 +1,11 @@
-From 4046e0ac8ed93354c01de5f3b5cae790cce70404 Mon Sep 17 00:00:00 2001
-From: Will Dietz <w@wdtz.org>
-Date: Thu, 29 Mar 2018 07:21:02 -0500
-Subject: [PATCH] Explicitly search LIBGL_PATH as fallback, if defined.
-
----
- src/dispatch_common.c | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
 diff --git a/src/dispatch_common.c b/src/dispatch_common.c
-index bc2fb94..776237b 100644
+index b3e4f5f..303e8f5 100644
 --- a/src/dispatch_common.c
 +++ b/src/dispatch_common.c
-@@ -306,6 +306,18 @@ get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail)
-     pthread_mutex_lock(&api.mutex);
-     if (!*handle) {
-         *handle = dlopen(lib_name, RTLD_LAZY | RTLD_LOCAL);
+@@ -310,6 +310,19 @@ get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail, bool l
+             flags |= RTLD_NOLOAD;
+ 
+         *handle = dlopen(lib_name, flags);
 +#ifdef LIBGL_PATH
 +        if (!*handle) {
 +          char pathbuf[sizeof(LIBGL_PATH) + 1 + 1024 + 1];
@@ -24,12 +15,10 @@ index bc2fb94..776237b 100644
 +            fprintf(stderr, "Error prefixing library pathname\n");
 +            exit(1);
 +          }
-+          *handle = dlopen(pathbuf, RTLD_LAZY | RTLD_LOCAL);
++          *handle = dlopen(pathbuf, flags);
 +        }
 +#endif
++
          if (!*handle) {
              if (exit_on_fail) {
                  fprintf(stderr, "Couldn't open %s: %s\n", lib_name, dlerror());
--- 
-2.16.3
-
diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix
index 7d72de2a2de..7c3b3447d61 100644
--- a/pkgs/development/libraries/ffmpeg/generic.nix
+++ b/pkgs/development/libraries/ffmpeg/generic.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
 , alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
-, libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr
-, x264, x265, xvidcore, zlib, libopus
+, libssh, libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr
+, x264, x265, xvidcore, zlib, libopus, speex
 , openglSupport ? false, libGLU_combined ? null
 # Build options
 , runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime
@@ -128,6 +128,7 @@ stdenv.mkDerivation rec {
       "--enable-libmp3lame"
       (ifMinVer "1.2" "--enable-iconv")
       "--enable-libtheora"
+      (ifMinVer "2.1" "--enable-libssh")
       (ifMinVer "0.6" (enableFeature vaapiSupport "vaapi"))
       "--enable-vdpau"
       "--enable-libvorbis"
@@ -141,6 +142,7 @@ stdenv.mkDerivation rec {
       "--enable-libxvid"
       "--enable-zlib"
       (ifMinVer "2.8" "--enable-libopus")
+      "--enable-libspeex"
       (ifMinVer "2.8" "--enable-libx265")
     # Developer flags
       (enableFeature debugDeveloper "debug")
@@ -157,8 +159,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ perl pkgconfig texinfo yasm ];
 
   buildInputs = [
-    bzip2 fontconfig freetype gnutls libiconv lame libass libogg libtheora
-    libvdpau libvorbis lzma soxr x264 x265 xvidcore zlib libopus
+    bzip2 fontconfig freetype gnutls libiconv lame libass libogg libssh libtheora
+    libvdpau libvorbis lzma soxr x264 x265 xvidcore zlib libopus speex
   ] ++ optional openglSupport libGLU_combined
     ++ optional vpxSupport libvpx
     ++ optionals (!isDarwin && !isAarch32) [ libpulseaudio ] # Need to be fixed on Darwin and ARM
diff --git a/pkgs/development/libraries/gdbm/default.nix b/pkgs/development/libraries/gdbm/default.nix
index 685775e2918..8d88dc04924 100644
--- a/pkgs/development/libraries/gdbm/default.nix
+++ b/pkgs/development/libraries/gdbm/default.nix
@@ -1,13 +1,13 @@
 { stdenv, lib, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "gdbm-1.17";
-  # FIXME: remove on update to > 1.17
+  name = "gdbm-1.18";
+  # FIXME: remove on update to > 1.18
   NIX_CFLAGS_COMPILE = if stdenv.cc.isClang then "-Wno-error=return-type" else null;
 
   src = fetchurl {
     url = "mirror://gnu/gdbm/${name}.tar.gz";
-    sha256 = "0zcp2iv5dbab18859a5fvacg8lkp8k4pr9af13kfvami6lpcrn3w";
+    sha256 = "1kimnv12bzjjhaqk4c8w2j6chdj9c6bg21lchaf7abcyfss2r0mq";
   };
 
   doCheck = true; # not cross;
diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix
index 4531a5a01d4..1b2f6bbc222 100644
--- a/pkgs/development/libraries/gettext/default.nix
+++ b/pkgs/development/libraries/gettext/default.nix
@@ -51,6 +51,7 @@ stdenv.mkDerivation rec {
   gettextNeedsLdflags = stdenv.hostPlatform.libc != "glibc" && !stdenv.hostPlatform.isMusl;
 
   enableParallelBuilding = true;
+  enableParallelChecking = false; # fails sometimes
 
   meta = with lib; {
     description = "Well integrated set of translation tools and documentation";
diff --git a/pkgs/development/libraries/gpgme/default.nix b/pkgs/development/libraries/gpgme/default.nix
index 71fe23ea6b0..416ecb5631e 100644
--- a/pkgs/development/libraries/gpgme/default.nix
+++ b/pkgs/development/libraries/gpgme/default.nix
@@ -2,7 +2,7 @@
 , file, which
 , autoreconfHook
 , git
-, texinfo5
+, texinfo
 , qtbase ? null
 , withPython ? false, swig2 ? null, python ? null
 }:
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     [ libgpgerror glib libassuan pth ]
     ++ lib.optional (qtbase != null) qtbase;
 
-  nativeBuildInputs = [ file pkgconfig gnupg autoreconfHook git texinfo5 ]
+  nativeBuildInputs = [ file pkgconfig gnupg autoreconfHook git texinfo ]
   ++ lib.optionals withPython [ python swig2 which ];
 
   postPatch =''
diff --git a/pkgs/development/libraries/libatomic_ops/default.nix b/pkgs/development/libraries/libatomic_ops/default.nix
index 0c0fc3861c9..a887384f94d 100644
--- a/pkgs/development/libraries/libatomic_ops/default.nix
+++ b/pkgs/development/libraries/libatomic_ops/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   name = "libatomic_ops-${version}";
-  version = "7.6.4";
+  version = "7.6.6";
 
   src = fetchurl {
     urls = [
       "http://www.ivmaisoft.com/_bin/atomic_ops/libatomic_ops-${version}.tar.gz"
       "https://github.com/ivmai/libatomic_ops/releases/download/v${version}/libatomic_ops-${version}.tar.gz"
     ];
-    sha256 = "0knxncsjhbknlyy6lx7ycxhpzfk3sykhvicgxyp0rmsxd1d3v0jv";
+    sha256 = "0x7071z707msvyrv9dmgahd1sghbkw8fpbagvcag6xs8yp2spzlr";
   };
 
   outputs = [ "out" "dev" "doc" ];
diff --git a/pkgs/development/libraries/libdaemon/default.nix b/pkgs/development/libraries/libdaemon/default.nix
index 59e576fd392..5dc153dd5cc 100644
--- a/pkgs/development/libraries/libdaemon/default.nix
+++ b/pkgs/development/libraries/libdaemon/default.nix
@@ -1,6 +1,6 @@
 {stdenv, fetchurl}:
 
-stdenv.mkDerivation (rec {
+stdenv.mkDerivation rec {
   name = "libdaemon-0.14";
 
   src = fetchurl {
@@ -8,6 +8,8 @@ stdenv.mkDerivation (rec {
     sha256 = "0d5qlq5ab95wh1xc87rqrh1vx6i8lddka1w3f1zcqvcqdxgyn8zx";
   };
 
+  patches = [ ./fix-includes.patch ];
+
   configureFlags = [ "--disable-lynx" ]
     ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
     [ # Can't run this test while cross-compiling
@@ -16,16 +18,8 @@ stdenv.mkDerivation (rec {
 
   meta = {
     description = "Lightweight C library that eases the writing of UNIX daemons";
-
     homepage = http://0pointer.de/lennart/projects/libdaemon/;
-
     license = stdenv.lib.licenses.lgpl2Plus;
-
     platforms = stdenv.lib.platforms.unix;
-    maintainers = [ ];
   };
-} // stdenv.lib.optionalAttrs stdenv.hostPlatform.isMusl {
-  # This patch should be applied unconditionally, but doing so will cause mass rebuild.
-  patches = ./fix-includes.patch;
-})
-
+}
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index 5107d8898d4..761216f420b 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.93";
+  name = "libdrm-2.4.94";
 
   src = fetchurl {
     url = "https://dri.freedesktop.org/libdrm/${name}.tar.bz2";
-    sha256 = "0g6d9wsnb7lx8r1m4kq8js0wsc5jl20cz1csnlh6z9s8jpfd313f";
+    sha256 = "1ghn3l1dv1rsp9z6jpmy4ryna1s8rm4xx0ds532041bnlfq5jg5p";
   };
 
   outputs = [ "out" "dev" "bin" ];
diff --git a/pkgs/development/libraries/libgsf/default.nix b/pkgs/development/libraries/libgsf/default.nix
index 20a08885142..bcd37396bf7 100644
--- a/pkgs/development/libraries/libgsf/default.nix
+++ b/pkgs/development/libraries/libgsf/default.nix
@@ -2,11 +2,11 @@
 , python, perl, gdk_pixbuf, libiconv, libintl }:
 
 stdenv.mkDerivation rec {
-  name = "libgsf-1.14.42";
+  name = "libgsf-1.14.44";
 
   src = fetchurl {
     url    = "mirror://gnome/sources/libgsf/1.14/${name}.tar.xz";
-    sha256 = "1hhdz0ymda26q6bl5ygickkgrh998lxqq4z9i8dzpcvqna3zpzr9";
+    sha256 = "1ppzfk3zmmgrg9jh8vc4dacddbfngjslq2wpj94pcr3i0c8dxgk8";
   };
 
   nativeBuildInputs = [ pkgconfig intltool libintl ];
diff --git a/pkgs/development/libraries/libinput/default.nix b/pkgs/development/libraries/libinput/default.nix
index d42bd315d22..4c85971cc3c 100644
--- a/pkgs/development/libraries/libinput/default.nix
+++ b/pkgs/development/libraries/libinput/default.nix
@@ -16,11 +16,11 @@ in
 with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "libinput-${version}";
-  version = "1.11.3";
+  version = "1.12.0";
 
   src = fetchurl {
     url = "https://www.freedesktop.org/software/libinput/${name}.tar.xz";
-    sha256 = "01nb1shnl871d939wgfd7nc9svclcnfjfhlq64b4yns2dvcr24gk";
+    sha256 = "1901wxh9k8kz3krfmvacf8xa8r4idfyisw8d80a2ql0bxiw2pb0m";
   };
 
   outputs = [ "bin" "out" "dev" ];
@@ -46,12 +46,6 @@ stdenv.mkDerivation rec {
 
   patches = [ ./udev-absolute-path.patch ];
 
-   preBuild = ''
-    # meson setup-hook changes the directory so the files are located one level up
-    patchShebangs ../udev/parse_hwdb.py
-    patchShebangs ../test/symbols-leak-test.in
-  '';
-
   doCheck = testsSupport;
 
   meta = {
diff --git a/pkgs/development/libraries/libinput/udev-absolute-path.patch b/pkgs/development/libraries/libinput/udev-absolute-path.patch
index fb22fea40e8..5c85b863948 100644
--- a/pkgs/development/libraries/libinput/udev-absolute-path.patch
+++ b/pkgs/development/libraries/libinput/udev-absolute-path.patch
@@ -5,7 +5,7 @@
  
  udev_rules_config = configuration_data()
 -udev_rules_config.set('UDEV_TEST_PATH', '')
-+udev_rules_config.set('UDEV_TEST_PATH', udev_dir + '/')
++udev_rules_config.set('UDEV_TEST_PATH', dir_udev + '/')
  configure_file(input : 'udev/80-libinput-device-groups.rules.in',
  	       output : '80-libinput-device-groups.rules',
  	       install : true,
diff --git a/pkgs/development/libraries/libsndfile/default.nix b/pkgs/development/libraries/libsndfile/default.nix
index a68b5b2b6d5..b150dd0f59c 100644
--- a/pkgs/development/libraries/libsndfile/default.nix
+++ b/pkgs/development/libraries/libsndfile/default.nix
@@ -36,6 +36,11 @@ stdenv.mkDerivation rec {
       url = "https://github.com/erikd/libsndfile/commit/85c877d5072866aadbe8ed0c3e0590fbb5e16788.patch";
       sha256 = "0kc7vp22qsxidhvmlc6nfamw7k92n0hcfpmwhb3gaksjamwhb2df";
     })
+    (fetchurl {
+      name = "CVE-2018-13139.patch";
+      url = "https://github.com/erikd/libsndfile/commit/aaea680337267bfb6d2544da878890ee7f1c5077.patch";
+      sha256 = "01q3m7pa3xqkh05ijmfgv064v8flkg4p24bgy9wxnc6wfcdifggx";
+    })
   ];
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/development/libraries/libunistring/default.nix b/pkgs/development/libraries/libunistring/default.nix
index 24da3a8e2c7..312a5c11810 100644
--- a/pkgs/development/libraries/libunistring/default.nix
+++ b/pkgs/development/libraries/libunistring/default.nix
@@ -19,7 +19,19 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  enableParallelBuilding = true;
+  /* This seems to cause several random failures like these, which I assume
+     is because of bad or missing target dependencies in their build system:
+
+        ./unistdio/test-u16-vasnprintf2.sh: line 16: ./test-u16-vasnprintf1: No such file or directory
+        FAIL unistdio/test-u16-vasnprintf2.sh (exit status: 1)
+
+        FAIL: unistdio/test-u16-vasnprintf3.sh
+        ======================================
+
+        ./unistdio/test-u16-vasnprintf3.sh: line 16: ./test-u16-vasnprintf1: No such file or directory
+        FAIL unistdio/test-u16-vasnprintf3.sh (exit status: 1)
+  */
+  enableParallelBuilding = false;
 
   meta = {
     homepage = http://www.gnu.org/software/libunistring/;
diff --git a/pkgs/development/libraries/libuv/default.nix b/pkgs/development/libraries/libuv/default.nix
index 067f8fb432d..73d2db8e999 100644
--- a/pkgs/development/libraries/libuv/default.nix
+++ b/pkgs/development/libraries/libuv/default.nix
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
         "tcp_open" "tcp_write_queue_order" "tcp_try_write" "tcp_writealot"
         "multiple_listen" "delayed_accept"
         "shutdown_close_tcp" "shutdown_eof" "shutdown_twice" "callback_stack"
-        "tty_pty"
+        "tty_pty" "condvar_5"
       ] ++ stdenv.lib.optionals stdenv.isAarch32 [
         # I observe this test failing with some regularity on ARMv7:
         # https://github.com/libuv/libuv/issues/1871
diff --git a/pkgs/development/libraries/mesa-darwin/default.nix b/pkgs/development/libraries/mesa-darwin/default.nix
deleted file mode 100644
index 2bfdb679156..00000000000
--- a/pkgs/development/libraries/mesa-darwin/default.nix
+++ /dev/null
@@ -1,73 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, intltool, flex, bison
-, python, libxml2Python, expat, makedepend, xorg, llvm, libffi, libvdpau
-, OpenGL, apple_sdk, Xplugin
-}:
-
-let
-  version = "8.0.5";
-  self = stdenv.mkDerivation rec {
-    name = "mesa-${version}";
-
-    src =  fetchurl {
-      url = "ftp://ftp.freedesktop.org/pub/mesa/older-versions/8.x/${version}/MesaLib-${version}.tar.bz2";
-      sha256 = "0pjs8x51c0i6mawgd4w03lxpyx5fnx7rc8plr8jfsscf9yiqs6si";
-    };
-
-    nativeBuildInputs = [ pkgconfig python makedepend flex bison ];
-
-    buildInputs = with xorg; [
-      glproto dri2proto libXfixes libXi libXmu
-      intltool expat libxml2Python llvm
-      presentproto
-      libX11 libXext libxcb libXt libxshmfence
-      libffi libvdpau
-    ] ++ stdenv.lib.optionals stdenv.isDarwin [ OpenGL apple_sdk.sdk Xplugin ];
-
-    propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ OpenGL ];
-
-    postUnpack = ''
-      ln -s darwin $sourceRoot/configs/current
-    '';
-
-    preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
-      substituteInPlace bin/mklib --replace g++ clang++
-    '';
-
-    patches = [
-      ./patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch
-      ./patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch
-      ./patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch
-      ./patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch
-      ./patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch
-      ./patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch
-      ./patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch
-      ./patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch
-      ./patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch
-      ./patches/patch-src-mapi-vgapi-Makefile.diff
-    ];
-
-    postPatch = "patchShebangs .";
-
-    configurePhase = ":";
-
-    configureFlags = [
-      # NOTE: Patents expired on June 17 2018.
-      # For details see: https://www.phoronix.com/scan.php?page=news_item&px=OpenGL-Texture-Float-Freed
-      "texture-float"
-    ];
-
-    makeFlags = "INSTALL_DIR=\${out} CC=cc CXX=c++";
-
-    enableParallelBuilding = true;
-
-    passthru = { inherit version; };
-
-    meta = {
-      description = "An open source implementation of OpenGL";
-      homepage = http://www.mesa3d.org/;
-      license = "bsd";
-      platforms = stdenv.lib.platforms.darwin;
-      maintainers = with stdenv.lib.maintainers; [ cstrahan ];
-    };
-  };
-in self // { driverLink = self; }
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch b/pkgs/development/libraries/mesa-darwin/patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch
deleted file mode 100644
index 5466ffc9085..00000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-From 9cf1afbf8ae87ddbb29b24a0f9f2724e9e2935c1 Mon Sep 17 00:00:00 2001
-From: Brian Paul <brianp@vmware.com>
-Date: Tue, 4 Sep 2012 20:17:15 -0600
-Subject: [PATCH 03/13] mesa: fix per-level max texture size error checking
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This is a long-standing omission in Mesa's texture image size checking.
-We need to take the mipmap level into consideration when checking if the
-width, height and depth are too large.
-
-Fixes the new piglit max-texture-size-level test.
-Thanks to Stéphane Marchesin for finding this problem.
-
-Note: This is a candidate for the stable branches.
-
-Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
-(cherry picked from commit 771e7b6d884bb4294a89f276a904d90b28efb90a)
----
- src/mesa/main/teximage.c | 36 +++++++++++++++++++++---------------
- 1 file changed, 21 insertions(+), 15 deletions(-)
-
-diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
-index 3aecc0f..ed22fa9 100644
---- a/src/mesa/main/teximage.c
-+++ b/src/mesa/main/teximage.c
-@@ -1251,11 +1251,12 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
- 
-    switch (target) {
-    case GL_PROXY_TEXTURE_1D:
--      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
--      if (width < 2 * border || width > 2 * border + maxSize)
--         return GL_FALSE;
-       if (level >= ctx->Const.MaxTextureLevels)
-          return GL_FALSE;
-+      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); /* level zero size */
-+      maxSize >>= level;  /* level size */
-+      if (width < 2 * border || width > 2 * border + maxSize)
-+         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
-@@ -1263,13 +1264,14 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_2D:
-+      if (level >= ctx->Const.MaxTextureLevels)
-+         return GL_FALSE;
-       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-+      maxSize >>= level;
-       if (width < 2 * border || width > 2 * border + maxSize)
-          return GL_FALSE;
-       if (height < 2 * border || height > 2 * border + maxSize)
-          return GL_FALSE;
--      if (level >= ctx->Const.MaxTextureLevels)
--         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
-@@ -1279,15 +1281,16 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_3D:
-+      if (level >= ctx->Const.Max3DTextureLevels)
-+         return GL_FALSE;
-       maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
-+      maxSize >>= level;
-       if (width < 2 * border || width > 2 * border + maxSize)
-          return GL_FALSE;
-       if (height < 2 * border || height > 2 * border + maxSize)
-          return GL_FALSE;
-       if (depth < 2 * border || depth > 2 * border + maxSize)
-          return GL_FALSE;
--      if (level >= ctx->Const.Max3DTextureLevels)
--         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
-@@ -1299,23 +1302,24 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_RECTANGLE_NV:
-+      if (level != 0)
-+         return GL_FALSE;
-       maxSize = ctx->Const.MaxTextureRectSize;
-       if (width < 0 || width > maxSize)
-          return GL_FALSE;
-       if (height < 0 || height > maxSize)
-          return GL_FALSE;
--      if (level != 0)
--         return GL_FALSE;
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
-+      if (level >= ctx->Const.MaxCubeTextureLevels)
-+         return GL_FALSE;
-       maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
-+      maxSize >>= level;
-       if (width < 2 * border || width > 2 * border + maxSize)
-          return GL_FALSE;
-       if (height < 2 * border || height > 2 * border + maxSize)
-          return GL_FALSE;
--      if (level >= ctx->Const.MaxCubeTextureLevels)
--         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
-@@ -1325,13 +1329,14 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
-+      if (level >= ctx->Const.MaxTextureLevels)
-+         return GL_FALSE;
-       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-+      maxSize >>= level;
-       if (width < 2 * border || width > 2 * border + maxSize)
-          return GL_FALSE;
-       if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
-          return GL_FALSE;
--      if (level >= ctx->Const.MaxTextureLevels)
--         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
-@@ -1339,15 +1344,16 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
-+      if (level >= ctx->Const.MaxTextureLevels)
-+         return GL_FALSE;
-       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-+      maxSize >>= level;
-       if (width < 2 * border || width > 2 * border + maxSize)
-          return GL_FALSE;
-       if (height < 2 * border || height > 2 * border + maxSize)
-          return GL_FALSE;
-       if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
-          return GL_FALSE;
--      if (level >= ctx->Const.MaxTextureLevels)
--         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch b/pkgs/development/libraries/mesa-darwin/patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch
deleted file mode 100644
index ff933b2ec28..00000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From db8cb2250335a93cad6e877e634116e5cd6b42fc Mon Sep 17 00:00:00 2001
-From: Dave Airlie <airlied@redhat.com>
-Date: Tue, 13 Mar 2012 14:53:25 +0000
-Subject: [PATCH 08/13] glsl: initialise const force glsl extension warning in
- fake ctx
-
-valgrind complained about an uninitialised value being used in
-glsl_parser_extras.cpp, and this was the one it was giving out about.
-
-Just initialise the value in the fakectx.
-
-Signed-off-by: Dave Airlie <airlied@redhat.com>
-Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48057
-(cherry picked from commit b78a77f979b21a84aecb6fa4f19a2ed51a48c306)
----
- src/glsl/builtins/tools/generate_builtins.py | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py
-index 72d12bb..bd15c4d 100755
---- a/src/glsl/builtins/tools/generate_builtins.py
-+++ b/src/glsl/builtins/tools/generate_builtins.py
-@@ -156,6 +156,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne
-    fakeCtx.API = API_OPENGL;
-    fakeCtx.Const.GLSLVersion = 130;
-    fakeCtx.Extensions.ARB_ES2_compatibility = true;
-+   fakeCtx.Const.ForceGLSLExtensionsWarn = false;
-    gl_shader *sh = _mesa_new_shader(NULL, 0, target);
-    struct _mesa_glsl_parse_state *st =
-       new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh);
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch b/pkgs/development/libraries/mesa-darwin/patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch
deleted file mode 100644
index 919443045e4..00000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 2286bd68a832a4d4908d50e1a4496853e1f3305a Mon Sep 17 00:00:00 2001
-From: Brian Paul <brianp@vmware.com>
-Date: Mon, 27 Aug 2012 21:52:07 -0600
-Subject: [PATCH 09/13] mesa: test for GL_EXT_framebuffer_sRGB in glPopAttrib()
-
-To avoid spurious GL_INVALID_ENUM errors if the extension isn't supported.
-(cherry picked from commit 1aee8803f83f7ae24d9c2150c70afff2b1ee4c2f)
----
- src/mesa/main/attrib.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
-index 225ac89..cc384c7 100644
---- a/src/mesa/main/attrib.c
-+++ b/src/mesa/main/attrib.c
-@@ -993,7 +993,8 @@ _mesa_PopAttrib(void)
-                _mesa_ClampColorARB(GL_CLAMP_READ_COLOR_ARB, color->ClampReadColor);
- 
-                /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
--               _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
-+               if (ctx->Extensions.EXT_framebuffer_sRGB)
-+                  _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
-             }
-             break;
-          case GL_CURRENT_BIT:
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch b/pkgs/development/libraries/mesa-darwin/patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch
deleted file mode 100644
index 565d5e6c273..00000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 9c50093adff0c7531ab32a7ec9ce3b91712b4d20 Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Date: Sat, 20 Jul 2013 10:25:28 -0700
-Subject: [PATCH 11/13] Apple: glFlush() is not needed with CGLFlushDrawable()
-
-<rdar://problem/14496373>
-
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-(cherry picked from commit fa5ed99d8e809fb86e486a40273a4a6971055398)
----
- src/glx/apple/apple_glx.c | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/src/glx/apple/apple_glx.c b/src/glx/apple/apple_glx.c
-index 56cff64..4e2aa33 100644
---- a/src/glx/apple/apple_glx.c
-+++ b/src/glx/apple/apple_glx.c
-@@ -132,8 +132,6 @@ apple_glx_swap_buffers(void *ptr)
- {
-    struct apple_glx_context *ac = ptr;
- 
--   /* This may not be needed with CGLFlushDrawable: */
--   glFlush();
-    apple_cgl.flush_drawable(ac->context_obj);
- }
- 
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch b/pkgs/development/libraries/mesa-darwin/patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch
deleted file mode 100644
index 58ac66bd551..00000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 629600450b3845a768c0edc92ea3f444d03a2738 Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Date: Tue, 20 May 2014 01:37:58 -0700
-Subject: [PATCH 12/13] glapi: Avoid heap corruption in _glapi_table
-
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Reviewed-by: Chia-I Wu <olv@lunarg.com>
-(cherry picked from commit ff5456d1acf6f627a6837be3f3f37c6a268c9e8e)
----
- src/mapi/glapi/gen/gl_gentable.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
-index 5657e32..0d0a02d 100644
---- a/src/mapi/glapi/gen/gl_gentable.py
-+++ b/src/mapi/glapi/gen/gl_gentable.py
-@@ -111,7 +111,7 @@ __glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
- 
- struct _glapi_table *
- _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
--    struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table));
-+    struct _glapi_table *disp = calloc(1, _glapi_get_dispatch_table_size() * sizeof(_glapi_proc));
-     char symboln[512];
- 
-     if(!disp)
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch b/pkgs/development/libraries/mesa-darwin/patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch
deleted file mode 100644
index 5ec0d9024ef..00000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From ba59a779ed41e08fa16805c1c60da39885546d0e Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Date: Tue, 20 May 2014 10:53:00 -0700
-Subject: [PATCH 13/13] darwin: Fix test for kCGLPFAOpenGLProfile support at
- runtime
-
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-(cherry picked from commit 7a109268ab5b3544e7f7b99e84ef1fdf54023fb4)
----
- src/glx/apple/apple_visual.c | 14 +++++++++-----
- 1 file changed, 9 insertions(+), 5 deletions(-)
-
-diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
-index 282934f..238c248 100644
---- a/src/glx/apple/apple_visual.c
-+++ b/src/glx/apple/apple_visual.c
-@@ -73,11 +73,15 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
-    GLint vsref = 0;
-    CGLError error = 0;
- 
--   /* Request an OpenGL 3.2 profile if one is available */
--   if(apple_cgl.version_major > 1 || (apple_cgl.version_major == 1 && apple_cgl.version_minor >= 3)) {
--      attr[numattr++] = kCGLPFAOpenGLProfile;
--      attr[numattr++] = kCGLOGLPVersion_3_2_Core;
--   }
-+   /* Request an OpenGL 3.2 profile if one is available and supported */
-+   attr[numattr++] = kCGLPFAOpenGLProfile;
-+   attr[numattr++] = kCGLOGLPVersion_3_2_Core;
-+
-+   /* Test for kCGLPFAOpenGLProfile support at runtime and roll it out if not supported */
-+   attr[numattr] = 0;
-+   error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
-+   if (error == kCGLBadAttribute)
-+      numattr -= 2;
- 
-    if (offscreen) {
-       apple_glx_diagnostic
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch b/pkgs/development/libraries/mesa-darwin/patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch
deleted file mode 100644
index 372ce4a27a3..00000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From f0702d6e631bb912a230c081463bb51a0dde1bff Mon Sep 17 00:00:00 2001
-From: Jon TURNEY <jon.turney@dronecode.org.uk>
-Date: Mon, 12 May 2014 15:38:26 +0100
-Subject: [PATCH 1001/1003] appleglx: Improve error reporting if
- CGLChoosePixelFormat() didn't find any matching pixel formats.
-
-Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
-Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-(cherry picked from commit 002a3a74273b81dfb226e1c3f0a8c18525ed0af4)
----
- src/glx/apple/apple_visual.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
-index 238c248..c6ede51 100644
---- a/src/glx/apple/apple_visual.c
-+++ b/src/glx/apple/apple_visual.c
-@@ -167,4 +167,9 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
-       fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
-       abort();
-    }
-+
-+   if (!*pfobj) {
-+      fprintf(stderr, "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
-+      abort();
-+   }
- }
--- 
-1.9.2 (Apple Git-49)
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch b/pkgs/development/libraries/mesa-darwin/patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch
deleted file mode 100644
index 4818ee63d4c..00000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 1b2f877c8ef052b183c1f20ece6c6e4a7bfd237c Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Date: Sat, 24 May 2014 14:13:33 -0700
-Subject: [PATCH 1002/1003] darwin: Write errors in choosing the pixel format
- to the crash log
-
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-(cherry picked from commit 9eb1d36c978a9b15ae2e999c630492dfffd7f165)
----
- src/glx/apple/apple_visual.c | 18 ++++++++++++++++--
- 1 file changed, 16 insertions(+), 2 deletions(-)
-
-diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
-index c6ede51..951b213 100644
---- a/src/glx/apple/apple_visual.c
-+++ b/src/glx/apple/apple_visual.c
-@@ -63,6 +63,16 @@ enum
-    MAX_ATTR = 60
- };
- 
-+static char __crashreporter_info_buff__[4096] = { 0 };
-+static const char *__crashreporter_info__ __attribute__((__used__)) =
-+    &__crashreporter_info_buff__[0];
-+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
-+// This is actually a toolchain requirement, but I'm not sure the correct check,
-+// but it should be fine to just only include it for Leopard and later.  This line
-+// just tells the linker to never strip this symbol (such as for space optimization)
-+__asm__ (".desc ___crashreporter_info__, 0x10");
-+#endif
-+
- void
- apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * mode,
-                           bool * double_buffered, bool * uses_stereo,
-@@ -164,12 +174,16 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
-    error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
- 
-    if (error) {
--      fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
-+      snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
-+               "CGLChoosePixelFormat error: %s\n", apple_cgl.error_string(error));
-+      fprintf(stderr, "%s", __crashreporter_info_buff__);
-       abort();
-    }
- 
-    if (!*pfobj) {
--      fprintf(stderr, "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
-+      snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
-+               "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
-+      fprintf(stderr, "%s", __crashreporter_info_buff__);
-       abort();
-    }
- }
--- 
-1.9.2 (Apple Git-49)
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch b/pkgs/development/libraries/mesa-darwin/patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch
deleted file mode 100644
index 72841e2a2cc..00000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 9d6e12eb6b06202519e48a7321f32944d7a34b0f Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Date: Sat, 24 May 2014 14:08:16 -0700
-Subject: [PATCH 1003/1003] darwin: Guard Core Profile usage behind a testing
- envvar
-
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-(cherry picked from commit 04ce3be4010305902cc5ae81e8e0c8550d043a1e)
----
- src/glx/apple/apple_visual.c | 30 ++++++++++++++++++++----------
- 1 file changed, 20 insertions(+), 10 deletions(-)
-
-diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
-index 951b213..046581b 100644
---- a/src/glx/apple/apple_visual.c
-+++ b/src/glx/apple/apple_visual.c
-@@ -82,16 +82,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
-    int numattr = 0;
-    GLint vsref = 0;
-    CGLError error = 0;
--
--   /* Request an OpenGL 3.2 profile if one is available and supported */
--   attr[numattr++] = kCGLPFAOpenGLProfile;
--   attr[numattr++] = kCGLOGLPVersion_3_2_Core;
--
--   /* Test for kCGLPFAOpenGLProfile support at runtime and roll it out if not supported */
--   attr[numattr] = 0;
--   error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
--   if (error == kCGLBadAttribute)
--      numattr -= 2;
-+   bool use_core_profile = getenv("LIBGL_PROFILE_CORE");
- 
-    if (offscreen) {
-       apple_glx_diagnostic
-@@ -167,12 +158,31 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
-       attr[numattr++] = mode->samples;
-    }
- 
-+   /* Debugging support for Core profiles to support newer versions of OpenGL */
-+   if (use_core_profile) {
-+      attr[numattr++] = kCGLPFAOpenGLProfile;
-+      attr[numattr++] = kCGLOGLPVersion_3_2_Core;
-+   }
-+
-    attr[numattr++] = 0;
- 
-    assert(numattr < MAX_ATTR);
- 
-    error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
- 
-+   if ((error == kCGLBadAttribute || vsref == 0) && use_core_profile) {
-+      apple_glx_diagnostic
-+         ("Trying again without CoreProfile: error=%s, vsref=%d\n", apple_cgl.error_string(error), vsref);
-+
-+      if (!error)
-+         apple_cgl.destroy_pixel_format(*pfobj);
-+
-+      numattr -= 3;
-+      attr[numattr++] = 0;
-+
-+      error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
-+   }
-+
-    if (error) {
-       snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
-                "CGLChoosePixelFormat error: %s\n", apple_cgl.error_string(error));
--- 
-1.9.2 (Apple Git-49)
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/patch-src-mapi-vgapi-Makefile.diff b/pkgs/development/libraries/mesa-darwin/patches/patch-src-mapi-vgapi-Makefile.diff
deleted file mode 100644
index e29a8464076..00000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/patch-src-mapi-vgapi-Makefile.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/src/mapi/vgapi/Makefile	2012-11-30 12:06:24.000000000 -0500
-+++ b/src/mapi/vgapi/Makefile	2012-11-30 12:06:52.000000000 -0500
-@@ -75,6 +75,8 @@
- install-headers:
- 	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/VG
- 	$(INSTALL) -m 644 $(TOP)/include/VG/*.h $(DESTDIR)$(INSTALL_INC_DIR)/VG
-+	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/KHR
-+	$(INSTALL) -m 644 $(TOP)/include/KHR/*.h $(DESTDIR)$(INSTALL_INC_DIR)/KHR
- 
- install: default install-headers install-pc
- 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
diff --git a/pkgs/development/libraries/mesa/darwin-clock-gettime.patch b/pkgs/development/libraries/mesa/darwin-clock-gettime.patch
new file mode 100644
index 00000000000..94e90a1c587
--- /dev/null
+++ b/pkgs/development/libraries/mesa/darwin-clock-gettime.patch
@@ -0,0 +1,76 @@
+diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
+index 45cb6075e6..62937311b9 100644
+--- a/include/c11/threads_posix.h
++++ b/include/c11/threads_posix.h
+@@ -36,6 +36,11 @@
+ #include <sched.h>
+ #include <stdint.h> /* for intptr_t */
+ 
++#ifdef __MACH__
++#include <mach/clock.h>
++#include <mach/mach.h>
++#endif
++
+ /*
+ Configuration macro:
+ 
+@@ -383,12 +388,25 @@ tss_set(tss_t key, void *val)
+ /*-------------------- 7.25.7 Time functions --------------------*/
+ // 7.25.6.1
+ #ifndef HAVE_TIMESPEC_GET
++
+ static inline int
+ timespec_get(struct timespec *ts, int base)
+ {
+     if (!ts) return 0;
+     if (base == TIME_UTC) {
++#ifdef __MACH__
++        if (ts != NULL) {
++            clock_serv_t cclock;
++            mach_timespec_t mts;
++            host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
++            clock_get_time(cclock, &mts);
++            mach_port_deallocate(mach_task_self(), cclock);
++            ts->tv_sec = mts.tv_sec;
++            ts->tv_nsec = mts.tv_nsec;
++        }
++#else
+         clock_gettime(CLOCK_REALTIME, ts);
++#endif
+         return base;
+     }
+     return 0;
+diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
+index 1208ebb315..e1378fb1f0 100644
+--- a/src/egl/drivers/dri2/egl_dri2.c
++++ b/src/egl/drivers/dri2/egl_dri2.c
+@@ -65,6 +65,11 @@
+ #include "util/u_vector.h"
+ #include "mapi/glapi/glapi.h"
+ 
++#ifdef __MACH__
++#include <mach/clock.h>
++#include <mach/mach.h>
++#endif
++
+ #define NUM_ATTRIBS 12
+ 
+ static void
+@@ -3092,7 +3097,17 @@ dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
+ 
+             /* We override the clock to monotonic when creating the condition
+              * variable. */
++#ifdef __MACH__
++            clock_serv_t cclock;
++            mach_timespec_t mts;
++            host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
++            clock_get_time(cclock, &mts);
++            mach_port_deallocate(mach_task_self(), cclock);
++            current.tv_sec = mts.tv_sec;
++            current.tv_nsec = mts.tv_nsec;
++#else
+             clock_gettime(CLOCK_MONOTONIC, &current);
++#endif
+ 
+             /* calculating when to expire */
+             expire.tv_nsec = timeout % 1000000000L;
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 0a8a3c75a1c..aca9a237b0c 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -8,6 +8,8 @@
 , galliumDrivers ? null
 , driDrivers ? null
 , vulkanDrivers ? null
+, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
+, OpenGL, Xplugin
 }:
 
 /** Packaging design:
@@ -29,19 +31,21 @@ else
 
 let
   defaultGalliumDrivers =
-    if stdenv.isAarch32
+    optionals (builtins.elem "drm" eglPlatforms)
+    (if stdenv.isAarch32
     then ["virgl" "nouveau" "freedreno" "vc4" "etnaviv" "imx"]
     else if stdenv.isAarch64
     then ["virgl" "nouveau" "vc4" ]
-    else ["virgl" "svga" "i915" "r300" "r600" "radeonsi" "nouveau"];
+    else ["virgl" "svga" "i915" "r300" "r600" "radeonsi" "nouveau"]);
   defaultDriDrivers =
-    if (stdenv.isAarch32 || stdenv.isAarch64)
+    optionals (builtins.elem "drm" eglPlatforms)
+    (if (stdenv.isAarch32 || stdenv.isAarch64)
     then ["nouveau"]
-    else ["i915" "i965" "nouveau" "radeon" "r200"];
+    else ["i915" "i965" "nouveau" "radeon" "r200"]);
   defaultVulkanDrivers =
-    if (stdenv.isAarch32 || stdenv.isAarch64)
+    optionals stdenv.isLinux (if (stdenv.isAarch32 || stdenv.isAarch64)
     then []
-    else ["intel"] ++ lib.optional enableRadv "radeon";
+    else ["intel"] ++ lib.optional enableRadv "radeon");
 in
 
 let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in
@@ -51,11 +55,11 @@ let
     (if gallium_ == null
           then defaultGalliumDrivers
           else gallium_)
-    ++ ["swrast" "virgl"];
+    ++ lib.optional stdenv.isLinux "swrast";
   driDrivers =
     (if dri_ == null
-      then defaultDriDrivers
-      else dri_) ++ ["swrast"];
+      then optionals (elem "drm" eglPlatforms) defaultDriDrivers
+      else dri_) ++ lib.optional stdenv.isLinux "swrast";
   vulkanDrivers =
     if vulkan_ == null
     then defaultVulkanDrivers
@@ -63,7 +67,7 @@ let
 in
 
 let
-  version = "18.1.7";
+  version = "18.2.1";
   branch  = head (splitString "." version);
 in
 
@@ -77,7 +81,7 @@ let self = stdenv.mkDerivation {
       "ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz"
       "https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
     ];
-    sha256 = "655e3b32ce3bdddd5e6e8768596e5d4bdef82d0dd37067c324cc4b2daa207306";
+    sha256 = "0mhhr1id11s1fbdxbvr4a81xjh1nsznpra9dl36bv2hq7mpxqdln";
   };
 
   prePatch = "patchShebangs .";
@@ -89,9 +93,10 @@ let self = stdenv.mkDerivation {
     ./symlink-drivers.patch
     ./missing-includes.patch # dev_t needs sys/stat.h, time_t needs time.h, etc.-- fixes build w/musl
     ./disk_cache-include-dri-driver-path-in-cache-key.patch
-  ];
+  ] ++ lib.optional stdenv.isDarwin ./darwin-clock-gettime.patch;
 
-  outputs = [ "out" "dev" "drivers" "osmesa" ];
+  outputs = [ "out" "dev" "drivers" ]
+            ++ lib.optional (elem "swrast" galliumDrivers) "osmesa";
 
   # TODO: Figure out how to enable opencl without having a runtime dependency on clang
   configureFlags = [
@@ -99,19 +104,11 @@ let self = stdenv.mkDerivation {
     "--localstatedir=/var"
     "--with-dri-driverdir=$(drivers)/lib/dri"
     "--with-dri-searchpath=${libglvnd.driverLink}/lib/dri"
-    "--with-platforms=x11,wayland,drm"
+    "--with-platforms=${concatStringsSep "," eglPlatforms}"
+    "--with-gallium-drivers=${concatStringsSep "," galliumDrivers}"
+    "--with-dri-drivers=${concatStringsSep "," driDrivers}"
+    "--with-vulkan-drivers=${concatStringsSep "," vulkanDrivers}"
     "--enable-texture-float"
-  ]
-  ++ (optional (galliumDrivers != [])
-      ("--with-gallium-drivers=" +
-        builtins.concatStringsSep "," galliumDrivers))
-  ++ (optional (driDrivers != [])
-      ("--with-dri-drivers=" +
-        builtins.concatStringsSep "," driDrivers))
-  ++ (optional (vulkanDrivers != [])
-      ("--with-vulkan-drivers=" +
-        builtins.concatStringsSep "," vulkanDrivers))
-  ++ [
     (enableFeature stdenv.isLinux "dri3")
     (enableFeature stdenv.isLinux "nine") # Direct3D in Wine
     "--enable-libglvnd"
@@ -122,17 +119,18 @@ let self = stdenv.mkDerivation {
     "--enable-glx"
     # https://bugs.freedesktop.org/show_bug.cgi?id=35268
     (enableFeature (!stdenv.hostPlatform.isMusl) "glx-tls")
-    "--enable-gallium-osmesa" # used by wine
+    # used by wine
+    (enableFeature (elem "swrast" galliumDrivers) "gallium-osmesa")
     "--enable-llvm"
-    "--enable-egl"
-    "--enable-xa" # used in vmware driver
-    "--enable-gbm"
+    (enableFeature stdenv.isLinux "egl")
+    (enableFeature stdenv.isLinux "xa") # used in vmware driver
+    (enableFeature stdenv.isLinux "gbm")
     "--enable-xvmc"
     "--enable-vdpau"
     "--enable-shared-glapi"
     "--enable-llvm-shared-libs"
-    "--enable-omx-bellagio"
-    "--enable-va"
+    (enableFeature stdenv.isLinux "omx-bellagio")
+    (enableFeature stdenv.isLinux "va")
     "--disable-opencl"
   ];
 
@@ -140,16 +138,18 @@ let self = stdenv.mkDerivation {
 
   propagatedBuildInputs = with xorg;
     [ libXdamage libXxf86vm ]
-    ++ optional stdenv.isLinux libdrm;
+    ++ optional stdenv.isLinux libdrm
+    ++ optionals stdenv.isDarwin [ OpenGL Xplugin ];
 
   buildInputs = with xorg; [
     expat llvmPackages.llvm libglvnd
     glproto dri2proto dri3proto presentproto
-    libX11 libXext libxcb libXt libXfixes libxshmfence
-    libffi wayland wayland-protocols libvdpau libelf libXvMC
-    libomxil-bellagio libva-minimal libpthreadstubs openssl/*or another sha1 provider*/
+    libX11 libXext libxcb libXt libXfixes libxshmfence libXrandr
+    libffi libvdpau libelf libXvMC
+    libpthreadstubs openssl/*or another sha1 provider*/
     valgrind-light python2 python2.pkgs.Mako
-  ];
+  ] ++ lib.optionals stdenv.isLinux [ wayland wayland-protocols
+                                      libomxil-bellagio libva-minimal ];
 
   enableParallelBuilding = true;
   doCheck = false;
@@ -161,7 +161,7 @@ let self = stdenv.mkDerivation {
   ];
 
   # TODO: probably not all .la files are completely fixed, but it shouldn't matter;
-  postInstall = ''
+  postInstall = optionalString (galliumDrivers != []) ''
     # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
     mv -t "$drivers/lib/"    \
       $out/lib/libXvMC*      \
@@ -215,7 +215,7 @@ let self = stdenv.mkDerivation {
   # TODO:
   #  check $out doesn't depend on llvm: builder failures are ignored
   #  for some reason grep -qv '${llvmPackages.llvm}' -R "$out";
-  postFixup = ''
+  postFixup = optionalString (galliumDrivers != []) ''
     # add RPATH so the drivers can find the moved libgallium and libdricore9
     # moved here to avoid problems with stripping patchelfed files
     for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
@@ -235,7 +235,9 @@ let self = stdenv.mkDerivation {
 
       # Use stub libraries from libglvnd and headers from Mesa.
       buildCommand = ''
-        ln -s ${libglvnd.out} $out
+        mkdir -p $out/nix-support
+        ln -s ${libglvnd.out}/lib $out/lib
+
         mkdir -p $dev/{,lib/pkgconfig,nix-support}
         echo "$out" > $dev/nix-support/propagated-build-inputs
         ln -s ${self.dev}/include $dev/include
@@ -257,6 +259,8 @@ let self = stdenv.mkDerivation {
         genPkgConfig egl EGL
         genPkgConfig glesv1_cm GLESv1_CM
         genPkgConfig glesv2 GLESv2
+      '' + lib.optionalString stdenv.isDarwin ''
+        echo ${OpenGL} > $out/nix-support/propagated-build-inputs
       '';
     };
   };
@@ -265,7 +269,7 @@ let self = stdenv.mkDerivation {
     description = "An open source implementation of OpenGL";
     homepage = https://www.mesa3d.org/;
     license = licenses.mit; # X11 variant, in most files
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
     maintainers = with maintainers; [ vcunat ];
   };
 };
diff --git a/pkgs/development/libraries/mesa/missing-includes.patch b/pkgs/development/libraries/mesa/missing-includes.patch
index feb6ffe428c..18e7d5437b1 100644
--- a/pkgs/development/libraries/mesa/missing-includes.patch
+++ b/pkgs/development/libraries/mesa/missing-includes.patch
@@ -32,16 +32,6 @@
  #include <unistd.h>
  #include <fcntl.h>
  #else
---- ./src/mesa/drivers/dri/i965/brw_bufmgr.h
-+++ ./src/mesa/drivers/dri/i965/brw_bufmgr.h
-@@ -37,6 +37,7 @@
- #include <stdbool.h>
- #include <stdint.h>
- #include <stdio.h>
-+#include <time.h>
- #include "util/u_atomic.h"
- #include "util/list.h"
-
 --- ./src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
 +++ ./src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
 @@ -28,6 +28,8 @@
diff --git a/pkgs/development/libraries/newt/default.nix b/pkgs/development/libraries/newt/default.nix
index a10f52462a8..1a5656b7ca1 100644
--- a/pkgs/development/libraries/newt/default.nix
+++ b/pkgs/development/libraries/newt/default.nix
@@ -22,10 +22,9 @@ stdenv.mkDerivation rec {
     unset CPP
   '';
 
-  # Use `lib.optionalString` next mass rebuild.
-  makeFlags = if stdenv.buildPlatform == stdenv.hostPlatform
-              then null
-              else "CROSS_COMPILE=${stdenv.cc.targetPrefix}";
+  makeFlags = stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
+    "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
+  ];
 
   meta = with stdenv.lib; {
     homepage = https://fedorahosted.org/newt/;
diff --git a/pkgs/development/libraries/nspr/default.nix b/pkgs/development/libraries/nspr/default.nix
index ce18498ee85..9cb7d701b9d 100644
--- a/pkgs/development/libraries/nspr/default.nix
+++ b/pkgs/development/libraries/nspr/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchurl
 , CoreServices ? null }:
 
-let version = "4.19"; in
+let version = "4.20"; in
 
 stdenv.mkDerivation {
   name = "nspr-${version}";
 
   src = fetchurl {
     url = "mirror://mozilla/nspr/releases/v${version}/src/nspr-${version}.tar.gz";
-    sha256 = "0agpv3f17h8kmzi0ifibaaxc1k3xc0q61wqw3l6r2xr2z8bmkn9f";
+    sha256 = "0vjms4j75zvv5b2siyafg7hh924ysx2cwjad8spzp7x87n8n929c";
   };
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix
index f7ddf8ff780..8715aaaa44d 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -68,6 +68,7 @@ stdenv.mkDerivation rec {
       ./parallel-configure.patch
       ./clang-5-darwin.patch
       ./qt-4.8.7-unixmake-darwin.patch
+      ./kill-legacy-darwin-apis.patch
       (substituteAll {
         src = ./dlopen-absolute-paths.diff;
         cups = if cups != null then lib.getLib cups else null;
diff --git a/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch b/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch
new file mode 100644
index 00000000000..c1338e98d85
--- /dev/null
+++ b/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch
@@ -0,0 +1,330 @@
+diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
+index 4a9049b..c0ac9db 100644
+--- a/src/corelib/io/qfilesystemengine_unix.cpp
++++ b/src/corelib/io/qfilesystemengine_unix.cpp
+@@ -242,9 +242,8 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
+ #else
+     char *ret = 0;
+ # if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
+-    // When using -mmacosx-version-min=10.4, we get the legacy realpath implementation,
+-    // which does not work properly with the realpath(X,0) form. See QTBUG-28282.
+-    if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) {
++    // In Nix-on-Darwin, we don't support ancient macOS anyway, and the deleted branch relies on
++    // a symbol that's been deprecated for years and that our CF doesn't have
+         ret = (char*)malloc(PATH_MAX + 1);
+         if (ret && realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) {
+             const int savedErrno = errno; // errno is checked below, and free() might change it
+@@ -252,19 +251,6 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
+             errno = savedErrno;
+             ret = 0;
+         }
+-    } else {
+-        // on 10.5 we can use FSRef to resolve the file path.
+-        QString path = QDir::cleanPath(entry.filePath());
+-        FSRef fsref;
+-        if (FSPathMakeRef((const UInt8 *)path.toUtf8().data(), &fsref, 0) == noErr) {
+-            CFURLRef urlref = CFURLCreateFromFSRef(NULL, &fsref);
+-            CFStringRef canonicalPath = CFURLCopyFileSystemPath(urlref, kCFURLPOSIXPathStyle);
+-            QString ret = QCFString::toQString(canonicalPath);
+-            CFRelease(canonicalPath);
+-            CFRelease(urlref);
+-            return QFileSystemEntry(ret);
+-        }
+-    }
+ # else
+ #  if _POSIX_VERSION >= 200801L
+     ret = realpath(entry.nativeFilePath().constData(), (char*)0);
+diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
+index 3bf7342..b6bcfc0 100644
+--- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
++++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
+@@ -43,7 +43,6 @@ BOOL stringIsCaseInsensitiveEqualToString(NSString *first, NSString *second);
+ BOOL hasCaseInsensitiveSuffix(NSString *string, NSString *suffix);
+ BOOL hasCaseInsensitiveSubstring(NSString *string, NSString *substring);
+ NSString *filenameByFixingIllegalCharacters(NSString *string);
+-CFStringEncoding stringEncodingForResource(Handle resource);
+ 
+ #ifdef __cplusplus
+ }
+diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
+index d6c3f0c..c88ca76 100644
+--- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
++++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
+@@ -68,45 +68,4 @@ BOOL hasCaseInsensitiveSubstring(NSString *string, NSString *substring)
+     return filename;
+ }
+ 
+-CFStringEncoding stringEncodingForResource(Handle resource)
+-{
+-    short resRef = HomeResFile(resource);
+-    if (ResError() != noErr)
+-        return NSMacOSRomanStringEncoding;
+-    
+-    // Get the FSRef for the current resource file
+-    FSRef fref;
+-    OSStatus error = FSGetForkCBInfo(resRef, 0, NULL, NULL, NULL, &fref, NULL);
+-    if (error != noErr)
+-        return NSMacOSRomanStringEncoding;
+-    
+-    RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateFromFSRef(NULL, &fref));
+-    if (!url)
+-        return NSMacOSRomanStringEncoding;
+-
+-    NSString *path = [(NSURL *)url.get() path];
+-
+-    // Get the lproj directory name
+-    path = [path stringByDeletingLastPathComponent];
+-    if (!stringIsCaseInsensitiveEqualToString([path pathExtension], @"lproj"))
+-        return NSMacOSRomanStringEncoding;
+-    
+-    NSString *directoryName = [[path stringByDeletingPathExtension] lastPathComponent];
+-    RetainPtr<CFStringRef> locale(AdoptCF, CFLocaleCreateCanonicalLocaleIdentifierFromString(NULL, (CFStringRef)directoryName));
+-    if (!locale)
+-        return NSMacOSRomanStringEncoding;
+-
+-    LangCode lang;
+-    RegionCode region;
+-    error = LocaleStringToLangAndRegionCodes([(NSString *)locale.get() UTF8String], &lang, &region);
+-    if (error != noErr)
+-        return NSMacOSRomanStringEncoding;
+-
+-    TextEncoding encoding;
+-    error = UpgradeScriptInfoToTextEncoding(kTextScriptDontCare, lang, region, NULL, &encoding);
+-    if (error != noErr)
+-        return NSMacOSRomanStringEncoding;
+-    
+-    return encoding;
+-}
+ 
+diff --git a/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp b/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
+index 865ea32..20bda8d 100644
+--- a/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
++++ b/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
+@@ -101,33 +101,6 @@ static WTF::RetainPtr<CFDictionaryRef> readPListFile(CFStringRef fileName, bool
+     return map;
+ }
+ 
+-static Vector<String> stringListFromResourceId(SInt16 id)
+-{
+-    Vector<String> list;
+-
+-    Handle handle = Get1Resource('STR#', id);
+-    if (!handle)
+-        return list;
+-
+-    CFStringEncoding encoding = stringEncodingForResource(handle);
+-
+-    unsigned char* p = (unsigned char*)*handle;
+-    if (!p)
+-        return list;
+-
+-    SInt16 count = *(SInt16*)p;
+-    p += sizeof(SInt16);
+-
+-    for (SInt16 i = 0; i < count; ++i) {
+-        unsigned char length = *p;
+-        WTF::RetainPtr<CFStringRef> str = CFStringCreateWithPascalString(0, p, encoding);
+-        list.append(str.get());
+-        p += 1 + length;
+-    }
+-
+-    return list;
+-}
+-
+ bool PluginPackage::fetchInfo()
+ {
+     if (!load())
+@@ -202,36 +175,8 @@ bool PluginPackage::fetchInfo()
+         m_description = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(m_module, CFSTR("WebPluginDescription"));
+ 
+     } else {
+-        int resFile = CFBundleOpenBundleResourceMap(m_module);
+-
+-        UseResFile(resFile);
+-
+-        Vector<String> mimes = stringListFromResourceId(MIMEListStringStringNumber);
+-
+-        if (mimes.size() % 2 != 0)
+-            return false;
+-
+-        Vector<String> descriptions = stringListFromResourceId(MIMEDescriptionStringNumber);
+-        if (descriptions.size() != mimes.size() / 2)
+-            return false;
+-
+-        for (size_t i = 0;  i < mimes.size(); i += 2) {
+-            String mime = mimes[i].lower();
+-            Vector<String> extensions;
+-            mimes[i + 1].lower().split(UChar(','), extensions);
+-
+-            m_mimeToExtensions.set(mime, extensions);
+-
+-            m_mimeToDescriptions.set(mime, descriptions[i / 2]);
+-        }
+-
+-        Vector<String> names = stringListFromResourceId(PluginNameOrDescriptionStringNumber);
+-        if (names.size() == 2) {
+-            m_description = names[0];
+-            m_name = names[1];
+-        }
+-
+-        CFBundleCloseBundleResourceMap(m_module, resFile);
++        LOG(Plugins, "Nix removed ancient code that relies on long-deprecated functionality that we don't want to support!");
++        return false;
+     }
+ 
+     LOG(Plugins, "PluginPackage::fetchInfo(): Found plug-in '%s'", m_name.utf8().data());
+diff --git a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+index b206e48..669d442 100644
+--- a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
++++ b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+@@ -26,7 +26,6 @@
+ #import "config.h"
+ #import "NetscapePluginModule.h"
+ 
+-#import <WebCore/WebCoreNSStringExtras.h>
+ #import <wtf/HashSet.h>
+ 
+ using namespace WebCore;
+@@ -196,132 +195,6 @@ static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& plugi
+     return true;    
+ }
+ 
+-class ResourceMap {
+-public:
+-    explicit ResourceMap(CFBundleRef bundle)
+-        : m_bundle(bundle)
+-        , m_currentResourceFile(CurResFile())
+-        , m_bundleResourceMap(CFBundleOpenBundleResourceMap(m_bundle))
+-    {
+-        UseResFile(m_bundleResourceMap);
+-    }
+-
+-    ~ResourceMap()
+-    {
+-        // Close the resource map.
+-        CFBundleCloseBundleResourceMap(m_bundle, m_bundleResourceMap);
+-        
+-        // And restore the old resource.
+-        UseResFile(m_currentResourceFile);
+-    }
+-
+-    bool isValid() const { return m_bundleResourceMap != -1; }
+-
+-private:
+-    CFBundleRef m_bundle;
+-    ResFileRefNum m_currentResourceFile;
+-    ResFileRefNum m_bundleResourceMap;
+-};
+-
+-static bool getStringListResource(ResID resourceID, Vector<String>& stringList) {
+-    Handle stringListHandle = Get1Resource('STR#', resourceID);
+-    if (!stringListHandle || !*stringListHandle)
+-        return false;
+-
+-    // Get the string list size.
+-    Size stringListSize = GetHandleSize(stringListHandle);
+-    if (stringListSize < static_cast<Size>(sizeof(UInt16)))
+-        return false;
+-
+-    CFStringEncoding stringEncoding = stringEncodingForResource(stringListHandle);
+-
+-    unsigned char* ptr = reinterpret_cast<unsigned char*>(*stringListHandle);
+-    unsigned char* end = ptr + stringListSize;
+-    
+-    // Get the number of strings in the string list.
+-    UInt16 numStrings = *reinterpret_cast<UInt16*>(ptr);
+-    ptr += sizeof(UInt16);
+-
+-    for (UInt16 i = 0; i < numStrings; ++i) {
+-        // We're past the end of the string, bail.
+-        if (ptr >= end)
+-            return false;
+-
+-        // Get the string length.
+-        unsigned char stringLength = *ptr++;
+-
+-        RetainPtr<CFStringRef> cfString(AdoptCF, CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, ptr, stringLength, stringEncoding, false, kCFAllocatorNull));
+-        if (!cfString.get())
+-            return false;
+-
+-        stringList.append(cfString.get());
+-        ptr += stringLength;
+-    }
+-
+-    if (ptr != end)
+-        return false;
+-
+-    return true;
+-}
+-
+-static const ResID PluginNameOrDescriptionStringNumber = 126;
+-static const ResID MIMEDescriptionStringNumber = 127;
+-static const ResID MIMEListStringStringNumber = 128;
+-
+-static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& pluginInfo)
+-{
+-    ResourceMap resourceMap(bundle);
+-    if (!resourceMap.isValid())
+-        return false;
+-
+-    // Get the description and name string list.
+-    Vector<String> descriptionAndName;
+-    if (!getStringListResource(PluginNameOrDescriptionStringNumber, descriptionAndName))
+-        return false;
+-
+-    // Get the MIME types and extensions string list. This list needs to be a multiple of two.
+-    Vector<String> mimeTypesAndExtensions;
+-    if (!getStringListResource(MIMEListStringStringNumber, mimeTypesAndExtensions))
+-        return false;
+-
+-    if (mimeTypesAndExtensions.size() % 2)
+-        return false;
+-
+-    // Now get the MIME type descriptions string list. This string list needs to be the same length as the number of MIME types.
+-    Vector<String> mimeTypeDescriptions;
+-    if (!getStringListResource(MIMEDescriptionStringNumber, mimeTypeDescriptions))
+-        return false;
+-
+-    // Add all MIME types.
+-    for (size_t i = 0; i < mimeTypesAndExtensions.size() / 2; ++i) {
+-        MimeClassInfo mimeClassInfo;
+-        
+-        const String& mimeType = mimeTypesAndExtensions[i * 2];
+-        String description;
+-        if (i < mimeTypeDescriptions.size())
+-            description = mimeTypeDescriptions[i];
+-        
+-        mimeClassInfo.type = mimeType.lower();
+-        mimeClassInfo.desc = description;
+-        
+-        Vector<String> extensions;
+-        mimeTypesAndExtensions[i * 2 + 1].split(',', extensions);
+-        
+-        for (size_t i = 0; i < extensions.size(); ++i)
+-            mimeClassInfo.extensions.append(extensions[i].lower());
+-
+-        pluginInfo.mimes.append(mimeClassInfo);
+-    }
+-
+-    // Set the description and name if they exist.
+-    if (descriptionAndName.size() > 0)
+-        pluginInfo.desc = descriptionAndName[0];
+-    if (descriptionAndName.size() > 1)
+-        pluginInfo.name = descriptionAndName[1];
+-
+-    return true;
+-}
+-
+ bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin& plugin)
+ {
+     RetainPtr<CFStringRef> bundlePath(AdoptCF, pluginPath.createCFString());
+@@ -344,8 +217,7 @@ static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& plu
+         return false;
+     
+     // Check that there's valid info for this plug-in.
+-    if (!getPluginInfoFromPropertyLists(bundle.get(), plugin.info) &&
+-        !getPluginInfoFromCarbonResources(bundle.get(), plugin.info))
++    if (!getPluginInfoFromPropertyLists(bundle.get(), plugin.info))
+         return false;
+     
+     plugin.path = pluginPath;
diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix
index a84cb7623d8..b050a19db37 100644
--- a/pkgs/development/libraries/science/math/openblas/default.nix
+++ b/pkgs/development/libraries/science/math/openblas/default.nix
@@ -79,12 +79,12 @@ let
 in
 stdenv.mkDerivation rec {
   name = "openblas-${version}";
-  version = "0.3.1";
+  version = "0.3.3";
   src = fetchFromGitHub {
     owner = "xianyi";
     repo = "OpenBLAS";
     rev = "v${version}";
-    sha256 = "1dkwp4gz1hzpmhzks9y9ipb4c5h0r6c7yff62x3s8x9z6f8knaqc";
+    sha256 = "0cpkvfvc14xm9mifrm919rp8vrq70gpl7r2sww4f0izrl39wklwx";
   };
 
   inherit blas64;
@@ -118,20 +118,7 @@ stdenv.mkDerivation rec {
     ] ++ stdenv.lib.optional (stdenv.hostPlatform.libc == "musl") "NO_AFFINITY=1"
     ++ mapAttrsToList (var: val: var + "=" + val) config;
 
-    patches = [
-      # Backport of https://github.com/xianyi/OpenBLAS/pull/1667, which
-      # is causing problems and was already accepted upstream.
-      (fetchpatch {
-        url = "https://github.com/xianyi/OpenBLAS/commit/5f2a3c05cd0e3872be3c5686b9da6b627658eeb7.patch";
-        sha256 = "1qvxhk92likrshw6z6hjqxvkblwzgsbzis2b2f71bsvx9174qfk1";
-      })
-      # Double "MAX_ALLOCATING_THREADS", fix with Go and Octave
-      # https://github.com/xianyi/OpenBLAS/pull/1663 (see also linked issue)
-      (fetchpatch {
-        url = "https://github.com/xianyi/OpenBLAS/commit/a49203b48c4a3d6f86413fc8c4b1fbfaa1946463.patch";
-        sha256 = "0v6kjkbgbw7hli6xkism48wqpkypxmcqvxpx564snll049l2xzq2";
-      })
-    ];
+    patches = [];
 
   doCheck = true;
   checkTarget = "tests";
@@ -140,7 +127,7 @@ stdenv.mkDerivation rec {
     # Write pkgconfig aliases. Upstream report:
     # https://github.com/xianyi/OpenBLAS/issues/1740
     for alias in blas cblas lapack; do
-      cat <<EOF > $out/lib/pkgconfig/openblas-$alias.pc
+      cat <<EOF > $out/lib/pkgconfig/$alias.pc
 Name: $alias
 Version: ${version}
 Description: $alias provided by the OpenBLAS package.