summary refs log tree commit diff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-12-03 19:15:17 +0100
committerMarius Bakke <mbakke@fastmail.com>2018-12-03 19:15:17 +0100
commit99f63f011df2aab38e98d7ee4608a8c70bf74c4d (patch)
tree3f224028f30c60f2ed7b9846365ad926192fc7e9 /gnu/packages/patches
parente9a8b603337802a77ff2d68f0d30dc0e67721e3a (diff)
parent4f03aa23e805bd653de774e1d74ed2f50826899b (diff)
downloadguix-99f63f011df2aab38e98d7ee4608a8c70bf74c4d.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/aegisub-boost68.patch35
-rw-r--r--gnu/packages/patches/avogadro-boost148.patch69
-rw-r--r--gnu/packages/patches/avogadro-eigen3-update.patch603
-rw-r--r--gnu/packages/patches/avogadro-python-eigen-lib.patch161
-rw-r--r--gnu/packages/patches/bastet-change-source-of-unordered_set.patch40
-rw-r--r--gnu/packages/patches/binutils-aarch64-symbol-relocation.patch36
-rw-r--r--gnu/packages/patches/blender-newer-ffmpeg.patch80
-rw-r--r--gnu/packages/patches/borg-respect-storage-quota.patch32
-rw-r--r--gnu/packages/patches/cairo-setjmp-wrapper.patch78
-rw-r--r--gnu/packages/patches/casync-renameat2-declaration.patch27
-rw-r--r--gnu/packages/patches/ceph-detect-rocksdb.patch24
-rw-r--r--gnu/packages/patches/ceph-rocksdb-compat.patch63
-rw-r--r--gnu/packages/patches/ceph-skip-unittest_blockdev.patch20
-rw-r--r--gnu/packages/patches/ceph-volume-respect-PATH.patch22
-rw-r--r--gnu/packages/patches/clamav-config-llvm-libs.patch14
-rw-r--r--gnu/packages/patches/clamav-system-tomsfastmath.patch102
-rw-r--r--gnu/packages/patches/clang-3.5-libsanitizer-ustat-fix.patch46
-rw-r--r--gnu/packages/patches/clisp-glibc-2.26.patch20
-rw-r--r--gnu/packages/patches/crawl-upgrade-saves.patch25
-rw-r--r--gnu/packages/patches/crossmap-allow-system-pysam.patch121
-rw-r--r--gnu/packages/patches/delly-use-system-libraries.patch56
-rw-r--r--gnu/packages/patches/doxygen-gcc-ice.patch25
-rw-r--r--gnu/packages/patches/dropbear-CVE-2018-15599.patch240
-rw-r--r--gnu/packages/patches/emacs-exwm-fix-fullscreen-issue.patch27
-rw-r--r--gnu/packages/patches/emacs-pdf-tools-poppler.patch41
-rw-r--r--gnu/packages/patches/emacs-realgud-fix-configure-ac.patch27
-rw-r--r--gnu/packages/patches/findutils-gnulib-libio.patch114
-rw-r--r--gnu/packages/patches/findutils-makedev.patch22
-rw-r--r--gnu/packages/patches/freetype-CVE-2018-6942.patch31
-rw-r--r--gnu/packages/patches/gcc-4.9-libsanitizer-ustat.patch37
-rw-r--r--gnu/packages/patches/gcc-libsanitizer-ustat.patch41
-rw-r--r--gnu/packages/patches/gcc-strmov-store-file-names.patch12
-rw-r--r--gnu/packages/patches/gd-CVE-2018-1000222.patch87
-rw-r--r--gnu/packages/patches/gemma-intel-compat.patch44
-rw-r--r--gnu/packages/patches/ghc-haddock-library-unbundle.patch86
-rw-r--r--gnu/packages/patches/ghostscript-CVE-2018-10194.patch52
-rw-r--r--gnu/packages/patches/ghostscript-CVE-2018-16509.patch193
-rw-r--r--gnu/packages/patches/ghostscript-bug-699708.patch160
-rw-r--r--gnu/packages/patches/ghostscript-runpath.patch18
-rw-r--r--gnu/packages/patches/glibc-2.28-git-fixes.patch248
-rw-r--r--gnu/packages/patches/gnucash-disable-failing-tests.patch39
-rw-r--r--gnu/packages/patches/gnucash-price-quotes-perl.patch5
-rw-r--r--gnu/packages/patches/grub-binutils-compat.patch53
-rw-r--r--gnu/packages/patches/grub-check-error-efibootmgr.patch197
-rw-r--r--gnu/packages/patches/handbrake-pkg-config-path.patch24
-rw-r--r--gnu/packages/patches/haskell-mode-make-check.patch35
-rw-r--r--gnu/packages/patches/haskell-mode-unused-variables.patch44
-rw-r--r--gnu/packages/patches/hmmer-remove-cpu-specificity.patch22
-rw-r--r--gnu/packages/patches/hplip-remove-imageprocessor.patch232
-rw-r--r--gnu/packages/patches/icecat-CVE-2018-5157-and-CVE-2018-5158.patch441
-rw-r--r--gnu/packages/patches/icecat-avoid-bundled-libraries.patch34
-rw-r--r--gnu/packages/patches/icecat-bug-1413868-pt1.patch663
-rw-r--r--gnu/packages/patches/icecat-use-system-graphite2+harfbuzz.patch226
-rw-r--r--gnu/packages/patches/icecat-use-system-graphite2.patch248
-rw-r--r--gnu/packages/patches/icecat-use-system-harfbuzz.patch279
-rw-r--r--gnu/packages/patches/icecat-use-system-media-libs.patch381
-rw-r--r--gnu/packages/patches/jemalloc-arm-address-bits.patch39
-rw-r--r--gnu/packages/patches/jq-CVE-2015-8863.patch45
-rw-r--r--gnu/packages/patches/ldc-1.7.0-disable-phobos-tests.patch88
-rw-r--r--gnu/packages/patches/ldc-disable-phobos-tests.patch22
-rw-r--r--gnu/packages/patches/libgcrypt-make-yat2m-reproducible.patch32
-rw-r--r--gnu/packages/patches/libgit2-oom-test.patch62
-rw-r--r--gnu/packages/patches/libgpg-error-aarch64-logging-fix.patch58
-rw-r--r--gnu/packages/patches/libgxps-CVE-2017-11590.patch48
-rw-r--r--gnu/packages/patches/liblxqt-include.patch14
-rw-r--r--gnu/packages/patches/libopenshot-tests-with-system-libs.patch95
-rw-r--r--gnu/packages/patches/libssh-hostname-parser-bug.patch22
-rw-r--r--gnu/packages/patches/libvpx-use-after-free-in-postproc.patch34
-rw-r--r--gnu/packages/patches/lirc-reproducible-build.patch72
-rw-r--r--gnu/packages/patches/m4-gnulib-libio.patch128
-rw-r--r--gnu/packages/patches/mailutils-uninitialized-memory.patch87
-rw-r--r--gnu/packages/patches/mariadb-gcc-ice.patch24
-rw-r--r--gnu/packages/patches/meandmyshadow-define-paths-earlier.patch50
-rw-r--r--gnu/packages/patches/meson-for-build-rpath.patch6
-rw-r--r--gnu/packages/patches/mono-mdoc-timestamping.patch15
-rw-r--r--gnu/packages/patches/myrepos-CVE-2018-7032.patch69
-rw-r--r--gnu/packages/patches/netsurf-message-timestamp.patch11
-rw-r--r--gnu/packages/patches/netsurf-system-utf8proc.patch25
-rw-r--r--gnu/packages/patches/nyacc-binary-literals.patch29
-rw-r--r--gnu/packages/patches/oath-toolkit-glibc-compat.patch90
-rw-r--r--gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch246
-rw-r--r--gnu/packages/patches/openexr-missing-samples.patch23
-rw-r--r--gnu/packages/patches/openssl-1.0.2-CVE-2018-0495.patch215
-rw-r--r--gnu/packages/patches/openssl-1.0.2-CVE-2018-0732.patch50
-rw-r--r--gnu/packages/patches/openssl-1.1-c-rehash-in.patch (renamed from gnu/packages/patches/openssl-1.1.0-c-rehash-in.patch)6
-rw-r--r--gnu/packages/patches/parted-glibc-compat.patch17
-rw-r--r--gnu/packages/patches/patchutils-test-perms.patch14
-rw-r--r--gnu/packages/patches/patchutils-xfail-gendiff-tests.patch26
-rw-r--r--gnu/packages/patches/perf-gcc-ice.patch13
-rw-r--r--gnu/packages/patches/perl-archive-tar-CVE-2018-12015.patch36
-rw-r--r--gnu/packages/patches/perl-deterministic-ordering.patch6
-rw-r--r--gnu/packages/patches/perl-file-path-CVE-2017-6512.patch173
-rw-r--r--gnu/packages/patches/pinentry-efl.patch798
-rw-r--r--gnu/packages/patches/podofo-cmake-3.12.patch19
-rw-r--r--gnu/packages/patches/poppler-CVE-2018-19149.patch80
-rw-r--r--gnu/packages/patches/python-CVE-2018-14647.patch61
-rw-r--r--gnu/packages/patches/python-cffi-x87-stack-clean.patch29
-rw-r--r--gnu/packages/patches/python-genshi-add-support-for-python-3.4-AST.patch151
-rw-r--r--gnu/packages/patches/python-genshi-buildable-on-python-2.7.patch25
-rw-r--r--gnu/packages/patches/python-genshi-disable-speedups-on-python-3.3.patch32
-rw-r--r--gnu/packages/patches/python-genshi-fix-tests-on-python-3.5.patch112
-rw-r--r--gnu/packages/patches/python-genshi-isstring-helper.patch37
-rw-r--r--gnu/packages/patches/python-genshi-stripping-of-unsafe-script-tags.patch51
-rw-r--r--gnu/packages/patches/python-networkx2-reproducible-build.patch29
-rw-r--r--gnu/packages/patches/python-paste-remove-website-test.patch21
-rw-r--r--gnu/packages/patches/python-pillow-fix-failing-tests.patchbin112373 -> 0 bytes
-rw-r--r--gnu/packages/patches/python-pygit2-disable-network-tests.patch43
-rw-r--r--gnu/packages/patches/python-scikit-learn-fix-test-non-determinism.patch25
-rw-r--r--gnu/packages/patches/python-testtools.patch57
-rw-r--r--gnu/packages/patches/python2-CVE-2018-1000802.patch47
-rw-r--r--gnu/packages/patches/python2-CVE-2018-14647.patch61
-rw-r--r--gnu/packages/patches/qt-5-renameat2.patch35
-rw-r--r--gnu/packages/patches/quilt-compat-getopt-fix-option-with-nondigit-param.patch45
-rw-r--r--gnu/packages/patches/quilt-compat-getopt-fix-second-separator.patch58
-rw-r--r--gnu/packages/patches/quilt-test-fix-regex.patch41
-rw-r--r--gnu/packages/patches/randomjungle-disable-static-build.patch14
-rw-r--r--gnu/packages/patches/rsem-makefile.patch682
-rw-r--r--gnu/packages/patches/rust-1.19-mrustc.patch28
-rw-r--r--gnu/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch111
-rw-r--r--gnu/packages/patches/rust-reproducible-builds.patch25
-rw-r--r--gnu/packages/patches/scribus-poppler.patch72
-rw-r--r--gnu/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch36
-rw-r--r--gnu/packages/patches/soundconverter-remove-gconf-dependency.patch83
-rw-r--r--gnu/packages/patches/swig-guile-gc.patch76
-rw-r--r--gnu/packages/patches/teeworlds-use-latest-wavpack.patch72
-rw-r--r--gnu/packages/patches/telegram-purple-adjust-test.patch14
-rw-r--r--gnu/packages/patches/texinfo-5-perl-compat.patch19
-rw-r--r--gnu/packages/patches/texinfo-perl-compat.patch51
-rw-r--r--gnu/packages/patches/tomsfastmath-constness.patch76
-rw-r--r--gnu/packages/patches/tophat-build-with-later-seqan.patch24
-rw-r--r--gnu/packages/patches/u-boot-pinebook-a64-update-dts.patch1485
-rw-r--r--gnu/packages/patches/u-boot-pinebook-dts.patch388
-rw-r--r--gnu/packages/patches/u-boot-pinebook-mmc-calibration.patch98
-rw-r--r--gnu/packages/patches/u-boot-pinebook-r_i2c-controller.patch70
-rw-r--r--gnu/packages/patches/u-boot-pinebook-syscon-node.patch38
-rw-r--r--gnu/packages/patches/u-boot-pinebook-video-bridge.patch50
-rw-r--r--gnu/packages/patches/vsearch-unbundle-cityhash.patch6
-rw-r--r--gnu/packages/patches/wxmaxima-do-not-use-old-gnuplot-parameters.patch26
-rw-r--r--gnu/packages/patches/x265-arm-asm-primitives.patch360
-rw-r--r--gnu/packages/patches/x265-arm-flags.patch36
-rw-r--r--gnu/packages/patches/x265-detect512-all-arches.patch37
-rw-r--r--gnu/packages/patches/x265-fix-ppc64le-build.patch25
-rw-r--r--gnu/packages/patches/xapian-revert-5489fb2f8.patch23
-rw-r--r--gnu/packages/patches/xf86-video-ast-remove-mibstore.patch90
-rw-r--r--gnu/packages/patches/zathura-pdf-mupdf-link-to-jpeg-libraries.patch55
-rw-r--r--gnu/packages/patches/zstd-fix-stdin-list-test.patch30
-rw-r--r--gnu/packages/patches/zstd-fix-stdin-list-without-tty.patch67
147 files changed, 8989 insertions, 5227 deletions
diff --git a/gnu/packages/patches/aegisub-boost68.patch b/gnu/packages/patches/aegisub-boost68.patch
new file mode 100644
index 0000000000..013721f3bd
--- /dev/null
+++ b/gnu/packages/patches/aegisub-boost68.patch
@@ -0,0 +1,35 @@
+Source: https://git.archlinux.org/svntogit/community.git/plain/trunk/boost-1.68.patch?h=packages/aegisub
+From d8336d2fed73c72d1227b343d6acfb991bc1651b Mon Sep 17 00:00:00 2001
+From: Jan Beich <jbeich@FreeBSD.org>
+Date: Mon, 9 Jul 2018 20:15:29 +0000
+Subject: [PATCH] Keep using std::distance after Boost 1.68
+
+src/search_replace_engine.cpp:256:14: error: call to
+      'distance' is ambiguous
+                                count += distance(
+                                         ^~~~~~~~
+/usr/include/c++/v1/iterator:511:1: note: candidate function [with _InputIter =
+      boost::u32regex_iterator<std::__1::__wrap_iter<const char *> >]
+distance(_InputIter __first, _InputIter __last)
+^
+/usr/local/include/boost/iterator/distance.hpp:49:9: note: candidate function [with SinglePassIterator =
+      boost::u32regex_iterator<std::__1::__wrap_iter<const char *> >]
+        distance(SinglePassIterator first, SinglePassIterator last)
+        ^
+---
+ src/search_replace_engine.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/search_replace_engine.cpp b/src/search_replace_engine.cpp
+index 594c21e5e..14c71680d 100644
+--- a/src/search_replace_engine.cpp
++++ b/src/search_replace_engine.cpp
+@@ -253,7 +253,7 @@ bool SearchReplaceEngine::ReplaceAll() {
+ 			if (MatchState ms = matches(&diag, 0)) {
+ 				auto& diag_field = diag.*get_dialogue_field(settings.field);
+ 				std::string const& text = diag_field.get();
+-				count += distance(
++				count += std::distance(
+ 					boost::u32regex_iterator<std::string::const_iterator>(begin(text), end(text), *ms.re),
+ 					boost::u32regex_iterator<std::string::const_iterator>());
+ 				diag_field = u32regex_replace(text, *ms.re, settings.replace_with);
diff --git a/gnu/packages/patches/avogadro-boost148.patch b/gnu/packages/patches/avogadro-boost148.patch
new file mode 100644
index 0000000000..f244f14674
--- /dev/null
+++ b/gnu/packages/patches/avogadro-boost148.patch
@@ -0,0 +1,69 @@
+Index: avogadro-1.2.0/libavogadro/src/pythonengine_p.h
+===================================================================
+--- avogadro-1.2.0.orig/libavogadro/src/pythonengine_p.h
++++ avogadro-1.2.0/libavogadro/src/pythonengine_p.h
+@@ -31,7 +31,9 @@
+ 
+ #include <avogadro/global.h>
+ #include <avogadro/engine.h>
++#ifndef Q_MOC_RUN
+ #include <boost/python.hpp>
++#endif
+ 
+ namespace Avogadro {
+ 
+Index: avogadro-1.2.0/libavogadro/src/pythonextension_p.h
+===================================================================
+--- avogadro-1.2.0.orig/libavogadro/src/pythonextension_p.h
++++ avogadro-1.2.0/libavogadro/src/pythonextension_p.h
+@@ -33,7 +33,9 @@
+ #include <avogadro/extension.h>
+ #include <avogadro/primitive.h>
+ #include <avogadro/glwidget.h>
++#ifndef Q_MOC_RUN
+ #include <boost/python.hpp>
++#endif
+ 
+ #include <QWidget>
+ #include <QList>
+Index: avogadro-1.2.0/libavogadro/src/pythontool_p.h
+===================================================================
+--- avogadro-1.2.0.orig/libavogadro/src/pythontool_p.h
++++ avogadro-1.2.0/libavogadro/src/pythontool_p.h
+@@ -31,7 +31,9 @@
+ 
+ #include <avogadro/global.h>
+ #include <avogadro/tool.h>
++#ifndef Q_MOC_RUN
+ #include <boost/python.hpp>
++#endif
+ 
+ #include <QObject>
+ #include <QAction>
+Index: avogadro-1.2.0/libavogadro/src/pythoninterpreter.h
+===================================================================
+--- avogadro-1.2.0.orig/libavogadro/src/pythoninterpreter.h
++++ avogadro-1.2.0/libavogadro/src/pythoninterpreter.h
+@@ -26,7 +26,9 @@
+ #define PYTHONINTERPRETER_H
+ 
+ #include <avogadro/global.h>
++#ifndef Q_MOC_RUN
+ #include <boost/python.hpp>
++#endif
+ #include <avogadro/primitive.h>
+ #include <QString>
+ 
+Index: avogadro-1.2.0/libavogadro/src/pythonscript.h
+===================================================================
+--- avogadro-1.2.0.orig/libavogadro/src/pythonscript.h
++++ avogadro-1.2.0/libavogadro/src/pythonscript.h
+@@ -27,6 +27,8 @@
+ #define PYTHONSCRIPT_H
+ 
+ #include <avogadro/global.h>
++#ifndef Q_MOC_RUN
+ #include <boost/python.hpp>
++#endif
+ 
+ #include "pythonerror.h"
diff --git a/gnu/packages/patches/avogadro-eigen3-update.patch b/gnu/packages/patches/avogadro-eigen3-update.patch
new file mode 100644
index 0000000000..a5f669292f
--- /dev/null
+++ b/gnu/packages/patches/avogadro-eigen3-update.patch
@@ -0,0 +1,603 @@
+From 43af3c117b0b3220b15c2fe2895b94bbd83d3a60 Mon Sep 17 00:00:00 2001
+From: Claudio Fernandes <claudiosf.claudio@gmail.com>
+Date: Sun, 15 Jan 2017 21:23:39 -0200
+Subject: [PATCH] Adapt Avogadro to Eigen 3.3
+
+---
+ CMakeLists.txt                                     |  9 +------
+ avogadro/src/mainwindow.cpp                        |  5 ++--
+ libavogadro/src/camera.cpp                         | 10 ++++----
+ libavogadro/src/camera.h                           | 14 +++++------
+ libavogadro/src/engines/wireengine.cpp             |  4 ++--
+ .../crystallography/crystallographyextension.cpp   |  2 +-
+ .../crystallography/ui/ceviewoptionswidget.cpp     |  2 +-
+ .../src/extensions/orca/orcaanalysedialog.cpp      |  1 -
+ .../src/extensions/orca/orcainputdialog.cpp        |  1 -
+ .../src/extensions/qtaim/qtaimmathutilities.cpp    |  1 +
+ .../qtaim/qtaimwavefunctionevaluator.cpp           | 28 +++++++++++-----------
+ .../extensions/surfaces/openqube/gamessukout.cpp   |  1 +
+ .../src/extensions/surfaces/openqube/slaterset.cpp |  6 +++--
+ libavogadro/src/glpainter_p.cpp                    | 14 +++++------
+ libavogadro/src/glwidget.cpp                       |  4 ++--
+ libavogadro/src/molecule.cpp                       | 26 ++++++++++++++++++--
+ libavogadro/src/navigate.cpp                       |  2 +-
+ libavogadro/src/tools/bondcentrictool.cpp          | 28 +++++++++++-----------
+ libavogadro/src/tools/manipulatetool.cpp           | 17 +++++++------
+ libavogadro/src/tools/navigatetool.cpp             |  3 ++-
+ libavogadro/src/tools/skeletontree.cpp             |  7 +++---
+ libavogadro/src/tools/skeletontree.h               |  2 +-
+ 22 files changed, 102 insertions(+), 85 deletions(-)
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -231,14 +231,7 @@ if(NOT Linguist_FOUND)
+   message(WARNING " Qt4 Linguist not found, please install it if you want Avogadro translations")
+ endif()
+ 
+-find_package(Eigen3) # find and setup Eigen3 if available
+-if(NOT EIGEN3_FOUND)
+-   message(STATUS "Cannot find Eigen3, trying Eigen2")
+-   find_package(Eigen2 REQUIRED) # Some version is required
+-else()
+-# Use Stage10 Eigen3 support
+-   set (EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API TRUE)
+-endif()
++find_package(Eigen3 REQUIRED) # find and setup Eigen3 if available
+ 
+ find_package(ZLIB REQUIRED)
+ find_package(OpenBabel2 REQUIRED) # find and setup OpenBabel
+--- a/avogadro/src/mainwindow.cpp
++++ b/avogadro/src/mainwindow.cpp
+@@ -115,7 +115,6 @@
+ #include <QDebug>
+ 
+ #include <Eigen/Geometry>
+-#include <Eigen/Array>
+ #define USEQUAT
+ // This is a "hidden" exported Qt function on the Mac for Qt-4.x.
+ #ifdef Q_WS_MAC
+@@ -2775,7 +2774,7 @@ protected:
+     linearGoal.row(1) = linearGoal.row(2).cross(linearGoal.row(0));
+ 
+     // calculate the translation matrix
+-    Transform3d goal(linearGoal);
++    Projective3d goal(linearGoal);
+ 
+     goal.pretranslate(- 3.0 * (d->glWidget->radius() + CAMERA_NEAR_DISTANCE) * Vector3d::UnitZ());
+ 
+@@ -2840,7 +2839,7 @@ protected:
+     Matrix3d linearGoal = Matrix3d::Identity();
+ 
+     // calculate the translation matrix
+-    Transform3d goal(linearGoal);
++    Projective3d goal(linearGoal);
+ 
+     goal.pretranslate(- 3.0 * (d->glWidget->radius() + CAMERA_NEAR_DISTANCE) * Vector3d::UnitZ());
+ 
+--- a/libavogadro/src/camera.cpp
++++ b/libavogadro/src/camera.cpp
+@@ -47,7 +47,7 @@ namespace Avogadro
+ 
+       CameraPrivate() {};
+ 
+-      Eigen::Transform3d modelview, projection;
++      Eigen::Projective3d modelview, projection;
+       const GLWidget *parent;
+       double angleOfViewY;
+       double orthoScale;
+@@ -169,20 +169,20 @@ namespace Avogadro
+ 
+   double Camera::distance(const Eigen::Vector3d & point) const
+   {
+-    return ( d->modelview * point ).norm();
++    return ( d->modelview * point.homogeneous() ).head<3>().norm();
+   }
+ 
+-  void Camera::setModelview(const Eigen::Transform3d &matrix)
++  void Camera::setModelview(const Eigen::Projective3d &matrix)
+   {
+     d->modelview = matrix;
+   }
+ 
+-  const Eigen::Transform3d & Camera::modelview() const
++  const Eigen::Projective3d & Camera::modelview() const
+   {
+     return d->modelview;
+   }
+ 
+-  Eigen::Transform3d & Camera::modelview()
++  Eigen::Projective3d & Camera::modelview()
+   {
+     return d->modelview;
+   }
+--- a/libavogadro/src/camera.h
++++ b/libavogadro/src/camera.h
+@@ -101,16 +101,16 @@ namespace Avogadro {
+       double angleOfViewY() const;
+       /** Sets 4x4 "modelview" matrix representing the camera orientation and position.
+         * @param matrix the matrix to copy from
+-        * @sa Eigen::Transform3d & modelview(), applyModelview() */
+-      void setModelview(const Eigen::Transform3d &matrix);
++        * @sa Eigen::Projective3d & modelview(), applyModelview() */
++      void setModelview(const Eigen::Projective3d &matrix);
+       /** @return a constant reference to the 4x4 "modelview" matrix representing
+         *         the camera orientation and position
+-        * @sa setModelview(), Eigen::Transform3d & modelview() */
+-      const Eigen::Transform3d & modelview() const;
++        * @sa setModelview(), Eigen::Projective3d & modelview() */
++      const Eigen::Projective3d & modelview() const;
+       /** @return a non-constant reference to the 4x4 "modelview" matrix representing
+         *         the camera orientation and position
+-        * @sa setModelview(), const Eigen::Transform3d & modelview() const */
+-      Eigen::Transform3d & modelview();
++        * @sa setModelview(), const Eigen::Projective3d & modelview() const */
++      Eigen::Projective3d & modelview();
+       /** Calls gluPerspective() or glOrtho() with parameters automatically chosen
+         * for rendering the GLWidget's molecule with this camera. Should be called
+         * only in GL_PROJECTION matrix mode. Example code is given
+@@ -342,7 +342,7 @@ namespace Avogadro {
+        * @return {x/w, y/w, z/w} vector
+        */
+       Eigen::Vector3d V4toV3DivW(const Eigen::Vector4d & v4) {
+-        return v4.start<3>()/v4.w();
++        return v4.head<3>()/v4.w();
+       }
+   };
+ 
+--- a/libavogadro/src/engines/wireengine.cpp
++++ b/libavogadro/src/engines/wireengine.cpp
+@@ -109,7 +109,7 @@ namespace Avogadro {
+     const Camera *camera = pd->camera();
+ 
+     // perform a rough form of frustum culling
+-    Eigen::Vector3d transformedPos = pd->camera()->modelview() * v;
++    Eigen::Vector3d transformedPos = (pd->camera()->modelview() * v.homogeneous()).head<3>();
+     double dot = transformedPos.z() / transformedPos.norm();
+     if(dot > -0.8)
+       return true;
+@@ -167,7 +167,7 @@ namespace Avogadro {
+       map = pd->colorMap(); // fall back to global color map
+ 
+     // perform a rough form of frustum culling
+-    Eigen::Vector3d transformedEnd1 = pd->camera()->modelview() * v1;
++    Eigen::Vector3d transformedEnd1 = (pd->camera()->modelview() * v1.homogeneous()).head<3>();
+     double dot = transformedEnd1.z() / transformedEnd1.norm();
+     if(dot > -0.8)
+       return true; // i.e., don't bother rendering
+--- a/libavogadro/src/extensions/crystallography/crystallographyextension.cpp
++++ b/libavogadro/src/extensions/crystallography/crystallographyextension.cpp
+@@ -1989,7 +1989,7 @@ namespace Avogadro
+     // fix coordinates
+     // Apply COB matrix:
+     Eigen::Matrix3d invCob;
+-    cob.computeInverse(&invCob);
++    invCob = cob.inverse();
+     for (QList<Eigen::Vector3d>::iterator
+            it = fcoords.begin(),
+            it_end = fcoords.end();
+--- a/libavogadro/src/extensions/crystallography/ui/ceviewoptionswidget.cpp
++++ b/libavogadro/src/extensions/crystallography/ui/ceviewoptionswidget.cpp
+@@ -139,7 +139,7 @@ namespace Avogadro
+   {
+     // View into a Miller plane
+     Camera *camera = m_glWidget->camera();
+-    Eigen::Transform3d modelView;
++    Eigen::Projective3d modelView;
+     modelView.setIdentity();
+ 
+     // OK, so we want to rotate to look along the normal at the plane
+--- a/libavogadro/src/extensions/orca/orcaanalysedialog.cpp
++++ b/libavogadro/src/extensions/orca/orcaanalysedialog.cpp
+@@ -41,7 +41,6 @@
+ #include <openbabel/mol.h>
+ 
+ #include <Eigen/Geometry>
+-#include <Eigen/LeastSquares>
+ 
+ #include <vector>
+ 
+--- a/libavogadro/src/extensions/orca/orcainputdialog.cpp
++++ b/libavogadro/src/extensions/orca/orcainputdialog.cpp
+@@ -33,7 +33,6 @@
+ #include <openbabel/mol.h>
+ 
+ #include <Eigen/Geometry>
+-#include <Eigen/LeastSquares>
+ 
+ #include <vector>
+ 
+--- a/libavogadro/src/extensions/qtaim/qtaimmathutilities.cpp
++++ b/libavogadro/src/extensions/qtaim/qtaimmathutilities.cpp
+@@ -28,6 +28,7 @@
+ 
+ #include <cmath>
+ #include <Eigen/QR>
++#include <Eigen/Eigenvalues>
+ 
+ namespace Avogadro {
+   namespace QTAIMMathUtilities {
+--- a/libavogadro/src/extensions/qtaim/qtaimwavefunctionevaluator.cpp
++++ b/libavogadro/src/extensions/qtaim/qtaimwavefunctionevaluator.cpp
+@@ -35,21 +35,21 @@ namespace Avogadro
+     m_nprim=wfn.numberOfGaussianPrimitives();
+     m_nnuc=wfn.numberOfNuclei();
+ 
+-    m_nucxcoord=Map<Matrix<qreal,Dynamic,1> >(wfn.xNuclearCoordinates(),m_nnuc);
+-    m_nucycoord=Map<Matrix<qreal,Dynamic,1> >(wfn.yNuclearCoordinates(),m_nnuc);
+-    m_nuczcoord=Map<Matrix<qreal,Dynamic,1> >(wfn.zNuclearCoordinates(),m_nnuc);
+-    m_nucz=Map<Matrix<qint64,Dynamic,1> >(wfn.nuclearCharges(),m_nnuc);
+-    m_X0=Map<Matrix<qreal,Dynamic,1> >(wfn.xGaussianPrimitiveCenterCoordinates(),m_nprim,1);
+-    m_Y0=Map<Matrix<qreal,Dynamic,1> >(wfn.yGaussianPrimitiveCenterCoordinates(),m_nprim,1);
+-    m_Z0=Map<Matrix<qreal,Dynamic,1> >(wfn.zGaussianPrimitiveCenterCoordinates(),m_nprim,1);
+-    m_xamom=Map<Matrix<qint64,Dynamic,1> >(wfn.xGaussianPrimitiveAngularMomenta(),m_nprim,1);
+-    m_yamom=Map<Matrix<qint64,Dynamic,1> >(wfn.yGaussianPrimitiveAngularMomenta(),m_nprim,1);
+-    m_zamom=Map<Matrix<qint64,Dynamic,1> >(wfn.zGaussianPrimitiveAngularMomenta(),m_nprim,1);
+-    m_alpha=Map<Matrix<qreal,Dynamic,1> >(wfn.gaussianPrimitiveExponentCoefficients(),m_nprim,1);
++    m_nucxcoord=Map<Matrix<qreal,Dynamic,1> >(const_cast<qreal*>(wfn.xNuclearCoordinates()),m_nnuc);
++    m_nucycoord=Map<Matrix<qreal,Dynamic,1> >(const_cast<qreal*>(wfn.yNuclearCoordinates()),m_nnuc);
++    m_nuczcoord=Map<Matrix<qreal,Dynamic,1> >(const_cast<qreal*>(wfn.zNuclearCoordinates()),m_nnuc);
++    m_nucz=Map<Matrix<qint64,Dynamic,1> >(const_cast<qint64*>(wfn.nuclearCharges()),m_nnuc);
++    m_X0=Map<Matrix<qreal,Dynamic,1> >(const_cast<qreal*>(wfn.xGaussianPrimitiveCenterCoordinates()),m_nprim,1);
++    m_Y0=Map<Matrix<qreal,Dynamic,1> >(const_cast<qreal*>(wfn.yGaussianPrimitiveCenterCoordinates()),m_nprim,1);
++    m_Z0=Map<Matrix<qreal,Dynamic,1> >(const_cast<qreal*>(wfn.zGaussianPrimitiveCenterCoordinates()),m_nprim,1);
++    m_xamom=Map<Matrix<qint64,Dynamic,1> >(const_cast<qint64*>(wfn.xGaussianPrimitiveAngularMomenta()),m_nprim,1);
++    m_yamom=Map<Matrix<qint64,Dynamic,1> >(const_cast<qint64*>(wfn.yGaussianPrimitiveAngularMomenta()),m_nprim,1);
++    m_zamom=Map<Matrix<qint64,Dynamic,1> >(const_cast<qint64*>(wfn.zGaussianPrimitiveAngularMomenta()),m_nprim,1);
++    m_alpha=Map<Matrix<qreal,Dynamic,1> >(const_cast<qreal*>(wfn.gaussianPrimitiveExponentCoefficients()),m_nprim,1);
+     // TODO Implement screening for unoccupied molecular orbitals.
+-    m_occno=Map<Matrix<qreal,Dynamic,1> >(wfn.molecularOrbitalOccupationNumbers(),m_nmo,1);
+-    m_orbe=Map<Matrix<qreal,Dynamic,1> >(wfn.molecularOrbitalEigenvalues(),m_nmo,1);
+-    m_coef=Map<Matrix<qreal,Dynamic,Dynamic,RowMajor> >(wfn.molecularOrbitalCoefficients(),m_nmo,m_nprim);
++    m_occno=Map<Matrix<qreal,Dynamic,1> >(const_cast<qreal*>(wfn.molecularOrbitalOccupationNumbers()),m_nmo,1);
++    m_orbe=Map<Matrix<qreal,Dynamic,1> >(const_cast<qreal*>(wfn.molecularOrbitalEigenvalues()),m_nmo,1);
++    m_coef=Map<Matrix<qreal,Dynamic,Dynamic,RowMajor> >(const_cast<qreal*>(wfn.molecularOrbitalCoefficients()),m_nmo,m_nprim);
+     m_totalEnergy=wfn.totalEnergy();
+     m_virialRatio=wfn.virialRatio();
+ 
+--- a/libavogadro/src/extensions/surfaces/openqube/gamessukout.cpp
++++ b/libavogadro/src/extensions/surfaces/openqube/gamessukout.cpp
+@@ -19,6 +19,7 @@
+ using Eigen::Vector3d;
+ using std::vector;
+ 
++#include <iostream>
+ #include <fstream>
+ 
+ namespace OpenQube
+--- a/libavogadro/src/extensions/surfaces/openqube/slaterset.cpp
++++ b/libavogadro/src/extensions/surfaces/openqube/slaterset.cpp
+@@ -25,9 +25,9 @@
+ 
+ #include "cube.h"
+ 
+-#include <Eigen/Array>
+ #include <Eigen/LU>
+ #include <Eigen/QR>
++#include <Eigen/Eigenvalues>
+ 
+ #include <cmath>
+ 
+@@ -250,7 +250,9 @@ bool SlaterSet::initialize()
+ 
+   SelfAdjointEigenSolver<MatrixXd> s(m_overlap);
+   MatrixXd p = s.eigenvectors();
+-  MatrixXd m = p * s.eigenvalues().cwise().inverse().cwise().sqrt().asDiagonal() * p.inverse();
++  // TODO check if this is correct
++  MatrixXd m1 = (s.eigenvalues().array().inverse().sqrt());
++  MatrixXd m = p.array()*(m1.diagonal().array())*p.inverse().array();
+   m_normalized = m * m_eigenVectors;
+ 
+   if (!(m_overlap*m*m).isIdentity())
+--- a/libavogadro/src/glpainter_p.cpp
++++ b/libavogadro/src/glpainter_p.cpp
+@@ -789,13 +789,13 @@ namespace Avogadro
+         } else {
+           points[theta-1] = Eigen::AngleAxisd(theta * (M_PI / 180.0) / 2, n) * u;
+         }
+-        points[theta-1] = d->widget->camera()->modelview() * (origin + points[theta-1]);
++        points[theta-1] = (d->widget->camera()->modelview() * (origin + points[theta-1]).homogeneous()).head<3>();
+       }
+ 
+     // Get vectors representing the points' positions in terms of the model view.
+-    Eigen::Vector3d _origin = d->widget->camera()->modelview() * origin;
+-    Eigen::Vector3d _direction1 = d->widget->camera()->modelview() * (origin+u);
+-    Eigen::Vector3d _direction2 = d->widget->camera()->modelview() * (origin+v);
++    Eigen::Vector3d _origin = (d->widget->camera()->modelview() * origin.homogeneous()).head<3>();
++    Eigen::Vector3d _direction1 = (d->widget->camera()->modelview() * (origin+u).homogeneous()).head<3>();
++    Eigen::Vector3d _direction2 = (d->widget->camera()->modelview() * (origin+v).homogeneous()).head<3>();
+ 
+     glPushAttrib(GL_ALL_ATTRIB_BITS);
+     glPushMatrix();
+@@ -880,12 +880,12 @@ namespace Avogadro
+         } else {
+           points[theta-1] = Eigen::AngleAxisd(theta * (M_PI / 180.0) / 2, n) * u;
+         }
+-        points[theta-1] = d->widget->camera()->modelview() * (origin + points[theta-1]);
++        points[theta-1] = (d->widget->camera()->modelview() * (origin + points[theta-1]).homogeneous()).head<3>();
+       }
+ 
+     // Get vectors representing the points' positions in terms of the model view.
+-    Eigen::Vector3d _direction1 = d->widget->camera()->modelview() * (origin + u);
+-    Eigen::Vector3d _direction2 = d->widget->camera()->modelview() * (origin + v);
++    Eigen::Vector3d _direction1 = (d->widget->camera()->modelview() * (origin + u).homogeneous()).head<3>();
++    Eigen::Vector3d _direction2 = (d->widget->camera()->modelview() * (origin + v).homogeneous()).head<3>();
+ 
+     glPushAttrib(GL_ALL_ATTRIB_BITS);
+     glPushMatrix();
+--- a/libavogadro/src/glwidget.cpp
++++ b/libavogadro/src/glwidget.cpp
+@@ -765,7 +765,7 @@ namespace Avogadro {
+       GLfloat fogColor[4]= {static_cast<GLfloat>(d->background.redF()), static_cast<GLfloat>(d->background.greenF()),
+                             static_cast<GLfloat>(d->background.blueF()), static_cast<GLfloat>(d->background.alphaF())};
+       glFogfv(GL_FOG_COLOR, fogColor);
+-      Vector3d distance = camera()->modelview() * d->center;
++      Vector3d distance = (camera()->modelview() * d->center.homogeneous()).head<3>();
+       double distanceToCenter = distance.norm();
+       glFogf(GL_FOG_DENSITY, 1.0);
+       glHint(GL_FOG_HINT, GL_NICEST);
+@@ -1711,7 +1711,7 @@ namespace Avogadro {
+ 
+       if (d->renderModelViewDebug) {
+         // Model view matrix:
+-        const Eigen::Transform3d &modelview = d->camera->modelview();
++        const Eigen::Projective3d &modelview = d->camera->modelview();
+         y += d->pd->painter()->drawText
+             (x, y, tr("ModelView row 1: %L1 %L2 %L3 %L4")
+              .arg(modelview(0, 0), 6, 'f', 2, ' ')
+--- a/libavogadro/src/molecule.cpp
++++ b/libavogadro/src/molecule.cpp
+@@ -38,7 +38,7 @@
+ #include "zmatrix.h"
+ 
+ #include <Eigen/Geometry>
+-#include <Eigen/LeastSquares>
++#include <Eigen/Eigenvalues>
+ 
+ #include <vector>
+ 
+@@ -1907,7 +1907,29 @@ namespace Avogadro{
+         }
+         d->center /= static_cast<double>(nAtoms);
+         Eigen::Hyperplane<double, 3> planeCoeffs;
+-        Eigen::fitHyperplane(numAtoms(), atomPositions, &planeCoeffs);
++        //Eigen::fitHyperplane(numAtoms(), atomPositions, &planeCoeffs);
++
++        // TODO check if this is OK
++        /************************/
++        typedef Eigen::Matrix<double,3,3> CovMatrixType;
++        typedef Eigen::Vector3d VectorType;
++        
++        VectorType mean = d->center;
++        int size=3;
++        int numPoints=numAtoms();
++        VectorType ** points=atomPositions;
++        CovMatrixType covMat = CovMatrixType::Zero(size, size);
++        VectorType remean = VectorType::Zero(size);
++        for(int i = 0; i < numPoints; ++i)
++        {
++          VectorType diff = (*(points[i]) - mean).conjugate();
++          covMat += diff * diff.adjoint();
++        }
++        Eigen::SelfAdjointEigenSolver<CovMatrixType> eig(covMat);
++        planeCoeffs.normal() = eig.eigenvectors().col(0);
++        /************************/
++
++
+         delete[] atomPositions;
+         d->normalVector = planeCoeffs.normal();
+       }
+--- a/libavogadro/src/navigate.cpp
++++ b/libavogadro/src/navigate.cpp
+@@ -40,7 +40,7 @@ namespace Avogadro {
+   void Navigate::zoom(GLWidget *widget, const Eigen::Vector3d &goal,
+                       double delta)
+   {
+-    Vector3d transformedGoal = widget->camera()->modelview() * goal;
++    Vector3d transformedGoal = (widget->camera()->modelview() * goal.homogeneous()).head<3>();
+     double distanceToGoal = transformedGoal.norm();
+ 
+     double t = ZOOM_SPEED * delta;
+--- a/libavogadro/src/tools/bondcentrictool.cpp
++++ b/libavogadro/src/tools/bondcentrictool.cpp
+@@ -578,8 +578,8 @@ namespace Avogadro {
+ 
+           Vector3d clicked = *m_clickedAtom->pos();
+ 
+-          Vector3d axis = Vector3d(0, 0, ((widget->camera()->modelview() * other).z() >=
+-                (widget->camera()->modelview() * center).z() ? -1 : 1));
++          Vector3d axis = Vector3d(0, 0, ((widget->camera()->modelview() * other.homogeneous()).z() >=
++                (widget->camera()->modelview() * center.homogeneous()).z() ? -1 : 1));
+ 
+           Vector3d centerProj = widget->camera()->project(center);
+           centerProj -= Vector3d(0,0,centerProj.z());
+@@ -673,8 +673,8 @@ namespace Avogadro {
+ 
+           Vector3d clicked = *m_clickedAtom->pos();
+ 
+-          Vector3d axis = Vector3d(0, 0, ((widget->camera()->modelview() * other).z() >=
+-                (widget->camera()->modelview() * center).z() ? -1 : 1));
++          Vector3d axis = Vector3d(0, 0, ((widget->camera()->modelview() * other.homogeneous()).z() >=
++                (widget->camera()->modelview() * center.homogeneous()).z() ? -1 : 1));
+ 
+           Vector3d centerProj = widget->camera()->project(center);
+           centerProj -= Vector3d(0,0,centerProj.z());
+@@ -1362,10 +1362,10 @@ namespace Avogadro {
+ 
+     planeVec = length * (planeVec / planeVec.norm());
+ 
+-    Vector3d topLeft = widget->camera()->modelview() * (left + planeVec);
+-    Vector3d topRight = widget->camera()->modelview() * (right + planeVec);
+-    Vector3d botRight = widget->camera()->modelview() * (right - planeVec);
+-    Vector3d botLeft = widget->camera()->modelview() * (left - planeVec);
++    Vector3d topLeft = (widget->camera()->modelview() * (left + planeVec).homogeneous()).head<3>();
++    Vector3d topRight = (widget->camera()->modelview() * (right + planeVec).homogeneous()).head<3>();
++    Vector3d botRight = (widget->camera()->modelview() * (right - planeVec).homogeneous()).head<3>();
++    Vector3d botLeft = (widget->camera()->modelview() * (left - planeVec).homogeneous()).head<3>();
+ 
+     float alpha = 0.4;
+     double lineWidth = 1.5;
+@@ -1444,10 +1444,10 @@ namespace Avogadro {
+       C = D + ((C-D).normalized() * minWidth);
+     }
+ 
+-    Vector3d topLeft = widget->camera()->modelview() * D;
+-    Vector3d topRight = widget->camera()->modelview() * C;
+-    Vector3d botRight = widget->camera()->modelview() * B;
+-    Vector3d botLeft = widget->camera()->modelview() * A;
++    Vector3d topLeft = (widget->camera()->modelview() * D.homogeneous()).head<3>();
++    Vector3d topRight = (widget->camera()->modelview() * C.homogeneous()).head<3>();
++    Vector3d botRight = (widget->camera()->modelview() * B.homogeneous()).head<3>();
++    Vector3d botLeft = (widget->camera()->modelview() * A.homogeneous()).head<3>();
+ 
+     float alpha = 0.4;
+     double lineWidth = 1.5;
+@@ -1506,12 +1506,12 @@ namespace Avogadro {
+       Vector3d positionVector)
+   {
+     //Rotate skeleton around a particular axis and center point
+-    Eigen::Transform3d rotation;
++    Eigen::Projective3d rotation;
+     rotation = Eigen::AngleAxisd(angle, rotationVector);
+     rotation.pretranslate(centerVector);
+     rotation.translate(-centerVector);
+ 
+-    return rotation*positionVector;
++    return (rotation*positionVector.homogeneous()).head<3>();
+   }
+ 
+   // ##########  showAnglesChanged  ##########
+--- a/libavogadro/src/tools/manipulatetool.cpp
++++ b/libavogadro/src/tools/manipulatetool.cpp
+@@ -40,7 +40,6 @@
+ #include <QAbstractButton>
+ 
+ using Eigen::Vector3d;
+-using Eigen::Transform3d;
+ using Eigen::AngleAxisd;
+ 
+ namespace Avogadro {
+@@ -138,7 +137,7 @@ namespace Avogadro {
+     double yRotate = m_settingsWidget->yRotateSpinBox->value() * DEG_TO_RAD;
+     double zRotate = m_settingsWidget->zRotateSpinBox->value() * DEG_TO_RAD;
+ 
+-    Eigen::Transform3d rotation;
++    Eigen::Projective3d rotation;
+     rotation.matrix().setIdentity();
+     rotation.translation() = center;
+     rotation.rotate(AngleAxisd(xRotate, Vector3d::UnitX())
+@@ -152,12 +151,12 @@ namespace Avogadro {
+         if (p->type() == Primitive::AtomType) {
+           Atom *atom = static_cast<Atom*>(p);
+           tempPos = translate + *(atom->pos());
+-          atom->setPos(rotation * tempPos);
++          atom->setPos((rotation * tempPos.homogeneous()).head<3>());
+         }
+     } else {
+       foreach(Atom *atom, widget->molecule()->atoms()) {
+         tempPos = translate + *(atom->pos());
+-        atom->setPos(rotation * tempPos);
++        atom->setPos((rotation * tempPos.homogeneous()).head<3>());
+       }
+     }
+ 
+@@ -199,7 +198,7 @@ namespace Avogadro {
+     widget->setCursor(Qt::SizeVerCursor);
+ 
+     // Move the selected atom(s) in to or out of the screen
+-    Vector3d transformedGoal = widget->camera()->modelview() * *goal;
++    Vector3d transformedGoal = (widget->camera()->modelview() * goal->homogeneous()).head<3>();
+     double distanceToGoal = transformedGoal.norm();
+ 
+     double t = ZOOM_SPEED * delta;
+@@ -255,7 +254,7 @@ namespace Avogadro {
+ 
+     // Rotate the selected atoms about the center
+     // rotate only selected primitives
+-    Transform3d fragmentRotation;
++    Eigen::Projective3d fragmentRotation;
+     fragmentRotation.matrix().setIdentity();
+     fragmentRotation.translation() = *center;
+     fragmentRotation.rotate(
+@@ -266,7 +265,7 @@ namespace Avogadro {
+ 
+     foreach(Primitive *p, widget->selectedPrimitives())
+       if (p->type() == Primitive::AtomType)
+-        static_cast<Atom *>(p)->setPos(fragmentRotation * *static_cast<Atom *>(p)->pos());
++        static_cast<Atom *>(p)->setPos((fragmentRotation * static_cast<Atom *>(p)->pos()->homogeneous()).head<3>());
+     widget->molecule()->update();
+   }
+ 
+@@ -274,7 +273,7 @@ namespace Avogadro {
+                             double delta) const
+   {
+     // Tilt the selected atoms about the center
+-    Transform3d fragmentRotation;
++    Eigen::Projective3d fragmentRotation;
+     fragmentRotation.matrix().setIdentity();
+     fragmentRotation.translation() = *center;
+     fragmentRotation.rotate(AngleAxisd(delta * ROTATION_SPEED, widget->camera()->backTransformedZAxis()));
+@@ -282,7 +281,7 @@ namespace Avogadro {
+ 
+     foreach(Primitive *p, widget->selectedPrimitives())
+       if (p->type() == Primitive::AtomType)
+-        static_cast<Atom *>(p)->setPos(fragmentRotation * *static_cast<Atom *>(p)->pos());
++        static_cast<Atom *>(p)->setPos((fragmentRotation * static_cast<Atom *>(p)->pos()->homogeneous()).head<3>());
+     widget->molecule()->update();
+   }
+ 
+--- a/libavogadro/src/tools/navigatetool.cpp
++++ b/libavogadro/src/tools/navigatetool.cpp
+@@ -92,7 +92,8 @@ namespace Avogadro {
+       double sumOfWeights = 0.;
+       QList<Atom*> atoms = widget->molecule()->atoms();
+       foreach (Atom *atom, atoms) {
+-        Vector3d transformedAtomPos = widget->camera()->modelview() * *atom->pos();
++        Vector3d transformedAtomPos = (widget->camera()->modelview() *
++                                       atom->pos()->homogeneous()).head<3>();
+         double atomDistance = transformedAtomPos.norm();
+         double dot = transformedAtomPos.z() / atomDistance;
+         double weight = exp(-30. * (1. + dot));
+--- a/libavogadro/src/tools/skeletontree.cpp
++++ b/libavogadro/src/tools/skeletontree.cpp
+@@ -29,6 +29,7 @@
+ #include <avogadro/atom.h>
+ #include <avogadro/bond.h>
+ #include <avogadro/molecule.h>
++#include <iostream>
+ 
+ using namespace Eigen;
+ using namespace std;
+@@ -221,7 +222,7 @@ namespace Avogadro {
+   {
+     if (m_rootNode) {
+       //Rotate skeleton around a particular axis and center point
+-      Eigen::Transform3d rotation;
++      Eigen::Projective3d rotation;
+       rotation = Eigen::AngleAxisd(angle, rotationAxis);
+       rotation.pretranslate(centerVector);
+       rotation.translate(-centerVector);
+@@ -248,11 +249,11 @@ namespace Avogadro {
+   // ##########  recursiveRotate  ##########
+ 
+   void SkeletonTree::recursiveRotate(Node* n,
+-                                     const Eigen::Transform3d &rotationMatrix)
++                                     const Eigen::Projective3d &rotationMatrix)
+   {
+     // Update the root node with the new position
+     Atom* a = n->atom();
+-    a->setPos(rotationMatrix * (*a->pos()));
++    a->setPos((rotationMatrix * (*a->pos()).homogeneous()).head<3>());
+     a->update();
+ 
+     // Now update the children
+--- a/libavogadro/src/tools/skeletontree.h
++++ b/libavogadro/src/tools/skeletontree.h
+@@ -230,6 +230,6 @@ namespace Avogadro {
+        * @param centerVector Center location to rotate around.
+        */
+       void recursiveRotate(Node* n,
+-                           const Eigen::Transform3d &rotationMatrix);
++                           const Eigen::Projective3d &rotationMatrix);
+ 
+   };
+ } // End namespace Avogadro
\ No newline at end of file
diff --git a/gnu/packages/patches/avogadro-python-eigen-lib.patch b/gnu/packages/patches/avogadro-python-eigen-lib.patch
new file mode 100644
index 0000000000..ac9f2e30af
--- /dev/null
+++ b/gnu/packages/patches/avogadro-python-eigen-lib.patch
@@ -0,0 +1,161 @@
+From 2d4be7ede177a8df7340fe3b209698d591ee8a04 Mon Sep 17 00:00:00 2001
+From: Claudio Fernandes <claudiosf.claudio@gmail.com>
+Date: Mon, 16 Jan 2017 19:48:23 -0200
+Subject: [PATCH] Adapt libavogadro/python to Eigen 3.3
+
+---
+ libavogadro/src/python/camera.cpp |  2 +-
+ libavogadro/src/python/eigen.cpp  | 60 +++++++++++++++++++--------------------
+ 2 files changed, 31 insertions(+), 31 deletions(-)
+
+diff --git a/libavogadro/src/python/camera.cpp b/libavogadro/src/python/camera.cpp
+index 69ca87bf8..30b32af7d 100644
+--- a/libavogadro/src/python/camera.cpp
++++ b/libavogadro/src/python/camera.cpp
+@@ -10,7 +10,7 @@ using namespace Avogadro;
+ void export_Camera()
+ {
+ 
+-  const Eigen::Transform3d& (Camera::*modelview_ptr)() const = &Camera::modelview;
++  const Eigen::Projective3d& (Camera::*modelview_ptr)() const = &Camera::modelview;
+   Eigen::Vector3d (Camera::*unProject_ptr1)(const Eigen::Vector3d&) const = &Camera::unProject;
+   Eigen::Vector3d (Camera::*unProject_ptr2)(const QPoint&, const Eigen::Vector3d&) const = &Camera::unProject;
+   Eigen::Vector3d (Camera::*unProject_ptr3)(const QPoint&) const = &Camera::unProject;
+diff --git a/libavogadro/src/python/eigen.cpp b/libavogadro/src/python/eigen.cpp
+index c1faedbcc..20b4e719d 100644
+--- a/libavogadro/src/python/eigen.cpp
++++ b/libavogadro/src/python/eigen.cpp
+@@ -305,9 +305,9 @@ template <> struct ScalarTraits<double>
+     struct innerclass
+     {
+       //
+-      //  Eigen::Transform3d --> python array (4x4)
++      //  Eigen::Projective3d --> python array (4x4)
+       //
+-      static PyObject* convert(Eigen::Transform3d const &trans)
++      static PyObject* convert(Eigen::Projective3d const &trans)
+       {
+         npy_intp dims[2] = { 4, 4 };
+         PyObject *result = PyArray_SimpleNew(2, dims, PyArray_DOUBLE);
+@@ -321,9 +321,9 @@ template <> struct ScalarTraits<double>
+         return incref(result);
+       }
+       //
+-      //  Eigen::Transform3d* --> python array (4x4)
++      //  Eigen::Projective3d* --> python array (4x4)
+       //
+-      static PyObject* convert(Eigen::Transform3d *trans)
++      static PyObject* convert(Eigen::Projective3d *trans)
+       {
+         npy_intp dims[2] = { 4, 4 };
+         PyObject *result = PyArray_SimpleNew(2, dims, PyArray_DOUBLE);
+@@ -337,9 +337,9 @@ template <> struct ScalarTraits<double>
+         return incref(result);
+       }
+       //
+-      //  const Eigen::Transform3d* --> python array (4x4)
++      //  const Eigen::Projective3d* --> python array (4x4)
+       //
+-      static PyObject* convert(const Eigen::Transform3d *trans)
++      static PyObject* convert(const Eigen::Projective3d *trans)
+       {
+         npy_intp dims[2] = { 4, 4 };
+         PyObject *result = PyArray_SimpleNew(2, dims, PyArray_DOUBLE);
+@@ -358,10 +358,10 @@ template <> struct ScalarTraits<double>
+     Transform3d_to_python_array()
+     {
+       #ifndef WIN32
+-      to_python_converter<Eigen::Transform3d, innerclass>();
++      to_python_converter<Eigen::Projective3d, innerclass>();
+       #endif
+-      to_python_converter<Eigen::Transform3d*, innerclass>();
+-      to_python_converter<const Eigen::Transform3d*, innerclass>();
++      to_python_converter<Eigen::Projective3d*, innerclass>();
++      to_python_converter<const Eigen::Projective3d*, innerclass>();
+     }
+ 
+   };
+@@ -373,17 +373,17 @@ template <> struct ScalarTraits<double>
+       // Insert an rvalue from_python converter at the tail of the
+       // chain. Used for implicit conversions
+       //
+-      //  python array --> Eigen::Transform3d
++      //  python array --> Eigen::Projective3d
+       //
+       // used for:
+       //
+-      //  void function(Eigen::Transform3d vec)
+-      //  void function(Eigen::Transform3d & vec)
+-      //  void function(const Eigen::Transform3d & vec)
++      //  void function(Eigen::Projective3d vec)
++      //  void function(Eigen::Projective3d & vec)
++      //  void function(const Eigen::Projective3d & vec)
+       //
+-      converter::registry::push_back( &convertible, &construct, type_id<Eigen::Transform3d>() );
++      converter::registry::push_back( &convertible, &construct, type_id<Eigen::Projective3d>() );
+       
+-      converter::registry::insert( &convert, type_id<Eigen::Transform3d>() );
++      converter::registry::insert( &convert, type_id<Eigen::Projective3d>() );
+     }
+ 
+     static void* convert(PyObject *obj_ptr)
+@@ -401,7 +401,7 @@ template <> struct ScalarTraits<double>
+         throw_error_already_set(); // the 1D array does not have exactly 3 elements
+ 
+       double *values = reinterpret_cast<double*>(array->data);
+-      Eigen::Transform3d *c_obj = new Eigen::Transform3d();
++      Eigen::Projective3d *c_obj = new Eigen::Projective3d();
+       double *dataPtr = c_obj->data();
+ 
+       for (int i = 0; i < 16; ++i)
+@@ -432,7 +432,7 @@ template <> struct ScalarTraits<double>
+       // I think this is a better way to get at the double array, where is this
+       // deleted though? Does Boost::Python do it?
+       double *values = reinterpret_cast<double*>(array->data);
+-      Eigen::Transform3d *storage = new Eigen::Transform3d();
++      Eigen::Projective3d *storage = new Eigen::Projective3d();
+       double *dataPtr = storage->data();
+ 
+       for (int i = 0; i < 16; ++i)
+@@ -467,21 +467,21 @@ class EigenUnitTestHelper
+     void set_vector3d_ptr(Eigen::Vector3d* vec)                 { m_vector3d = *vec; }
+     void set_const_vector3d_ptr(const Eigen::Vector3d* const vec) { m_vector3d = *vec; }
+ 
+-    //Eigen::Transform3d             transform3d()              { return m_transform3d; }
+-    //Eigen::Transform3d&            transform3d_ref()          { return m_transform3d; }
+-    const Eigen::Transform3d&      const_transform3d_ref()    { return m_transform3d; }
+-    Eigen::Transform3d*            transform3d_ptr()          { return &m_transform3d; }
+-    const Eigen::Transform3d*      const_transform3d_ptr()    { return &m_transform3d; }
+-
+-    //void set_transform3d(Eigen::Transform3d vec)                      { m_transform3d = vec; }
+-    //void set_transform3d_ref(Eigen::Transform3d& vec)                 { m_transform3d = vec; }
+-    void set_const_transform3d_ref(const Eigen::Transform3d& vec)     { m_transform3d = vec; }
+-    void set_transform3d_ptr(Eigen::Transform3d* vec)                 { m_transform3d = *vec; }
+-    void set_const_transform3d_ptr(const Eigen::Transform3d* const vec) { m_transform3d = *vec; }
++    //Eigen::Projective3d             transform3d()              { return m_transform3d; }
++    //Eigen::Projective3d&            transform3d_ref()          { return m_transform3d; }
++    const Eigen::Projective3d&      const_transform3d_ref()    { return m_transform3d; }
++    Eigen::Projective3d*            transform3d_ptr()          { return &m_transform3d; }
++    const Eigen::Projective3d*      const_transform3d_ptr()    { return &m_transform3d; }
++
++    //void set_transform3d(Eigen::Projective3d vec)                      { m_transform3d = vec; }
++    //void set_transform3d_ref(Eigen::Projective3d& vec)                 { m_transform3d = vec; }
++    void set_const_transform3d_ref(const Eigen::Projective3d& vec)     { m_transform3d = vec; }
++    void set_transform3d_ptr(Eigen::Projective3d* vec)                 { m_transform3d = *vec; }
++    void set_const_transform3d_ptr(const Eigen::Projective3d* const vec) { m_transform3d = *vec; }
+  
+   private:
+     Eigen::Vector3d m_vector3d;
+-    Eigen::Transform3d m_transform3d;
++    Eigen::Projective3d m_transform3d;
+ 
+ };
+ #endif
+@@ -529,6 +529,6 @@ void export_Eigen()
+   Vector3x_to_python_array<Eigen::Vector3i>();
+   Vector3x_from_python_array<Eigen::Vector3i>();
+ 
+-  // Eigen::Transform3d
++  // Eigen::Projective3d
+   Transform3d_to_python_array();
+   Transform3d_from_python_array();
diff --git a/gnu/packages/patches/bastet-change-source-of-unordered_set.patch b/gnu/packages/patches/bastet-change-source-of-unordered_set.patch
new file mode 100644
index 0000000000..ef3970a3e2
--- /dev/null
+++ b/gnu/packages/patches/bastet-change-source-of-unordered_set.patch
@@ -0,0 +1,40 @@
+From: Tobias Geerinckx-Rice <me@tobias.gr>
+Date: Wed, 3 Oct 2018 23:30:42 +0200
+Subject: [PATCH] bastet: Change source of unordered_set.
+
+This allows building bastet 0.43.2 with boost >=1.66.
+It was backported verbatim from the upstream master branch.
+
+From 0e03f8d4d6bc6949cf1c447e632ce0d1b98c4be1 Mon Sep 17 00:00:00 2001
+From: Federico Poloni <fpoloni@di.unipi.it>
+Date: Wed, 4 Oct 2017 19:35:01 +0200
+Subject: [PATCH] Changed source of unordered_set (should hopefully fix #6
+ without reopening #1)
+
+---
+ BastetBlockChooser.hpp | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/BastetBlockChooser.hpp b/BastetBlockChooser.hpp
+index 992e556..7ee3b7c 100644
+--- a/BastetBlockChooser.hpp
++++ b/BastetBlockChooser.hpp
+@@ -23,8 +23,7 @@
+ 
+ #include "Well.hpp"
+ 
+-#include <boost/tr1/tr1/unordered_set>
+-#include <set>
++#include <boost/unordered_set.hpp>
+ #include <boost/functional/hash.hpp>
+ 
+ namespace Bastet{
+@@ -75,7 +74,7 @@ namespace Bastet{
+   public:
+     Searcher(BlockType b, const Well *well, Vertex v, WellVisitor *visitor);
+   private:
+-    std::tr1::unordered_set<Vertex> _visited;
++    boost::unordered_set<Vertex> _visited;
+     //std::set<Vertex> _visited; ^^ the above is more efficient, we need to do many inserts
+     BlockType _block;
+     const Well *_well;
diff --git a/gnu/packages/patches/binutils-aarch64-symbol-relocation.patch b/gnu/packages/patches/binutils-aarch64-symbol-relocation.patch
deleted file mode 100644
index fbd596862b..0000000000
--- a/gnu/packages/patches/binutils-aarch64-symbol-relocation.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Fix a regression in Binutils 2.30 where some symbols are incorrectly assumed
-to be addresses:
-
-https://sourceware.org/bugzilla/show_bug.cgi?id=22764
-
-Patch taken from upstream (with ChangeLog entries and tests omitted):
-
-https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=279b2f94168ee91e02ccd070d27c983fc001fe12
-
-diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
-index af448f9..2737773 100644
---- a/bfd/elfnn-aarch64.c
-+++ b/bfd/elfnn-aarch64.c
-@@ -7189,10 +7189,19 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
- #if ARCH_SIZE == 64
- 	case BFD_RELOC_AARCH64_32:
- #endif
--	  if (bfd_link_pic (info)
--	      && (sec->flags & SEC_ALLOC) != 0
--	      && (sec->flags & SEC_READONLY) != 0)
-+	  if (bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0)
- 	    {
-+	      if (h != NULL
-+		  /* This is an absolute symbol.  It represents a value instead
-+		     of an address.  */
-+		  && ((h->root.type == bfd_link_hash_defined
-+		       && bfd_is_abs_section (h->root.u.def.section))
-+		      /* This is an undefined symbol.  */
-+		      || h->root.type == bfd_link_hash_undefined))
-+		break;
-+
-+	      /* For local symbols, defined global symbols in a non-ABS section,
-+		 it is assumed that the value is an address.  */
- 	      int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
- 	      _bfd_error_handler
- 		/* xgettext:c-format */
diff --git a/gnu/packages/patches/blender-newer-ffmpeg.patch b/gnu/packages/patches/blender-newer-ffmpeg.patch
new file mode 100644
index 0000000000..363489bc70
--- /dev/null
+++ b/gnu/packages/patches/blender-newer-ffmpeg.patch
@@ -0,0 +1,80 @@
+https://sources.debian.org/data/main/b/blender/2.79.b+dfsg0-4/debian/patches/0008-fix_building_with_latest_versions_of_FFmpeg.patch
+
+From: Bastien Montagne <montagne29@wanadoo.fr>
+Date: Tue, 8 May 2018 16:00:52 +0200
+Subject: fix_building_with_latest_versions_of_FFmpeg
+
+Some years-old deprecated stuff has now been removed.
+
+Correct solution is probably to use valid defines etc. in own code, but
+this is more FFMEPG maintainer task (since it also may change how old
+FFMPEG we do support...).
+---
+ intern/ffmpeg/ffmpeg_compat.h                  | 39 ++++++++++++++++++++++++++
+ source/blender/blenkernel/intern/writeffmpeg.c |  3 +-
+ 2 files changed, 41 insertions(+), 1 deletion(-)
+
+diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
+index 9c06c8a..f7f437c 100644
+--- a/intern/ffmpeg/ffmpeg_compat.h
++++ b/intern/ffmpeg/ffmpeg_compat.h
+@@ -109,6 +109,45 @@ int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
+ 
+ #endif
+ 
++/* XXX TODO Probably fix to correct modern flags in code? Not sure how old FFMPEG we want to support though,
++ * so for now this will do. */
++
++#ifndef FF_MIN_BUFFER_SIZE
++#  ifdef AV_INPUT_BUFFER_MIN_SIZE
++#    define FF_MIN_BUFFER_SIZE AV_INPUT_BUFFER_MIN_SIZE
++#  endif
++#endif
++
++#ifndef FF_INPUT_BUFFER_PADDING_SIZE
++#  ifdef AV_INPUT_BUFFER_PADDING_SIZE
++#    define FF_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE
++#  endif
++#endif
++
++#ifndef CODEC_FLAG_GLOBAL_HEADER
++#  ifdef AV_CODEC_FLAG_GLOBAL_HEADER
++#    define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
++#  endif
++#endif
++
++#ifndef CODEC_FLAG_GLOBAL_HEADER
++#  ifdef AV_CODEC_FLAG_GLOBAL_HEADER
++#    define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
++#  endif
++#endif
++
++#ifndef CODEC_FLAG_INTERLACED_DCT
++#  ifdef AV_CODEC_FLAG_INTERLACED_DCT
++#    define CODEC_FLAG_INTERLACED_DCT AV_CODEC_FLAG_INTERLACED_DCT
++#  endif
++#endif
++
++#ifndef CODEC_FLAG_INTERLACED_ME
++#  ifdef AV_CODEC_FLAG_INTERLACED_ME
++#    define CODEC_FLAG_INTERLACED_ME AV_CODEC_FLAG_INTERLACED_ME
++#  endif
++#endif
++
+ /* FFmpeg upstream 1.0 is the first who added AV_ prefix. */
+ #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 59, 100)
+ #  define AV_CODEC_ID_NONE CODEC_ID_NONE
+diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
+index a19e414..04d508a 100644
+--- a/source/blender/blenkernel/intern/writeffmpeg.c
++++ b/source/blender/blenkernel/intern/writeffmpeg.c
+@@ -605,7 +605,8 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int
+ 	c->rc_buffer_aggressivity = 1.0;
+ #endif
+ 
+-	c->me_method = ME_EPZS;
++	/* Deprecated and not doing anything since July 2015, deleted in recent ffmpeg */
++	//c->me_method = ME_EPZS;
+ 	
+ 	codec = avcodec_find_encoder(c->codec_id);
+ 	if (!codec)
diff --git a/gnu/packages/patches/borg-respect-storage-quota.patch b/gnu/packages/patches/borg-respect-storage-quota.patch
new file mode 100644
index 0000000000..d23d1ffc01
--- /dev/null
+++ b/gnu/packages/patches/borg-respect-storage-quota.patch
@@ -0,0 +1,32 @@
+Make sure the client respects the storage quota set by the server:
+
+https://github.com/borgbackup/borg/issues/4093
+
+Patch copied from upstream source repository:
+
+https://github.com/borgbackup/borg/commit/975cc33206e0e3644626fb7204c34d2157715b61
+
+From 975cc33206e0e3644626fb7204c34d2157715b61 Mon Sep 17 00:00:00 2001
+From: Manu <manu@snapdragon.cc>
+Date: Wed, 3 Oct 2018 23:47:36 +0800
+Subject: [PATCH] Add storage_quota for forced_result if set by serve command.
+
+---
+ src/borg/archiver.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/borg/archiver.py b/src/borg/archiver.py
+index 916725e7..279194c1 100644
+--- a/src/borg/archiver.py
++++ b/src/borg/archiver.py
+@@ -4276,6 +4276,7 @@ def get_args(self, argv, cmd):
+             result.restrict_to_paths = forced_result.restrict_to_paths
+             result.restrict_to_repositories = forced_result.restrict_to_repositories
+             result.append_only = forced_result.append_only
++            result.storage_quota = forced_result.storage_quota
+         return result
+ 
+     def parse_args(self, args=None):
+-- 
+2.19.1
+
diff --git a/gnu/packages/patches/cairo-setjmp-wrapper.patch b/gnu/packages/patches/cairo-setjmp-wrapper.patch
new file mode 100644
index 0000000000..bffac6e041
--- /dev/null
+++ b/gnu/packages/patches/cairo-setjmp-wrapper.patch
@@ -0,0 +1,78 @@
+Revert faulty commit to avoid undefined behaviour:
+https://bugs.freedesktop.org/show_bug.cgi?id=104325
+
+Taken from this upstream commit:
+https://cgit.freedesktop.org/cairo/commit/?h=1.14&id=2acc4382c54bd8239361ceed14423412a343d311
+
+diff --git a/src/cairo-bentley-ottmann-rectangular.c b/src/cairo-bentley-ottmann-rectangular.c
+index cb2e30c..5541bdc 100644
+--- a/src/cairo-bentley-ottmann-rectangular.c
++++ b/src/cairo-bentley-ottmann-rectangular.c
+@@ -593,12 +593,6 @@ sweep_line_insert (sweep_line_t	*sweep, rectangle_t *rectangle)
+     pqueue_push (sweep, rectangle);
+ }
+ 
+-static int
+-sweep_line_setjmp (sweep_line_t *sweep_line)
+-{
+-    return setjmp (sweep_line->unwind);
+-}
+-
+ static cairo_status_t
+ _cairo_bentley_ottmann_tessellate_rectangular (rectangle_t	**rectangles,
+ 					       int			  num_rectangles,
+@@ -615,7 +609,7 @@ _cairo_bentley_ottmann_tessellate_rectangular (rectangle_t	**rectangles,
+ 		     rectangles, num_rectangles,
+ 		     fill_rule,
+ 		     do_traps, container);
+-    if ((status = sweep_line_setjmp (&sweep_line)))
++    if ((status = setjmp (sweep_line.unwind)))
+ 	return status;
+ 
+     rectangle = rectangle_pop_start (&sweep_line);
+diff --git a/src/cairo-png.c b/src/cairo-png.c
+index e64b14a..068617d 100644
+--- a/src/cairo-png.c
++++ b/src/cairo-png.c
+@@ -158,14 +158,6 @@ png_simple_warning_callback (png_structp png,
+      */
+ }
+ 
+-static int
+-png_setjmp (png_struct *png)
+-{
+-#ifdef PNG_SETJMP_SUPPORTED
+-    return setjmp (png_jmpbuf (png));
+-#endif
+-    return 0;
+-}
+ 
+ /* Starting with libpng-1.2.30, we must explicitly specify an output_flush_fn.
+  * Otherwise, we will segfault if we are writing to a stream. */
+@@ -237,8 +229,10 @@ write_png (cairo_surface_t	*surface,
+ 	goto BAIL4;
+     }
+ 
+-    if (png_setjmp (png))
++#ifdef PNG_SETJMP_SUPPORTED
++    if (setjmp (png_jmpbuf (png)))
+ 	goto BAIL4;
++#endif
+ 
+     png_set_write_fn (png, closure, write_func, png_simple_output_flush_fn);
+ 
+@@ -577,11 +571,12 @@ read_png (struct png_read_closure_t *png_closure)
+     png_set_read_fn (png, png_closure, stream_read_func);
+ 
+     status = CAIRO_STATUS_SUCCESS;
+-
+-    if (png_setjmp (png)) {
++#ifdef PNG_SETJMP_SUPPORTED
++    if (setjmp (png_jmpbuf (png))) {
+ 	surface = _cairo_surface_create_in_error (status);
+ 	goto BAIL;
+     }
++#endif
+ 
+     png_read_info (png, info);
+ 
diff --git a/gnu/packages/patches/casync-renameat2-declaration.patch b/gnu/packages/patches/casync-renameat2-declaration.patch
new file mode 100644
index 0000000000..74c2ca7b3c
--- /dev/null
+++ b/gnu/packages/patches/casync-renameat2-declaration.patch
@@ -0,0 +1,27 @@
+Fix build failure on glibc 2.28 where 'renameat2' would end up being
+declared twice: <https://github.com/systemd/casync/issues/166>.
+
+From 625244ca47e8ee1375d2d0092271bfd13b0913ea Mon Sep 17 00:00:00 2001
+From: Daniel Mack <daniel@zonque.org>
+Date: Tue, 13 Nov 2018 17:52:48 +0100
+Subject: [PATCH] meson.build: pass -D_GNU_SOURCE when checking for functions
+
+As described in #166, -D_GNU_SOURCE needs to be passed to the meson function
+availability checker. h/t to @tomeon for providing a link to the solution as
+well.
+---
+ meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index f42ed16..c0f741e 100644
+--- a/meson.build
++++ b/meson.build
+@@ -78,6 +78,6 @@ foreach ident : [
+         ['copy_file_range',   '''#include <sys/syscall.h>
+                                  #include <unistd.h>'''],
+ ]
+-        have = cc.has_function(ident[0], prefix : ident[1])
++        have = cc.has_function(ident[0], args : '-D_GNU_SOURCE', prefix : ident[1])
+         conf.set10('HAVE_' + ident[0].to_upper(), have)
+ endforeach
diff --git a/gnu/packages/patches/ceph-detect-rocksdb.patch b/gnu/packages/patches/ceph-detect-rocksdb.patch
new file mode 100644
index 0000000000..badad6d1b9
--- /dev/null
+++ b/gnu/packages/patches/ceph-detect-rocksdb.patch
@@ -0,0 +1,24 @@
+Help the build system find system RocksDB.
+
+Taken from this upstream commit:
+https://github.com/ceph/ceph/commit/2ac26bd0e01fd6c82bd59936cf25c25173f7775a
+
+diff --git a/cmake/modules/Findrocksdb.cmake b/cmake/modules/Findrocksdb.cmake
+index f8369f73fc..5926647348 100644
+--- a/cmake/modules/Findrocksdb.cmake
++++ b/cmake/modules/Findrocksdb.cmake
+@@ -15,11 +15,11 @@ find_library(ROCKSDB_LIBRARIES rocksdb)
+ 
+ if(ROCKSDB_INCLUDE_DIR AND EXISTS "${ROCKSDB_INCLUDE_DIR}/rocksdb/version.h")
+   foreach(ver "MAJOR" "MINOR" "PATCH")
+-    file(STRINGS "${ROCKSDB_INCLUDE_DIR}/version.h" ROCKSDB_VER_${ver}_LINE
++    file(STRINGS "${ROCKSDB_INCLUDE_DIR}/rocksdb/version.h" ROCKSDB_VER_${ver}_LINE
+       REGEX "^#define[ \t]+ROCKSDB_${ver}[ \t]+[0-9]+$")
+     string(REGEX REPLACE "^#define[ \t]+ROCKSDB_${ver}[ \t]+([0-9]+)$"
+-      "\\1" ROCKSDB_VERSION_${ver} "${ROCKDB_VER_${ver}_LINE}")
+-    unset(${ROCKDB_VER_${ver}_LINE})
++      "\\1" ROCKSDB_VERSION_${ver} "${ROCKSDB_VER_${ver}_LINE}")
++    unset(${ROCKSDB_VER_${ver}_LINE})
+   endforeach()
+   set(ROCKSDB_VERSION_STRING
+     "${ROCKSDB_VERSION_MAJOR}.${ROCKSDB_VERSION_MINOR}.${ROCKSDB_VERSION_PATCH}")
diff --git a/gnu/packages/patches/ceph-rocksdb-compat.patch b/gnu/packages/patches/ceph-rocksdb-compat.patch
deleted file mode 100644
index 1a3c6b0b23..0000000000
--- a/gnu/packages/patches/ceph-rocksdb-compat.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-Fix compatibility with newer versions of RocksDB.
-
-Adapted from this upstream patch, with some additional changes for 12.2:
-https://github.com/ceph/ceph/commit/9d73a7121fdb1ae87cb1aa6f7d9d7a13f329ae68
-
-diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc
-index 8660afe1886d..bc0de79e23cb 100644
---- a/src/kv/RocksDBStore.cc
-+++ b/src/kv/RocksDBStore.cc
-@@ -505,7 +505,7 @@
-   // considering performance overhead, default is disabled
-   if (g_conf->rocksdb_perf) {
-     rocksdb::SetPerfLevel(rocksdb::PerfLevel::kEnableTimeExceptForMutex);
--    rocksdb::perf_context.Reset();
-+    rocksdb::get_perf_context()->Reset();
-   }
- 
-   RocksDBTransactionImpl * _t =
-@@ -532,13 +532,13 @@
-     utime_t write_wal_time;
-     utime_t write_pre_and_post_process_time;
-     write_wal_time.set_from_double(
--	static_cast<double>(rocksdb::perf_context.write_wal_time)/1000000000);
-+	static_cast<double>(rocksdb::get_perf_context()->write_wal_time)/1000000000);
-     write_memtable_time.set_from_double(
--	static_cast<double>(rocksdb::perf_context.write_memtable_time)/1000000000);
-+	static_cast<double>(rocksdb::get_perf_context()->write_memtable_time)/1000000000);
-     write_delay_time.set_from_double(
--	static_cast<double>(rocksdb::perf_context.write_delay_time)/1000000000);
-+	static_cast<double>(rocksdb::get_perf_context()->write_delay_time)/1000000000);
-     write_pre_and_post_process_time.set_from_double(
--	static_cast<double>(rocksdb::perf_context.write_pre_and_post_process_time)/1000000000);
-+	static_cast<double>(rocksdb::get_perf_context()->write_pre_and_post_process_time)/1000000000);
-     logger->tinc(l_rocksdb_write_memtable_time, write_memtable_time);
-     logger->tinc(l_rocksdb_write_delay_time, write_delay_time);
-     logger->tinc(l_rocksdb_write_wal_time, write_wal_time);
-@@ -558,7 +558,7 @@
-   // considering performance overhead, default is disabled
-   if (g_conf->rocksdb_perf) {
-     rocksdb::SetPerfLevel(rocksdb::PerfLevel::kEnableTimeExceptForMutex);
--    rocksdb::perf_context.Reset();
-+    rocksdb::get_perf_context()->Reset();
-   }
- 
-   RocksDBTransactionImpl * _t =
-@@ -586,13 +586,13 @@
-     utime_t write_wal_time;
-     utime_t write_pre_and_post_process_time;
-     write_wal_time.set_from_double(
--	static_cast<double>(rocksdb::perf_context.write_wal_time)/1000000000);
-+	static_cast<double>(rocksdb::get_perf_context()->write_wal_time)/1000000000);
-     write_memtable_time.set_from_double(
--	static_cast<double>(rocksdb::perf_context.write_memtable_time)/1000000000);
-+	static_cast<double>(rocksdb::get_perf_context()->write_memtable_time)/1000000000);
-     write_delay_time.set_from_double(
--	static_cast<double>(rocksdb::perf_context.write_delay_time)/1000000000);
-+	static_cast<double>(rocksdb::get_perf_context()->write_delay_time)/1000000000);
-     write_pre_and_post_process_time.set_from_double(
--	static_cast<double>(rocksdb::perf_context.write_pre_and_post_process_time)/1000000000);
-+	static_cast<double>(rocksdb::get_perf_context()->write_pre_and_post_process_time)/1000000000);
-     logger->tinc(l_rocksdb_write_memtable_time, write_memtable_time);
-     logger->tinc(l_rocksdb_write_delay_time, write_delay_time);
-     logger->tinc(l_rocksdb_write_wal_time, write_wal_time);
diff --git a/gnu/packages/patches/ceph-skip-unittest_blockdev.patch b/gnu/packages/patches/ceph-skip-unittest_blockdev.patch
index 43b9984862..407bd93278 100644
--- a/gnu/packages/patches/ceph-skip-unittest_blockdev.patch
+++ b/gnu/packages/patches/ceph-skip-unittest_blockdev.patch
@@ -4,25 +4,21 @@ This test tries to walk a sysfs path and hits a null pointer exception.
 Expected: (dir) != (nullptr), actual: NULL vs 8-byte object <00-00 00-00 00-00 00-00>
 
 diff --git a/src/test/common/CMakeLists.txt b/src/test/common/CMakeLists.txt
-index 5172663898..ac84085eaa 100644
 --- a/src/test/common/CMakeLists.txt
 +++ b/src/test/common/CMakeLists.txt
-@@ -12,15 +12,6 @@ target_link_libraries(get_command_descriptions
+@@ -12,15 +12,6 @@
    ${CMAKE_DL_LIBS}
    )
  
 -if(HAVE_BLKID)
--# unittest_blkdev
--add_executable(unittest_blkdev
--  test_blkdev.cc
--  )
--add_ceph_unittest(unittest_blkdev ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unittest_blkdev)
--target_link_libraries(unittest_blkdev global ${BLKID_LIBRARIES})
--endif(HAVE_BLKID)
+-  # unittest_blkdev
+-  add_executable(unittest_blkdev
+-    test_blkdev.cc
+-    )
+-  add_ceph_unittest(unittest_blkdev)
+-  target_link_libraries(unittest_blkdev ceph-common ${BLKID_LIBRARIES})
+-endif()
 -
  # unittest_bloom_filter
  add_executable(unittest_bloom_filter
    test_bloom_filter.cc
--- 
-2.11.1
-
diff --git a/gnu/packages/patches/ceph-volume-respect-PATH.patch b/gnu/packages/patches/ceph-volume-respect-PATH.patch
new file mode 100644
index 0000000000..08a9a15ddd
--- /dev/null
+++ b/gnu/packages/patches/ceph-volume-respect-PATH.patch
@@ -0,0 +1,22 @@
+Look for required tools in $PATH instead of just a handful locations.
+
+diff --git a/src/ceph-volume/ceph_volume/util/system.py b/src/ceph-volume/ceph_volume/util/system.py
+index b637f023a4..14516e1c65 100644
+--- a/src/ceph-volume/ceph_volume/util/system.py
++++ b/src/ceph-volume/ceph_volume/util/system.py
+@@ -33,14 +33,7 @@ def generate_uuid():
+ 
+ def which(executable):
+     """find the location of an executable"""
+-    locations = (
+-        '/usr/local/bin',
+-        '/bin',
+-        '/usr/bin',
+-        '/usr/local/sbin',
+-        '/usr/sbin',
+-        '/sbin',
+-    )
++    locations = os.getenv('PATH').split(':')
+ 
+     for location in locations:
+         executable_path = os.path.join(location, executable)
diff --git a/gnu/packages/patches/clamav-config-llvm-libs.patch b/gnu/packages/patches/clamav-config-llvm-libs.patch
new file mode 100644
index 0000000000..054264ee2e
--- /dev/null
+++ b/gnu/packages/patches/clamav-config-llvm-libs.patch
@@ -0,0 +1,14 @@
+Our llvm does not contain a single top-level library, so consult llvm-config
+for the libraries that need to be linked against.
+
+--- clamav-0.100.2/libclamav/c++/configure.ac	2018-09-19 14:29:07.000000000 -0500
++++ clamav-0.100.2/libclamav/c++/configure.ac	2018-10-06 21:45:09.377249158 -0500
+@@ -105,7 +105,7 @@
+ 
+     if test "x$llvm_linking" = "xdynamic"; then
+         AC_SUBST(LLVMCONFIG_LDFLAGS, [`$llvmconfig --ldflags`])
+-        AC_SUBST(LLVMCONFIG_LIBS, [-lLLVM-$llvmver])
++        AC_SUBST(LLVMCONFIG_LIBS, [`$llvmconfig --libs $llvmcomp`])
+         AC_SUBST(LLVMCONFIG_LIBFILES, [])
+     else
+         if test $llvmver_test -ge 350; then
diff --git a/gnu/packages/patches/clamav-system-tomsfastmath.patch b/gnu/packages/patches/clamav-system-tomsfastmath.patch
new file mode 100644
index 0000000000..07ab79f3f7
--- /dev/null
+++ b/gnu/packages/patches/clamav-system-tomsfastmath.patch
@@ -0,0 +1,102 @@
+From 756ff89526b5ffaa7a4f49b1bbecf2ecbd6f85f9 Mon Sep 17 00:00:00 2001
+From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
+Date: Wed, 11 Mar 2015 20:03:15 +0100
+Subject: add support for system tomsfastmath
+
+Patch-Name: add-support-for-system-tomsfastmath.patch
+---
+ configure.ac                           |    2 ++
+ libclamav/Makefile.am                  |   10 ++++++++--
+ libclamav/bignum.h                     |    6 +++++-
+ libclamav/xdp.c                        |    2 +-
+ m4/reorganization/libs/tomsfastmath.m4 |   12 ++++++++++++
+ 5 files changed, 28 insertions(+), 4 deletions(-)
+ create mode 100644 m4/reorganization/libs/tomsfastmath.m4
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -82,6 +82,7 @@ m4_include([m4/reorganization/libs/xml.m
+ m4_include([m4/reorganization/libs/openssl.m4])
+ m4_include([m4/reorganization/libs/json.m4])
+ m4_include([m4/reorganization/libs/pcre.m4])
++m4_include([m4/reorganization/libs/tomsfastmath.m4])
+ 
+ AM_MAINTAINER_MODE
+ m4_include([m4/reorganization/libs/libz.m4])
+@@ -285,6 +286,7 @@ else
+ fi
+ CL_MSG_STATUS([yara        ],[$enable_yara],[$enable_yara])
+ CL_MSG_STATUS([fts         ],[yes],[$lfs_fts_msg])
++CL_MSG_STATUS([tomsfastmath],[yes],[$tomsfastmath_msg])
+ 
+ 
+ # Yep, downgrading the compiler avoids the bug too:
+--- a/libclamav/Makefile.am
++++ b/libclamav/Makefile.am
+@@ -496,8 +496,10 @@ libclamav_la_SOURCES += yara_arena.c \
+ 	yara_clam.h
+ endif
+ 
+-libclamav_la_SOURCES += bignum.h\
+-	bignum_fast.h\
++libclamav_la_SOURCES += bignum.h
++
++if !SYSTEM_TOMSFASTMATH
++libclamav_la_SOURCES += bignum_fast.h\
+         tomsfastmath/addsub/fp_add.c\
+         tomsfastmath/addsub/fp_add_d.c\
+         tomsfastmath/addsub/fp_addmod.c\
+@@ -579,6 +581,10 @@ libclamav_la_SOURCES += bignum.h\
+         tomsfastmath/sqr/fp_sqr_comba_generic.c\
+         tomsfastmath/sqr/fp_sqr_comba_small_set.c\
+ 	tomsfastmath/sqr/fp_sqrmod.c
++else
++libclamav_la_CFLAGS += $(TOMSFASTMATH_CFLAGS)
++libclamav_la_LIBADD += $(TOMSFASTMATH_LIBS)
++endif
+ 
+ .PHONY: version.h.tmp
+ version.c: version.h
+--- a/libclamav/bignum.h
++++ b/libclamav/bignum.h
+@@ -1,9 +1,13 @@
+ #ifndef BIGNUM_H_
+ #define BIGNUM_H_
+ 
++#if HAVE_SYSTEM_TOMSFASTMATH
++#include <tfm.h>
++#else
+ #define TFM_CHECK
+-
+ #include "bignum_fast.h"
++#endif
++
+ typedef fp_int mp_int;
+ #define mp_cmp fp_cmp
+ #define mp_toradix_n(a,b,c,d) fp_toradix_n(a,b,c,d)
+--- a/libclamav/xdp.c
++++ b/libclamav/xdp.c
+@@ -57,7 +57,7 @@
+ #include "scanners.h"
+ #include "conv.h"
+ #include "xdp.h"
+-#include "bignum_fast.h"
++#include "bignum.h"
+ #include "filetypes.h"
+ 
+ static char *dump_xdp(cli_ctx *ctx, const char *start, size_t sz);
+--- /dev/null
++++ b/m4/reorganization/libs/tomsfastmath.m4
+@@ -0,0 +1,12 @@
++dnl Check for system tomsfastmath
++PKG_CHECK_MODULES([TOMSFASTMATH], [tomsfastmath], [have_system_tomsfastmath=yes], [have_system_tomsfastmath=no])
++
++AM_CONDITIONAL([SYSTEM_TOMSFASTMATH], [test "x$have_system_tomsfastmath" = "xyes"])
++
++if test "x$have_system_tomsfastmath" = "xyes"; then
++    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [1], [link against system-wide tomsfastmath library])
++    tomsfastmath_msg="External, $TOMSFASTMATH_CFLAGS $TOMSFASTMATH_LIBS"
++else
++    AC_DEFINE([HAVE_SYSTEM_TOMSFASTMATH], [0], [don't link against system-wide tomsfastmath library])
++    tomsfastmath_msg="Internal"
++fi
diff --git a/gnu/packages/patches/clang-3.5-libsanitizer-ustat-fix.patch b/gnu/packages/patches/clang-3.5-libsanitizer-ustat-fix.patch
new file mode 100644
index 0000000000..cfb09a8ce3
--- /dev/null
+++ b/gnu/packages/patches/clang-3.5-libsanitizer-ustat-fix.patch
@@ -0,0 +1,46 @@
+From d9d97cac3702b99a00cd113de98c41eb535d47ed Mon Sep 17 00:00:00 2001
+From: Efraim Flashner <efraim@flashner.co.il>
+Date: Sun, 14 Oct 2018 12:11:30 +0300
+Subject: [PATCH] patch modified from the gcc patch series, also dealing with
+ ustat.
+
+---
+ .../sanitizer_platform_limits_posix.cc            | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 29fea6e..570b9a5 100644
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -129,7 +129,6 @@
+ #include <sys/statvfs.h>
+ #include <sys/timex.h>
+ #include <sys/user.h>
+-#include <sys/ustat.h>
+ #include <linux/cyclades.h>
+ #include <linux/if_eql.h>
+ #include <linux/if_plip.h>
+@@ -222,7 +221,19 @@ namespace __sanitizer {
+ #endif  // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-  unsigned struct_ustat_sz = sizeof(struct ustat);
++  // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
++  // has been removed from glibc 2.28.
++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
++  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
++  || defined(__x86_64__)
++#define SIZEOF_STRUCT_USTAT 32
++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
++  || defined(__powerpc__) || defined(__s390__)
++#define SIZEOF_STRUCT_USTAT 20
++#else
++#error Unknown size of struct ustat
++#endif
++  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
+   unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
+   unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
+ #endif  // SANITIZER_LINUX && !SANITIZER_ANDROID
+-- 
+2.19.1
+
diff --git a/gnu/packages/patches/clisp-glibc-2.26.patch b/gnu/packages/patches/clisp-glibc-2.26.patch
deleted file mode 100644
index c8920ceccc..0000000000
--- a/gnu/packages/patches/clisp-glibc-2.26.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-This patch comes from Debian.
-
-Description: cfree is not present in glibc-2.26, stop wrapping it
-Author: Adam Conrad <adconrad@ubuntu.com>
-Bug: https://sourceforge.net/p/clisp/bugs/717/
-Bug-Debian: https://bugs.debian.org/880686
-Applied-Upstream: https://sourceforge.net/p/clisp/clisp/ci/3bc928712d150ff1e5f6b2bfb7838655f3ff52fa/
-Reviewed-By: Sébastien Villemot <sebastien@debian.org>
-Last-Update: 2017-11-27
-
---- clisp-2.49.20170913.orig/modules/bindings/glibc/linux.lisp
-+++ clisp-2.49.20170913/modules/bindings/glibc/linux.lisp
-@@ -649,7 +649,6 @@
- (def-call-out calloc (:arguments (nmemb size_t) (size size_t))
-   (:return-type c-pointer))
- (def-call-out free (:arguments (ptr c-pointer)) (:return-type nil))
--(def-call-out cfree (:arguments (ptr c-pointer)) (:return-type nil))
- (def-call-out valloc (:arguments (size size_t)) (:return-type c-pointer))
- 
- (def-call-out abort (:arguments) (:return-type nil))
diff --git a/gnu/packages/patches/crawl-upgrade-saves.patch b/gnu/packages/patches/crawl-upgrade-saves.patch
index 301942dc30..4c0b3a427b 100644
--- a/gnu/packages/patches/crawl-upgrade-saves.patch
+++ b/gnu/packages/patches/crawl-upgrade-saves.patch
@@ -5,8 +5,9 @@ By default crawl checks for a mtime difference on files in DATADIR to see if an
 upgrade is required, but guix nulls all file dates,
 and crawl would never upgrade saves.
 
---- a/source/database.cc	2016-05-31 09:56:08.000000000 +0200
-+++ a/source/database.cc	2017-06-05 03:00:19.270632107 +0200
+diff -ur a/source/database.cc b/source/database.cc
+--- a/source/database.cc	2018-08-09 21:49:26.000000000 -0400
++++ b/source/database.cc	2018-10-07 18:06:41.022445789 -0400
 @@ -25,6 +25,7 @@
  #include "syscalls.h"
  #include "threads.h"
@@ -23,16 +24,16 @@ and crawl would never upgrade saves.
      TextDB *_parent;
      const char* lang() { return _parent ? Options.lang_name : 0; }
  public:
-@@ -165,7 +167,7 @@
+@@ -163,7 +165,7 @@
  
- TextDB::TextDB(const char* db_name, const char* dir, ...)
-     : _db_name(db_name), _directory(dir),
+ TextDB::TextDB(const char* db_name, const char* dir, vector<string> files)
+     : _db_name(db_name), _directory(dir), _input_files(files),
 -      _db(nullptr), timestamp(""), _parent(0), translation(0)
 +      _db(nullptr), timestamp(""), version(""),  _parent(0), translation(0)
  {
-     va_list args;
-     va_start(args, dir);
-@@ -187,7 +189,7 @@
+ }
+ 
+@@ -171,7 +173,7 @@
      : _db_name(parent->_db_name),
        _directory(parent->_directory + Options.lang_name + "/"),
        _input_files(parent->_input_files), // FIXME: pointless copy
@@ -41,7 +42,7 @@ and crawl would never upgrade saves.
  {
  }
  
-@@ -202,6 +204,9 @@
+@@ -186,6 +188,9 @@
          return false;
  
      timestamp = _query_database(*this, "TIMESTAMP", false, false, true);
@@ -51,7 +52,7 @@ and crawl would never upgrade saves.
      if (timestamp.empty())
          return false;
  
-@@ -245,6 +250,9 @@
+@@ -229,6 +234,9 @@
      string ts;
      bool no_files = true;
  
@@ -61,7 +62,7 @@ and crawl would never upgrade saves.
      for (const string &file : _input_files)
      {
          string full_input_path = _directory + file;
-@@ -261,7 +269,7 @@
+@@ -245,7 +253,7 @@
          ts += buf;
      }
  
@@ -70,7 +71,7 @@ and crawl would never upgrade saves.
      {
          // No point in empty databases, although for simplicity keep ones
          // for disappeared translations for now.
-@@ -321,7 +329,10 @@
+@@ -313,7 +321,10 @@
              _store_text_db(full_input_path, _db);
          }
      }
diff --git a/gnu/packages/patches/crossmap-allow-system-pysam.patch b/gnu/packages/patches/crossmap-allow-system-pysam.patch
deleted file mode 100644
index 611c4ff74d..0000000000
--- a/gnu/packages/patches/crossmap-allow-system-pysam.patch
+++ /dev/null
@@ -1,121 +0,0 @@
-This patch modifies the build process such that the bundled copy of pysam does
-not need to be built if CROSSMAP_USE_SYSTEM_PYSAM is set and the pysam module
-can be imported.
-
-Upstream has agreed to apply the patch in the next maintenance release of
-crossmap.  The patch has already been uploaded to
-http://sourceforge.net/projects/crossmap/files/patch/.
-
-diff --git a/setup.py b/setup.py
---- a/setup.py	2015-02-26 15:28:49.771189185 +0100
-+++ b/setup.py	2015-02-26 15:55:03.440327752 +0100
-@@ -19,6 +19,15 @@
- except:
- 	have_numpy = False
- 
-+try:
-+	import pysam
-+	if os.environ['CROSSMAP_USE_SYSTEM_PYSAM']:
-+		have_pysam = True
-+	else:
-+		have_pysam = False
-+except ImportError:
-+	have_pysam = False
-+
- if platform.system()=='Windows':
- 	print >> sys.stderr, "Sorry, Windows platform is not supported!"
- 	sys.exit()
-@@ -165,49 +174,50 @@
- 	
- 	
- 	#================= pysam samtools ====================
--	extensions.append(Extension(
--    	"pysam.csamtools",              
--		csamtools_sources + [ "lib/pysam/%s" % x for x in ("pysam_util.c", )] +\
--		glob.glob( os.path.join( "lib/samtools", "*.pysam.c" )) +\
--		os_c_files + \
--		glob.glob( os.path.join( "lib/samtools", "*", "*.pysam.c" ) ),
--		library_dirs=[],
--		include_dirs=[ "lib/samtools", "lib/pysam" ] + include_os,
--		libraries=[ "z", ],
--		language="c",
--		define_macros = [('_FILE_OFFSET_BITS','64'),('_USE_KNETFILE','')], 
--    ))
--
--	extensions.append(Extension(
--		"pysam.ctabix",                   
--		tabix_sources + [ "lib/pysam/%s" % x for x in ( "tabix_util.c", )] +\
--		os_c_files + \
--		glob.glob( os.path.join( "lib/tabix", "*.pysam.c" ) ),
--		library_dirs=[],
--		include_dirs=[ "lib/tabix", "lib/pysam" ] + include_os,
--		libraries=[ "z", ],
--		language="c",
--		define_macros = [('_FILE_OFFSET_BITS','64'),
--                     ('_USE_KNETFILE','')], 
--    ))
--
--	extensions.append(Extension(
--		"pysam.TabProxies",               
--		tabproxies_sources + os_c_files,
--		library_dirs=[],
--		include_dirs= include_os,
--		libraries=[ "z", ],
--		language="c",
--    ))
--
--	extensions.append(Extension(
--		"pysam.cvcf",                   
--		cvcf_sources + os_c_files,
--		library_dirs=[],
--		include_dirs= ["lib/tabix",] + include_os,
--		libraries=[ "z", ],
--		language="c",
--    ))
-+        if not have_pysam:
-+                extensions.append(Extension(
-+                        "pysam.csamtools",              
-+                        csamtools_sources + [ "lib/pysam/%s" % x for x in ("pysam_util.c", )] +\
-+                        glob.glob( os.path.join( "lib/samtools", "*.pysam.c" )) +\
-+                        os_c_files + \
-+                        glob.glob( os.path.join( "lib/samtools", "*", "*.pysam.c" ) ),
-+                        library_dirs=[],
-+                        include_dirs=[ "lib/samtools", "lib/pysam" ] + include_os,
-+                        libraries=[ "z", ],
-+                        language="c",
-+                        define_macros = [('_FILE_OFFSET_BITS','64'),('_USE_KNETFILE','')], 
-+                ))
-+
-+                extensions.append(Extension(
-+                        "pysam.ctabix",                   
-+                        tabix_sources + [ "lib/pysam/%s" % x for x in ( "tabix_util.c", )] +\
-+                        os_c_files + \
-+                        glob.glob( os.path.join( "lib/tabix", "*.pysam.c" ) ),
-+                        library_dirs=[],
-+                        include_dirs=[ "lib/tabix", "lib/pysam" ] + include_os,
-+                        libraries=[ "z", ],
-+                        language="c",
-+                        define_macros = [('_FILE_OFFSET_BITS','64'),
-+                                         ('_USE_KNETFILE','')], 
-+                ))
-+
-+                extensions.append(Extension(
-+                        "pysam.TabProxies",               
-+                        tabproxies_sources + os_c_files,
-+                        library_dirs=[],
-+                        include_dirs= include_os,
-+                        libraries=[ "z", ],
-+                        language="c",
-+                ))
-+
-+                extensions.append(Extension(
-+                        "pysam.cvcf",                   
-+                        cvcf_sources + os_c_files,
-+                        library_dirs=[],
-+                        include_dirs= ["lib/tabix",] + include_os,
-+                        libraries=[ "z", ],
-+                        language="c",
-+                ))
- 
- 
- 	return extensions     
diff --git a/gnu/packages/patches/delly-use-system-libraries.patch b/gnu/packages/patches/delly-use-system-libraries.patch
deleted file mode 100644
index 3315c2a176..0000000000
--- a/gnu/packages/patches/delly-use-system-libraries.patch
+++ /dev/null
@@ -1,56 +0,0 @@
---- a/Makefile	2017-04-09 12:48:15.000000000 +0200
-+++ b/Makefile	2017-06-21 14:26:02.749282787 +0200
-@@ -9,8 +9,8 @@
- 
- # Flags
- CXX=g++
--CXXFLAGS += -isystem ${SEQTK_ROOT} -isystem ${BOOST_ROOT} -pedantic -W -Wall -Wno-unknown-pragmas -D__STDC_LIMIT_MACROS -fno-strict-aliasing
--LDFLAGS += -L${SEQTK_ROOT} -L${BOOST_ROOT}/stage/lib -lboost_iostreams -lboost_filesystem -lboost_system -lboost_program_options -lboost_date_time 
-+CXXFLAGS += -pedantic -W -Wall -Wno-unknown-pragmas -D__STDC_LIMIT_MACROS -fno-strict-aliasing
-+LDFLAGS += -lboost_iostreams -lboost_filesystem -lboost_system -lboost_program_options -lboost_date_time 
- 
- # Additional flags for release/debug
- ifeq (${PARALLEL}, 1)
-@@ -23,7 +23,7 @@
- ifeq (${STATIC}, 1)
- 	LDFLAGS += -static -static-libgcc -pthread -lhts -lz
- else
--	LDFLAGS += -lhts -lz -Wl,-rpath,${SEQTK_ROOT},-rpath,${BOOST_ROOT}/stage/lib
-+	LDFLAGS += -lhts -lz
- endif
- ifeq (${DEBUG}, 1)
- 	CXXFLAGS += -g -O0 -fno-inline -DDEBUG
-@@ -41,29 +41,17 @@
- DELLYSOURCES = $(wildcard src/*.h) $(wildcard src/*.cpp)
- 
- # Targets
--TARGETS = .htslib .bcftools .boost src/delly src/cov src/dpe
-+TARGETS = src/delly src/cov src/dpe
- 
- all:   	$(TARGETS)
- 
--.htslib: $(HTSLIBSOURCES)
--	cd src/htslib && make && make lib-static && cd ../../ && touch .htslib
--
--.bcftools: $(HTSLIBSOURCES)
--	cd src/bcftools && make && cd ../../ && touch .bcftools
--
--.boost: $(BOOSTSOURCES)
--	cd src/modular-boost && ./bootstrap.sh --prefix=${PWD}/src/modular-boost --without-icu --with-libraries=iostreams,filesystem,system,program_options,date_time && ./b2 && ./b2 headers && cd ../../ && touch .boost
--
--src/delly: .htslib .bcftools .boost $(DELLYSOURCES)
--	$(CXX) $(CXXFLAGS) $@.cpp -o $@ $(LDFLAGS)
--
--src/cov: .htslib .bcftools .boost $(DELLYSOURCES)
-+src/cov: $(DELLYSOURCES)
- 	$(CXX) $(CXXFLAGS) $@.cpp -o $@ $(LDFLAGS)
- 
--src/dpe: .htslib .bcftools .boost $(DELLYSOURCES)
-+src/dpe: $(DELLYSOURCES)
- 	$(CXX) $(CXXFLAGS) $@.cpp -o $@ $(LDFLAGS)
- 
- clean:
- 	cd src/htslib && make clean
- 	cd src/modular-boost && ./b2 --clean-all
--	rm -f $(TARGETS) $(TARGETS:=.o) .htslib .boost .bcftools
-+	rm -f $(TARGETS) $(TARGETS:=.o)
diff --git a/gnu/packages/patches/doxygen-gcc-ice.patch b/gnu/packages/patches/doxygen-gcc-ice.patch
deleted file mode 100644
index fbfedcb7ab..0000000000
--- a/gnu/packages/patches/doxygen-gcc-ice.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Work around this GCC ICE: <https://bugs.gnu.org/31708>.  It shows up
-only when doing native compiles on armhf-linux.
-
-Yes it's a terrible patch, but it does the job.
-
---- doxygen-1.8.13/qtools/qutfcodec.cpp	1970-01-01 01:00:00.000000000 +0100
-+++ doxygen-1.8.13/qtools/qutfcodec.cpp	2018-06-08 14:14:29.614009929 +0200
-@@ -189,7 +189,7 @@ int QUtf16Codec::heuristicContentMatch(c
- }
- 
- 
--
-+volatile const void *bomPointer = &QChar::byteOrderMark;
- 
- class QUtf16Encoder : public QTextEncoder {
-     bool headerdone;
-@@ -209,7 +209,7 @@ public:
- 	    headerdone = TRUE;
- 	    len_in_out = (1+uc.length())*(int)sizeof(QChar);
- 	    QCString d(len_in_out);
--	    memcpy(d.rawData(),&QChar::byteOrderMark,sizeof(QChar));
-+	    memcpy(d.rawData(),(void *)bomPointer,sizeof(QChar));
- 	    memcpy(d.rawData()+sizeof(QChar),uc.unicode(),uc.length()*sizeof(QChar));
- 	    return d;
- 	}
diff --git a/gnu/packages/patches/dropbear-CVE-2018-15599.patch b/gnu/packages/patches/dropbear-CVE-2018-15599.patch
new file mode 100644
index 0000000000..a474552cd2
--- /dev/null
+++ b/gnu/packages/patches/dropbear-CVE-2018-15599.patch
@@ -0,0 +1,240 @@
+Fix CVE-2018-15599:
+
+http://lists.ucc.gu.uwa.edu.au/pipermail/dropbear/2018q3/002108.html
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-15599
+
+Patch copied from upstream source repository:
+
+https://github.com/mkj/dropbear/commit/52adbb34c32d3e2e1bcdb941e20a6f81138b8248
+
+From 52adbb34c32d3e2e1bcdb941e20a6f81138b8248 Mon Sep 17 00:00:00 2001
+From: Matt Johnston <matt@ucc.asn.au>
+Date: Thu, 23 Aug 2018 23:43:12 +0800
+Subject: [PATCH] Wait to fail invalid usernames
+
+---
+ auth.h           |  6 +++---
+ svr-auth.c       | 19 +++++--------------
+ svr-authpam.c    | 26 ++++++++++++++++++++++----
+ svr-authpasswd.c | 27 ++++++++++++++-------------
+ svr-authpubkey.c | 11 ++++++++++-
+ 5 files changed, 54 insertions(+), 35 deletions(-)
+
+diff --git a/auth.h b/auth.h
+index da498f5b..98f54683 100644
+--- a/auth.h
++++ b/auth.h
+@@ -37,9 +37,9 @@ void recv_msg_userauth_request(void);
+ void send_msg_userauth_failure(int partial, int incrfail);
+ void send_msg_userauth_success(void);
+ void send_msg_userauth_banner(const buffer *msg);
+-void svr_auth_password(void);
+-void svr_auth_pubkey(void);
+-void svr_auth_pam(void);
++void svr_auth_password(int valid_user);
++void svr_auth_pubkey(int valid_user);
++void svr_auth_pam(int valid_user);
+ 
+ #if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT
+ int svr_pubkey_allows_agentfwd(void);
+diff --git a/svr-auth.c b/svr-auth.c
+index c19c0901..edde86bc 100644
+--- a/svr-auth.c
++++ b/svr-auth.c
+@@ -149,10 +149,8 @@ void recv_msg_userauth_request() {
+ 		if (methodlen == AUTH_METHOD_PASSWORD_LEN &&
+ 				strncmp(methodname, AUTH_METHOD_PASSWORD,
+ 					AUTH_METHOD_PASSWORD_LEN) == 0) {
+-			if (valid_user) {
+-				svr_auth_password();
+-				goto out;
+-			}
++			svr_auth_password(valid_user);
++			goto out;
+ 		}
+ 	}
+ #endif
+@@ -164,10 +162,8 @@ void recv_msg_userauth_request() {
+ 		if (methodlen == AUTH_METHOD_PASSWORD_LEN &&
+ 				strncmp(methodname, AUTH_METHOD_PASSWORD,
+ 					AUTH_METHOD_PASSWORD_LEN) == 0) {
+-			if (valid_user) {
+-				svr_auth_pam();
+-				goto out;
+-			}
++			svr_auth_pam(valid_user);
++			goto out;
+ 		}
+ 	}
+ #endif
+@@ -177,12 +173,7 @@ void recv_msg_userauth_request() {
+ 	if (methodlen == AUTH_METHOD_PUBKEY_LEN &&
+ 			strncmp(methodname, AUTH_METHOD_PUBKEY,
+ 				AUTH_METHOD_PUBKEY_LEN) == 0) {
+-		if (valid_user) {
+-			svr_auth_pubkey();
+-		} else {
+-			/* pubkey has no failure delay */
+-			send_msg_userauth_failure(0, 0);
+-		}
++		svr_auth_pubkey(valid_user);
+ 		goto out;
+ 	}
+ #endif
+diff --git a/svr-authpam.c b/svr-authpam.c
+index 05e4f3e5..d201bc96 100644
+--- a/svr-authpam.c
++++ b/svr-authpam.c
+@@ -178,13 +178,14 @@ pamConvFunc(int num_msg,
+  * Keyboard interactive would be a lot nicer, but since PAM is synchronous, it
+  * gets very messy trying to send the interactive challenges, and read the
+  * interactive responses, over the network. */
+-void svr_auth_pam() {
++void svr_auth_pam(int valid_user) {
+ 
+ 	struct UserDataS userData = {NULL, NULL};
+ 	struct pam_conv pamConv = {
+ 		pamConvFunc,
+ 		&userData /* submitted to pamvConvFunc as appdata_ptr */ 
+ 	};
++	const char* printable_user = NULL;
+ 
+ 	pam_handle_t* pamHandlep = NULL;
+ 
+@@ -204,12 +205,23 @@ void svr_auth_pam() {
+ 
+ 	password = buf_getstring(ses.payload, &passwordlen);
+ 
++	/* We run the PAM conversation regardless of whether the username is valid
++	in case the conversation function has an inherent delay.
++	Use ses.authstate.username rather than ses.authstate.pw_name.
++	After PAM succeeds we then check the valid_user flag too */
++
+ 	/* used to pass data to the PAM conversation function - don't bother with
+ 	 * strdup() etc since these are touched only by our own conversation
+ 	 * function (above) which takes care of it */
+-	userData.user = ses.authstate.pw_name;
++	userData.user = ses.authstate.username;
+ 	userData.passwd = password;
+ 
++	if (ses.authstate.pw_name) {
++		printable_user = ses.authstate.pw_name;
++	} else {
++		printable_user = "<invalid username>";
++	}
++
+ 	/* Init pam */
+ 	if ((rc = pam_start("sshd", NULL, &pamConv, &pamHandlep)) != PAM_SUCCESS) {
+ 		dropbear_log(LOG_WARNING, "pam_start() failed, rc=%d, %s", 
+@@ -242,7 +254,7 @@ void svr_auth_pam() {
+ 				rc, pam_strerror(pamHandlep, rc));
+ 		dropbear_log(LOG_WARNING,
+ 				"Bad PAM password attempt for '%s' from %s",
+-				ses.authstate.pw_name,
++				printable_user,
+ 				svr_ses.addrstring);
+ 		send_msg_userauth_failure(0, 1);
+ 		goto cleanup;
+@@ -253,12 +265,18 @@ void svr_auth_pam() {
+ 				rc, pam_strerror(pamHandlep, rc));
+ 		dropbear_log(LOG_WARNING,
+ 				"Bad PAM password attempt for '%s' from %s",
+-				ses.authstate.pw_name,
++				printable_user,
+ 				svr_ses.addrstring);
+ 		send_msg_userauth_failure(0, 1);
+ 		goto cleanup;
+ 	}
+ 
++	if (!valid_user) {
++		/* PAM auth succeeded but the username isn't allowed in for another reason
++		(checkusername() failed) */
++		send_msg_userauth_failure(0, 1);
++	}
++
+ 	/* successful authentication */
+ 	dropbear_log(LOG_NOTICE, "PAM password auth succeeded for '%s' from %s",
+ 			ses.authstate.pw_name,
+diff --git a/svr-authpasswd.c b/svr-authpasswd.c
+index bdee2aa1..69c7d8af 100644
+--- a/svr-authpasswd.c
++++ b/svr-authpasswd.c
+@@ -48,22 +48,14 @@ static int constant_time_strcmp(const char* a, const char* b) {
+ 
+ /* Process a password auth request, sending success or failure messages as
+  * appropriate */
+-void svr_auth_password() {
++void svr_auth_password(int valid_user) {
+ 	
+ 	char * passwdcrypt = NULL; /* the crypt from /etc/passwd or /etc/shadow */
+ 	char * testcrypt = NULL; /* crypt generated from the user's password sent */
+-	char * password;
++	char * password = NULL;
+ 	unsigned int passwordlen;
+-
+ 	unsigned int changepw;
+ 
+-	passwdcrypt = ses.authstate.pw_passwd;
+-
+-#ifdef DEBUG_HACKCRYPT
+-	/* debugging crypt for non-root testing with shadows */
+-	passwdcrypt = DEBUG_HACKCRYPT;
+-#endif
+-
+ 	/* check if client wants to change password */
+ 	changepw = buf_getbool(ses.payload);
+ 	if (changepw) {
+@@ -73,12 +65,21 @@ void svr_auth_password() {
+ 	}
+ 
+ 	password = buf_getstring(ses.payload, &passwordlen);
+-
+-	/* the first bytes of passwdcrypt are the salt */
+-	testcrypt = crypt(password, passwdcrypt);
++	if (valid_user) {
++		/* the first bytes of passwdcrypt are the salt */
++		passwdcrypt = ses.authstate.pw_passwd;
++		testcrypt = crypt(password, passwdcrypt);
++	}
+ 	m_burn(password, passwordlen);
+ 	m_free(password);
+ 
++	/* After we have got the payload contents we can exit if the username
++	is invalid. Invalid users have already been logged. */
++	if (!valid_user) {
++		send_msg_userauth_failure(0, 1);
++		return;
++	}
++
+ 	if (testcrypt == NULL) {
+ 		/* crypt() with an invalid salt like "!!" */
+ 		dropbear_log(LOG_WARNING, "User account '%s' is locked",
+diff --git a/svr-authpubkey.c b/svr-authpubkey.c
+index aa6087c9..ff481c87 100644
+--- a/svr-authpubkey.c
++++ b/svr-authpubkey.c
+@@ -79,7 +79,7 @@ static int checkfileperm(char * filename);
+ 
+ /* process a pubkey auth request, sending success or failure message as
+  * appropriate */
+-void svr_auth_pubkey() {
++void svr_auth_pubkey(int valid_user) {
+ 
+ 	unsigned char testkey; /* whether we're just checking if a key is usable */
+ 	char* algo = NULL; /* pubkey algo */
+@@ -102,6 +102,15 @@ void svr_auth_pubkey() {
+ 	keybloblen = buf_getint(ses.payload);
+ 	keyblob = buf_getptr(ses.payload, keybloblen);
+ 
++	if (!valid_user) {
++		/* Return failure once we have read the contents of the packet
++		required to validate a public key. 
++		Avoids blind user enumeration though it isn't possible to prevent
++		testing for user existence if the public key is known */
++		send_msg_userauth_failure(0, 0);
++		goto out;
++	}
++
+ 	/* check if the key is valid */
+ 	if (checkpubkey(algo, algolen, keyblob, keybloblen) == DROPBEAR_FAILURE) {
+ 		send_msg_userauth_failure(0, 0);
diff --git a/gnu/packages/patches/emacs-exwm-fix-fullscreen-issue.patch b/gnu/packages/patches/emacs-exwm-fix-fullscreen-issue.patch
deleted file mode 100644
index 5c9bd36598..0000000000
--- a/gnu/packages/patches/emacs-exwm-fix-fullscreen-issue.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 13a14579cc1bb772735f895dd5b4b90c6812f3ee Mon Sep 17 00:00:00 2001
-From: Chris Feng <chris.w.feng@gmail.com>
-Date: Sun, 29 Jul 2018 00:00:00 +0000
-Subject: [PATCH] Fix issues with destroying full screen X windows
-
-* exwm-manage.el (exwm-manage--unmanage-window): Set the Emacs window
-of an full screen X window as non-dedicated before killing its buffer
-so as not to cause other side effects.
----
- exwm-manage.el | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/exwm-manage.el b/exwm-manage.el
-index a0a9e05..349157f 100644
---- a/exwm-manage.el
-+++ b/exwm-manage.el
-@@ -392,6 +392,10 @@ manager is shutting down."
-                                :window window :parent exwm--root :x 0 :y 0))
-             (xcb:+request exwm--connection
-                 (make-instance 'xcb:DestroyWindow :window container))))
-+        (when (exwm-layout--fullscreen-p)
-+          (let ((window (get-buffer-window)))
-+            (when window
-+              (set-window-dedicated-p window nil))))
-         (exwm-manage--set-client-list)
-         (xcb:flush exwm--connection))
-       (let ((kill-buffer-func
diff --git a/gnu/packages/patches/emacs-pdf-tools-poppler.patch b/gnu/packages/patches/emacs-pdf-tools-poppler.patch
new file mode 100644
index 0000000000..0477508fa9
--- /dev/null
+++ b/gnu/packages/patches/emacs-pdf-tools-poppler.patch
@@ -0,0 +1,41 @@
+Fix build issue with recent Poppler:
+  <https://github.com/politza/pdf-tools/issues/372>.
+
+This combines upstream commits
+6cd76dec9aece2a8daa90f17ab77fbf773157a1d..50a5297b82e26cfd52f6c00645ddc1057099d6a7
+for this file.
+
+diff --git a/server/poppler-hack.cc b/server/poppler-hack.cc
+index 0c62f73..427f9df 100644
+--- a/server/poppler-hack.cc
++++ b/server/poppler-hack.cc
+@@ -51,7 +51,10 @@ GType poppler_annot_markup_get_type (void) G_GNUC_CONST;
+     double y2;
+   };
+ 
+-  char *_xpoppler_goo_string_to_utf8(GooString *s)
++  // This function does not modify its argument s, but for
++  // compatibility reasons (e.g. getLength in GooString.h before 2015)
++  // with older poppler code, it can't be declared as such.
++  char *_xpoppler_goo_string_to_utf8(/* const */ GooString *s)
+   {
+     char *result;
+ 
+@@ -85,7 +88,7 @@ GType poppler_annot_markup_get_type (void) G_GNUC_CONST;
+   // Set the rectangle of an annotation.  It was first added in v0.26.
+   void xpoppler_annot_set_rectangle (PopplerAnnot *a, PopplerRectangle *rectangle)
+   {
+-    GooString *state = a->annot->getAppearState ();
++    GooString *state = (GooString*) a->annot->getAppearState ();
+     char *ustate = _xpoppler_goo_string_to_utf8 (state);
+ 
+     a->annot->setRect (rectangle->x1, rectangle->y1,
+@@ -105,7 +108,7 @@ GType poppler_annot_markup_get_type (void) G_GNUC_CONST;
+     g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), NULL);
+ 
+     annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot);
+-    text = annot->getDate ();
++    text = (GooString*) annot->getDate ();
+ 
+     return text ? _xpoppler_goo_string_to_utf8 (text) : NULL;
+   }
diff --git a/gnu/packages/patches/emacs-realgud-fix-configure-ac.patch b/gnu/packages/patches/emacs-realgud-fix-configure-ac.patch
new file mode 100644
index 0000000000..8165857c87
--- /dev/null
+++ b/gnu/packages/patches/emacs-realgud-fix-configure-ac.patch
@@ -0,0 +1,27 @@
+From a293690f29407ac54a218d6d20c2142e1a0319d1 Mon Sep 17 00:00:00 2001
+From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
+Date: Wed, 31 Oct 2018 00:08:34 -0400
+Subject: [PATCH] configure.ac: Fix NO_CHECK_EMACS_PACKAGES elisp.
+
+Remove the extraneous trailing parenthesis.
+---
+ configure.ac | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index de0d932..69bcea7 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -25,8 +25,7 @@ AC_MSG_NOTICE("Checking prerequiste packages")
+ $EMACS -batch -q --no-site-file -eval \
+   '(dolist (package
+          (quote (cl-lib loc-changes load-relative test-simple)))
+-        (require package))
+-   )'
++        (require package))'
+ fi
+ if test $? -ne 0 ; then
+     AC_MSG_ERROR([Can't continue until above error is corrected.])
+-- 
+2.19.0
+
diff --git a/gnu/packages/patches/findutils-gnulib-libio.patch b/gnu/packages/patches/findutils-gnulib-libio.patch
new file mode 100644
index 0000000000..79f9fd914d
--- /dev/null
+++ b/gnu/packages/patches/findutils-gnulib-libio.patch
@@ -0,0 +1,114 @@
+Adjust to removal of libio interface in glibc 2.28.
+
+Based on this gnulib commit:
+https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4af4a4a71827c0bc5e0ec67af23edef4f15cee8e
+
+diff --git a/gl/lib/fflush.c b/gl/lib/fflush.c
+index 5ae3e41..7a82470 100644
+--- a/gl/lib/fflush.c
++++ b/gl/lib/fflush.c
+@@ -33,7 +33,7 @@
+ #undef fflush
+ 
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+ /* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
+ static void
+@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
+ 
+ #endif
+ 
+-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
++#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
+ 
+ # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
+@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
+   if (stream == NULL || ! freading (stream))
+     return fflush (stream);
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+   clear_ungetc_buffer_preserving_position (stream);
+ 
+diff --git a/gl/lib/fpurge.c b/gl/lib/fpurge.c
+index f313b22..ecdf82d 100644
+--- a/gl/lib/fpurge.c
++++ b/gl/lib/fpurge.c
+@@ -62,7 +62,7 @@ fpurge (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   fp->_IO_read_end = fp->_IO_read_ptr;
+   fp->_IO_write_ptr = fp->_IO_write_base;
+   /* Avoid memory leak when there is an active ungetc buffer.  */
+diff --git a/gl/lib/freadahead.c b/gl/lib/freadahead.c
+index 094daab..3f8101e 100644
+--- a/gl/lib/freadahead.c
++++ b/gl/lib/freadahead.c
+@@ -25,7 +25,7 @@
+ size_t
+ freadahead (FILE *fp)
+ {
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   if (fp->_IO_write_ptr > fp->_IO_write_base)
+     return 0;
+   return (fp->_IO_read_end - fp->_IO_read_ptr)
+diff --git a/gl/lib/freading.c b/gl/lib/freading.c
+index 0512b19..8c48fe4 100644
+--- a/gl/lib/freading.c
++++ b/gl/lib/freading.c
+@@ -31,7 +31,7 @@ freading (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   return ((fp->_flags & _IO_NO_WRITES) != 0
+           || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
+               && fp->_IO_read_base != NULL));
+diff --git a/gl/lib/fseeko.c b/gl/lib/fseeko.c
+index 1c65d2a..9026408 100644
+--- a/gl/lib/fseeko.c
++++ b/gl/lib/fseeko.c
+@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
+ #endif
+ 
+   /* These tests are based on fpurge.c.  */
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   if (fp->_IO_read_end == fp->_IO_read_ptr
+       && fp->_IO_write_ptr == fp->_IO_write_base
+       && fp->_IO_save_base == NULL)
+@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
+           return -1;
+         }
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+       fp->_flags &= ~_IO_EOF_SEEN;
+       fp->_offset = pos;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+diff --git a/gl/lib/stdio-impl.h b/gl/lib/stdio-impl.h
+index 502d891..ea38ee2 100644
+--- a/gl/lib/stdio-impl.h
++++ b/gl/lib/stdio-impl.h
+@@ -18,6 +18,12 @@
+    the same implementation of stdio extension API, except that some fields
+    have different naming conventions, or their access requires some casts.  */
+ 
++/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
++   problem by defining it ourselves.  FIXME: Do not rely on glibc
++   internals.  */
++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
++# define _IO_IN_BACKUP 0x100
++#endif
+ 
+ /* BSD stdio derived implementations.  */
+ 
diff --git a/gnu/packages/patches/findutils-makedev.patch b/gnu/packages/patches/findutils-makedev.patch
new file mode 100644
index 0000000000..2f16c625d8
--- /dev/null
+++ b/gnu/packages/patches/findutils-makedev.patch
@@ -0,0 +1,22 @@
+Include <sys/sysmacros.h> for "makedev".
+
+Taken from this gnulib commit:
+https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4da63c5881f60f71999a943612da9112232b9161
+
+diff --git a/gl/lib/mountlist.c b/gl/lib/mountlist.c
+index bb4e4ee21..cf4020e2a 100644
+--- a/gl/lib/mountlist.c
++++ b/gl/lib/mountlist.c
+@@ -37,6 +37,12 @@
+ # include <sys/param.h>
+ #endif
+ 
++#if MAJOR_IN_MKDEV
++# include <sys/mkdev.h>
++#elif MAJOR_IN_SYSMACROS
++# include <sys/sysmacros.h>
++#endif
++
+ #if defined MOUNTED_GETFSSTAT   /* OSF_1 and Darwin1.3.x */
+ # if HAVE_SYS_UCRED_H
+ #  include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
diff --git a/gnu/packages/patches/freetype-CVE-2018-6942.patch b/gnu/packages/patches/freetype-CVE-2018-6942.patch
deleted file mode 100644
index 680f357765..0000000000
--- a/gnu/packages/patches/freetype-CVE-2018-6942.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-Fix CVE-2018-6942:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-6942
-https://people.canonical.com/~ubuntu-security/cve/2018/CVE-2018-6942.html
-
-Copied from upstream (ChangeLog section removed):
-https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=29c759284e305ec428703c9a5831d0b1fc3497ef
-
-diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
-index d855aaa..551f14a 100644
---- a/src/truetype/ttinterp.c
-+++ b/src/truetype/ttinterp.c
-@@ -7532,8 +7532,16 @@
-       return;
-     }
- 
--    for ( i = 0; i < num_axes; i++ )
--      args[i] = coords[i] >> 2; /* convert 16.16 to 2.14 format */
-+    if ( coords )
-+    {
-+      for ( i = 0; i < num_axes; i++ )
-+        args[i] = coords[i] >> 2; /* convert 16.16 to 2.14 format */
-+    }
-+    else
-+    {
-+      for ( i = 0; i < num_axes; i++ )
-+        args[i] = 0;
-+    }
-   }
- 
- 
diff --git a/gnu/packages/patches/gcc-4.9-libsanitizer-ustat.patch b/gnu/packages/patches/gcc-4.9-libsanitizer-ustat.patch
new file mode 100644
index 0000000000..795881ab9b
--- /dev/null
+++ b/gnu/packages/patches/gcc-4.9-libsanitizer-ustat.patch
@@ -0,0 +1,37 @@
+Remove use of deprecated ustat interface in glibc 2.28:
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85835
+
+Adapted to GCC 4 series from this upstream patch:
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=260684
+
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -81,7 +81,6 @@
+ #include <sys/statvfs.h>
+ #include <sys/timex.h>
+ #include <sys/user.h>
+-#include <sys/ustat.h>
+ #include <linux/cyclades.h>
+ #include <linux/if_eql.h>
+ #include <linux/if_plip.h>
+@@ -163,7 +162,19 @@
+   unsigned struct_old_utsname_sz = sizeof(struct old_utsname);
+   unsigned struct_oldold_utsname_sz = sizeof(struct oldold_utsname);
+   unsigned struct_itimerspec_sz = sizeof(struct itimerspec);
+-  unsigned struct_ustat_sz = sizeof(struct ustat);
++  // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
++  // has been removed from glibc 2.28.
++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
++  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
++  || defined(__x86_64__)
++#define SIZEOF_STRUCT_USTAT 32
++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
++  || defined(__powerpc__) || defined(__s390__)
++#define SIZEOF_STRUCT_USTAT 20
++#else
++#error Unknown size of struct ustat
++#endif
++  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
+ #endif // SANITIZER_LINUX
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
diff --git a/gnu/packages/patches/gcc-libsanitizer-ustat.patch b/gnu/packages/patches/gcc-libsanitizer-ustat.patch
new file mode 100644
index 0000000000..a4e0c6affa
--- /dev/null
+++ b/gnu/packages/patches/gcc-libsanitizer-ustat.patch
@@ -0,0 +1,41 @@
+Remove use of deprecated ustat interface in glibc 2.28:
+
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85835
+
+Taken from upstream:
+
+https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=260684
+
+diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+index 858bb2184505..de18e56d11cf 100644
+--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -157,7 +157,6 @@ typedef struct user_fpregs elf_fpregset_t;
+ # include <sys/procfs.h>
+ #endif
+ #include <sys/user.h>
+-#include <sys/ustat.h>
+ #include <linux/cyclades.h>
+ #include <linux/if_eql.h>
+ #include <linux/if_plip.h>
+@@ -250,7 +249,19 @@ namespace __sanitizer {
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+-  unsigned struct_ustat_sz = sizeof(struct ustat);
++  // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
++  // has been removed from glibc 2.28.
++#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
++  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
++  || defined(__x86_64__)
++#define SIZEOF_STRUCT_USTAT 32
++#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
++  || defined(__powerpc__) || defined(__s390__)
++#define SIZEOF_STRUCT_USTAT 20
++#else
++#error Unknown size of struct ustat
++#endif
++  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
+   unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
+   unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
+ #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
diff --git a/gnu/packages/patches/gcc-strmov-store-file-names.patch b/gnu/packages/patches/gcc-strmov-store-file-names.patch
index 9f9162855d..7358de3326 100644
--- a/gnu/packages/patches/gcc-strmov-store-file-names.patch
+++ b/gnu/packages/patches/gcc-strmov-store-file-names.patch
@@ -15,7 +15,7 @@ and <https://bugs.gnu.org/30395>.
 
 --- gcc-5.3.0/gcc/builtins.c	2016-10-18 10:50:46.080616285 +0200
 +++ gcc-5.3.0/gcc/builtins.c	2016-11-09 15:26:43.693042737 +0100
-@@ -3192,6 +3192,54 @@ determine_block_size (tree len, rtx len_
+@@ -3192,6 +3192,58 @@ determine_block_size (tree len, rtx len_
  			  GET_MODE_MASK (GET_MODE (len_rtx)));
  }
  
@@ -35,9 +35,13 @@ and <https://bugs.gnu.org/30395>.
 +  if (TREE_CODE (str) == VAR_DECL
 +      && TREE_STATIC (str)
 +      && TREE_READONLY (str))
-+    /* STR may be a 'static const' variable whose initial value
-+       is a string constant.  See <https://bugs.gnu.org/30395>.  */
-+    str = DECL_INITIAL (str);
++    {
++      /* STR may be a 'static const' variable whose initial value
++         is a string constant.  See <https://bugs.gnu.org/30395>.  */
++      str = DECL_INITIAL (str);
++      if (str == NULL_TREE)
++        return false;
++    }
 +
 +  if (TREE_CODE (str) != STRING_CST)
 +    return false;
diff --git a/gnu/packages/patches/gd-CVE-2018-1000222.patch b/gnu/packages/patches/gd-CVE-2018-1000222.patch
new file mode 100644
index 0000000000..7e94295bb6
--- /dev/null
+++ b/gnu/packages/patches/gd-CVE-2018-1000222.patch
@@ -0,0 +1,87 @@
+Fix CVE-2018-1000222:
+
+https://github.com/libgd/libgd/issues/447
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000222
+
+Patch copied from upstream source repository:
+
+https://github.com/libgd/libgd/commit/4b1e18a00ce7c4b7e6919c3b3109a034393b805a
+
+From 4b1e18a00ce7c4b7e6919c3b3109a034393b805a Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 14 Jul 2018 13:54:08 -0400
+Subject: [PATCH] bmp: check return value in gdImageBmpPtr
+
+Closes #447.
+
+(cherry picked from commit ac16bdf2d41724b5a65255d4c28fb0ec46bc42f5)
+---
+ src/gd_bmp.c | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/src/gd_bmp.c b/src/gd_bmp.c
+index ccafdcd..d625da1 100644
+--- a/src/gd_bmp.c
++++ b/src/gd_bmp.c
+@@ -48,6 +48,8 @@ static int bmp_read_4bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp
+ static int bmp_read_8bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header);
+ static int bmp_read_rle(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info);
+ 
++static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression);
++
+ #define BMP_DEBUG(s)
+ 
+ static int gdBMPPutWord(gdIOCtx *out, int w)
+@@ -88,8 +90,10 @@ BGD_DECLARE(void *) gdImageBmpPtr(gdImagePtr im, int *size, int compression)
+ 	void *rv;
+ 	gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
+ 	if (out == NULL) return NULL;
+-	gdImageBmpCtx(im, out, compression);
+-	rv = gdDPExtractData(out, size);
++	if (!_gdImageBmpCtx(im, out, compression))
++		rv = gdDPExtractData(out, size);
++	else
++		rv = NULL;
+ 	out->gd_free(out);
+ 	return rv;
+ }
+@@ -142,6 +146,11 @@ BGD_DECLARE(void) gdImageBmp(gdImagePtr im, FILE *outFile, int compression)
+ 		compression - whether to apply RLE or not.
+ */
+ BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
++{
++	_gdImageBmpCtx(im, out, compression);
++}
++
++static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
+ {
+ 	int bitmap_size = 0, info_size, total_size, padding;
+ 	int i, row, xpos, pixel;
+@@ -149,6 +158,7 @@ BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
+ 	unsigned char *uncompressed_row = NULL, *uncompressed_row_start = NULL;
+ 	FILE *tmpfile_for_compression = NULL;
+ 	gdIOCtxPtr out_original = NULL;
++	int ret = 1;
+ 
+ 	/* No compression if its true colour or we don't support seek */
+ 	if (im->trueColor) {
+@@ -326,6 +336,7 @@ BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
+ 		out_original = NULL;
+ 	}
+ 
++	ret = 0;
+ cleanup:
+ 	if (tmpfile_for_compression) {
+ #ifdef _WIN32
+@@ -339,7 +350,7 @@ cleanup:
+ 	if (out_original) {
+ 		out_original->gd_free(out_original);
+ 	}
+-	return;
++	return ret;
+ }
+ 
+ static int compress_row(unsigned char *row, int length)
+-- 
+2.18.0
+
diff --git a/gnu/packages/patches/gemma-intel-compat.patch b/gnu/packages/patches/gemma-intel-compat.patch
deleted file mode 100644
index f12ec56d9b..0000000000
--- a/gnu/packages/patches/gemma-intel-compat.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From da1ed24209121f7b0f03f360b1029d7125a38e70 Mon Sep 17 00:00:00 2001
-From: Efraim Flashner <efraim@flashner.co.il>
-Date: Tue, 4 Jul 2017 12:44:53 +0300
-Subject: [PATCH] Add NO_INTEL_COMPAT flag to Makefile.
-
-see also: https://github.com/xiangzhou/GEMMA/pull/47
-
----
- Makefile | 12 ++++++++----
- 1 file changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 5bb8748..712b1ad 100644
---- a/Makefile
-+++ b/Makefile
-@@ -11,6 +11,7 @@
- SYS = LNX
- # Leave blank after "=" to disable; put "= 1" to enable
- WITH_LAPACK = 1
-+NO_INTEL_COMPAT = 
- FORCE_32BIT = 
- FORCE_DYNAMIC = 
- DIST_NAME = gemma-0.96
-@@ -64,10 +65,13 @@ endif
-   HDR += $(SRC_DIR)/lapack.h
- endif
- 
--ifdef FORCE_32BIT
--  CPPFLAGS += -m32
--else
--  CPPFLAGS += -m64
-+ifdef NO_INTEL_COMPAT
-+  else
-+  ifdef FORCE_32BIT
-+    CPPFLAGS += -m32
-+  else
-+    CPPFLAGS += -m64
-+  endif
- endif
- 
- ifdef FORCE_DYNAMIC
--- 
-2.13.2
-
diff --git a/gnu/packages/patches/ghc-haddock-library-unbundle.patch b/gnu/packages/patches/ghc-haddock-library-unbundle.patch
new file mode 100644
index 0000000000..0e8b548956
--- /dev/null
+++ b/gnu/packages/patches/ghc-haddock-library-unbundle.patch
@@ -0,0 +1,86 @@
+This patch (inspired by Debian) allows ghc-haddock-library to use our
+ghc-attoparsec package instead of using a bundled version.
+
+--- a/haddock-library.cabal	2018-09-01 01:22:18.676855884 -0400
++++ b/haddock-library.cabal	2018-09-01 01:25:10.501150260 -0400
+@@ -10,7 +10,6 @@
+                       itself, see the ‘haddock’ package.
+ license:              BSD3
+ license-files:        LICENSE
+-                      vendor/attoparsec-0.13.1.0/LICENSE
+ maintainer:           Alex Biehl <alexbiehl@gmail.com>, Simon Hengel <sol@typeful.net>, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>
+ homepage:             http://www.haskell.org/haddock/
+ bug-reports:          https://github.com/haskell/haddock/issues
+@@ -28,7 +27,6 @@
+     , containers   >= 0.4.2.1 && < 0.6
+     , transformers >= 0.3.0   && < 0.6
+ 
+-  -- internal sub-lib
+   build-depends:        attoparsec
+ 
+   hs-source-dirs:       src
+@@ -49,42 +47,6 @@
+   if impl(ghc >= 8.0)
+     ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
+ 
+-library attoparsec
+-  default-language:     Haskell2010
+-
+-  build-depends:
+-      base         >= 4.5     && < 4.12
+-    , bytestring   >= 0.9.2.1 && < 0.11
+-    , deepseq      >= 1.3     && < 1.5
+-
+-  hs-source-dirs:       vendor/attoparsec-0.13.1.0
+-
+-  -- NB: haddock-library needs only small part of lib:attoparsec
+-  --     internally, so we only bundle that subset here
+-  exposed-modules:
+-    Data.Attoparsec.ByteString
+-    Data.Attoparsec.ByteString.Char8
+-    Data.Attoparsec.Combinator
+-
+-  other-modules:
+-    Data.Attoparsec
+-    Data.Attoparsec.ByteString.Buffer
+-    Data.Attoparsec.ByteString.FastSet
+-    Data.Attoparsec.ByteString.Internal
+-    Data.Attoparsec.Internal
+-    Data.Attoparsec.Internal.Fhthagn
+-    Data.Attoparsec.Internal.Types
+-    Data.Attoparsec.Number
+-
+-  ghc-options:          -funbox-strict-fields -Wall -fwarn-tabs -O2
+-
+-  ghc-options: -Wall
+-  if impl(ghc >= 8.0)
+-    ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
+-  else
+-    build-depends: semigroups ^>= 0.18.3, fail ^>= 4.9.0.0
+-
+-
+ test-suite spec
+   type:             exitcode-stdio-1.0
+   default-language: Haskell2010
+@@ -115,11 +77,10 @@
+     , hspec         ^>= 2.4.4
+     , QuickCheck    ^>= 2.11
+ 
+-  -- internal sub-lib
+   build-depends: attoparsec
+ 
+   -- Versions for the dependencies below are transitively pinned by
+-  -- dependency on haddock-library:lib:attoparsec
++  -- dependency on attoparsec
+   build-depends:
+       base
+     , bytestring
+@@ -146,7 +107,7 @@
+     haddock-library
+ 
+   -- Versions for the dependencies below are transitively pinned by
+-  -- dependency on haddock-library:lib:attoparsec
++  -- dependency on attoparsec
+   build-depends:
+       base
+ 
diff --git a/gnu/packages/patches/ghostscript-CVE-2018-10194.patch b/gnu/packages/patches/ghostscript-CVE-2018-10194.patch
deleted file mode 100644
index 242e57c27c..0000000000
--- a/gnu/packages/patches/ghostscript-CVE-2018-10194.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-Fix CVE-2018-10194:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-10194
-https://bugs.ghostscript.com/show_bug.cgi?id=699255
-
-Patch copied from upstream source repository:
-
-https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=39b1e54b2968620723bf32e96764c88797714879
-
-From 39b1e54b2968620723bf32e96764c88797714879 Mon Sep 17 00:00:00 2001
-From: Ken Sharp <ken.sharp@artifex.com>
-Date: Wed, 18 Apr 2018 15:46:32 +0100
-Subject: [PATCH] pdfwrite - Guard against trying to output an infinite number
-
-Bug #699255 " Buffer overflow on pprintg1 due to mishandle postscript file data to pdf"
-
-The file uses an enormous parameter to xyxhow, causing an overflow in
-the calculation of text positioning (value > 1e39).
-
-Since this is basically a nonsense value, and PostScript only supports
-real values up to 1e38, this patch follows the same approach as for
-a degenerate CTM, and treats it as 0.
-
-Adobe Acrobat Distiller throws a limitcheck error, so we could do that
-instead if this approach proves to be a problem.
----
- devices/vector/gdevpdts.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/devices/vector/gdevpdts.c b/devices/vector/gdevpdts.c
-index 848ad781f..172fe6bc3 100644
---- a/devices/vector/gdevpdts.c
-+++ b/devices/vector/gdevpdts.c
-@@ -103,9 +103,14 @@ append_text_move(pdf_text_state_t *pts, double dw)
- static int
- set_text_distance(gs_point *pdist, double dx, double dy, const gs_matrix *pmat)
- {
--    int code = gs_distance_transform_inverse(dx, dy, pmat, pdist);
-+    int code;
-     double rounded;
- 
-+    if (dx > 1e38 || dy > 1e38)
-+        code = gs_error_undefinedresult;
-+    else
-+        code = gs_distance_transform_inverse(dx, dy, pmat, pdist);
-+
-     if (code == gs_error_undefinedresult) {
-         /* The CTM is degenerate.
-            Can't know the distance in user space.
--- 
-2.18.0
-
diff --git a/gnu/packages/patches/ghostscript-CVE-2018-16509.patch b/gnu/packages/patches/ghostscript-CVE-2018-16509.patch
new file mode 100644
index 0000000000..50ffa3cb98
--- /dev/null
+++ b/gnu/packages/patches/ghostscript-CVE-2018-16509.patch
@@ -0,0 +1,193 @@
+Ghostscript 9.24 was released with an incomplete fix for CVE-2018-16509:
+https://nvd.nist.gov/vuln/detail/CVE-2018-16509
+https://bugs.chromium.org/p/project-zero/issues/detail?id=1640#c19
+https://bugs.ghostscript.com/show_bug.cgi?id=699718
+
+The reproducers no longer work after applying these commits:
+
+https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=5812b1b78fc4d36fdc293b7859de69241140d590
+https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=e914f1da46e33decc534486598dc3eadf69e6efb
+https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=3e5d316b72e3965b7968bb1d96baa137cd063ac6
+https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=643b24dbd002fb9c131313253c307cf3951b3d47
+
+This patch is a "squashed" version of those.
+
+diff --git a/Resource/Init/gs_setpd.ps b/Resource/Init/gs_setpd.ps
+index bba3c8c0e..8fa7c51df 100644
+--- a/Resource/Init/gs_setpd.ps
++++ b/Resource/Init/gs_setpd.ps
+@@ -95,27 +95,41 @@ level2dict begin
+  {	% Since setpagedevice doesn't create new device objects,
+         % we must (carefully) reinstall the old parameters in
+         % the same device.
+-   .currentpagedevice pop //null currentdevice //null .trysetparams
++   .currentpagedevice pop //null currentdevice //null
++   { .trysetparams } .internalstopped
++   {
++     //null
++   } if
+    dup type /booleantype eq
+     { pop pop }
+-    {		% This should never happen!
++    {
+       SETPDDEBUG { (Error in .trysetparams!) = pstack flush } if
+-      cleartomark pop pop pop
++      {cleartomark pop pop pop} .internalstopped pop
++      % if resetting the entire device state failed, at least put back the
++      % security related key
++      currentdevice //null //false mark /.LockSafetyParams
++      currentpagedevice /.LockSafetyParams .knownget not
++      {systemdict /SAFER .knownget not {//false} } if
++      .putdeviceparamsonly
+       /.installpagedevice cvx /rangecheck signalerror
+     }
+    ifelse pop pop
+         % A careful reading of the Red Book reveals that an erasepage
+         % should occur, but *not* an initgraphics.
+    erasepage .beginpage
+- } bind def
++ } bind executeonly def
+ 
+ /.uninstallpagedevice
+- { 2 .endpage { .currentnumcopies //false .outputpage } if
++ {
++   {2 .endpage { .currentnumcopies //false .outputpage } if} .internalstopped pop
+    nulldevice
+  } bind def
+ 
+ (%grestorepagedevice) cvn
+- { .uninstallpagedevice grestore .installpagedevice
++ {
++ .uninstallpagedevice
++ grestore
++ .installpagedevice
+  } bind def
+ 
+ (%grestoreallpagedevice) cvn
+diff --git a/psi/zdevice2.c b/psi/zdevice2.c
+index 0c7080d57..159a0c0d9 100644
+--- a/psi/zdevice2.c
++++ b/psi/zdevice2.c
+@@ -251,8 +251,8 @@ z2currentgstate(i_ctx_t *i_ctx_p)
+ /* ------ Wrappers for operators that reset the graphics state. ------ */
+ 
+ /* Check whether we need to call out to restore the page device. */
+-static bool
+-restore_page_device(const gs_gstate * pgs_old, const gs_gstate * pgs_new)
++static int
++restore_page_device(i_ctx_t *i_ctx_p, const gs_gstate * pgs_old, const gs_gstate * pgs_new)
+ {
+     gx_device *dev_old = gs_currentdevice(pgs_old);
+     gx_device *dev_new;
+@@ -260,9 +260,10 @@ restore_page_device(const gs_gstate * pgs_old, const gs_gstate * pgs_new)
+     gx_device *dev_t2;
+     bool samepagedevice = obj_eq(dev_old->memory, &gs_int_gstate(pgs_old)->pagedevice,
+         &gs_int_gstate(pgs_new)->pagedevice);
++    bool LockSafetyParams = dev_old->LockSafetyParams;
+ 
+     if ((dev_t1 = (*dev_proc(dev_old, get_page_device)) (dev_old)) == 0)
+-        return false;
++        return 0;
+     /* If we are going to putdeviceparams in a callout, we need to */
+     /* unlock temporarily.  The device will be re-locked as needed */
+     /* by putdeviceparams from the pgs_old->pagedevice dict state. */
+@@ -271,23 +272,51 @@ restore_page_device(const gs_gstate * pgs_old, const gs_gstate * pgs_new)
+     dev_new = gs_currentdevice(pgs_new);
+     if (dev_old != dev_new) {
+         if ((dev_t2 = (*dev_proc(dev_new, get_page_device)) (dev_new)) == 0)
+-            return false;
+-        if (dev_t1 != dev_t2)
+-            return true;
++            samepagedevice = true;
++        else if (dev_t1 != dev_t2)
++            samepagedevice = false;
++    }
++
++    if (LockSafetyParams && !samepagedevice) {
++        const int required_ops = 512;
++        const int required_es = 32;
++
++        /* The %grestorepagedevice must complete: the biggest danger
++           is operand stack overflow. As we use get/putdeviceparams
++           that means pushing all the device params onto the stack,
++           pdfwrite having by far the largest number of parameters
++           at (currently) 212 key/value pairs - thus needing (currently)
++           424 entries on the op stack. Allowing for working stack
++           space, and safety margin.....
++         */
++        if (required_ops + ref_stack_count(&o_stack) >= ref_stack_max_count(&o_stack)) {
++           gs_currentdevice(pgs_old)->LockSafetyParams = LockSafetyParams;
++           return_error(gs_error_stackoverflow);
++        }
++        /* We also want enough exec stack space - 32 is an overestimate of
++           what we need to complete the Postscript call out.
++         */
++        if (required_es + ref_stack_count(&e_stack) >= ref_stack_max_count(&e_stack)) {
++           gs_currentdevice(pgs_old)->LockSafetyParams = LockSafetyParams;
++           return_error(gs_error_execstackoverflow);
++        }
+     }
+     /*
+      * The current implementation of setpagedevice just sets new
+      * parameters in the same device object, so we have to check
+      * whether the page device dictionaries are the same.
+      */
+-    return !samepagedevice;
++    return samepagedevice ? 0 : 1;
+ }
+ 
+ /* - grestore - */
+ static int
+ z2grestore(i_ctx_t *i_ctx_p)
+ {
+-    if (!restore_page_device(igs, gs_gstate_saved(igs)))
++    int code = restore_page_device(i_ctx_p, igs, gs_gstate_saved(igs));
++    if (code < 0) return code;
++
++    if (code == 0)
+         return gs_grestore(igs);
+     return push_callout(i_ctx_p, "%grestorepagedevice");
+ }
+@@ -297,7 +326,9 @@ static int
+ z2grestoreall(i_ctx_t *i_ctx_p)
+ {
+     for (;;) {
+-        if (!restore_page_device(igs, gs_gstate_saved(igs))) {
++        int code = restore_page_device(i_ctx_p, igs, gs_gstate_saved(igs));
++        if (code < 0) return code;
++        if (code == 0) {
+             bool done = !gs_gstate_saved(gs_gstate_saved(igs));
+ 
+             gs_grestore(igs);
+@@ -328,11 +359,15 @@ z2restore(i_ctx_t *i_ctx_p)
+     if (code < 0) return code;
+ 
+     while (gs_gstate_saved(gs_gstate_saved(igs))) {
+-        if (restore_page_device(igs, gs_gstate_saved(igs)))
++        code = restore_page_device(i_ctx_p, igs, gs_gstate_saved(igs));
++        if (code < 0) return code;
++        if (code > 0)
+             return push_callout(i_ctx_p, "%restore1pagedevice");
+         gs_grestore(igs);
+     }
+-    if (restore_page_device(igs, gs_gstate_saved(igs)))
++    code = restore_page_device(i_ctx_p, igs, gs_gstate_saved(igs));
++    if (code < 0) return code;
++    if (code > 0)
+         return push_callout(i_ctx_p, "%restorepagedevice");
+ 
+     code = dorestore(i_ctx_p, asave);
+@@ -355,9 +390,12 @@ static int
+ z2setgstate(i_ctx_t *i_ctx_p)
+ {
+     os_ptr op = osp;
++    int code;
+ 
+     check_stype(*op, st_igstate_obj);
+-    if (!restore_page_device(igs, igstate_ptr(op)))
++    code = restore_page_device(i_ctx_p, igs, igstate_ptr(op));
++    if (code < 0) return code;
++    if (code == 0)
+         return zsetgstate(i_ctx_p);
+     return push_callout(i_ctx_p, "%setgstatepagedevice");
+ }
diff --git a/gnu/packages/patches/ghostscript-bug-699708.patch b/gnu/packages/patches/ghostscript-bug-699708.patch
new file mode 100644
index 0000000000..1567be1c6f
--- /dev/null
+++ b/gnu/packages/patches/ghostscript-bug-699708.patch
@@ -0,0 +1,160 @@
+Additional security fix that missed 9.24.
+
+Taken from upstream:
+http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=fb713b3818b52d8a6cf62c951eba2e1795ff9624
+
+From fb713b3818b52d8a6cf62c951eba2e1795ff9624 Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Thu, 6 Sep 2018 09:16:22 +0100
+Subject: [PATCH] Bug 699708 (part 1): 'Hide' non-replaceable error handlers
+ for SAFER
+
+We already had a 'private' dictionary for non-standard errors: gserrordict.
+
+This now includes all the default error handlers, the dictionary is made
+noaccess and all the prodedures are bound and executeonly.
+
+When running with -dSAFER, in the event of a Postscript error, instead of
+pulling the handler from errordict, we'll pull it from gserrordict - thus
+malicious input cannot trigger problems by the use of custom error handlers.
+
+errordict remains open and writeable, so files such as the Quality Logic tests
+that install their own handlers will still 'work', with the exception that the
+custom error handlers will not be called.
+
+This is a 'first pass', 'sledgehammer' approach: a nice addition would to allow
+an integrator to specify a list of errors that are not to be replaced (for
+example, embedded applications would probably want to ensure that VMerror is
+always handled as they intend).
+---
+ Resource/Init/gs_init.ps | 29 ++++++++++++++++++-----------
+ psi/interp.c             | 30 +++++++++++++++++++++---------
+ 2 files changed, 39 insertions(+), 20 deletions(-)
+
+diff --git a/Resource/Init/gs_init.ps b/Resource/Init/gs_init.ps
+index 071c39205..bc8b7951c 100644
+--- a/Resource/Init/gs_init.ps
++++ b/Resource/Init/gs_init.ps
+@@ -881,7 +881,7 @@ userdict /.currentresourcefile //null put
+        { not exch pop exit } { pop } ifelse
+     }
+    for exch pop .quit
+- } bind def
++ } bind executeonly def
+ /.errorhandler		% <command> <errorname> .errorhandler -
+   {		% Detect an internal 'stopped'.
+     1 .instopped { //null eq { pop pop stop } if } if
+@@ -926,7 +926,7 @@ userdict /.currentresourcefile //null put
+     $error /globalmode get $error /.nosetlocal get and .setglobal
+     $error /.inerror //false put
+     stop
+-  } bind def
++  } bind executeonly def
+ % Define the standard handleerror.  We break out the printing procedure
+ % (.printerror) so that it can be extended for binary output
+ % if the Level 2 facilities are present.
+@@ -976,7 +976,7 @@ userdict /.currentresourcefile //null put
+      ifelse	% newerror
+      end
+      flush
+-    } bind def
++    } bind executeonly def
+   /.printerror_long			% long error printout,
+                                         % $error is on the dict stack
+    {	% Push the (anonymous) stack printing procedure.
+@@ -1053,14 +1053,14 @@ userdict /.currentresourcefile //null put
+         { (Current file position is ) print position = }
+        if
+ 
+-   } bind def
++   } bind executeonly def
+ % Define a procedure for clearing the error indication.
+ /.clearerror
+  { $error /newerror //false put
+    $error /errorname //null put
+    $error /errorinfo //null put
+    0 .setoserrno
+- } bind def
++ } bind executeonly def
+ 
+ % Define $error.  This must be in local VM.
+ .currentglobal //false .setglobal
+@@ -1086,11 +1086,15 @@ end
+ /errordict ErrorNames length 3 add dict
+ .forcedef		% errordict is local, systemdict is global
+ .setglobal		% back to global VM
+-% For greater Adobe compatibility, we put all non-standard errors in a
+-%   separate dictionary, gserrordict.  It does not need to be in local VM,
+-%   because PostScript programs do not access it.
++%  gserrordict contains all the default error handling methods, but unlike
++%  errordict it is noaccess after creation (also it is in global VM).
++%  When running 'SAFER', we'll ignore the contents of errordict, which
++%  may have been tampered with by the running job, and always use gserrordict
++%  gserrordict also contains any non-standard errors, for better compatibility
++%  with Adobe.
++%
+ %   NOTE: the name gserrordict is known to the interpreter.
+-/gserrordict 5 dict def
++/gserrordict ErrorNames length 3 add dict def
+ % Register an error in errordict.  We make this a procedure because we only
+ % register the Level 1 errors here: the rest are registered by "feature"
+ % files.  However, ErrorNames contains all of the error names regardless of
+@@ -1119,8 +1123,11 @@ errordict begin
+  } bind def
+ end		% errordict
+ 
+-% Put non-standard errors in gserrordict.
+-gserrordict /unknownerror errordict /unknownerror get put
++% Put all the default handlers in gserrordict
++gserrordict
++errordict {2 index 3 1 roll put} forall
++noaccess pop
++% remove the non-standard errors from errordict
+ errordict /unknownerror .undef
+ % Define a stable private copy of handleerror that we will always use under
+ % JOBSERVER mode.
+diff --git a/psi/interp.c b/psi/interp.c
+index c27b70dca..d41a9d3f5 100644
+--- a/psi/interp.c
++++ b/psi/interp.c
+@@ -661,16 +661,28 @@ again:
+         return code;
+     if (gs_errorname(i_ctx_p, code, &error_name) < 0)
+         return code;            /* out-of-range error code! */
+-    /*
+-     * For greater Adobe compatibility, only the standard PostScript errors
+-     * are defined in errordict; the rest are in gserrordict.
++
++    /*  If LockFilePermissions is true, we only refer to gserrordict, which
++     *  is not accessible to Postcript jobs
+      */
+-    if (dict_find_string(systemdict, "errordict", &perrordict) <= 0 ||
+-        (dict_find(perrordict, &error_name, &epref) <= 0 &&
+-         (dict_find_string(systemdict, "gserrordict", &perrordict) <= 0 ||
+-          dict_find(perrordict, &error_name, &epref) <= 0))
+-        )
+-        return code;            /* error name not in errordict??? */
++    if (i_ctx_p->LockFilePermissions) {
++        if (((dict_find_string(systemdict, "gserrordict", &perrordict) <= 0 ||
++              dict_find(perrordict, &error_name, &epref) <= 0))
++            )
++            return code;            /* error name not in errordict??? */
++    }
++    else {
++        /*
++         * For greater Adobe compatibility, only the standard PostScript errors
++         * are defined in errordict; the rest are in gserrordict.
++         */
++        if (dict_find_string(systemdict, "errordict", &perrordict) <= 0 ||
++            (dict_find(perrordict, &error_name, &epref) <= 0 &&
++             (dict_find_string(systemdict, "gserrordict", &perrordict) <= 0 ||
++              dict_find(perrordict, &error_name, &epref) <= 0))
++            )
++            return code;            /* error name not in errordict??? */
++    }
+     doref = *epref;
+     epref = &doref;
+     /* Push the error object on the operand stack if appropriate. */
+-- 
+2.18.0
+
diff --git a/gnu/packages/patches/ghostscript-runpath.patch b/gnu/packages/patches/ghostscript-runpath.patch
deleted file mode 100644
index 9f161e45b3..0000000000
--- a/gnu/packages/patches/ghostscript-runpath.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-diff --git a/base/unix-dll.mak b/base/unix-dll.mak
-index 9d57a99..36ef1ff 100644
---- a/base/unix-dll.mak
-+++ b/base/unix-dll.mak
-@@ -171,11 +171,11 @@ gpdl-so-links-subtarget: $(GPDL_SO) $(UNIX_DLL_MAK) $(MAKEDIRS)
- # Build the small Ghostscript loaders, with Gtk+ and without
- $(GSSOC_XE): gs-so-links-subtarget $(PSSRC)$(SOC_LOADER) $(UNIX_DLL_MAK) $(MAKEDIRS)
- 	$(GLCC) -g -o $(GSSOC_XE) $(PSSRC)dxmainc.c \
--	-L$(BINDIR) -l$(GS_SO_BASE)
-+	-L$(BINDIR) -l$(GS_SO_BASE) -Wl,-rpath=$(libdir)
- 
- $(GSSOX_XE): gs-so-links-subtarget $(PSSRC)$(SOC_LOADER) $(UNIX_DLL_MAK) $(MAKEDIRS)
- 	$(GLCC) -g $(SOC_CFLAGS) -o $(GSSOX_XE) $(PSSRC)$(SOC_LOADER) \
--	-L$(BINDIR) -l$(GS_SO_BASE) $(SOC_LIBS)
-+	-L$(BINDIR) -l$(GS_SO_BASE) $(SOC_LIBS) -Wl,-rpath=$(libdir)
- 
- $(PCLSOC_XE): gpcl6-so-links-subtarget $(PLSRC)$(REALMAIN_SRC).c $(UNIX_DLL_MAK) $(MAKEDIRS)
- 	$(GLCC) -g -o $(PCLSOC_XE) $(PLSRC)$(REALMAIN_SRC).c -L$(BINDIR) -l$(PCL_SO_BASE)
diff --git a/gnu/packages/patches/glibc-2.28-git-fixes.patch b/gnu/packages/patches/glibc-2.28-git-fixes.patch
new file mode 100644
index 0000000000..7e370ef0b1
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.28-git-fixes.patch
@@ -0,0 +1,248 @@
+This file contains fixes from the "release/2.28/master" branch:
+https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/release/2.28/master
+
+Currently we have these commits (sans tests and ChangeLog updates):
+7f11842e7483da7aa9fa3031be122021978ef600
+726e1554ce4db5e35af41cb0110c54c5e1232054
+4b25485f03158959cff45379eecc1d73c7dcdd11
+d05b05d1570ba3ae354a2f5a3cfeefb373b09979
+bfcfa22589f2b4277a65e60c6b736b6bbfbd87d0
+2f498f3d140ab5152bd784df2be7af7d9c5e63ed
+
+diff --git a/htl/Versions b/htl/Versions
+index 6a63a1b8a1..c5a616da10 100644
+--- a/htl/Versions
++++ b/htl/Versions
+@@ -150,6 +150,8 @@ libpthread {
+     __cthread_keycreate;
+     __cthread_getspecific;
+     __cthread_setspecific;
++    __pthread_getspecific;
++    __pthread_setspecific;
+     __pthread_getattr_np;
+     __pthread_attr_getstack;
+   }
+
+diff --git a/sysdeps/htl/pt-getspecific.c b/sysdeps/htl/pt-getspecific.c
+index a0227a67f6..64ddf9551a 100644
+--- a/sysdeps/htl/pt-getspecific.c
++++ b/sysdeps/htl/pt-getspecific.c
+@@ -36,3 +36,4 @@ __pthread_getspecific (pthread_key_t key)
+   return self->thread_specifics[key];
+ }
+ strong_alias (__pthread_getspecific, pthread_getspecific);
++hidden_def (__pthread_getspecific)
+diff --git a/sysdeps/htl/pt-setspecific.c b/sysdeps/htl/pt-setspecific.c
+index a46a12f157..02aff417ef 100644
+--- a/sysdeps/htl/pt-setspecific.c
++++ b/sysdeps/htl/pt-setspecific.c
+@@ -48,3 +48,4 @@ __pthread_setspecific (pthread_key_t key, const void *value)
+   return 0;
+ }
+ strong_alias (__pthread_setspecific, pthread_setspecific);
++hidden_def (__pthread_setspecific)
+diff --git a/sysdeps/htl/pthreadP.h b/sysdeps/htl/pthreadP.h
+index 132ac1718e..71c2fcd9c6 100644
+--- a/sysdeps/htl/pthreadP.h
++++ b/sysdeps/htl/pthreadP.h
+@@ -68,6 +68,8 @@ struct __pthread_cancelation_handler **___pthread_get_cleanup_stack (void) attri
+ 
+ #if IS_IN (libpthread)
+ hidden_proto (__pthread_key_create)
++hidden_proto (__pthread_getspecific)
++hidden_proto (__pthread_setspecific)
+ hidden_proto (_pthread_mutex_init)
+ #endif
+ 
+diff --git a/sysdeps/unix/sysv/linux/getdents64.c b/sysdeps/unix/sysv/linux/getdents64.c
+index 3bde0cf4f0..bc140b5a7f 100644
+--- a/sysdeps/unix/sysv/linux/getdents64.c
++++ b/sysdeps/unix/sysv/linux/getdents64.c
+@@ -33,41 +33,80 @@ strong_alias (__getdents64, __getdents)
+ # include <shlib-compat.h>
+ 
+ # if SHLIB_COMPAT(libc, GLIBC_2_1, GLIBC_2_2)
+-# include <olddirent.h>
++#  include <olddirent.h>
++#  include <unistd.h>
+ 
+-/* kernel definition of as of 3.2.  */
+-struct compat_linux_dirent
++static ssize_t
++handle_overflow (int fd, __off64_t offset, ssize_t count)
+ {
+-  /* Both d_ino and d_off are compat_ulong_t which are defined in all
+-     architectures as 'u32'.  */
+-  uint32_t        d_ino;
+-  uint32_t        d_off;
+-  unsigned short  d_reclen;
+-  char            d_name[1];
+-};
++  /* If this is the first entry in the buffer, we can report the
++     error.  */
++  if (count == 0)
++    {
++      __set_errno (EOVERFLOW);
++      return -1;
++    }
++
++  /* Otherwise, seek to the overflowing entry, so that the next call
++     will report the error, and return the data read so far..  */
++  if (__lseek64 (fd, offset, SEEK_SET) != 0)
++    return -1;
++  return count;
++}
+ 
+ ssize_t
+ __old_getdents64 (int fd, char *buf, size_t nbytes)
+ {
+-  ssize_t retval = INLINE_SYSCALL_CALL (getdents, fd, buf, nbytes);
++  /* We do not move the individual directory entries.  This is only
++     possible if the target type (struct __old_dirent64) is smaller
++     than the source type.  */
++  _Static_assert (offsetof (struct __old_dirent64, d_name)
++		  <= offsetof (struct dirent64, d_name),
++		  "__old_dirent64 is larger than dirent64");
++  _Static_assert (__alignof__ (struct __old_dirent64)
++		  <= __alignof__ (struct dirent64),
++		  "alignment of __old_dirent64 is larger than dirent64");
+ 
+-  /* The kernel added the d_type value after the name.  Change this now.  */
+-  if (retval != -1)
++  ssize_t retval = INLINE_SYSCALL_CALL (getdents64, fd, buf, nbytes);
++  if (retval > 0)
+     {
+-      union
+-      {
+-	struct compat_linux_dirent k;
+-	struct dirent u;
+-      } *kbuf = (void *) buf;
+-
+-      while ((char *) kbuf < buf + retval)
++      char *p = buf;
++      char *end = buf + retval;
++      while (p < end)
+ 	{
+-	  char d_type = *((char *) kbuf + kbuf->k.d_reclen - 1);
+-	  memmove (kbuf->u.d_name, kbuf->k.d_name,
+-		   strlen (kbuf->k.d_name) + 1);
+-	  kbuf->u.d_type = d_type;
++	  struct dirent64 *source = (struct dirent64 *) p;
++
++	  /* Copy out the fixed-size data.  */
++	  __ino_t ino = source->d_ino;
++	  __off64_t offset = source->d_off;
++	  unsigned int reclen = source->d_reclen;
++	  unsigned char type = source->d_type;
++
++	  /* Check for ino_t overflow.  */
++	  if (__glibc_unlikely (ino != source->d_ino))
++	    return handle_overflow (fd, offset, p - buf);
++
++	  /* Convert to the target layout.  Use a separate struct and
++	     memcpy to side-step aliasing issues.  */
++	  struct __old_dirent64 result;
++	  result.d_ino = ino;
++	  result.d_off = offset;
++	  result.d_reclen = reclen;
++	  result.d_type = type;
++
++	  /* Write the fixed-sized part of the result to the
++	     buffer.  */
++	  size_t result_name_offset = offsetof (struct __old_dirent64, d_name);
++	  memcpy (p, &result, result_name_offset);
++
++	  /* Adjust the position of the name if necessary.  Copy
++	     everything until the end of the record, including the
++	     terminating NUL byte.  */
++	  if (result_name_offset != offsetof (struct dirent64, d_name))
++	    memmove (p + result_name_offset, source->d_name,
++		     reclen - offsetof (struct dirent64, d_name));
+ 
+-	  kbuf = (void *) ((char *) kbuf + kbuf->k.d_reclen);
++	  p += reclen;
+ 	}
+      }
+   return retval;
+
+diff --git a/misc/error.c b/misc/error.c
+index b4e8b6c938..03378e2f2a 100644
+--- a/misc/error.c
++++ b/misc/error.c
+@@ -319,6 +319,7 @@ error (int status, int errnum, const char *message, ...)
+ 
+   va_start (args, message);
+   error_tail (status, errnum, message, args);
++  va_end (args);
+ 
+ #ifdef _LIBC
+   _IO_funlockfile (stderr);
+@@ -390,6 +391,7 @@ error_at_line (int status, int errnum, const char *file_name,
+ 
+   va_start (args, message);
+   error_tail (status, errnum, message, args);
++  va_end (args);
+ 
+ #ifdef _LIBC
+   _IO_funlockfile (stderr);
+
+diff --git a/nscd/nscd_conf.c b/nscd/nscd_conf.c
+index 265a02434d..7293b795b6 100644
+--- a/nscd/nscd_conf.c
++++ b/nscd/nscd_conf.c
+@@ -190,7 +190,10 @@ nscd_parse_file (const char *fname, struct database_dyn dbs[lastdb])
+ 	  if (!arg1)
+ 	    error (0, 0, _("Must specify user name for server-user option"));
+ 	  else
+-	    server_user = xstrdup (arg1);
++	    {
++	      free ((char *) server_user);
++	      server_user = xstrdup (arg1);
++	    }
+ 	}
+       else if (strcmp (entry, "stat-user") == 0)
+ 	{
+@@ -198,6 +201,7 @@ nscd_parse_file (const char *fname, struct database_dyn dbs[lastdb])
+ 	    error (0, 0, _("Must specify user name for stat-user option"));
+ 	  else
+ 	    {
++	      free ((char *) stat_user);
+ 	      stat_user = xstrdup (arg1);
+ 
+ 	      struct passwd *pw = getpwnam (stat_user);
+
+diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
+index cfd34b66b9..35b0bfc5d2 100644
+--- a/nss/nss_files/files-alias.c
++++ b/nss/nss_files/files-alias.c
+@@ -221,6 +221,13 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
+ 			{
+ 			  while (! feof_unlocked (listfile))
+ 			    {
++			      if (room_left < 2)
++				{
++				  free (old_line);
++				  fclose (listfile);
++				  goto no_more_room;
++				}
++
+ 			      first_unused[room_left - 1] = '\xff';
+ 			      line = fgets_unlocked (first_unused, room_left,
+ 						     listfile);
+@@ -229,6 +236,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
+ 			      if (first_unused[room_left - 1] != '\xff')
+ 				{
+ 				  free (old_line);
++				  fclose (listfile);
+ 				  goto no_more_room;
+ 				}
+ 
+@@ -256,6 +264,7 @@ get_next_alias (FILE *stream, const char *match, struct aliasent *result,
+ 						       + __alignof__ (char *)))
+ 					{
+ 					  free (old_line);
++					  fclose (listfile);
+ 					  goto no_more_room;
+ 					}
+ 				      room_left -= ((first_unused - cp)
+
diff --git a/gnu/packages/patches/gnucash-disable-failing-tests.patch b/gnu/packages/patches/gnucash-disable-failing-tests.patch
new file mode 100644
index 0000000000..e0fdd86b5d
--- /dev/null
+++ b/gnu/packages/patches/gnucash-disable-failing-tests.patch
@@ -0,0 +1,39 @@
+test-stress-options.scm does not exist, and test-qof passes when run in the
+build directory after the gnucash build.
+
+diff -ur gnucash-3.3.old/gnucash/report/standard-reports/test/CMakeLists.txt gnucash-3.3/gnucash/report/standard-reports/test/CMakeLists.txt
+--- gnucash-3.3.old/gnucash/report/standard-reports/test/CMakeLists.txt	2018-10-04 09:29:00.916641417 -0400
++++ gnucash-3.3/gnucash/report/standard-reports/test/CMakeLists.txt	2018-10-04 09:30:52.962504860 -0400
+@@ -13,10 +13,6 @@
+   test-income-gst.scm
+ )
+ 
+-set(scm_test_with_textual_ports_SOURCES
+-    test-stress-options.scm
+-)
+-
+ set(GUILE_DEPENDS
+   scm-gnc-module
+   scm-app-utils
+@@ -31,9 +27,6 @@
+ 
+ if (HAVE_SRFI64)
+   gnc_add_scheme_tests("${scm_test_with_srfi64_SOURCES}")
+-  if (HAVE_TEXT_PORTS)
+-    gnc_add_scheme_tests("${scm_test_with_textual_ports_SOURCES}")
+-  endif (HAVE_TEXT_PORTS)
+ endif (HAVE_SRFI64)
+ 
+ gnc_add_scheme_tests("${scm_test_standard_reports_SOURCES}")
+diff -ur gnucash-3.3.old/libgnucash/engine/test/CMakeLists.txt gnucash-3.3/libgnucash/engine/test/CMakeLists.txt
+--- gnucash-3.3.old/libgnucash/engine/test/CMakeLists.txt	2018-10-04 09:29:00.876640751 -0400
++++ gnucash-3.3/libgnucash/engine/test/CMakeLists.txt	2018-10-05 10:46:22.542962546 -0400
+@@ -54,8 +54,6 @@
+ # This test does not run on Win32
+ if (NOT WIN32)
+   set(SOURCES ${test_qof_SOURCES} ${CMAKE_SOURCE_DIR}/common/test-core/unittest-support.c)
+-  add_engine_test(test-qof "${SOURCES}")
+-  target_compile_definitions(test-qof PRIVATE TESTPROG=test_qof)
+ 
+   set(SOURCES ${test_engine_SOURCES} ${CMAKE_SOURCE_DIR}/common/test-core/unittest-support.c)
+   add_engine_test(test-engine "${SOURCES}")
diff --git a/gnu/packages/patches/gnucash-price-quotes-perl.patch b/gnu/packages/patches/gnucash-price-quotes-perl.patch
index 982763f0ec..3101ddb007 100644
--- a/gnu/packages/patches/gnucash-price-quotes-perl.patch
+++ b/gnu/packages/patches/gnucash-price-quotes-perl.patch
@@ -1,8 +1,9 @@
 After wrapping gnc-fq-check and gnc-fq-helper we can no longer execute them
 with perl, so execute them directly instead.
 
---- gnucash-2.6.6/src/scm/price-quotes.scm.orig	2014-04-27 17:42:28.000000000 -0500
-+++ gnucash-2.6.6/src/scm/price-quotes.scm	2015-07-09 16:12:11.196218472 -0500
+diff -ur gnucash-3.2.old/libgnucash/scm/price-quotes.scm gnucash-3.2/libgnucash/scm/price-quotes.scm
+--- gnucash-3.2.old/libgnucash/scm/price-quotes.scm	2018-09-15 00:48:33.718389646 -0400
++++ gnucash-3.2/libgnucash/scm/price-quotes.scm	2018-09-15 13:51:49.249862724 -0400
 @@ -74,7 +74,7 @@
      (define (start-program)
        (if (not (string-null? gnc:*finance-quote-check*))
diff --git a/gnu/packages/patches/grub-binutils-compat.patch b/gnu/packages/patches/grub-binutils-compat.patch
new file mode 100644
index 0000000000..2107869314
--- /dev/null
+++ b/gnu/packages/patches/grub-binutils-compat.patch
@@ -0,0 +1,53 @@
+Fix a relocation issue that shows up with recent binutils.
+
+Patch taken from upstream:
+https://git.sv.gnu.org/cgit/grub.git/commit/?id=842c390469e2c2e10b5aa36700324cd3bde25875
+
+diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c
+index e49d0b6..18facf4 100644
+--- a/grub-core/efiemu/i386/loadcore64.c
++++ b/grub-core/efiemu/i386/loadcore64.c
+@@ -98,6 +98,7 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
+ 		    break;
+ 
+ 		  case R_X86_64_PC32:
++		  case R_X86_64_PLT32:
+ 		    err = grub_efiemu_write_value (addr,
+ 						   *addr32 + rel->r_addend
+ 						   + sym.off
+diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
+index 4406906..3a73e6e 100644
+--- a/grub-core/kern/x86_64/dl.c
++++ b/grub-core/kern/x86_64/dl.c
+@@ -70,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
+ 	  break;
+ 
+ 	case R_X86_64_PC32:
++	case R_X86_64_PLT32:
+ 	  {
+ 	    grub_int64_t value;
+ 	    value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
+diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
+index a2bb054..39d7efb 100644
+--- a/util/grub-mkimagexx.c
++++ b/util/grub-mkimagexx.c
+@@ -841,6 +841,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
+ 		  break;
+ 
+ 		case R_X86_64_PC32:
++		case R_X86_64_PLT32:
+ 		  {
+ 		    grub_uint32_t *t32 = (grub_uint32_t *) target;
+ 		    *t32 = grub_host_to_target64 (grub_target_to_host32 (*t32)
+diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c
+index 9179285..a79271f 100644
+--- a/util/grub-module-verifier.c
++++ b/util/grub-module-verifier.c
+@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = {
+       -1
+     }, (int[]){
+       R_X86_64_PC32,
++      R_X86_64_PLT32,
+       -1
+     }
+   },
diff --git a/gnu/packages/patches/grub-check-error-efibootmgr.patch b/gnu/packages/patches/grub-check-error-efibootmgr.patch
new file mode 100644
index 0000000000..efeb20f213
--- /dev/null
+++ b/gnu/packages/patches/grub-check-error-efibootmgr.patch
@@ -0,0 +1,197 @@
+Without this patch, GRUB may proceed to wipe all firmware boot entries
+and report a successful installation, even if efibootmgr hit an error.
+
+Origin URL:
+https://git.sv.gnu.org/cgit/grub.git/commit/?id=6400613ad0b463abc93362086a491cd2a5e99b0d
+
+From 6400613ad0b463abc93362086a491cd2a5e99b0d Mon Sep 17 00:00:00 2001
+From: Steve McIntyre <steve@einval.com>
+Date: Wed, 31 Jan 2018 21:49:36 +0000
+Subject: Make grub-install check for errors from efibootmgr
+
+Code is currently ignoring errors from efibootmgr, giving users
+clearly bogus output like:
+
+        Setting up grub-efi-amd64 (2.02~beta3-4) ...
+        Installing for x86_64-efi platform.
+        Could not delete variable: No space left on device
+        Could not prepare Boot variable: No space left on device
+        Installation finished. No error reported.
+
+and then potentially unbootable systems. If efibootmgr fails, grub-install
+should know that and report it!
+
+We've been using similar patch in Debian now for some time, with no ill effects.
+
+diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c
+index a3fcfca..ca448bc 100644
+--- a/grub-core/osdep/unix/platform.c
++++ b/grub-core/osdep/unix/platform.c
+@@ -78,19 +78,20 @@ get_ofpathname (const char *dev)
+ 		   dev);
+ }
+ 
+-static void
++static int
+ grub_install_remove_efi_entries_by_distributor (const char *efi_distributor)
+ {
+   int fd;
+   pid_t pid = grub_util_exec_pipe ((const char * []){ "efibootmgr", NULL }, &fd);
+   char *line = NULL;
+   size_t len = 0;
++  int rc;
+ 
+   if (!pid)
+     {
+       grub_util_warn (_("Unable to open stream from %s: %s"),
+ 		      "efibootmgr", strerror (errno));
+-      return;
++      return errno;
+     }
+ 
+   FILE *fp = fdopen (fd, "r");
+@@ -98,7 +99,7 @@ grub_install_remove_efi_entries_by_distributor (const char *efi_distributor)
+     {
+       grub_util_warn (_("Unable to open stream from %s: %s"),
+ 		      "efibootmgr", strerror (errno));
+-      return;
++      return errno;
+     }
+ 
+   line = xmalloc (80);
+@@ -119,23 +120,25 @@ grub_install_remove_efi_entries_by_distributor (const char *efi_distributor)
+       bootnum = line + sizeof ("Boot") - 1;
+       bootnum[4] = '\0';
+       if (!verbosity)
+-	grub_util_exec ((const char * []){ "efibootmgr", "-q",
++	rc = grub_util_exec ((const char * []){ "efibootmgr", "-q",
+ 	      "-b", bootnum,  "-B", NULL });
+       else
+-	grub_util_exec ((const char * []){ "efibootmgr",
++	rc = grub_util_exec ((const char * []){ "efibootmgr",
+ 	      "-b", bootnum, "-B", NULL });
+     }
+ 
+   free (line);
++  return rc;
+ }
+ 
+-void
++int
+ grub_install_register_efi (grub_device_t efidir_grub_dev,
+ 			   const char *efifile_path,
+ 			   const char *efi_distributor)
+ {
+   const char * efidir_disk;
+   int efidir_part;
++  int ret;
+   efidir_disk = grub_util_biosdisk_get_osdev (efidir_grub_dev->disk);
+   efidir_part = efidir_grub_dev->disk->partition ? efidir_grub_dev->disk->partition->number + 1 : 1;
+ 
+@@ -151,23 +154,26 @@ grub_install_register_efi (grub_device_t efidir_grub_dev,
+   grub_util_exec ((const char * []){ "modprobe", "-q", "efivars", NULL });
+ #endif
+   /* Delete old entries from the same distributor.  */
+-  grub_install_remove_efi_entries_by_distributor (efi_distributor);
++  ret = grub_install_remove_efi_entries_by_distributor (efi_distributor);
++  if (ret)
++    return ret;
+ 
+   char *efidir_part_str = xasprintf ("%d", efidir_part);
+ 
+   if (!verbosity)
+-    grub_util_exec ((const char * []){ "efibootmgr", "-q",
++    ret = grub_util_exec ((const char * []){ "efibootmgr", "-q",
+ 	  "-c", "-d", efidir_disk,
+ 	  "-p", efidir_part_str, "-w",
+ 	  "-L", efi_distributor, "-l", 
+ 	  efifile_path, NULL });
+   else
+-    grub_util_exec ((const char * []){ "efibootmgr",
++    ret = grub_util_exec ((const char * []){ "efibootmgr",
+ 	  "-c", "-d", efidir_disk,
+ 	  "-p", efidir_part_str, "-w",
+ 	  "-L", efi_distributor, "-l", 
+ 	  efifile_path, NULL });
+   free (efidir_part_str);
++  return ret;
+ }
+ 
+ void
+diff --git a/include/grub/util/install.h b/include/grub/util/install.h
+index 5910b0c..0dba8b6 100644
+--- a/include/grub/util/install.h
++++ b/include/grub/util/install.h
+@@ -210,7 +210,7 @@ grub_install_create_envblk_file (const char *name);
+ const char *
+ grub_install_get_default_x86_platform (void);
+ 
+-void
++int
+ grub_install_register_efi (grub_device_t efidir_grub_dev,
+ 			   const char *efifile_path,
+ 			   const char *efi_distributor);
+diff --git a/util/grub-install.c b/util/grub-install.c
+index 5e4cdfd..690f180 100644
+--- a/util/grub-install.c
++++ b/util/grub-install.c
+@@ -1848,9 +1848,13 @@ main (int argc, char *argv[])
+ 	  if (!removable && update_nvram)
+ 	    {
+ 	      /* Try to make this image bootable using the EFI Boot Manager, if available.  */
+-	      grub_install_register_efi (efidir_grub_dev,
+-					 "\\System\\Library\\CoreServices",
+-					 efi_distributor);
++	      int ret;
++	      ret = grub_install_register_efi (efidir_grub_dev,
++					       "\\System\\Library\\CoreServices",
++					       efi_distributor);
++	      if (ret)
++	        grub_util_error (_("efibootmgr failed to register the boot entry: %s"),
++				 strerror (ret));
+ 	    }
+ 
+ 	  grub_device_close (ins_dev);
+@@ -1871,6 +1875,7 @@ main (int argc, char *argv[])
+ 	{
+ 	  char * efifile_path;
+ 	  char * part;
++	  int ret;
+ 
+ 	  /* Try to make this image bootable using the EFI Boot Manager, if available.  */
+ 	  if (!efi_distributor || efi_distributor[0] == '\0')
+@@ -1887,7 +1892,10 @@ main (int argc, char *argv[])
+ 			  efidir_grub_dev->disk->name,
+ 			  (part ? ",": ""), (part ? : ""));
+ 	  grub_free (part);
+-	  grub_install_register_efi (efidir_grub_dev,
+-				     efifile_path, efi_distributor);
++	  ret = grub_install_register_efi (efidir_grub_dev,
++					   efifile_path, efi_distributor);
++	  if (ret)
++	    grub_util_error (_("efibootmgr failed to register the boot entry: %s"),
++			     strerror (ret));
+ 	}
+       break;
+
+
+Below is a followup to the patch above: the uninitialized variable could lead
+‘grub-install’ to error out when it shouldn’t (seen on an AArch64 box where
+‘grub_install_remove_efi_entries_by_distributor’ didn't have any entry to
+remove):
+
+  grub-install: error: efibootmgr failed to register the boot entry: Unknown error 65535.
+
+See <http://lists.gnu.org/archive/html/bug-grub/2018-10/msg00006.html>.
+
+--- grub-2.02/grub-core/osdep/unix/platform.c	2018-10-17 22:21:53.015284846 +0200
++++ grub-2.02/grub-core/osdep/unix/platform.c	2018-10-17 22:21:55.595271222 +0200
+@@ -85,7 +85,7 @@ grub_install_remove_efi_entries_by_distr
+   pid_t pid = grub_util_exec_pipe ((const char * []){ "efibootmgr", NULL }, &fd);
+   char *line = NULL;
+   size_t len = 0;
+-  int rc;
++  int rc = 0;
+ 
+   if (!pid)
+     {
diff --git a/gnu/packages/patches/handbrake-pkg-config-path.patch b/gnu/packages/patches/handbrake-pkg-config-path.patch
deleted file mode 100644
index 18f3953eaa..0000000000
--- a/gnu/packages/patches/handbrake-pkg-config-path.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Do not clobber PKG_CONFIG_PATH during configure.
-
---- HandBrake-0.10.5/gtk/module.rules.orig	2016-02-11 14:14:05.000000000 -0600
-+++ HandBrake-0.10.5/gtk/module.rules	2016-10-29 22:27:50.550960848 -0500
-@@ -15,7 +15,7 @@
- 	set -e; cd $(GTK.src/); NOCONFIGURE=1 ./autogen.sh
- 	set -e; cd $(GTK.build/); $(call fn.ABSOLUTE,$(GTK.src/))configure \
- 		$(GTK.CONFIGURE.extra) \
--		PKG_CONFIG_PATH=$(BUILD/)contrib/lib/pkgconfig \
-+		PKG_CONFIG_PATH=$(BUILD/)contrib/lib/pkgconfig$(if $(PKG_CONFIG_PATH),:)$(PKG_CONFIG_PATH) \
- 	    CFLAGS="$(call fn.ARGS,GTK.GCC,.g .O *D ?extra)" \
- 	    LDFLAGS="$(call fn.ARGS,GTK.GCC,?strip .g .O ?extra.exe)" \
- 	    --prefix=$(PREFIX) \
---- Handbrake-0.10.5-0.77d09e9-checkout/make/include/contrib.defs	1969-12-31 18:00:00.000000000 -0600
-+++ Handbrake-0.10.5-0.77d09e9-checkout/make/include/contrib.defs	2016-11-01 13:11:43.826144311 -0500
-@@ -119,7 +119,7 @@
-     endif
-     $(1).CONFIGURE.env.CPPFLAGS = CPPFLAGS="-I$$(call fn.ABSOLUTE,$(CONTRIB.build/))include $$(call fn.ARGS,$(1).GCC,*archs *sysroot *minver ?extra *D)"
-     $(1).CONFIGURE.env.LDFLAGS  = LDFLAGS="-L$$(call fn.ABSOLUTE,$(CONTRIB.build/))lib $$(call fn.ARGS,$(1).GCC,*archs *sysroot *minver ?extra.exe *D)"
--    $(1).CONFIGURE.env.PKG_CONFIG_PATH  = PKG_CONFIG_PATH="$$(call fn.ABSOLUTE,$$(CONTRIB.build/))lib/pkgconfig"
-+    $(1).CONFIGURE.env.PKG_CONFIG_PATH  = PKG_CONFIG_PATH="$$(call fn.ABSOLUTE,$$(CONTRIB.build/))lib/pkgconfig$(if $(PKG_CONFIG_PATH),:)$(PKG_CONFIG_PATH)"
- 
-     $(1).CONFIGURE.env.args = !CC !CFLAGS !CXX !CXXFLAGS !CPPFLAGS !LD !LDFLAGS !PKG_CONFIG_PATH !LOCAL_PATH !CROSS
-     $(1).CONFIGURE.env = $$(call fn.ARGS,$(1).CONFIGURE.env,$$($(1).CONFIGURE.env.args))
diff --git a/gnu/packages/patches/haskell-mode-make-check.patch b/gnu/packages/patches/haskell-mode-make-check.patch
new file mode 100644
index 0000000000..a4d4d525f2
--- /dev/null
+++ b/gnu/packages/patches/haskell-mode-make-check.patch
@@ -0,0 +1,35 @@
+Copied from upstream repository.
+Hunk #2 is removed since it cannot be applied and it is not needed.
+
+From 7cead7137bf54851c1b7df5a3854351296d21276 Mon Sep 17 00:00:00 2001
+From: Vasantha Ganesh K <vasanthaganesh.k@tuta.io>
+Date: Thu, 22 Jun 2017 23:38:40 +0530
+Subject: [PATCH] removed `check-conventions' from make
+
+---
+ Makefile                          |   7 +-
+ tests/haskell-code-conventions.el | 165 ------------------------------
+ 2 files changed, 1 insertion(+), 171 deletions(-)
+ delete mode 100644 tests/haskell-code-conventions.el
+
+diff --git a/Makefile b/Makefile
+index b2c89d6..aa907c5 100644
+--- a/Makefile
++++ b/Makefile
+@@ -79,12 +79,7 @@ build-$(EMACS_VERSION)/build-flag : build-$(EMACS_VERSION) $(patsubst %.el,build
+ check-%: tests/%-tests.el
+ 	$(BATCH) -l "$<" -f ert-run-tests-batch-and-exit;
+ 
+-check: compile $(AUTOLOADS) check-ert check-conventions
+-
+-check-conventions :
+-	$(BATCH) -l tests/haskell-code-conventions.el                                           \
+-                 -f haskell-check-conventions-batch-and-exit
+-	@echo "conventions are okay"
++check: compile $(AUTOLOADS) check-ert
+ 
+ check-ert: $(ELCHECKS)
+ 	$(BATCH) --eval "(when (= emacs-major-version 24)					\
+-- 
+2.18.0
+
diff --git a/gnu/packages/patches/haskell-mode-unused-variables.patch b/gnu/packages/patches/haskell-mode-unused-variables.patch
new file mode 100644
index 0000000000..b175fae28c
--- /dev/null
+++ b/gnu/packages/patches/haskell-mode-unused-variables.patch
@@ -0,0 +1,44 @@
+Copied verbatim from upstream repository.
+
+From cee22450ee30e79952f594796721dc6b17798ee6 Mon Sep 17 00:00:00 2001
+From: Sascha Wilde <wilde@sha-bang.de>
+Date: Fri, 23 Sep 2016 15:35:59 +0200
+Subject: [PATCH] Removed unused lexical variables.
+
+---
+ haskell-lexeme.el  | 3 +--
+ haskell-process.el | 4 +---
+ 2 files changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/haskell-lexeme.el b/haskell-lexeme.el
+index 4256a79..b832560 100644
+--- a/haskell-lexeme.el
++++ b/haskell-lexeme.el
+@@ -138,8 +138,7 @@ When match is successful, match-data will contain:
+   (match-text 2) - whole qualified identifier
+   (match-text 3) - unqualified part of identifier
+   (match-text 4) - closing backtick"
+-  (let ((begin (point))
+-        (match-data-old (match-data))
++  (let ((match-data-old (match-data))
+         first-backtick-start
+         last-backtick-start
+         qid-start
+diff --git a/haskell-process.el b/haskell-process.el
+index b4efba2..4f3f859 100644
+--- a/haskell-process.el
++++ b/haskell-process.el
+@@ -160,9 +160,7 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
+ (defun haskell-process-log (msg)
+   "Effective append MSG to the process log (if enabled)."
+   (when haskell-process-log
+-    (let* ((append-to (get-buffer-create "*haskell-process-log*"))
+-           (windows (get-buffer-window-list append-to t t))
+-           move-point-in-windows)
++    (let* ((append-to (get-buffer-create "*haskell-process-log*")))
+       (with-current-buffer append-to
+         ;; point should follow insertion so that it stays at the end
+         ;; of the buffer
+-- 
+2.18.0
+
diff --git a/gnu/packages/patches/hmmer-remove-cpu-specificity.patch b/gnu/packages/patches/hmmer-remove-cpu-specificity.patch
deleted file mode 100644
index ba98db4d0e..0000000000
--- a/gnu/packages/patches/hmmer-remove-cpu-specificity.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-This patch removes compilation flags which make the build for the machine
-where compilation takes place, rendering the build not reproducible.
-
-diff --git a/configure b/configure
-index 8b6aaef..49a6afc 100755
---- a/configure
-+++ b/configure
-@@ -6125,14 +6125,6 @@ fi # guess arch
- 
- if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then
- for arch in $ax_gcc_arch; do
--  if test "x$acx_maxopt_portable" = xyes; then # if we require portable code
--    flags="-mtune=$arch"
--    # -mcpu=$arch and m$arch generate nonportable code on every arch except
--    # x86.  And some other arches (e.g. Alpha) don't accept -mtune.  Grrr.
--    case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac
--  else
--    flags="-march=$arch -mcpu=$arch -m$arch"
--  fi
-   for flag in $flags; do
-     as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5
diff --git a/gnu/packages/patches/hplip-remove-imageprocessor.patch b/gnu/packages/patches/hplip-remove-imageprocessor.patch
new file mode 100644
index 0000000000..cde3ecba2d
--- /dev/null
+++ b/gnu/packages/patches/hplip-remove-imageprocessor.patch
@@ -0,0 +1,232 @@
+This patch is based heavily on the Debian patch.
+
+https://salsa.debian.org/printing-team/hplip/raw/debian/3.18.10+dfsg0-1/debian/patches/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch
+
+---
+ Makefile.am                  | 22 +++-------------------
+ Makefile.in                  | 33 +++++----------------------------
+ prnt/hpcups/HPCupsFilter.cpp | 21 ---------------------
+ 3 files changed, 8 insertions(+), 68 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index ef6480f..ecada5c 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -166,7 +166,7 @@ if !HPLIP_CLASS_DRIVER
+ dist_hplip_SCRIPTS = hpssd.py __init__.py hpdio.py
+ endif #HPLIP_CLASS_DRIVER
+ 
+-dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template prnt/hpcups/libImageProcessor-x86_64.so prnt/hpcups/libImageProcessor-x86_32.so
++dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template
+ dist_noinst_SCRIPTS += dat2drv.py install.py  hplip-install init-suse-firewall init-iptables-firewall class_rpm_build.sh hplipclassdriver.spec createPPD.sh Makefile_dat2drv hpijs-drv
+ 
+ if !HPLIP_CLASS_DRIVER
+@@ -590,11 +590,10 @@ hpcups_SOURCES = prnt/hpcups/HPCupsFilter.cpp prnt/hpcups/HPCupsFilter.h prnt/hp
+ 	prnt/hpcups/flate_colorspace.h prnt/hpcups/RunLenEncoding.h prnt/hpcups/common_defines.h \
+ 	prnt/hpcups/genPCLm.h \
+ 	common/utils.c common/utils.h prnt/hpcups/Hbpl1_Wrapper.cpp prnt/hpcups/genPCLm.cpp \
+-	prnt/hpcups/genJPEGStrips.cpp prnt/hpcups/RunLenEncoding.cpp \
+-	prnt/hpcups/ImageProcessor.h
++	prnt/hpcups/genJPEGStrips.cpp prnt/hpcups/RunLenEncoding.cpp
+ 
+ hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS)
+-hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lImageProcessor -lcups -lcupsimage -lz $(DBUS_LIBS)
++hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lcups -lcupsimage -lz $(DBUS_LIBS)
+ #else
+ #hpcupsdir = $(cupsfilterdir)
+ #hpcups_PROGRAMS = hpcups
+@@ -679,21 +678,10 @@ printpluginsdir=$(cupsfilterdir)
+ 
+ 
+ dist_filter_DATA = hpcups hpps dat2drv
+-dist_printplugins_DATA = prnt/plugins/hbpl1-arm32.so prnt/plugins/hbpl1-arm64.so prnt/plugins/hbpl1-x86_32.so prnt/plugins/hbpl1-x86_64.so prnt/plugins/lj-arm32.so prnt/plugins/lj-arm64.so prnt/plugins/lj-x86_32.so prnt/plugins/lj-x86_64.so
+ endif #HPLIP_CLASS_DRIVER
+ 
+ install-data-hook:
+ if HPLIP_BUILD
+-	if [ \( "$(UNAME)" = "x86_64" -a  -d "$(libdir)/" \) ]; then \
+-		cp prnt/hpcups/libImageProcessor-x86_64.so $(libdir)/ ; \
+-		chmod 775 $(libdir)/libImageProcessor-x86_64.so ; \
+-		ln -sf $(libdir)/libImageProcessor-x86_64.so $(libdir)/libImageProcessor.so ; \
+-	fi; \
+-	if [ \( \( "$(UNAME)" = "i686" -o "$(UNAME)" = "i386" \) -a -d "$(libdir)/" \) ]; then \
+-		cp prnt/hpcups/libImageProcessor-x86_32.so $(libdir)/ ; \
+-		chmod 775 $(libdir)/libImageProcessor-x86_32.so ; \
+-		ln -sf $(libdir)/libImageProcessor-x86_32.so $(libdir)/libImageProcessor.so ; \
+-	fi
+ if !HPLIP_CLASS_DRIVER
+ #	   If scanner build, add hpaio entry to sane dll.conf.
+ 	if [ "$(scan_build)" = "yes" ]; then \
+@@ -874,10 +862,6 @@ if HPLIP_CLASS_DRIVER
+ 	rm -rf $(distdir)/setup.py
+ 	rm -rf $(distdir)/systray.py
+ 	rm -rf $(distdir)/timedate.py
+-	rm -rf $(distdir)/prnt/plugins/lj-arm32.so
+-	rm -rf $(distdir)/prnt/plugins/lj-arm64.so
+-	rm -rf $(distdir)/prnt/plugins/lj-x86_32.so
+-	rm -rf $(distdir)/prnt/plugins/lj-x86_64.so
+ 	rm -rf $(distdir)/hpijs-drv
+ 	rm -rf $(distdir)/prnt/hpcups/
+ 	rm -rf $(distdir)/prnt/ps/
+diff --git a/Makefile.in b/Makefile.in
+index 910a268..cd44203 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -103,7 +103,7 @@ DIST_COMMON = $(am__configure_deps) \
+ 
+ # ip library
+ @HPLIP_BUILD_TRUE@am__append_12 = libhpip.la
+-@FULL_BUILD_TRUE@@HPLIP_BUILD_TRUE@am__append_13 = prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template prnt/hpcups/libImageProcessor-x86_64.so prnt/hpcups/libImageProcessor-x86_32.so
++@FULL_BUILD_TRUE@@HPLIP_BUILD_TRUE@am__append_13 = prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template
+ @FULL_BUILD_TRUE@@HPLIP_BUILD_TRUE@am__append_14 = dat2drv.py install.py  hplip-install init-suse-firewall init-iptables-firewall class_rpm_build.sh hplipclassdriver.spec createPPD.sh Makefile_dat2drv hpijs-drv
+ @FULL_BUILD_TRUE@@HPLIP_BUILD_TRUE@@HPLIP_CLASS_DRIVER_FALSE@am__append_15 = scan/sane/hpaio.desc \
+ @FULL_BUILD_TRUE@@HPLIP_BUILD_TRUE@@HPLIP_CLASS_DRIVER_FALSE@	installer/text_install.py \
+@@ -500,8 +500,7 @@ am__hpcups_SOURCES_DIST = prnt/hpcups/HPCupsFilter.cpp \
+ 	prnt/hpcups/RunLenEncoding.h prnt/hpcups/common_defines.h \
+ 	prnt/hpcups/genPCLm.h common/utils.c common/utils.h \
+ 	prnt/hpcups/Hbpl1_Wrapper.cpp prnt/hpcups/genPCLm.cpp \
+-	prnt/hpcups/genJPEGStrips.cpp prnt/hpcups/RunLenEncoding.cpp \
+-	prnt/hpcups/ImageProcessor.h
++	prnt/hpcups/genJPEGStrips.cpp prnt/hpcups/RunLenEncoding.cpp
+ @HPCUPS_INSTALL_TRUE@am_hpcups_OBJECTS =  \
+ @HPCUPS_INSTALL_TRUE@	hpcups-HPCupsFilter.$(OBJEXT) \
+ @HPCUPS_INSTALL_TRUE@	hpcups-dbuscomm.$(OBJEXT) \
+@@ -723,8 +722,7 @@ am__dist_locatedriver_DATA_DIST = locatedriver
+ am__dist_models_DATA_DIST = data/models/models.dat
+ am__dist_noinst_DATA_DIST = prnt/drv/hpijs.drv.in.template \
+ 	prnt/drv/hpcups.drv.in.template \
+-	prnt/hpcups/libImageProcessor-x86_64.so \
+-	prnt/hpcups/libImageProcessor-x86_32.so scan/sane/hpaio.desc \
++	scan/sane/hpaio.desc \
+ 	installer/text_install.py data/localization/hplip_de.ts \
+ 	data/localization/hplip_es.ts data/localization/hplip_fr.ts \
+ 	data/localization/hplip_it.ts data/localization/hplip_pt.ts \
+@@ -1932,11 +1930,6 @@ am__dist_ppd_DATA_DIST = prnt/ps/hp-designjet_z6810ps_42in-ps.ppd.gz \
+ 	ppd/classppd/ps/hp-postscript-inkjet.ppd.gz \
+ 	ppd/classppd/ps/hp-postscript-laserjet-pro.ppd.gz \
+ 	ppd/classppd/ps/hp-postscript-laserjet.ppd.gz
+-am__dist_printplugins_DATA_DIST = prnt/plugins/hbpl1-arm32.so \
+-	prnt/plugins/hbpl1-arm64.so prnt/plugins/hbpl1-x86_32.so \
+-	prnt/plugins/hbpl1-x86_64.so prnt/plugins/lj-arm32.so \
+-	prnt/plugins/lj-arm64.so prnt/plugins/lj-x86_32.so \
+-	prnt/plugins/lj-x86_64.so
+ am__dist_prnt_DATA_DIST = prnt/cups.py prnt/__init__.py prnt/ldl.py \
+ 	prnt/pcl.py prnt/colorcal.py
+ am__dist_rules_DATA_DIST = data/rules/56-hpmud.rules \
+@@ -4665,11 +4658,10 @@ libapdk_la_CFLAGS = $(libapdk_la_CXXFLAGS) -Iprnt/hpijs
+ @HPCUPS_INSTALL_TRUE@	prnt/hpcups/flate_colorspace.h prnt/hpcups/RunLenEncoding.h prnt/hpcups/common_defines.h \
+ @HPCUPS_INSTALL_TRUE@	prnt/hpcups/genPCLm.h \
+ @HPCUPS_INSTALL_TRUE@	common/utils.c common/utils.h prnt/hpcups/Hbpl1_Wrapper.cpp prnt/hpcups/genPCLm.cpp \
+-@HPCUPS_INSTALL_TRUE@	prnt/hpcups/genJPEGStrips.cpp prnt/hpcups/RunLenEncoding.cpp \
+-@HPCUPS_INSTALL_TRUE@	prnt/hpcups/ImageProcessor.h
++@HPCUPS_INSTALL_TRUE@	prnt/hpcups/genJPEGStrips.cpp prnt/hpcups/RunLenEncoding.cpp
+ 
+ @HPCUPS_INSTALL_TRUE@hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS)
+-@HPCUPS_INSTALL_TRUE@hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lImageProcessor -lcups -lcupsimage -lz $(DBUS_LIBS)
++@HPCUPS_INSTALL_TRUE@hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lcups -lcupsimage -lz $(DBUS_LIBS)
+ #else
+ #hpcupsdir = $(cupsfilterdir)
+ #hpcups_PROGRAMS = hpcups
+@@ -4717,7 +4709,6 @@ ppddir = $(hpppddir)
+ @HPLIP_CLASS_DRIVER_TRUE@filterdir = $(cupsfilterdir)
+ @HPLIP_CLASS_DRIVER_TRUE@printpluginsdir = $(cupsfilterdir)
+ @HPLIP_CLASS_DRIVER_TRUE@dist_filter_DATA = hpcups hpps dat2drv
+-@HPLIP_CLASS_DRIVER_TRUE@dist_printplugins_DATA = prnt/plugins/hbpl1-arm32.so prnt/plugins/hbpl1-arm64.so prnt/plugins/hbpl1-x86_32.so prnt/plugins/hbpl1-x86_64.so prnt/plugins/lj-arm32.so prnt/plugins/lj-arm64.so prnt/plugins/lj-x86_32.so prnt/plugins/lj-x86_64.so
+ all: all-am
+ 
+ .SUFFIXES:
+@@ -9380,16 +9371,6 @@ uninstall-am: uninstall-apparmor_abstractionDATA \
+ 
+ 
+ install-data-hook:
+-@HPLIP_BUILD_TRUE@	if [ \( "$(UNAME)" = "x86_64" -a  -d "$(libdir)/" \) ]; then \
+-@HPLIP_BUILD_TRUE@		cp prnt/hpcups/libImageProcessor-x86_64.so $(libdir)/ ; \
+-@HPLIP_BUILD_TRUE@		chmod 775 $(libdir)/libImageProcessor-x86_64.so ; \
+-@HPLIP_BUILD_TRUE@		ln -sf $(libdir)/libImageProcessor-x86_64.so $(libdir)/libImageProcessor.so ; \
+-@HPLIP_BUILD_TRUE@	fi; \
+-@HPLIP_BUILD_TRUE@	if [ \( \( "$(UNAME)" = "i686" -o "$(UNAME)" = "i386" \) -a -d "$(libdir)/" \) ]; then \
+-@HPLIP_BUILD_TRUE@		cp prnt/hpcups/libImageProcessor-x86_32.so $(libdir)/ ; \
+-@HPLIP_BUILD_TRUE@		chmod 775 $(libdir)/libImageProcessor-x86_32.so ; \
+-@HPLIP_BUILD_TRUE@		ln -sf $(libdir)/libImageProcessor-x86_32.so $(libdir)/libImageProcessor.so ; \
+-@HPLIP_BUILD_TRUE@	fi
+ #	   If scanner build, add hpaio entry to sane dll.conf.
+ @HPLIP_BUILD_TRUE@@HPLIP_CLASS_DRIVER_FALSE@	if [ "$(scan_build)" = "yes" ]; then \
+ @HPLIP_BUILD_TRUE@@HPLIP_CLASS_DRIVER_FALSE@	   $(mkinstalldirs) $(DESTDIR)/etc/sane.d; \
+@@ -9556,10 +9537,6 @@ dist-hook:
+ @HPLIP_CLASS_DRIVER_TRUE@	rm -rf $(distdir)/setup.py
+ @HPLIP_CLASS_DRIVER_TRUE@	rm -rf $(distdir)/systray.py
+ @HPLIP_CLASS_DRIVER_TRUE@	rm -rf $(distdir)/timedate.py
+-@HPLIP_CLASS_DRIVER_TRUE@	rm -rf $(distdir)/prnt/plugins/lj-arm32.so
+-@HPLIP_CLASS_DRIVER_TRUE@	rm -rf $(distdir)/prnt/plugins/lj-arm64.so
+-@HPLIP_CLASS_DRIVER_TRUE@	rm -rf $(distdir)/prnt/plugins/lj-x86_32.so
+-@HPLIP_CLASS_DRIVER_TRUE@	rm -rf $(distdir)/prnt/plugins/lj-x86_64.so
+ @HPLIP_CLASS_DRIVER_TRUE@	rm -rf $(distdir)/hpijs-drv
+ @HPLIP_CLASS_DRIVER_TRUE@	rm -rf $(distdir)/prnt/hpcups/
+ @HPLIP_CLASS_DRIVER_TRUE@	rm -rf $(distdir)/prnt/ps/
+diff --git a/prnt/hpcups/HPCupsFilter.cpp b/prnt/hpcups/HPCupsFilter.cpp
+index 5b282d8..0bacfaf 100644
+--- a/prnt/hpcups/HPCupsFilter.cpp
++++ b/prnt/hpcups/HPCupsFilter.cpp
+@@ -31,7 +31,6 @@
+ \*****************************************************************************/
+ 
+ #include "HPCupsFilter.h"
+-#include "ImageProcessor.h"
+ 
+ #include <signal.h>
+ #include <sys/wait.h>
+@@ -637,16 +636,10 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+ 
+ 
+     sprintf(hpPreProcessedRasterFile, "%s/hp_%s_cups_SwapedPagesXXXXXX",CUPS_TMP_DIR, m_JA.user_name);
+-    image_processor_t* imageProcessor = imageProcessorCreate();
+ 
+     while (cupsRasterReadHeader2(cups_raster, &cups_header))
+     {
+ 
+-        IMAGE_PROCESSOR_ERROR result = imageProcessorStartPage(imageProcessor, &cups_header);
+-        if (result != IPE_SUCCESS){
+-            dbglog("DEBUG: imageProcessorStartPage failed result = %d\n", result);
+-        }
+-
+         current_page_number++;
+ 
+         if (current_page_number == 1) {
+@@ -745,12 +738,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+             color_raster = rgbRaster;
+             black_raster = kRaster;
+ 
+-            result = imageProcessorProcessLine(imageProcessor, m_pPrinterBuffer, cups_header.cupsBytesPerLine);
+-            if (result != IPE_SUCCESS){
+-                dbglog("DEBUG: imageProcessorProcessLine failed result = %d\n", result);
+-            }
+-
+-
+             if ((y == 0) && !is_ljmono) {
+                 //For ljmono, make sure that first line is not a blankRaster line.Otherwise printer
+                 //may not skip blank lines before actual data
+@@ -780,12 +767,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+             }
+         }  // for() loop end
+ 
+-        result = imageProcessorEndPage(imageProcessor);
+-        if (result != IPE_SUCCESS){
+-                dbglog("DEBUG: imageProcessorEndPage failed result = %d\n", result);
+-        }
+-
+-
+         m_Job.NewPage();
+         if (err != NO_ERROR) {
+             break;
+@@ -800,8 +781,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+         rgbRaster = NULL;
+     }
+ 
+-    imageProcessorDestroy(imageProcessor);
+-
+     unlink(hpPreProcessedRasterFile);
+     return ret_status;
+ }
+-- 
+2.19.1
+
diff --git a/gnu/packages/patches/icecat-CVE-2018-5157-and-CVE-2018-5158.patch b/gnu/packages/patches/icecat-CVE-2018-5157-and-CVE-2018-5158.patch
deleted file mode 100644
index b776640133..0000000000
--- a/gnu/packages/patches/icecat-CVE-2018-5157-and-CVE-2018-5158.patch
+++ /dev/null
@@ -1,441 +0,0 @@
-Based on <https://hg.mozilla.org/releases/mozilla-esr52/rev/608e76ec5ba2>
-Adapted to apply cleanly to GNU IceCat.
-
-# HG changeset patch
-# User Ryan VanderMeulen <ryanvm@gmail.com>
-# Date 1523630807 14400
-# Node ID 608e76ec5ba25cec2271d2b400c7bce2d4c5ef79
-# Parent  10b7f43b536f93151201d44d304c991aa9af5d0c
-Bug 1452075 - Backport some upstream pdf.js fixes to ESR52. r=bdahl, r=yury, a=RyanVM
-
-diff --git a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm
---- a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm
-+++ b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm
-@@ -24,17 +24,18 @@ const Cc = Components.classes;
- const Ci = Components.interfaces;
- const Cr = Components.results;
- const Cu = Components.utils;
- // True only if this is the version of pdf.js that is included with icecat.
- const MOZ_CENTRAL = JSON.parse('true');
- const PDFJS_EVENT_ID = 'pdf.js.message';
- const PDF_CONTENT_TYPE = 'application/pdf';
- const PREF_PREFIX = 'pdfjs';
--const PDF_VIEWER_WEB_PAGE = 'resource://pdf.js/web/viewer.html';
-+const PDF_VIEWER_ORIGIN = "resource://pdf.js";
-+const PDF_VIEWER_WEB_PAGE = "resource://pdf.js/web/viewer.html";
- const MAX_NUMBER_OF_PREFS = 50;
- const MAX_STRING_PREF_LENGTH = 128;
- 
- Cu.import('resource://gre/modules/XPCOMUtils.jsm');
- Cu.import('resource://gre/modules/Services.jsm');
- Cu.import('resource://gre/modules/NetUtil.jsm');
- 
- XPCOMUtils.defineLazyModuleGetter(this, 'NetworkManager',
-@@ -105,21 +106,25 @@ function log(aMsg) {
-   if (!getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false)) {
-     return;
-   }
-   var msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
-   Services.console.logStringMessage(msg);
-   dump(msg + '\n');
- }
- 
--function getDOMWindow(aChannel) {
-+function getDOMWindow(aChannel, aPrincipal) {
-   var requestor = aChannel.notificationCallbacks ?
-                   aChannel.notificationCallbacks :
-                   aChannel.loadGroup.notificationCallbacks;
-   var win = requestor.getInterface(Components.interfaces.nsIDOMWindow);
-+  // Ensure the window wasn't navigated to something that is not PDF.js.
-+  if (!win.document.nodePrincipal.equals(aPrincipal)) {
-+    return null;
-+  }
-   return win;
- }
- 
- function getLocalizedStrings(path) {
-   var stringBundle = Cc['@mozilla.org/intl/stringbundle;1'].
-       getService(Ci.nsIStringBundleService).
-       createBundle('chrome://pdf.js/locale/' + path);
- 
-@@ -627,31 +632,31 @@ var RangedChromeActions = (function Rang
-       data = this.dataListener.readData();
- 
-       this.dataListener.onprogress = function (loaded, total) {
-         self.domWindow.postMessage({
-           pdfjsLoadAction: 'progressiveRead',
-           loaded: loaded,
-           total: total,
-           chunk: self.dataListener.readData()
--        }, '*');
-+        }, PDF_VIEWER_ORIGIN);
-       };
-       this.dataListener.oncomplete = function () {
-         self.dataListener = null;
-       };
-     }
- 
-     this.domWindow.postMessage({
-       pdfjsLoadAction: 'supportsRangedLoading',
-       rangeEnabled: this.rangeEnabled,
-       streamingEnabled: this.streamingEnabled,
-       pdfUrl: this.pdfUrl,
-       length: this.contentLength,
-       data: data
--    }, '*');
-+    }, PDF_VIEWER_ORIGIN);
- 
-     return true;
-   };
- 
-   proto.requestDataRange = function RangedChromeActions_requestDataRange(args) {
-     if (!this.rangeEnabled) {
-       return;
-     }
-@@ -663,23 +668,23 @@ var RangedChromeActions = (function Rang
-     // errors from chrome code for non-range requests, so this doesn't
-     // seem high-pri
-     this.networkManager.requestRange(begin, end, {
-       onDone: function RangedChromeActions_onDone(args) {
-         domWindow.postMessage({
-           pdfjsLoadAction: 'range',
-           begin: args.begin,
-           chunk: args.chunk
--        }, '*');
-+        }, PDF_VIEWER_ORIGIN);
-       },
-       onProgress: function RangedChromeActions_onProgress(evt) {
-         domWindow.postMessage({
-           pdfjsLoadAction: 'rangeProgress',
-           loaded: evt.loaded,
--        }, '*');
-+        }, PDF_VIEWER_ORIGIN);
-       }
-     });
-   };
- 
-   proto.abortLoading = function RangedChromeActions_abortLoading() {
-     this.networkManager.abortAllRequests();
-     if (this.originalRequest) {
-       this.originalRequest.cancel(Cr.NS_BINDING_ABORTED);
-@@ -718,26 +723,26 @@ var StandardChromeActions = (function St
-     var self = this;
- 
-     this.dataListener.onprogress = function ChromeActions_dataListenerProgress(
-                                       loaded, total) {
-       self.domWindow.postMessage({
-         pdfjsLoadAction: 'progress',
-         loaded: loaded,
-         total: total
--      }, '*');
-+      }, PDF_VIEWER_ORIGIN);
-     };
- 
-     this.dataListener.oncomplete =
-         function StandardChromeActions_dataListenerComplete(data, errorCode) {
-       self.domWindow.postMessage({
-         pdfjsLoadAction: 'complete',
-         data: data,
-         errorCode: errorCode
--      }, '*');
-+      }, PDF_VIEWER_ORIGIN);
- 
-       self.dataListener = null;
-       self.originalRequest = null;
-     };
- 
-     return true;
-   };
- 
-@@ -972,31 +977,35 @@ PdfStreamConverter.prototype = {
-     var proxy = {
-       onStartRequest: function(request, context) {
-         listener.onStartRequest(aRequest, aContext);
-       },
-       onDataAvailable: function(request, context, inputStream, offset, count) {
-         listener.onDataAvailable(aRequest, aContext, inputStream,
-                                  offset, count);
-       },
--      onStopRequest: function(request, context, statusCode) {
--        // We get the DOM window here instead of before the request since it
--        // may have changed during a redirect.
--        var domWindow = getDOMWindow(channel);
-+      onStopRequest(request, context, statusCode) {
-+        var domWindow = getDOMWindow(channel, resourcePrincipal);
-+        if (!Components.isSuccessCode(statusCode) || !domWindow) {
-+          // The request may have been aborted and the document may have been
-+          // replaced with something that is not PDF.js, abort attaching.
-+          listener.onStopRequest(aRequest, context, statusCode);
-+          return;
-+        }
-         var actions;
-         if (rangeRequest || streamRequest) {
-           actions = new RangedChromeActions(
-             domWindow, contentDispositionFilename, aRequest,
-             rangeRequest, streamRequest, dataListener);
-         } else {
-           actions = new StandardChromeActions(
-             domWindow, contentDispositionFilename, aRequest, dataListener);
-         }
-         var requestListener = new RequestListener(actions);
--        domWindow.addEventListener(PDFJS_EVENT_ID, function(event) {
-+        domWindow.document.addEventListener(PDFJS_EVENT_ID, function(event) {
-           requestListener.receive(event);
-         }, false, true);
-         if (actions.supportsIntegratedFind()) {
-           var findEventManager = new FindEventManager(domWindow);
-           findEventManager.bind();
-         }
-         listener.onStopRequest(aRequest, aContext, statusCode);
- 
-diff --git a/browser/extensions/pdfjs/content/build/pdf.worker.js b/browser/extensions/pdfjs/content/build/pdf.worker.js
---- a/browser/extensions/pdfjs/content/build/pdf.worker.js
-+++ b/browser/extensions/pdfjs/content/build/pdf.worker.js
-@@ -41648,16 +41648,32 @@
-       var error = sharedUtil.error;
-       var info = sharedUtil.info;
-       var isArray = sharedUtil.isArray;
-       var isBool = sharedUtil.isBool;
-       var isDict = corePrimitives.isDict;
-       var isStream = corePrimitives.isStream;
-       var PostScriptLexer = corePsParser.PostScriptLexer;
-       var PostScriptParser = corePsParser.PostScriptParser;
-+      function toNumberArray(arr) {
-+        if (!Array.isArray(arr)) {
-+          return null;
-+        }
-+        var length = arr.length;
-+        for (var i = 0; i < length; i++) {
-+          if (typeof arr[i] !== 'number') {
-+            var result = new Array(length);
-+            for (var j = 0; j < length; j++) {
-+              result[j] = +arr[j];
-+            }
-+            return result;
-+          }
-+        }
-+        return arr;
-+      }
-       var PDFFunction = function PDFFunctionClosure() {
-         var CONSTRUCT_SAMPLED = 0;
-         var CONSTRUCT_INTERPOLATED = 2;
-         var CONSTRUCT_STICHED = 3;
-         var CONSTRUCT_POSTSCRIPT = 4;
-         return {
-           getSampleArray: function PDFFunction_getSampleArray(size, outputSize, bps, str) {
-             var i, ii;
-@@ -41747,43 +41763,43 @@
-                 out[index] = [
-                   arr[i],
-                   arr[i + 1]
-                 ];
-                 ++index;
-               }
-               return out;
-             }
--            var domain = dict.getArray('Domain');
--            var range = dict.getArray('Range');
-+            var domain = toNumberArray(dict.getArray('Domain'));
-+            var range = toNumberArray(dict.getArray('Range'));
-             if (!domain || !range) {
-               error('No domain or range');
-             }
-             var inputSize = domain.length / 2;
-             var outputSize = range.length / 2;
-             domain = toMultiArray(domain);
-             range = toMultiArray(range);
--            var size = dict.get('Size');
-+            var size = toNumberArray(dict.get('Size'));
-             var bps = dict.get('BitsPerSample');
-             var order = dict.get('Order') || 1;
-             if (order !== 1) {
-               // No description how cubic spline interpolation works in PDF32000:2008
-               // As in poppler, ignoring order, linear interpolation may work as good
-               info('No support for cubic spline interpolation: ' + order);
-             }
--            var encode = dict.getArray('Encode');
-+            var encode = toNumberArray(dict.getArray('Encode'));
-             if (!encode) {
-               encode = [];
-               for (var i = 0; i < inputSize; ++i) {
--                encode.push(0);
--                encode.push(size[i] - 1);
--              }
--            }
--            encode = toMultiArray(encode);
--            var decode = dict.getArray('Decode');
-+                encode.push([0, size[i] - 1]);
-+              }
-+            } else {
-+              encode = toMultiArray(encode);
-+            }
-+            var decode = toNumberArray(dict.getArray('Decode'));
-             if (!decode) {
-               decode = range;
-             } else {
-               decode = toMultiArray(decode);
-             }
-             var samples = this.getSampleArray(size, outputSize, bps, str);
-             return [
-               CONSTRUCT_SAMPLED,
-@@ -41868,22 +41884,19 @@
-                 //                    Decode_2j, Decode_2j+1)
-                 rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
-                 // y_j = min(max(r_j, range_2j), range_2j+1)
-                 dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
-               }
-             };
-           },
-           constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
--            var c0 = dict.getArray('C0') || [0];
--            var c1 = dict.getArray('C1') || [1];
-+            var c0 = toNumberArray(dict.getArray('C0')) || [0];
-+            var c1 = toNumberArray(dict.getArray('C1')) || [1];
-             var n = dict.get('N');
--            if (!isArray(c0) || !isArray(c1)) {
--              error('Illegal dictionary for interpolated function');
--            }
-             var length = c0.length;
-             var diff = [];
-             for (var i = 0; i < length; ++i) {
-               diff.push(c1[i] - c0[i]);
-             }
-             return [
-               CONSTRUCT_INTERPOLATED,
-               c0,
-@@ -41899,49 +41912,45 @@
-             return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
-               var x = n === 1 ? src[srcOffset] : Math.pow(src[srcOffset], n);
-               for (var j = 0; j < length; ++j) {
-                 dest[destOffset + j] = c0[j] + x * diff[j];
-               }
-             };
-           },
-           constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
--            var domain = dict.getArray('Domain');
-+            var domain = toNumberArray(dict.getArray('Domain'));
-             if (!domain) {
-               error('No domain');
-             }
-             var inputSize = domain.length / 2;
-             if (inputSize !== 1) {
-               error('Bad domain for stiched function');
-             }
-             var fnRefs = dict.get('Functions');
-             var fns = [];
-             for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
--              fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
--            }
--            var bounds = dict.getArray('Bounds');
--            var encode = dict.getArray('Encode');
-+              fns.push(PDFFunction.parse(xref, xref.fetchIfRef(fnRefs[i])));
-+            }
-+            var bounds = toNumberArray(dict.getArray('Bounds'));
-+            var encode = toNumberArray(dict.getArray('Encode'));
-             return [
-               CONSTRUCT_STICHED,
-               domain,
-               bounds,
-               encode,
-               fns
-             ];
-           },
-           constructStichedFromIR: function PDFFunction_constructStichedFromIR(IR) {
-             var domain = IR[1];
-             var bounds = IR[2];
-             var encode = IR[3];
--            var fnsIR = IR[4];
--            var fns = [];
-+            var fns = IR[4];
-             var tmpBuf = new Float32Array(1);
--            for (var i = 0, ii = fnsIR.length; i < ii; i++) {
--              fns.push(PDFFunction.fromIR(fnsIR[i]));
--            }
-             return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
-               var clip = function constructStichedFromIRClip(v, min, max) {
-                 if (v > max) {
-                   v = max;
-                 } else if (v < min) {
-                   v = min;
-                 }
-                 return v;
-@@ -41968,18 +41977,18 @@
-               // Prevent the value from becoming NaN as a result
-               // of division by zero (fixes issue6113.pdf).
-               tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
-               // call the appropriate function
-               fns[i](tmpBuf, 0, dest, destOffset);
-             };
-           },
-           constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
--            var domain = dict.getArray('Domain');
--            var range = dict.getArray('Range');
-+            var domain = toNumberArray(dict.getArray('Domain'));
-+            var range = toNumberArray(dict.getArray('Range'));
-             if (!domain) {
-               error('No domain.');
-             }
-             if (!range) {
-               error('No range.');
-             }
-             var lexer = new PostScriptLexer(fn);
-             var parser = new PostScriptParser(lexer);
-@@ -42928,18 +42937,18 @@
-           case 'IndexedCS':
-             var baseIndexedCS = IR[1];
-             var hiVal = IR[2];
-             var lookup = IR[3];
-             return new IndexedCS(ColorSpace.fromIR(baseIndexedCS), hiVal, lookup);
-           case 'AlternateCS':
-             var numComps = IR[1];
-             var alt = IR[2];
--            var tintFnIR = IR[3];
--            return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
-+            var tintFn = IR[3];
-+            return new AlternateCS(numComps, ColorSpace.fromIR(alt), tintFn);
-           case 'LabCS':
-             whitePoint = IR[1];
-             blackPoint = IR[2];
-             var range = IR[3];
-             return new LabCS(whitePoint, blackPoint, range);
-           default:
-             error('Unknown name ' + name);
-           }
-@@ -43067,22 +43076,22 @@
-               var name = xref.fetchIfRef(cs[1]);
-               numComps = 1;
-               if (isName(name)) {
-                 numComps = 1;
-               } else if (isArray(name)) {
-                 numComps = name.length;
-               }
-               alt = ColorSpace.parseToIR(cs[2], xref, res);
--              var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
-+              var tintFn = PDFFunction.parse(xref, xref.fetchIfRef(cs[3]));
-               return [
-                 'AlternateCS',
-                 numComps,
-                 alt,
--                tintFnIR
-+                tintFn
-               ];
-             case 'Lab':
-               params = xref.fetchIfRef(cs[1]);
-               whitePoint = params.getArray('WhitePoint');
-               blackPoint = params.getArray('BlackPoint');
-               var range = params.getArray('Range');
-               return [
-                 'LabCS',
-@@ -52483,9 +52492,9 @@
-         initializeWorker();
-       }
-       exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
-       exports.WorkerTask = WorkerTask;
-       exports.WorkerMessageHandler = WorkerMessageHandler;
-     }));
-   }.call(pdfjsLibs));
-   exports.WorkerMessageHandler = pdfjsLibs.pdfjsCoreWorker.WorkerMessageHandler;
--}));
-\ No newline at end of file
-+}));
-
diff --git a/gnu/packages/patches/icecat-avoid-bundled-libraries.patch b/gnu/packages/patches/icecat-avoid-bundled-libraries.patch
index 114631517a..33203b1a33 100644
--- a/gnu/packages/patches/icecat-avoid-bundled-libraries.patch
+++ b/gnu/packages/patches/icecat-avoid-bundled-libraries.patch
@@ -1,8 +1,8 @@
 Fixes needed when avoiding bundled libraries.
 
---- icecat-52.0.2/xpcom/build/moz.build.orig
-+++ icecat-52.0.2/xpcom/build/moz.build
-@@ -93,10 +93,5 @@
+--- icecat-60.2.0/xpcom/build/moz.build.orig	2018-09-13 17:46:49.000000000 -0400
++++ icecat-60.2.0/xpcom/build/moz.build	2018-09-22 04:26:50.659564554 -0400
+@@ -99,10 +99,5 @@
      '/docshell/base',
  ]
  
@@ -13,9 +13,9 @@ Fixes needed when avoiding bundled libraries.
 -
  if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
      CXXFLAGS += CONFIG['TK_CFLAGS']
---- icecat-52.0.2/storage/moz.build.orig
-+++ icecat-52.0.2/storage/moz.build
-@@ -114,7 +114,6 @@
+--- icecat-60.2.0/storage/moz.build.orig	2018-09-13 17:51:11.000000000 -0400
++++ icecat-60.2.0/storage/moz.build	2018-09-22 04:26:50.659564554 -0400
+@@ -117,7 +117,6 @@
      DEFINES['MOZ_MEMORY_TEMP_STORE_PRAGMA'] = True
  
  LOCAL_INCLUDES += [
@@ -23,13 +23,27 @@ Fixes needed when avoiding bundled libraries.
      '/dom/base',
  ]
  
---- icecat-52.0.2/dom/indexedDB/moz.build.orig
-+++ icecat-52.0.2/dom/indexedDB/moz.build
-@@ -101,7 +101,6 @@
+--- icecat-60.2.0/dom/indexedDB/moz.build.orig	2018-09-13 17:49:42.000000000 -0400
++++ icecat-60.2.0/dom/indexedDB/moz.build	2018-09-22 04:26:50.663564574 -0400
+@@ -102,7 +102,6 @@
      CXXFLAGS += ['-Wno-error=shadow']
  
  LOCAL_INCLUDES += [
 -    '/db/sqlite3/src',
      '/dom/base',
      '/dom/storage',
-     '/dom/workers',
+     '/ipc/glue',
+--- icecat-60.2.0/media/webrtc/trunk/webrtc/base/rtc_task_queue_gn/moz.build.orig	2018-09-13 17:40:54.000000000 -0400
++++ icecat-60.2.0/media/webrtc/trunk/webrtc/base/rtc_task_queue_gn/moz.build	2018-09-23 21:33:12.319975105 -0400
+@@ -130,11 +130,6 @@
+     DEFINES["WEBRTC_POSIX"] = True
+     DEFINES["_FILE_OFFSET_BITS"] = "64"
+ 
+-    LOCAL_INCLUDES += [
+-        "/ipc/chromium/src/third_party/libevent/include/",
+-        "/ipc/chromium/src/third_party/libevent/linux/"
+-    ]
+-
+     UNIFIED_SOURCES += [
+         "/media/webrtc/trunk/webrtc/base/task_queue_libevent.cc",
+         "/media/webrtc/trunk/webrtc/base/task_queue_posix.cc"
diff --git a/gnu/packages/patches/icecat-bug-1413868-pt1.patch b/gnu/packages/patches/icecat-bug-1413868-pt1.patch
deleted file mode 100644
index 18382dc33a..0000000000
--- a/gnu/packages/patches/icecat-bug-1413868-pt1.patch
+++ /dev/null
@@ -1,663 +0,0 @@
-Based on <https://hg.mozilla.org/releases/mozilla-esr52/rev/431fa5dd4016>
-Adapted to apply cleanly to GNU IceCat.
-
-# HG changeset patch
-# User Honza Bambas <honzab.moz@firemni.cz>
-# Date 1528830658 14400
-# Node ID 431fa5dd4016bdab7e4bb0d3c4df85468fe337b0
-# Parent  e8e9e1ef79f2a18c61ec1b87cfb214c8d4960f8e
-Bug 1413868. r=valentin, a=RyanVM
-
-diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
---- a/toolkit/xre/nsAppRunner.cpp
-+++ b/toolkit/xre/nsAppRunner.cpp
-@@ -4,16 +4,17 @@
-  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- 
- #include "mozilla/dom/ContentParent.h"
- #include "mozilla/dom/ContentChild.h"
- #include "mozilla/ipc/GeckoChildProcessHost.h"
- 
- #include "mozilla/ArrayUtils.h"
- #include "mozilla/Attributes.h"
-+#include "mozilla/FilePreferences.h"
- #include "mozilla/ChaosMode.h"
- #include "mozilla/IOInterposer.h"
- #include "mozilla/Likely.h"
- #include "mozilla/MemoryChecking.h"
- #include "mozilla/Poison.h"
- #include "mozilla/Preferences.h"
- #include "mozilla/ScopeExit.h"
- #include "mozilla/Services.h"
-@@ -4304,16 +4305,20 @@ XREMain::XRE_mainRun()
-       // Need to write out the fact that the profile has been removed and potentially
-       // that the selected/default profile changed.
-       mProfileSvc->Flush();
-     }
-   }
- 
-   mDirProvider.DoStartup();
- 
-+  // As FilePreferences need the profile directory, we must initialize right here.
-+  mozilla::FilePreferences::InitDirectoriesWhitelist();
-+  mozilla::FilePreferences::InitPrefs();
-+
-   OverrideDefaultLocaleIfNeeded();
- 
- #ifdef MOZ_CRASHREPORTER
-   nsCString userAgentLocale;
-   // Try a localized string first. This pref is always a localized string in
-   // IceCatMobile, and might be elsewhere, too.
-   if (NS_SUCCEEDED(Preferences::GetLocalizedCString("general.useragent.locale", &userAgentLocale))) {
-     CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale);
-diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp
---- a/toolkit/xre/nsEmbedFunctions.cpp
-+++ b/toolkit/xre/nsEmbedFunctions.cpp
-@@ -46,16 +46,17 @@
- #include "nsX11ErrorHandler.h"
- #include "nsGDKErrorHandler.h"
- #include "base/at_exit.h"
- #include "base/command_line.h"
- #include "base/message_loop.h"
- #include "base/process_util.h"
- #include "chrome/common/child_process.h"
- 
-+#include "mozilla/FilePreferences.h"
- #include "mozilla/ipc/BrowserProcessSubThread.h"
- #include "mozilla/ipc/GeckoChildProcessHost.h"
- #include "mozilla/ipc/IOThreadChild.h"
- #include "mozilla/ipc/ProcessChild.h"
- #include "ScopedXREEmbed.h"
- 
- #include "mozilla/plugins/PluginProcessChild.h"
- #include "mozilla/dom/ContentProcess.h"
-@@ -680,16 +681,18 @@ XRE_InitChildProcess(int aArgc,
-       ::SetProcessShutdownParameters(0x280 - 1, SHUTDOWN_NORETRY);
- #endif
- 
- #if defined(MOZ_SANDBOX) && defined(XP_WIN)
-       // We need to do this after the process has been initialised, as
-       // InitLoggingIfRequired may need access to prefs.
-       mozilla::sandboxing::InitLoggingIfRequired(aChildData->ProvideLogFunction);
- #endif
-+      mozilla::FilePreferences::InitDirectoriesWhitelist();
-+      mozilla::FilePreferences::InitPrefs();
- 
-       OverrideDefaultLocaleIfNeeded();
- 
- #if defined(MOZ_CRASHREPORTER)
- #if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK)
-       AddContentSandboxLevelAnnotation();
- #endif
- #endif
-diff --git a/xpcom/io/FilePreferences.cpp b/xpcom/io/FilePreferences.cpp
-new file mode 100644
---- /dev/null
-+++ b/xpcom/io/FilePreferences.cpp
-@@ -0,0 +1,271 @@
-+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-+/* This Source Code Form is subject to the terms of the Mozilla Public
-+* License, v. 2.0. If a copy of the MPL was not distributed with this
-+* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-+
-+#include "FilePreferences.h"
-+
-+#include "mozilla/Preferences.h"
-+#include "nsAppDirectoryServiceDefs.h"
-+#include "nsDirectoryServiceDefs.h"
-+#include "nsDirectoryServiceUtils.h"
-+
-+namespace mozilla {
-+namespace FilePreferences {
-+
-+static bool sBlockUNCPaths = false;
-+typedef nsTArray<nsString> Paths;
-+
-+static Paths& PathArray()
-+{
-+  static Paths sPaths;
-+  return sPaths;
-+}
-+
-+static void AllowDirectory(char const* directory)
-+{
-+  nsCOMPtr<nsIFile> file;
-+  NS_GetSpecialDirectory(directory, getter_AddRefs(file));
-+  if (!file) {
-+    return;
-+  }
-+
-+  nsString path;
-+  if (NS_FAILED(file->GetTarget(path))) {
-+    return;
-+  }
-+
-+  // The whitelist makes sense only for UNC paths, because this code is used
-+  // to block only UNC paths, hence, no need to add non-UNC directories here
-+  // as those would never pass the check.
-+  if (!StringBeginsWith(path, NS_LITERAL_STRING("\\\\"))) {
-+    return;
-+  }
-+
-+  if (!PathArray().Contains(path)) {
-+    PathArray().AppendElement(path);
-+  }
-+}
-+
-+void InitPrefs()
-+{
-+  sBlockUNCPaths = Preferences::GetBool("network.file.disable_unc_paths", false);
-+}
-+
-+void InitDirectoriesWhitelist()
-+{
-+  // NS_GRE_DIR is the installation path where the binary resides.
-+  AllowDirectory(NS_GRE_DIR);
-+  // NS_APP_USER_PROFILE_50_DIR and NS_APP_USER_PROFILE_LOCAL_50_DIR are the two
-+  // parts of the profile we store permanent and local-specific data.
-+  AllowDirectory(NS_APP_USER_PROFILE_50_DIR);
-+  AllowDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR);
-+}
-+
-+namespace { // anon
-+
-+class Normalizer
-+{
-+public:
-+  Normalizer(const nsAString& aFilePath, const char16_t aSeparator);
-+  bool Get(nsAString& aNormalizedFilePath);
-+
-+private:
-+  bool ConsumeItem();
-+  bool ConsumeSeparator();
-+  bool IsEOF() { return mFilePathCursor == mFilePathEnd; }
-+
-+  bool ConsumeName();
-+  bool CheckParentDir();
-+  bool CheckCurrentDir();
-+
-+  nsString::const_char_iterator mFilePathCursor;
-+  nsString::const_char_iterator mFilePathEnd;
-+
-+  nsDependentSubstring mItem;
-+  char16_t const mSeparator;
-+  nsTArray<nsDependentSubstring> mStack;
-+};
-+
-+Normalizer::Normalizer(const nsAString& aFilePath, const char16_t aSeparator)
-+  : mFilePathCursor(aFilePath.BeginReading())
-+  , mFilePathEnd(aFilePath.EndReading())
-+  , mSeparator(aSeparator)
-+{
-+}
-+
-+bool Normalizer::ConsumeItem()
-+{
-+  if (IsEOF()) {
-+    return false;
-+  }
-+
-+  nsString::const_char_iterator nameBegin = mFilePathCursor;
-+  while (mFilePathCursor != mFilePathEnd) {
-+    if (*mFilePathCursor == mSeparator) {
-+      break; // don't include the separator
-+    }
-+    ++mFilePathCursor;
-+  }
-+
-+  mItem.Rebind(nameBegin, mFilePathCursor);
-+  return true;
-+}
-+
-+bool Normalizer::ConsumeSeparator()
-+{
-+  if (IsEOF()) {
-+    return false;
-+  }
-+
-+  if (*mFilePathCursor != mSeparator) {
-+    return false;
-+  }
-+
-+  ++mFilePathCursor;
-+  return true;
-+}
-+
-+bool Normalizer::Get(nsAString& aNormalizedFilePath)
-+{
-+  aNormalizedFilePath.Truncate();
-+
-+  if (IsEOF()) {
-+    return true;
-+  }
-+  if (ConsumeSeparator()) {
-+    aNormalizedFilePath.Append(mSeparator);
-+  }
-+
-+  if (IsEOF()) {
-+    return true;
-+  }
-+  if (ConsumeSeparator()) {
-+    aNormalizedFilePath.Append(mSeparator);
-+  }
-+
-+  while (!IsEOF()) {
-+    if (!ConsumeName()) {
-+      return false;
-+    }
-+  }
-+
-+  for (auto const& name : mStack) {
-+    aNormalizedFilePath.Append(name);
-+  }
-+
-+  return true;
-+}
-+
-+bool Normalizer::ConsumeName()
-+{
-+  if (!ConsumeItem()) {
-+    return true;
-+  }
-+
-+  if (CheckCurrentDir()) {
-+    return true;
-+  }
-+
-+  if (CheckParentDir()) {
-+    if (!mStack.Length()) {
-+      // This means there are more \.. than valid names
-+      return false;
-+    }
-+
-+    mStack.RemoveElementAt(mStack.Length() - 1);
-+    return true;
-+  }
-+
-+  if (mItem.IsEmpty()) {
-+    // this means an empty name (a lone slash), which is illegal
-+    return false;
-+  }
-+
-+  if (ConsumeSeparator()) {
-+    mItem.Rebind(mItem.BeginReading(), mFilePathCursor);
-+  }
-+  mStack.AppendElement(mItem);
-+
-+  return true;
-+}
-+
-+bool Normalizer::CheckCurrentDir()
-+{
-+  if (mItem == NS_LITERAL_STRING(".")) {
-+    ConsumeSeparator();
-+    // EOF is acceptable
-+    return true;
-+  }
-+
-+  return false;
-+}
-+
-+bool Normalizer::CheckParentDir()
-+{
-+  if (mItem == NS_LITERAL_STRING("..")) {
-+    ConsumeSeparator();
-+    // EOF is acceptable
-+    return true;
-+  }
-+
-+  return false;
-+}
-+
-+} // anon
-+
-+bool IsBlockedUNCPath(const nsAString& aFilePath)
-+{
-+  if (!sBlockUNCPaths) {
-+    return false;
-+  }
-+
-+  if (!StringBeginsWith(aFilePath, NS_LITERAL_STRING("\\\\"))) {
-+    return false;
-+  }
-+
-+  nsAutoString normalized;
-+  if (!Normalizer(aFilePath, L'\\').Get(normalized)) {
-+    // Broken paths are considered invalid and thus inaccessible
-+    return true;
-+  }
-+
-+  for (const auto& allowedPrefix : PathArray()) {
-+    if (StringBeginsWith(normalized, allowedPrefix)) {
-+      if (normalized.Length() == allowedPrefix.Length()) {
-+        return false;
-+      }
-+      if (normalized[allowedPrefix.Length()] == L'\\') {
-+        return false;
-+      }
-+
-+      // When we are here, the path has a form "\\path\prefixevil"
-+      // while we have an allowed prefix of "\\path\prefix".
-+      // Note that we don't want to add a slash to the end of a prefix
-+      // so that opening the directory (no slash at the end) still works.
-+      break;
-+    }
-+  }
-+
-+  return true;
-+}
-+
-+void testing::SetBlockUNCPaths(bool aBlock)
-+{
-+  sBlockUNCPaths = aBlock;
-+}
-+
-+void testing::AddDirectoryToWhitelist(nsAString const & aPath)
-+{
-+  PathArray().AppendElement(aPath);
-+}
-+
-+bool testing::NormalizePath(nsAString const & aPath, nsAString & aNormalized)
-+{
-+  Normalizer normalizer(aPath, L'\\');
-+  return normalizer.Get(aNormalized);
-+}
-+
-+} // ::FilePreferences
-+} // ::mozilla
-diff --git a/xpcom/io/FilePreferences.h b/xpcom/io/FilePreferences.h
-new file mode 100644
---- /dev/null
-+++ b/xpcom/io/FilePreferences.h
-@@ -0,0 +1,25 @@
-+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-+/* This Source Code Form is subject to the terms of the Mozilla Public
-+* License, v. 2.0. If a copy of the MPL was not distributed with this
-+* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-+
-+#include "nsIObserver.h"
-+
-+namespace mozilla {
-+namespace FilePreferences {
-+
-+void InitPrefs();
-+void InitDirectoriesWhitelist();
-+bool IsBlockedUNCPath(const nsAString& aFilePath);
-+
-+namespace testing {
-+
-+void SetBlockUNCPaths(bool aBlock);
-+void AddDirectoryToWhitelist(nsAString const& aPath);
-+bool NormalizePath(nsAString const & aPath, nsAString & aNormalized);
-+
-+}
-+
-+} // FilePreferences
-+} // mozilla
-diff --git a/xpcom/io/moz.build b/xpcom/io/moz.build
---- a/xpcom/io/moz.build
-+++ b/xpcom/io/moz.build
-@@ -79,24 +79,26 @@ EXPORTS += [
-     'nsUnicharInputStream.h',
-     'nsWildCard.h',
-     'SlicedInputStream.h',
-     'SpecialSystemDirectory.h',
- ]
- 
- EXPORTS.mozilla += [
-     'Base64.h',
-+    'FilePreferences.h',
-     'SnappyCompressOutputStream.h',
-     'SnappyFrameUtils.h',
-     'SnappyUncompressInputStream.h',
- ]
- 
- UNIFIED_SOURCES += [
-     'Base64.cpp',
-     'crc32c.c',
-+    'FilePreferences.cpp',
-     'nsAnonymousTemporaryFile.cpp',
-     'nsAppFileLocationProvider.cpp',
-     'nsBinaryStream.cpp',
-     'nsDirectoryService.cpp',
-     'nsEscape.cpp',
-     'nsInputStreamTee.cpp',
-     'nsIOUtil.cpp',
-     'nsLinebreakConverter.cpp',
-diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp
---- a/xpcom/io/nsLocalFileWin.cpp
-+++ b/xpcom/io/nsLocalFileWin.cpp
-@@ -41,16 +41,17 @@
- #include  <stdio.h>
- #include  <stdlib.h>
- #include  <mbstring.h>
- 
- #include "nsXPIDLString.h"
- #include "prproces.h"
- #include "prlink.h"
- 
-+#include "mozilla/FilePreferences.h"
- #include "mozilla/Mutex.h"
- #include "SpecialSystemDirectory.h"
- 
- #include "nsTraceRefcnt.h"
- #include "nsXPCOMCIDInternal.h"
- #include "nsThreadUtils.h"
- #include "nsXULAppAPI.h"
- 
-@@ -1162,16 +1163,20 @@ nsLocalFile::InitWithPath(const nsAStrin
-   char16_t secondChar = *(++begin);
- 
-   // just do a sanity check.  if it has any forward slashes, it is not a Native path
-   // on windows.  Also, it must have a colon at after the first char.
-   if (FindCharInReadable(L'/', begin, end)) {
-     return NS_ERROR_FILE_UNRECOGNIZED_PATH;
-   }
- 
-+  if (FilePreferences::IsBlockedUNCPath(aFilePath)) {
-+    return NS_ERROR_FILE_ACCESS_DENIED;
-+  }
-+
-   if (secondChar != L':' && (secondChar != L'\\' || firstChar != L'\\')) {
-     return NS_ERROR_FILE_UNRECOGNIZED_PATH;
-   }
- 
-   if (secondChar == L':') {
-     // Make sure we have a valid drive, later code assumes the drive letter
-     // is a single char a-z or A-Z.
-     if (PathGetDriveNumberW(aFilePath.Data()) == -1) {
-@@ -1974,16 +1979,20 @@ nsLocalFile::CopySingleFile(nsIFile* aSo
-     bool path1Remote, path2Remote;
-     if (!IsRemoteFilePath(filePath.get(), path1Remote) ||
-         !IsRemoteFilePath(destPath.get(), path2Remote) ||
-         path1Remote || path2Remote) {
-       dwCopyFlags |= COPY_FILE_NO_BUFFERING;
-     }
-   }
- 
-+  if (FilePreferences::IsBlockedUNCPath(destPath)) {
-+    return NS_ERROR_FILE_ACCESS_DENIED;
-+  }
-+
-   if (!move) {
-     copyOK = ::CopyFileExW(filePath.get(), destPath.get(), nullptr,
-                            nullptr, nullptr, dwCopyFlags);
-   } else {
-     copyOK = ::MoveFileExW(filePath.get(), destPath.get(),
-                            MOVEFILE_REPLACE_EXISTING);
- 
-     // Check if copying the source file to a different volume,
-diff --git a/xpcom/tests/gtest/TestFilePreferencesWin.cpp b/xpcom/tests/gtest/TestFilePreferencesWin.cpp
-new file mode 100644
---- /dev/null
-+++ b/xpcom/tests/gtest/TestFilePreferencesWin.cpp
-@@ -0,0 +1,141 @@
-+#include "gtest/gtest.h"
-+
-+#include "mozilla/FilePreferences.h"
-+#include "nsIFile.h"
-+#include "nsXPCOMCID.h"
-+
-+TEST(FilePreferencesWin, Normalization)
-+{
-+  nsAutoString normalized;
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("foo"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("foo"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\foo"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\foo"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\foo"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("foo\\some"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("foo\\some"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\.\\foo"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\foo"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\."), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\.\\"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\.\\."), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\bar"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\foo\\bar"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\bar\\"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\foo\\bar\\"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\bar\\."), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\foo\\bar\\"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\bar\\.\\"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\foo\\bar\\"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\bar\\..\\"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\foo\\"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\bar\\.."), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\foo\\"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\..\\bar\\..\\"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\..\\bar"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\bar"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\bar\\..\\..\\"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\"));
-+
-+  mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\bar\\.\\..\\.\\..\\"), normalized);
-+  ASSERT_TRUE(normalized == NS_LITERAL_STRING("\\\\"));
-+
-+  bool result;
-+
-+  result = mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\.."), normalized);
-+  ASSERT_FALSE(result);
-+
-+  result = mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\..\\"), normalized);
-+  ASSERT_FALSE(result);
-+
-+  result = mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\.\\..\\"), normalized);
-+  ASSERT_FALSE(result);
-+
-+  result = mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\\\bar"), normalized);
-+  ASSERT_FALSE(result);
-+
-+  result = mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\foo\\bar\\..\\..\\..\\..\\"), normalized);
-+  ASSERT_FALSE(result);
-+
-+  result = mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\\\"), normalized);
-+  ASSERT_FALSE(result);
-+
-+  result = mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\.\\\\"), normalized);
-+  ASSERT_FALSE(result);
-+
-+  result = mozilla::FilePreferences::testing::NormalizePath(
-+    NS_LITERAL_STRING("\\\\..\\\\"), normalized);
-+  ASSERT_FALSE(result);
-+}
-+
-+TEST(FilePreferencesWin, AccessUNC)
-+{
-+  nsCOMPtr<nsIFile> lf = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
-+
-+  nsresult rv;
-+
-+  mozilla::FilePreferences::testing::SetBlockUNCPaths(false);
-+
-+  rv = lf->InitWithPath(NS_LITERAL_STRING("\\\\nice\\..\\evil\\share"));
-+  ASSERT_EQ(rv, NS_OK);
-+
-+  mozilla::FilePreferences::testing::SetBlockUNCPaths(true);
-+
-+  rv = lf->InitWithPath(NS_LITERAL_STRING("\\\\nice\\..\\evil\\share"));
-+  ASSERT_EQ(rv, NS_ERROR_FILE_ACCESS_DENIED);
-+
-+  mozilla::FilePreferences::testing::AddDirectoryToWhitelist(NS_LITERAL_STRING("\\\\nice"));
-+
-+  rv = lf->InitWithPath(NS_LITERAL_STRING("\\\\nice\\share"));
-+  ASSERT_EQ(rv, NS_OK);
-+
-+  rv = lf->InitWithPath(NS_LITERAL_STRING("\\\\nice\\..\\evil\\share"));
-+  ASSERT_EQ(rv, NS_ERROR_FILE_ACCESS_DENIED);
-+}
-diff --git a/xpcom/tests/gtest/moz.build b/xpcom/tests/gtest/moz.build
---- a/xpcom/tests/gtest/moz.build
-+++ b/xpcom/tests/gtest/moz.build
-@@ -51,16 +51,21 @@ UNIFIED_SOURCES += [
- if CONFIG['MOZ_DEBUG'] and CONFIG['OS_ARCH'] not in ('WINNT') and CONFIG['OS_TARGET'] != 'Android':
-     # FIXME bug 523392: TestDeadlockDetector doesn't like Windows
-     # Bug 1054249: Doesn't work on Android
-     UNIFIED_SOURCES += [
-         'TestDeadlockDetector.cpp',
-         'TestDeadlockDetectorScalability.cpp',
-     ]
- 
-+if CONFIG['OS_TARGET'] == 'WINNT':
-+    UNIFIED_SOURCES += [
-+        'TestFilePreferencesWin.cpp',
-+    ]
-+
- if CONFIG['WRAP_STL_INCLUDES'] and not CONFIG['CLANG_CL']:
-     UNIFIED_SOURCES += [
-         'TestSTLWrappers.cpp',
-     ]
- 
- # Compile TestAllocReplacement separately so Windows headers don't pollute
- # the global namespace for other files.
- SOURCES += [
-
diff --git a/gnu/packages/patches/icecat-use-system-graphite2+harfbuzz.patch b/gnu/packages/patches/icecat-use-system-graphite2+harfbuzz.patch
new file mode 100644
index 0000000000..94c211b797
--- /dev/null
+++ b/gnu/packages/patches/icecat-use-system-graphite2+harfbuzz.patch
@@ -0,0 +1,226 @@
+Allow building against system-wide graphite2/harfbuzz.
+See <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
+Based on:
+  https://svnweb.freebsd.org/ports/head/www/firefox-esr/files/patch-bug847568?revision=472833&view=co
+Modified for use with patch -p1, and to apply cleanly to GNU IceCat.
+
+--- icecat-60.2.0/config/system-headers.mozbuild
++++ icecat-60.2.0/config/system-headers.mozbuild
+@@ -1311,6 +1311,19 @@
+         'pixman.h',
+     ]
+ 
++if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
++    system_headers += [
++        'graphite2/Font.h',
++        'graphite2/Segment.h',
++    ]
++
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++    system_headers += [
++        'harfbuzz/hb-glib.h',
++        'harfbuzz/hb-ot.h',
++        'harfbuzz/hb.h',
++    ]
++
+ if CONFIG['MOZ_SYSTEM_LIBVPX']:
+     system_headers += [
+         'vpx_mem/vpx_mem.h',
+--- icecat-60.2.0/dom/base/moz.build
++++ icecat-60.2.0/dom/base/moz.build
+@@ -474,6 +474,9 @@
+ if CONFIG['MOZ_X11']:
+     CXXFLAGS += CONFIG['TK_CFLAGS']
+ 
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
++
+ GENERATED_FILES += [
+     'PropertyUseCounterMap.inc',
+     'UseCounterList.h',
+--- icecat-60.2.0/gfx/graphite2/moz-gr-update.sh
++++ icecat-60.2.0/gfx/graphite2/moz-gr-update.sh
+@@ -1,6 +1,7 @@
+ #!/bin/bash
+ 
+ # Script used to update the Graphite2 library in the mozilla source tree
++# and bump version for --with-system-graphite2
+ 
+ # This script lives in gfx/graphite2, along with the library source,
+ # but must be run from the top level of the mozilla-central tree.
+@@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
+ #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
+ #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
+ 
++# chase version for --with-system-graphite2
++perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
++  if /GR2_VERSION_REQUIRE/" old-configure.in
++
+ # summarize what's been touched
+ echo Updated to $RELEASE.
+ echo Here is what changed in the gfx/graphite2 directory:
+ echo
+ 
+-hg stat gfx/graphite2
++hg stat old-configure.in gfx/graphite2
+ 
+ echo
+ echo If gfx/graphite2/src/files.mk has changed, please make corresponding
+--- icecat-60.2.0/gfx/moz.build
++++ icecat-60.2.0/gfx/moz.build
+@@ -10,6 +10,12 @@ with Files('**'):
+ if CONFIG['MOZ_TREE_CAIRO']:
+     DIRS += ['cairo']
+ 
++if not CONFIG['MOZ_SYSTEM_GRAPHITE2']:
++    DIRS += ['graphite2/src' ]
++
++if not CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++    DIRS += ['harfbuzz/src']
++
+ DIRS += [
+     '2d',
+     'ycbcr',
+@@ -18,8 +24,6 @@ DIRS += [
+     'qcms',
+     'gl',
+     'layers',
+-    'graphite2/src',
+-    'harfbuzz/src',
+     'ots/src',
+     'thebes',
+     'ipc',
+--- icecat-60.2.0/gfx/skia/generate_mozbuild.py
++++ icecat-60.2.0/gfx/skia/generate_mozbuild.py
+@@ -148,6 +148,9 @@
+         '-Wno-unused-private-field',
+     ]
+ 
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
++
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk3', 'android'):
+     CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
+     CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
+--- icecat-60.2.0/gfx/skia/moz.build
++++ icecat-60.2.0/gfx/skia/moz.build
+@@ -822,6 +822,9 @@
+         '-Wno-unused-private-field',
+     ]
+ 
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
++
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk3', 'android'):
+     CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
+     CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
+--- icecat-60.2.0/gfx/thebes/moz.build
++++ icecat-60.2.0/gfx/thebes/moz.build
+@@ -272,7 +272,13 @@
+ 
+ LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
+ 
+-DEFINES['GRAPHITE2_STATIC'] = True
++if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
++    CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
++else:
++    DEFINES['GRAPHITE2_STATIC'] = True
++
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+ 
+ if CONFIG['CC_TYPE'] == 'clang':
+     # Suppress warnings from Skia header files.
+--- icecat-60.2.0/intl/unicharutil/util/moz.build
++++ icecat-60.2.0/intl/unicharutil/util/moz.build
+@@ -25,4 +25,7 @@ UNIFIED_SOURCES += [
+     'nsUnicodeProperties.cpp',
+ ]
+ 
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
++
+ FINAL_LIBRARY = 'xul'
+--- icecat-60.2.0/netwerk/dns/moz.build
++++ icecat-60.2.0/netwerk/dns/moz.build
+@@ -76,3 +76,6 @@
+ 
+ if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
+     CXXFLAGS += ['-Wno-error=shadow']
++
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+--- icecat-60.2.0/old-configure.in
++++ icecat-60.2.0/old-configure.in
+@@ -3995,6 +3995,27 @@
+ AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
+ 
+ dnl ========================================================
++dnl Check for graphite2
++dnl ========================================================
++if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
++    dnl graphite2.pc has bogus version, check manually
++    _SAVE_CFLAGS=$CFLAGS
++    CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
++    AC_TRY_COMPILE([ #include <graphite2/Font.h>
++                     #define GR2_VERSION_REQUIRE(major,minor,bugfix)  \
++                             ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
++                               * 100 + GR2_VERSION_BUGFIX >= \
++                               (major) * 10000 + (minor) * 100 + (bugfix) )
++                   ], [
++                     #if !GR2_VERSION_REQUIRE(1,3,10)
++                     #error "Insufficient graphite2 version."
++                     #endif
++                   ], [],
++                   [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
++    CFLAGS=$_SAVE_CFLAGS
++fi
++
++dnl ========================================================
+ dnl Check for pixman and cairo
+ dnl ========================================================
+ 
+--- icecat-60.2.0/toolkit/library/moz.build
++++ icecat-60.2.0/toolkit/library/moz.build
+@@ -235,6 +235,12 @@
+ if CONFIG['MOZ_SYSTEM_PNG']:
+     OS_LIBS += CONFIG['MOZ_PNG_LIBS']
+ 
++if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
++    OS_LIBS += CONFIG['MOZ_GRAPHITE2_LIBS']
++
++if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
++    OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS']
++
+ if CONFIG['MOZ_SYSTEM_HUNSPELL']:
+     OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
+ 
+--- icecat-60.2.0/toolkit/moz.configure
++++ icecat-60.2.0/toolkit/moz.configure
+@@ -1051,6 +1051,26 @@
+ add_old_configure_assignment('FT2_CFLAGS',
+                              ft2_info.cflags)
+ 
++# Graphite2
++# ==============================================================
++option('--with-system-graphite2',
++       help="Use system graphite2 (located with pkgconfig)")
++
++system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
++                                     when='--with-system-graphite2')
++
++set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _: True))
++
++# HarfBuzz
++# ==============================================================
++option('--with-system-harfbuzz',
++       help="Use system harfbuzz (located with pkgconfig)")
++
++system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.7.4',
++                                    when='--with-system-harfbuzz')
++
++set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
++
+ # Mortar
+ # ==============================================================
+ option('--enable-mortar', help='Enable mortar extension')
diff --git a/gnu/packages/patches/icecat-use-system-graphite2.patch b/gnu/packages/patches/icecat-use-system-graphite2.patch
deleted file mode 100644
index 188fba2bc9..0000000000
--- a/gnu/packages/patches/icecat-use-system-graphite2.patch
+++ /dev/null
@@ -1,248 +0,0 @@
-Copied from <https://reviewboard.mozilla.org/r/90218/diff/4>
-See <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
-
-diff --git a/config/Makefile.in b/config/Makefile.in
---- a/config/Makefile.in
-+++ b/config/Makefile.in
-@@ -36,16 +36,17 @@ ifdef WRAP_SYSTEM_INCLUDES
- export-preqs = \
-   $(call mkdir_deps,system_wrappers) \
-   $(NULL)
- 
- export:: $(export-preqs)
- 	$(PYTHON) -m mozbuild.action.preprocessor $(DEFINES) $(ACDEFINES) \
- 		-DMOZ_TREE_CAIRO=$(MOZ_TREE_CAIRO) \
- 		-DMOZ_TREE_PIXMAN=$(MOZ_TREE_PIXMAN) \
-+		-DMOZ_SYSTEM_GRAPHITE2=$(MOZ_SYSTEM_GRAPHITE2) \
- 		-DMOZ_SYSTEM_HARFBUZZ=$(MOZ_SYSTEM_HARFBUZZ) \
- 		-DMOZ_SYSTEM_HUNSPELL=$(MOZ_SYSTEM_HUNSPELL) \
- 		-DMOZ_SYSTEM_BZ2=$(MOZ_SYSTEM_BZ2) \
- 		-DMOZ_SYSTEM_ZLIB=$(MOZ_SYSTEM_ZLIB) \
- 		-DMOZ_SYSTEM_PNG=$(MOZ_SYSTEM_PNG) \
- 		-DMOZ_SYSTEM_JPEG=$(MOZ_SYSTEM_JPEG) \
- 		-DMOZ_SYSTEM_LIBEVENT=$(MOZ_SYSTEM_LIBEVENT) \
- 		-DMOZ_SYSTEM_LIBVPX=$(MOZ_SYSTEM_LIBVPX) \
-diff --git a/config/system-headers b/config/system-headers
---- a/config/system-headers
-+++ b/config/system-headers
-@@ -1260,16 +1260,20 @@ zlib.h
- #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
- libsn/sn.h
- libsn/sn-common.h
- libsn/sn-launchee.h
- libsn/sn-launcher.h
- libsn/sn-monitor.h
- libsn/sn-util.h
- #endif
-+#if MOZ_SYSTEM_GRAPHITE2==1
-+graphite2/Font.h
-+graphite2/Segment.h
-+#endif
- #if MOZ_SYSTEM_HARFBUZZ==1
- harfbuzz/hb-glib.h
- harfbuzz/hb-ot.h
- harfbuzz/hb.h
- #endif
- #if MOZ_SYSTEM_HUNSPELL==1
- hunspell.hxx
- #endif
-diff --git a/gfx/graphite2/moz-gr-update.sh b/gfx/graphite2/moz-gr-update.sh
---- a/gfx/graphite2/moz-gr-update.sh
-+++ b/gfx/graphite2/moz-gr-update.sh
-@@ -1,11 +1,12 @@
- #!/bin/bash
- 
- # Script used to update the Graphite2 library in the mozilla source tree
-+# and bump version for --with-system-graphite2
- 
- # This script lives in gfx/graphite2, along with the library source,
- # but must be run from the top level of the mozilla-central tree.
- 
- # Run as
- #
- #    ./gfx/graphite2/moz-gr-update.sh RELEASE
- #
-@@ -32,22 +33,26 @@ echo "This directory contains the Graphi
- echo "$TARBALL" >> gfx/graphite2/README.mozilla
- echo ""
- echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
- 
- # fix up includes because of bug 721839 (cstdio) and bug 803066 (Windows.h)
- #find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
- #find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
- 
-+# chase version for --with-system-graphite2
-+perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
-+  if /GR2_VERSION_REQUIRE/" old-configure.in
-+
- # summarize what's been touched
- echo Updated to $RELEASE.
- echo Here is what changed in the gfx/graphite2 directory:
- echo
- 
--hg stat gfx/graphite2
-+hg stat old-configure.in gfx/graphite2
- 
- echo
- echo If gfx/graphite2/src/files.mk has changed, please make corresponding
- echo changes to gfx/graphite2/src/moz.build
- echo
- 
- echo
- echo Now use hg commands to create a patch for the mozilla tree.
-diff --git a/gfx/moz.build b/gfx/moz.build
---- a/gfx/moz.build
-+++ b/gfx/moz.build
-@@ -2,28 +2,30 @@
- # vim: set filetype=python:
- # This Source Code Form is subject to the terms of the Mozilla Public
- # License, v. 2.0. If a copy of the MPL was not distributed with this
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
- 
- if CONFIG['MOZ_TREE_CAIRO']:
-     DIRS += ['cairo']
- 
-+if not CONFIG['MOZ_SYSTEM_GRAPHITE2']:
-+    DIRS += ['graphite2/src' ]
-+
- if not CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-     DIRS += ['harfbuzz/src']
- 
- DIRS += [
-     '2d',
-     'ycbcr',
-     'angle',
-     'src',
-     'qcms',
-     'gl',
-     'layers',
--    'graphite2/src',
-     'ots/src',
-     'thebes',
-     'ipc',
-     'vr',
-     'config',
- ]
- 
- if CONFIG['MOZ_ENABLE_SKIA']:
-diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
---- a/gfx/thebes/moz.build
-+++ b/gfx/thebes/moz.build
-@@ -261,16 +261,19 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('and
-     CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
- 
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
-     CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
- 
- LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
- LOCAL_INCLUDES += ['/media/libyuv/include']
- 
--DEFINES['GRAPHITE2_STATIC'] = True
-+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
-+    CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
-+else:
-+    DEFINES['GRAPHITE2_STATIC'] = True
- 
- if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-     CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
- 
- if CONFIG['CLANG_CXX']:
-     # Suppress warnings from Skia header files.
-     SOURCES['gfxPlatform.cpp'].flags += ['-Wno-implicit-fallthrough']
-diff --git a/moz.configure b/moz.configure
---- a/moz.configure
-+++ b/moz.configure
-@@ -260,16 +260,28 @@ def extra_programs(target):
- 
- check_prog('DSYMUTIL', delayed_getattr(extra_programs, 'DSYMUTIL'),
-            allow_missing=True)
- check_prog('GENISOIMAGE', delayed_getattr(extra_programs, 'GENISOIMAGE'),
-            allow_missing=True)
- check_prog('RPMBUILD', delayed_getattr(extra_programs, 'RPMBUILD'),
-            allow_missing=True)
- 
-+option('--with-system-graphite2',
-+       help="Use system graphite2 (located with pkgconfig)")
-+
-+@depends('--with-system-graphite2', compile_environment)
-+def check_for_graphite2(value, compile_env):
-+    return value and compile_env
-+
-+system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
-+                                    check_for_graphite2)
-+
-+set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _: True))
-+
- option('--with-system-harfbuzz',
-        help="Use system harfbuzz (located with pkgconfig)")
- 
- @depends('--with-system-harfbuzz', compile_environment)
- def check_for_harfbuzz(value, compile_env):
-     return value and compile_env
- 
- system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.3.3',
-diff --git a/old-configure.in b/old-configure.in
---- a/old-configure.in
-+++ b/old-configure.in
-@@ -5060,16 +5060,37 @@ if test "$USE_FC_FREETYPE"; then
-         CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
-         MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
-             [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
-         CPPFLAGS="$_SAVE_CPPFLAGS"
-     fi
- fi
- 
- dnl ========================================================
-+dnl Check for graphite2
-+dnl ========================================================
-+if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
-+    dnl graphite2.pc has bogus version, check manually
-+    _SAVE_CFLAGS=$CFLAGS
-+    CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
-+    AC_TRY_COMPILE([ #include <graphite2/Font.h>
-+                     #define GR2_VERSION_REQUIRE(major,minor,bugfix)  \
-+                             ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
-+                               * 100 + GR2_VERSION_BUGFIX >= \
-+                               (major) * 10000 + (minor) * 100 + (bugfix) )
-+                   ], [
-+                     #if !GR2_VERSION_REQUIRE(1,3,8)
-+                     #error "Insufficient graphite2 version."
-+                     #endif
-+                   ], [],
-+                   [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
-+    CFLAGS=$_SAVE_CFLAGS
-+fi
-+
-+dnl ========================================================
- dnl Check for pixman and cairo
- dnl ========================================================
- 
- MOZ_TREE_CAIRO=1
- MOZ_ARG_ENABLE_BOOL(system-cairo,
- [  --enable-system-cairo   Use system cairo (located with pkgconfig)],
- MOZ_TREE_CAIRO=,
- MOZ_TREE_CAIRO=1 )
-diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
---- a/toolkit/library/moz.build
-+++ b/toolkit/library/moz.build
-@@ -221,16 +221,19 @@ if CONFIG['SERVO_TARGET_DIR']:
-         OS_LIBS += ['-L%s' % CONFIG['SERVO_TARGET_DIR'], '-lgeckoservo']
- 
- if CONFIG['MOZ_SYSTEM_JPEG']:
-     OS_LIBS += CONFIG['MOZ_JPEG_LIBS']
- 
- if CONFIG['MOZ_SYSTEM_PNG']:
-     OS_LIBS += CONFIG['MOZ_PNG_LIBS']
- 
-+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
-+    OS_LIBS += CONFIG['MOZ_GRAPHITE2_LIBS']
-+
- if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-     OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS']
- 
- if CONFIG['MOZ_SYSTEM_HUNSPELL']:
-     OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
- 
- if CONFIG['MOZ_SYSTEM_LIBEVENT']:
-     OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']
-
diff --git a/gnu/packages/patches/icecat-use-system-harfbuzz.patch b/gnu/packages/patches/icecat-use-system-harfbuzz.patch
deleted file mode 100644
index 083d404c13..0000000000
--- a/gnu/packages/patches/icecat-use-system-harfbuzz.patch
+++ /dev/null
@@ -1,279 +0,0 @@
-Copied from <https://reviewboard.mozilla.org/r/35763/diff/9>
-See <https://bugzilla.mozilla.org/show_bug.cgi?id=847568>
-
-diff --git a/config/Makefile.in b/config/Makefile.in
---- a/config/Makefile.in
-+++ b/config/Makefile.in
-@@ -36,16 +36,17 @@ ifdef WRAP_SYSTEM_INCLUDES
- export-preqs = \
-   $(call mkdir_deps,system_wrappers) \
-   $(NULL)
- 
- export:: $(export-preqs)
- 	$(PYTHON) -m mozbuild.action.preprocessor $(DEFINES) $(ACDEFINES) \
- 		-DMOZ_TREE_CAIRO=$(MOZ_TREE_CAIRO) \
- 		-DMOZ_TREE_PIXMAN=$(MOZ_TREE_PIXMAN) \
-+		-DMOZ_SYSTEM_HARFBUZZ=$(MOZ_SYSTEM_HARFBUZZ) \
- 		-DMOZ_SYSTEM_HUNSPELL=$(MOZ_SYSTEM_HUNSPELL) \
- 		-DMOZ_SYSTEM_BZ2=$(MOZ_SYSTEM_BZ2) \
- 		-DMOZ_SYSTEM_ZLIB=$(MOZ_SYSTEM_ZLIB) \
- 		-DMOZ_SYSTEM_PNG=$(MOZ_SYSTEM_PNG) \
- 		-DMOZ_SYSTEM_JPEG=$(MOZ_SYSTEM_JPEG) \
- 		-DMOZ_SYSTEM_LIBEVENT=$(MOZ_SYSTEM_LIBEVENT) \
- 		-DMOZ_SYSTEM_LIBVPX=$(MOZ_SYSTEM_LIBVPX) \
- 		-DMOZ_SYSTEM_ICU=$(MOZ_SYSTEM_ICU) \
-diff --git a/config/system-headers b/config/system-headers
---- a/config/system-headers
-+++ b/config/system-headers
-@@ -1260,16 +1260,21 @@ zlib.h
- #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
- libsn/sn.h
- libsn/sn-common.h
- libsn/sn-launchee.h
- libsn/sn-launcher.h
- libsn/sn-monitor.h
- libsn/sn-util.h
- #endif
-+#if MOZ_SYSTEM_HARFBUZZ==1
-+harfbuzz/hb-glib.h
-+harfbuzz/hb-ot.h
-+harfbuzz/hb.h
-+#endif
- #if MOZ_SYSTEM_HUNSPELL==1
- hunspell.hxx
- #endif
- #if MOZ_SYSTEM_BZ2==1
- bzlib.h
- #endif
- #ifdef MOZ_ENABLE_GIO
- gio/gio.h
-diff --git a/dom/base/moz.build b/dom/base/moz.build
---- a/dom/base/moz.build
-+++ b/dom/base/moz.build
-@@ -474,16 +474,19 @@ for var in ('MOZ_B2G_RIL'):
-         DEFINES[var] = True
- 
- if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
-     DEFINES['HAVE_SIDEBAR'] = True
- 
- if CONFIG['MOZ_X11']:
-     CXXFLAGS += CONFIG['TK_CFLAGS']
- 
-+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
-+
- GENERATED_FILES += [
-     'PropertyUseCounterMap.inc',
-     'UseCounterList.h',
- ]
- 
- countermap = GENERATED_FILES['PropertyUseCounterMap.inc']
- countermap.script = 'gen-usecounters.py:property_map'
- countermap.inputs = ['UseCounters.conf']
-diff --git a/gfx/harfbuzz/README-mozilla b/gfx/harfbuzz/README-mozilla
---- a/gfx/harfbuzz/README-mozilla
-+++ b/gfx/harfbuzz/README-mozilla
-@@ -14,8 +14,13 @@ this file when updating harfbuzz, and ch
- 
- The normal approach to updating harfbuzz, therefore, is to pull the latest HB
- source into a scratch directory and do a local build; then copy the original
- sources AND the generated header mentioned above from the build directory into
- the mozilla tree.
- 
- If the collection of source files changes, manual updates to moz.build may be
- needed, as we don't use the upstream makefiles.
-+
-+The in-tree copy may be omitted during build by --with-system-harfbuzz.
-+Make sure to keep pkg-config version check within old-configure.in in sync
-+with checkout version or increment latest tag by one if it's not based
-+on upstream release.
-diff --git a/gfx/moz.build b/gfx/moz.build
---- a/gfx/moz.build
-+++ b/gfx/moz.build
-@@ -2,26 +2,28 @@
- # vim: set filetype=python:
- # This Source Code Form is subject to the terms of the Mozilla Public
- # License, v. 2.0. If a copy of the MPL was not distributed with this
- # file, You can obtain one at http://mozilla.org/MPL/2.0/.
- 
- if CONFIG['MOZ_TREE_CAIRO']:
-     DIRS += ['cairo']
- 
-+if not CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-+    DIRS += ['harfbuzz/src']
-+
- DIRS += [
-     '2d',
-     'ycbcr',
-     'angle',
-     'src',
-     'qcms',
-     'gl',
-     'layers',
-     'graphite2/src',
--    'harfbuzz/src',
-     'ots/src',
-     'thebes',
-     'ipc',
-     'vr',
-     'config',
- ]
- 
- if CONFIG['MOZ_ENABLE_SKIA']:
-diff --git a/gfx/skia/generate_mozbuild.py b/gfx/skia/generate_mozbuild.py
---- a/gfx/skia/generate_mozbuild.py
-+++ b/gfx/skia/generate_mozbuild.py
-@@ -138,16 +138,19 @@ if CONFIG['GNU_CXX'] and not CONFIG['CLA
- if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
-     CXXFLAGS += [
-         '-Wno-implicit-fallthrough',
-         '-Wno-inconsistent-missing-override',
-         '-Wno-macro-redefined',
-         '-Wno-unused-private-field',
-     ]
- 
-+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
-+
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'):
-     CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
-     CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
- 
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
-     CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
- """
- 
-diff --git a/gfx/skia/moz.build b/gfx/skia/moz.build
---- a/gfx/skia/moz.build
-+++ b/gfx/skia/moz.build
-@@ -748,14 +748,17 @@ if CONFIG['GNU_CXX'] and not CONFIG['CLA
- if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
-     CXXFLAGS += [
-         '-Wno-implicit-fallthrough',
-         '-Wno-inconsistent-missing-override',
-         '-Wno-macro-redefined',
-         '-Wno-unused-private-field',
-     ]
- 
-+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
-+
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'):
-     CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
-     CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
- 
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
-     CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
-diff --git a/gfx/thebes/moz.build b/gfx/thebes/moz.build
---- a/gfx/thebes/moz.build
-+++ b/gfx/thebes/moz.build
-@@ -263,11 +263,14 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('and
- if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
-     CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
- 
- LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
- LOCAL_INCLUDES += ['/media/libyuv/include']
- 
- DEFINES['GRAPHITE2_STATIC'] = True
- 
-+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
-+
- if CONFIG['CLANG_CXX']:
-     # Suppress warnings from Skia header files.
-     SOURCES['gfxPlatform.cpp'].flags += ['-Wno-implicit-fallthrough']
-diff --git a/intl/unicharutil/util/moz.build b/intl/unicharutil/util/moz.build
---- a/intl/unicharutil/util/moz.build
-+++ b/intl/unicharutil/util/moz.build
-@@ -37,9 +37,12 @@ if CONFIG['_MSC_VER']:
-     DEFINES['_USE_ANSI_CPP'] = True
-     # Don't include directives about which CRT to use
-     CFLAGS += ['-Zl']
-     CXXFLAGS += ['-Zl']
- 
- if CONFIG['ENABLE_INTL_API']:
-     USE_LIBS += ['icu']
- 
-+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
-+
- DIST_INSTALL = True
-diff --git a/moz.configure b/moz.configure
---- a/moz.configure
-+++ b/moz.configure
-@@ -260,16 +260,28 @@ def extra_programs(target):
- 
- check_prog('DSYMUTIL', delayed_getattr(extra_programs, 'DSYMUTIL'),
-            allow_missing=True)
- check_prog('GENISOIMAGE', delayed_getattr(extra_programs, 'GENISOIMAGE'),
-            allow_missing=True)
- check_prog('RPMBUILD', delayed_getattr(extra_programs, 'RPMBUILD'),
-            allow_missing=True)
- 
-+option('--with-system-harfbuzz',
-+       help="Use system harfbuzz (located with pkgconfig)")
-+
-+@depends('--with-system-harfbuzz', compile_environment)
-+def check_for_harfbuzz(value, compile_env):
-+    return value and compile_env
-+
-+system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.3.3',
-+                                    check_for_harfbuzz)
-+
-+set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
-+
- option('--enable-system-hunspell',
-        help="Use system hunspell (located with pkgconfig)")
- 
- @depends('--enable-system-hunspell', compile_environment)
- def check_for_hunspell(value, compile_env):
-     return value and compile_env
- 
- system_hunspell = pkg_check_modules('MOZ_HUNSPELL', 'hunspell',
-diff --git a/netwerk/dns/moz.build b/netwerk/dns/moz.build
---- a/netwerk/dns/moz.build
-+++ b/netwerk/dns/moz.build
-@@ -61,16 +61,19 @@ etld_data = GENERATED_FILES['etld_data.i
- etld_data.script = 'prepare_tlds.py'
- etld_data.inputs = ['effective_tld_names.dat']
- 
- # need to include etld_data.inc
- LOCAL_INCLUDES += [
-     '/netwerk/base',
- ]
- 
-+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-+    CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
-+
- if CONFIG['ENABLE_INTL_API']:
-     DEFINES['IDNA2008'] = True
-     USE_LIBS += ['icu']
- else:
-     UNIFIED_SOURCES += [
-         'nameprep.c',
-     ]
- 
-diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
---- a/toolkit/library/moz.build
-+++ b/toolkit/library/moz.build
-@@ -221,16 +221,19 @@ if CONFIG['SERVO_TARGET_DIR']:
-         OS_LIBS += ['-L%s' % CONFIG['SERVO_TARGET_DIR'], '-lgeckoservo']
- 
- if CONFIG['MOZ_SYSTEM_JPEG']:
-     OS_LIBS += CONFIG['MOZ_JPEG_LIBS']
- 
- if CONFIG['MOZ_SYSTEM_PNG']:
-     OS_LIBS += CONFIG['MOZ_PNG_LIBS']
- 
-+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
-+    OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS']
-+
- if CONFIG['MOZ_SYSTEM_HUNSPELL']:
-     OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
- 
- if CONFIG['MOZ_SYSTEM_LIBEVENT']:
-     OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']
- 
- if CONFIG['MOZ_SYSTEM_LIBVPX']:
-     OS_LIBS += CONFIG['MOZ_LIBVPX_LIBS']
-
diff --git a/gnu/packages/patches/icecat-use-system-media-libs.patch b/gnu/packages/patches/icecat-use-system-media-libs.patch
new file mode 100644
index 0000000000..648585a6f0
--- /dev/null
+++ b/gnu/packages/patches/icecat-use-system-media-libs.patch
@@ -0,0 +1,381 @@
+Support building with system media libraries.
+See <https://bugzilla.mozilla.org/show_bug.cgi?id=517422>
+
+Based on:
+  https://svnweb.freebsd.org/ports/head/www/firefox-esr/files/patch-z-bug517422?revision=472833&view=markup
+
+Changes to files within the bundled libraries are omitted, since those files
+are removed from Guix sources.  Modified for use with patch -p1, and to apply
+cleanly to GNU IceCat.
+
+--- icecat-60.2.0/build/moz.configure/old.configure
++++ icecat-60.2.0/build/moz.configure/old.configure
+@@ -273,7 +273,12 @@
+     '--with-system-libvpx',
+     '--with-system-nspr',
+     '--with-system-nss',
++    '--with-system-ogg',
+     '--with-system-png',
++    '--with-system-soundtouch',
++    '--with-system-theora',
++    '--with-system-tremor',
++    '--with-system-vorbis',
+     '--with-system-zlib',
+     '--with-thumb',
+     '--with-thumb-interwork',
+--- icecat-60.2.0/config/external/moz.build
++++ icecat-60.2.0/config/external/moz.build
+@@ -23,12 +23,21 @@
+ 
+ external_dirs += ['modules/xz-embedded']
+ 
+-if CONFIG['MOZ_VORBIS']:
++if not CONFIG['MOZ_SYSTEM_OGG']:
++    external_dirs += ['media/libogg']
++
++if CONFIG['MOZ_VORBIS'] and not CONFIG['MOZ_SYSTEM_VORBIS']:
+     external_dirs += ['media/libvorbis']
+ 
+-if CONFIG['MOZ_TREMOR']:
++if CONFIG['MOZ_TREMOR'] and not CONFIG['MOZ_SYSTEM_TREMOR']:
+     external_dirs += ['media/libtremor']
+ 
++if not CONFIG['MOZ_SYSTEM_THEORA']:
++    external_dirs += ['media/libtheora']
++
++if not CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
++    external_dirs += ['media/libsoundtouch']
++
+ if CONFIG['MOZ_WEBM_ENCODER']:
+     external_dirs += ['media/libmkv']
+ 
+@@ -51,11 +60,8 @@
+     'media/kiss_fft',
+     'media/libcubeb',
+     'media/libnestegg',
+-    'media/libogg',
+     'media/libopus',
+-    'media/libtheora',
+     'media/libspeex_resampler',
+-    'media/libsoundtouch',
+     'media/mp4parse-rust',
+     'media/psshparser'
+ ]
+--- icecat-60.2.0/config/system-headers.mozbuild
++++ icecat-60.2.0/config/system-headers.mozbuild
+@@ -1324,6 +1324,28 @@
+         'harfbuzz/hb.h',
+     ]
+ 
++if CONFIG['MOZ_SYSTEM_OGG']:
++    system_headers += [
++        'ogg/ogg.h',
++        'ogg/os_types.h',
++    ]
++
++if CONFIG['MOZ_SYSTEM_THEORA']:
++    system_headers += [
++        'theora/theoradec.h',
++    ]
++
++if CONFIG['MOZ_SYSTEM_VORBIS']:
++    system_headers += [
++        'vorbis/codec.h',
++        'vorbis/vorbisenc.h',
++    ]
++
++if CONFIG['MOZ_SYSTEM_TREMOR']:
++    system_headers += [
++        'tremor/ivorbiscodec.h',
++    ]
++
+ if CONFIG['MOZ_SYSTEM_LIBVPX']:
+     system_headers += [
+         'vpx_mem/vpx_mem.h',
+--- icecat-60.2.0/dom/media/AudioStream.cpp
++++ icecat-60.2.0/dom/media/AudioStream.cpp
+@@ -121,7 +121,9 @@
+   : mMonitor("AudioStream")
+   , mChannels(0)
+   , mOutChannels(0)
++#ifndef MOZ_SYSTEM_SOUNDTOUCH
+   , mTimeStretcher(nullptr)
++#endif
+   , mDumpFile(nullptr)
+   , mState(INITIALIZED)
+   , mDataSource(aSource)
+@@ -142,9 +144,11 @@
+   if (mDumpFile) {
+     fclose(mDumpFile);
+   }
++#ifndef MOZ_SYSTEM_SOUNDTOUCH
+   if (mTimeStretcher) {
+     soundtouch::destroySoundTouchObj(mTimeStretcher);
+   }
++#endif
+ #if defined(XP_WIN)
+   if (XRE_IsContentProcess()) {
+     audio::AudioNotificationReceiver::Unregister(this);
+@@ -168,7 +172,11 @@
+ {
+   mMonitor.AssertCurrentThreadOwns();
+   if (!mTimeStretcher) {
++#ifdef MOZ_SYSTEM_SOUNDTOUCH
++    mTimeStretcher = new soundtouch::SoundTouch();
++#else
+     mTimeStretcher = soundtouch::createSoundTouchObj();
++#endif
+     mTimeStretcher->setSampleRate(mAudioClock.GetInputRate());
+     mTimeStretcher->setChannels(mOutChannels);
+     mTimeStretcher->setPitch(1.0);
+--- icecat-60.2.0/dom/media/AudioStream.h
++++ icecat-60.2.0/dom/media/AudioStream.h
+@@ -15,7 +15,11 @@
+ #include "mozilla/TimeStamp.h"
+ #include "mozilla/UniquePtr.h"
+ #include "CubebUtils.h"
++#ifdef MOZ_SYSTEM_SOUNDTOUCH
++#include "soundtouch/SoundTouch.h"
++#else
+ #include "soundtouch/SoundTouchFactory.h"
++#endif
+ 
+ #if defined(XP_WIN)
+ #include "mozilla/audio/AudioNotificationReceiver.h"
+@@ -297,7 +301,11 @@
+   uint32_t mChannels;
+   uint32_t mOutChannels;
+   AudioClock mAudioClock;
++#ifdef MOZ_SYSTEM_SOUNDTOUCH
++  nsAutoPtr<soundtouch::SoundTouch> mTimeStretcher;
++#else
+   soundtouch::SoundTouch* mTimeStretcher;
++#endif
+ 
+   // Output file for dumping audio
+   FILE* mDumpFile;
+--- icecat-60.2.0/dom/media/moz.build
++++ icecat-60.2.0/dom/media/moz.build
+@@ -327,6 +327,21 @@
+ 
+ DEFINES['MOZILLA_INTERNAL_API'] = True
+ 
++if CONFIG['MOZ_SYSTEM_OGG']:
++    CXXFLAGS += CONFIG['MOZ_OGG_CFLAGS']
++
++if CONFIG['MOZ_SYSTEM_THEORA']:
++    CXXFLAGS += CONFIG['MOZ_THEORA_CFLAGS']
++
++if CONFIG['MOZ_SYSTEM_VORBIS']:
++    CXXFLAGS += CONFIG['MOZ_VORBIS_CFLAGS']
++
++if CONFIG['MOZ_SYSTEM_TREMOR']:
++    CXXFLAGS += CONFIG['MOZ_TREMOR_CFLAGS']
++
++if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
++    CXXFLAGS += CONFIG['MOZ_SOUNDTOUCH_CFLAGS']
++
+ if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
+     DEFINES['MOZ_ANDROID_HLS_SUPPORT'] = True
+ 
+--- icecat-60.2.0/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
++++ icecat-60.2.0/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
+@@ -15,9 +15,13 @@
+ #include <windows.h>
+ #endif
+ 
++#ifdef MOZ_SYSTEM_SOUNDTOUCH
++#include "nsXPCOMPrivate.h" // for XUL_DLL
++#else
+ // We use a known symbol located in lgpllibs to determine its location.
+ // soundtouch happens to be always included in lgpllibs
+ #include "soundtouch/SoundTouch.h"
++#endif
+ 
+ namespace mozilla {
+ 
+@@ -64,6 +68,12 @@
+ 
+   sLinkStatus = LinkStatus_FAILED;
+ 
++#ifdef MOZ_SYSTEM_SOUNDTOUCH
++  // We retrieve the path of the XUL library as this is where mozavcodec and
++  // mozavutil libs are located.
++  char* path =
++    PR_GetLibraryFilePathname(XUL_DLL, (PRFuncPtr)&FFVPXRuntimeLinker::Init);
++#else
+   // We retrieve the path of the lgpllibs library as this is where mozavcodec
+   // and mozavutil libs are located.
+   PathString lgpllibsname = GetLibraryName(nullptr, "lgpllibs");
+@@ -73,6 +83,7 @@
+   PathString path =
+     GetLibraryFilePathname(lgpllibsname.get(),
+                            (PRFuncPtr)&soundtouch::SoundTouch::getVersionId);
++#endif
+   if (path.IsEmpty()) {
+     return false;
+   }
+--- icecat-60.2.0/old-configure.in
++++ icecat-60.2.0/old-configure.in
+@@ -2451,6 +2451,111 @@
+ fi
+ fi # COMPILE_ENVIRONMENT
+ 
++dnl ========================================================
++dnl Check for libogg
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-ogg,
++[  --with-system-ogg       Use system libogg (located with pkgconfig)],
++MOZ_SYSTEM_OGG=1,
++MOZ_SYSTEM_OGG=)
++
++if test -n "$MOZ_SYSTEM_OGG"; then
++    PKG_CHECK_MODULES(MOZ_OGG, ogg >= 1.3.3)
++
++    _SAVE_LIBS=$LIBS
++    LIBS="$LIBS $MOZ_OGG_LIBS"
++    AC_CHECK_FUNC(ogg_set_mem_functions, [],
++      [AC_DEFINE(MOZ_OGG_NO_MEM_REPORTING)])
++    LIBS=$_SAVE_LIBS
++fi
++
++AC_SUBST(MOZ_SYSTEM_OGG)
++
++dnl ========================================================
++dnl Check for libvorbis
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-vorbis,
++[  --with-system-vorbis    Use system libvorbis (located with pkgconfig)],
++MOZ_SYSTEM_VORBIS=1,
++MOZ_SYSTEM_VORBIS=)
++
++if test -n "$MOZ_SYSTEM_VORBIS"; then
++    PKG_CHECK_MODULES(MOZ_VORBIS, vorbis vorbisenc >= 1.3.6)
++fi
++
++AC_SUBST(MOZ_SYSTEM_VORBIS)
++
++dnl ========================================================
++dnl Check for integer-only libvorbis aka tremor
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-tremor,
++[  --with-system-tremor    Use system libtremor (located with pkgconfig)],
++MOZ_SYSTEM_TREMOR=1,
++MOZ_SYSTEM_TREMOR=)
++
++if test -n "$MOZ_SYSTEM_TREMOR"; then
++    PKG_CHECK_MODULES(MOZ_TREMOR, vorbisidec >= 1.2.1)
++fi
++
++AC_SUBST(MOZ_SYSTEM_TREMOR)
++
++dnl ========================================================
++dnl Check for libtheora
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-theora,
++[  --with-system-theora    Use system libtheora (located with pkgconfig)],
++MOZ_SYSTEM_THEORA=1,
++MOZ_SYSTEM_THEORA=)
++
++if test -n "$MOZ_SYSTEM_THEORA"; then
++    PKG_CHECK_MODULES(MOZ_THEORA, theora >= 1.2)
++fi
++
++AC_SUBST(MOZ_SYSTEM_THEORA)
++
++dnl ========================================================
++dnl Check for libSoundTouch
++dnl ========================================================
++
++MOZ_ARG_WITH_BOOL(system-soundtouch,
++[  --with-system-soundtouch Use system libSoundTouch (located with pkgconfig)],
++MOZ_SYSTEM_SOUNDTOUCH=1,
++MOZ_SYSTEM_SOUNDTOUCH=)
++
++if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
++    PKG_CHECK_MODULES(MOZ_SOUNDTOUCH, soundtouch >= 1.9.0)
++
++    AC_LANG_SAVE
++    AC_LANG_CPLUSPLUS
++    _SAVE_CXXFLAGS=$CXXFLAGS
++    CXXFLAGS="$CXXFLAGS $MOZ_SOUNDTOUCH_CFLAGS"
++    AC_CACHE_CHECK(for soundtouch sample type,
++                   ac_cv_soundtouch_sample_type,
++                   [AC_TRY_COMPILE([#include <SoundTouch.h>
++                                    #ifndef SOUNDTOUCH_INTEGER_SAMPLES
++                                    #error soundtouch expects float samples
++                                    #endif],
++                                   [],
++                                   [ac_cv_soundtouch_sample_type=short],
++                                   [ac_cv_soundtouch_sample_type=float])])
++    CXXFLAGS=$_SAVE_CXXFLAGS
++    AC_LANG_RESTORE
++
++    if test \( -n "$MOZ_SAMPLE_TYPE_S16" -a "$ac_cv_soundtouch_sample_type" != short \) \
++         -o \( -n "$MOZ_SAMPLE_TYPE_FLOAT32" -a "$ac_cv_soundtouch_sample_type" != float \) ; then
++        AC_MSG_ERROR([SoundTouch library is built with incompatible sample type. Either rebuild the library with/without --enable-integer-samples, chase default Mozilla sample type or remove --with-system-soundtouch.])
++    fi
++fi
++
++if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
++    AC_DEFINE(MOZ_SYSTEM_SOUNDTOUCH)
++fi
++AC_SUBST(MOZ_SYSTEM_SOUNDTOUCH)
++
+ dnl system libvpx Support
+ dnl ========================================================
+ MOZ_ARG_WITH_BOOL(system-libvpx,
+--- icecat-60.2.0/toolkit/library/moz.build
++++ icecat-60.2.0/toolkit/library/moz.build
+@@ -244,6 +244,21 @@
+ if CONFIG['MOZ_SYSTEM_HUNSPELL']:
+     OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
+ 
++if CONFIG['MOZ_SYSTEM_OGG']:
++    OS_LIBS += CONFIG['MOZ_OGG_LIBS']
++
++if CONFIG['MOZ_SYSTEM_THEORA']:
++    OS_LIBS += CONFIG['MOZ_THEORA_LIBS']
++
++if CONFIG['MOZ_SYSTEM_VORBIS']:
++    OS_LIBS += CONFIG['MOZ_VORBIS_LIBS']
++
++if CONFIG['MOZ_SYSTEM_TREMOR']:
++    OS_LIBS += CONFIG['MOZ_TREMOR_LIBS']
++
++if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
++    OS_LIBS += CONFIG['MOZ_SOUNDTOUCH_LIBS']
++
+ if CONFIG['MOZ_SYSTEM_LIBEVENT']:
+     OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']
+ 
+--- icecat-60.2.0/xpcom/build/XPCOMInit.cpp
++++ icecat-60.2.0/xpcom/build/XPCOMInit.cpp
+@@ -138,7 +138,9 @@
+ 
+ #include "mozilla/ipc/GeckoChildProcessHost.h"
+ 
++#ifndef MOZ_OGG_NO_MEM_REPORTING
+ #include "ogg/ogg.h"
++#endif
+ #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
+ #if defined(HAVE_STDINT_H)
+ // mozilla-config.h defines HAVE_STDINT_H, and then it's defined *again* in
+@@ -639,11 +641,13 @@
+   // this oddness.
+   mozilla::SetICUMemoryFunctions();
+ 
++#ifndef MOZ_OGG_NO_MEM_REPORTING
+   // Do the same for libogg.
+   ogg_set_mem_functions(OggReporter::CountingMalloc,
+                         OggReporter::CountingCalloc,
+                         OggReporter::CountingRealloc,
+                         OggReporter::CountingFree);
++#endif
+ 
+ #if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
+   // And for VPX.
diff --git a/gnu/packages/patches/jemalloc-arm-address-bits.patch b/gnu/packages/patches/jemalloc-arm-address-bits.patch
deleted file mode 100644
index f2ef24c25a..0000000000
--- a/gnu/packages/patches/jemalloc-arm-address-bits.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 8cfc9dec37b312a2686f602bbcdd102ca07cca99 Mon Sep 17 00:00:00 2001
-From: David Goldblatt <davidgoldblatt@fb.com>
-Date: Fri, 29 Sep 2017 13:54:08 -0700
-Subject: [PATCH] ARM: Don't extend bit LG_VADDR to compute high address bits.
-
-In userspace ARM on Linux, zero-ing the high bits is the correct way to do this.
-This doesn't fix the fact that we currently set LG_VADDR to 48 on ARM, when in
-fact larger virtual address sizes are coming soon.  We'll cross that bridge when
-we come to it.
----
- include/jemalloc/internal/rtree.h | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/include/jemalloc/internal/rtree.h b/include/jemalloc/internal/rtree.h
-index b5d4db39..4563db23 100644
---- a/include/jemalloc/internal/rtree.h
-+++ b/include/jemalloc/internal/rtree.h
-@@ -178,9 +178,21 @@ rtree_leaf_elm_bits_read(tsdn_t *tsdn, rtree_t *rtree, rtree_leaf_elm_t *elm,
- 
- JEMALLOC_ALWAYS_INLINE extent_t *
- rtree_leaf_elm_bits_extent_get(uintptr_t bits) {
-+#    ifdef __aarch64__
-+	/*
-+	 * aarch64 doesn't sign extend the highest virtual address bit to set
-+	 * the higher ones.  Instead, the high bits gets zeroed.
-+	 */
-+	uintptr_t high_bit_mask = ((uintptr_t)1 << LG_VADDR) - 1;
-+	/* Mask off the slab bit. */
-+	uintptr_t low_bit_mask = ~(uintptr_t)1;
-+	uintptr_t mask = high_bit_mask & low_bit_mask;
-+	return (extent_t *)(bits & mask);
-+#    else
- 	/* Restore sign-extended high bits, mask slab bit. */
- 	return (extent_t *)((uintptr_t)((intptr_t)(bits << RTREE_NHIB) >>
- 	    RTREE_NHIB) & ~((uintptr_t)0x1));
-+#    endif
- }
- 
- JEMALLOC_ALWAYS_INLINE szind_t
diff --git a/gnu/packages/patches/jq-CVE-2015-8863.patch b/gnu/packages/patches/jq-CVE-2015-8863.patch
deleted file mode 100644
index 20b3bb3f06..0000000000
--- a/gnu/packages/patches/jq-CVE-2015-8863.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-Fix CVE-2015-8863 (Off-by-one error in the tokenadd function in
-jv_parse.c in jq allows remote attackers to cause a denial of service
-(crash) via a long JSON-encoded number, which triggers a heap-based
-buffer overflow):
-
-<https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2015-8863>
-
-Copied from upstream code repository:
-
-<https://github.com/stedolan/jq/commit/8eb1367ca44e772963e704a700ef72ae2e12babd>
-
-From 8eb1367ca44e772963e704a700ef72ae2e12babd Mon Sep 17 00:00:00 2001
-From: Nicolas Williams <nico@cryptonector.com>
-Date: Sat, 24 Oct 2015 17:24:57 -0500
-Subject: [PATCH] Heap buffer overflow in tokenadd() (fix #105)
-
-This was an off-by one: the NUL terminator byte was not allocated on
-resize.  This was triggered by JSON-encoded numbers longer than 256
-bytes.
----
- jv_parse.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/jv_parse.c b/jv_parse.c
-index 3102ed4..84245b8 100644
---- a/jv_parse.c
-+++ b/jv_parse.c
-@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) {
- 
- static void tokenadd(struct jv_parser* p, char c) {
-   assert(p->tokenpos <= p->tokenlen);
--  if (p->tokenpos == p->tokenlen) {
-+  if (p->tokenpos >= (p->tokenlen - 1)) {
-     p->tokenlen = p->tokenlen*2 + 256;
-     p->tokenbuf = jv_mem_realloc(p->tokenbuf, p->tokenlen);
-   }
-@@ -485,7 +485,7 @@ static pfunc check_literal(struct jv_parser* p) {
-     TRY(value(p, v));
-   } else {
-     // FIXME: better parser
--    p->tokenbuf[p->tokenpos] = 0; // FIXME: invalid
-+    p->tokenbuf[p->tokenpos] = 0;
-     char* end = 0;
-     double d = jvp_strtod(&p->dtoa, p->tokenbuf, &end);
-     if (end == 0 || *end != 0)
diff --git a/gnu/packages/patches/ldc-1.7.0-disable-phobos-tests.patch b/gnu/packages/patches/ldc-1.7.0-disable-phobos-tests.patch
deleted file mode 100644
index ccc136cc76..0000000000
--- a/gnu/packages/patches/ldc-1.7.0-disable-phobos-tests.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-diff --git a/std/path.d b/std/path.d
-index a9f0bd8..f47d103 100644
---- a/std/path.d
-+++ b/std/path.d
-@@ -4041,7 +4041,7 @@ version(unittest) import std.process : environment;
-         else version (Android)
-         {
-         }
--        else
-+        else version (HasRoot)
-         {
-             assert(expandTilde("~root") == "/root", expandTilde("~root"));
-             assert(expandTilde("~root/") == "/root/", expandTilde("~root/"));
-
-diff --git a/std/process.d b/std/process.d
-index df83296..d921cdb 100644
---- a/std/process.d
-+++ b/std/process.d
-@@ -1171,7 +1171,7 @@ version (Posix) @system unittest
-     assert(exists(buildPath(directory, "bar")));
- }
-
--@system unittest // Specifying a bad working directory.
-+@system version(skipunittest) unittest // Specifying a bad working directory.
- {
-     import std.exception : assertThrown;
-     TestScript prog = "/bin/echo";
-diff --git a/std/socket.d b/std/socket.d
-index 8a261d5..c1b87b6 100644
---- a/std/socket.d
-+++ b/std/socket.d
-@@ -484,7 +484,7 @@ class Protocol
- // Skip this test on Android because getprotobyname/number are
- // unimplemented in bionic.
- version(CRuntime_Bionic) {} else
--@safe unittest
-+@safe version(hasNetwork) unittest
- {
-     softUnittest({
-         Protocol proto = new Protocol;
-@@ -804,7 +804,7 @@ class InternetHost
- }
-
- ///
--@safe unittest
-+@safe version(hasNetwork) unittest
- {
-     InternetHost ih = new InternetHost;
-
-@@ -959,7 +959,7 @@ AddressInfo[] getAddressInfo(T...)(in char[] node, T options)
-     return () @trusted { return getAddressInfoImpl(node, service, &hints); }();
- }
-
--@system unittest
-+@system version(hasNetwork) unittest
- {
-     struct Oops
-     {
-@@ -1010,7 +1010,7 @@ private AddressInfo[] getAddressInfoImpl(in char[] node, in char[] service, addr
- }
-
-
--@safe unittest
-+@safe version(hasNetwork) unittest
- {
-     softUnittest({
-         if (getaddrinfoPointer)
-diff --git a/std/stdio.d b/std/stdio.d
-index 10106a5..4b0590e 100644
---- a/std/stdio.d
-+++ b/std/stdio.d
-@@ -1426,8 +1426,7 @@ Removes the lock over the specified file segment.
-         g.unlock();
-     }
-
--    version(Posix)
--    @system unittest
-+    @system version(skip) unittest
-     {
-         static import std.file;
-         auto deleteme = testFilename();
-@@ -1483,7 +1482,6 @@ Removes the lock over the specified file segment.
-         f.unlock();
-     }
-
--
- /**
- Writes its arguments in text format to the file.
diff --git a/gnu/packages/patches/ldc-disable-phobos-tests.patch b/gnu/packages/patches/ldc-disable-phobos-tests.patch
new file mode 100644
index 0000000000..f8a9743d59
--- /dev/null
+++ b/gnu/packages/patches/ldc-disable-phobos-tests.patch
@@ -0,0 +1,22 @@
+diff --git a/std/socket.d b/std/socket.d
+index 111cd17..6d23da9 100644
+--- a/std/socket.d
++++ b/std/socket.d
+@@ -448,7 +448,7 @@ class Protocol
+ // Skip this test on Android because getprotobyname/number are
+ // unimplemented in bionic.
+ version(CRuntime_Bionic) {} else
+-@safe unittest
++@safe version(hasNetwork) unittest
+ {
+     // import std.stdio : writefln;
+     softUnittest({
+@@ -770,7 +770,7 @@ class InternetHost
+ }
+ 
+ ///
+-@safe unittest
++@safe version(hasNetwork) unittest
+ {
+     InternetHost ih = new InternetHost;
+ 
diff --git a/gnu/packages/patches/libgcrypt-make-yat2m-reproducible.patch b/gnu/packages/patches/libgcrypt-make-yat2m-reproducible.patch
new file mode 100644
index 0000000000..3056f0baad
--- /dev/null
+++ b/gnu/packages/patches/libgcrypt-make-yat2m-reproducible.patch
@@ -0,0 +1,32 @@
+Make yat2m in libgcrypt respect SOURCE_DATE_EPOCH, making
+the build reproducible.
+
+This was already fixed upstream in GnuPG:
+https://dev.gnupg.org/rG139de02b93773615bdd95e04a7f0c1ad73b4f6fb
+
+and in libgpg-error:
+https://dev.gnupg.org/rE5494a5728418938d2e42158bb646b07124184e64
+
+
+--- a/doc/yat2m.c 2017-11-23 19:16:58.000000000 +0100
++++ b/doc/yat2m.c 2017-08-28 12:22:54.000000000 +0200
+@@ -1475,6 +1484,7 @@
+ main (int argc, char **argv)
+ {
+   int last_argc = -1;
++  const char *s;
+ 
+   opt_source = "GNU";
+   opt_release = "";
+@@ -1608,6 +1618,11 @@
+   if (argc > 1)
+     die ("usage: " PGM " [OPTION] [FILE] (try --help for more information)\n");
+ 
++  /* Take care of supplied timestamp for reproducible builds.  See
++   * https://reproducible-builds.org/specs/source-date-epoch/  */
++  if (!opt_date && (s = getenv ("SOURCE_DATE_EPOCH")) && *s)
++    opt_date = s;
++
+   /* Start processing. */
+   if (argc && strcmp (*argv, "-"))
+     {
diff --git a/gnu/packages/patches/libgit2-oom-test.patch b/gnu/packages/patches/libgit2-oom-test.patch
new file mode 100644
index 0000000000..9667d1c0da
--- /dev/null
+++ b/gnu/packages/patches/libgit2-oom-test.patch
@@ -0,0 +1,62 @@
+Fix a test failure on 32-bit platforms as reported
+at <https://github.com/libgit2/libgit2/issues/4868>.
+
+From 415a8ae9c9b6ac18f0524b6af8e58408b426457d Mon Sep 17 00:00:00 2001
+From: Edward Thomson <ethomson@edwardthomson.com>
+Date: Thu, 13 Sep 2018 13:27:07 +0100
+Subject: [PATCH] tests: don't run buf::oom on 32-bit systems
+
+On a 32-bit Linux systems, the value large enough to make malloc
+guarantee a failure is also large enough that valgrind considers it
+"fishy".  Skip this test on those systems entirely.
+---
+ tests/buf/oom.c | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/tests/buf/oom.c b/tests/buf/oom.c
+index 2741a8ddf2..ec3bad9979 100644
+--- a/tests/buf/oom.c
++++ b/tests/buf/oom.c
+@@ -11,12 +11,8 @@
+  */
+ #if defined(GIT_ARCH_64) && defined(__linux__)
+ # define TOOBIG 0x0fffffffffffffff
+-#elif defined(__linux__)
+-# define TOOBIG 0x0fffffff
+ #elif defined(GIT_ARCH_64)
+ # define TOOBIG 0xffffffffffffff00
+-#else
+-# define TOOBIG 0xffffff00
+ #endif
+ 
+ /**
+@@ -25,13 +21,18 @@
+  * will fail.  And because the git_buf_grow() wrapper always
+  * sets mark_oom, the code in git_buf_try_grow() will free
+  * the internal buffer and set it to git_buf__oom.
+- * 
++ *
+  * We initialized the internal buffer to (the static variable)
+  * git_buf__initbuf.  The purpose of this test is to make sure
+  * that we don't try to free the static buffer.
++ *
++ * Skip this test entirely on 32-bit platforms; a buffer large enough
++ * to guarantee malloc failures is so large that valgrind considers
++ * it likely to be an error.
+  */
+ void test_buf_oom__grow(void)
+ {
++#ifdef GIT_ARCH_64
+ 	git_buf buf = GIT_BUF_INIT;
+ 
+ 	git_buf_clear(&buf);
+@@ -40,6 +41,9 @@ void test_buf_oom__grow(void)
+ 	cl_assert(git_buf_oom(&buf));
+ 
+ 	git_buf_free(&buf);
++#else
++    cl_skip();
++#endif
+ }
+ 
+ void test_buf_oom__grow_by(void)
diff --git a/gnu/packages/patches/libgpg-error-aarch64-logging-fix.patch b/gnu/packages/patches/libgpg-error-aarch64-logging-fix.patch
deleted file mode 100644
index d848d639b2..0000000000
--- a/gnu/packages/patches/libgpg-error-aarch64-logging-fix.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgpg-error.git;a=patch;h=791177de023574223eddf7288eb7c5a0721ac623
-
-From 791177de023574223eddf7288eb7c5a0721ac623 Mon Sep 17 00:00:00 2001
-From: Werner Koch <wk@gnupg.org>
-Date: Sun, 18 Mar 2018 17:39:43 +0100
-Subject: [PATCH] core: Fix regression on arm64 due to invalid use of va_list.
-
-* src/logging.c (_gpgrt_log_printhex): Provide a dummy arg instead of
-NULL.
---
-
-Fix
-Suggested-by: Jakub Wilk <jwilk@jwilk.net>
-
-Signed-off-by: Werner Koch <wk@gnupg.org>
----
- src/logging.c | 18 ++++++++++++++----
- 1 file changed, 14 insertions(+), 4 deletions(-)
-
-diff --git a/src/logging.c b/src/logging.c
-index 1a4f620..d01f974 100644
---- a/src/logging.c
-+++ b/src/logging.c
-@@ -1090,9 +1090,10 @@ _gpgrt_log_flush (void)
- 
- 
- /* Print a hexdump of (BUFFER,LENGTH).  With FMT passed as NULL print
-- * just the raw dump, with FMT being an empty string, print a trailing
-- * linefeed, otherwise print an entire debug line with the expanded
-- * FMT followed by a possible wrapped hexdump and a final LF.  */
-+ * just the raw dump (in this case ARG_PTR is not used), with FMT
-+ * being an empty string, print a trailing linefeed, otherwise print
-+ * an entire debug line with the expanded FMT followed by a possible
-+ * wrapped hexdump and a final LF.  */
- void
- _gpgrt_logv_printhex (const void *buffer, size_t length,
-                       const char *fmt, va_list arg_ptr)
-@@ -1150,7 +1151,16 @@ _gpgrt_log_printhex (const void *buffer, size_t length,
-       va_end (arg_ptr);
-     }
-   else
--    _gpgrt_logv_printhex (buffer, length, NULL, NULL);
-+    {
-+      /* va_list is not necessary a pointer and thus we can't use NULL
-+       * because that would conflict with platforms using a straight
-+       * struct for it (e.g. arm64).  We use a dummy variable instead;
-+       * the static is a simple way zero it out so to not get
-+       * complains about uninitialized use.  */
-+      static va_list dummy_argptr;
-+
-+      _gpgrt_logv_printhex (buffer, length, NULL, dummy_argptr);
-+    }
- }
- 
- 
--- 
-2.8.0.rc3
-
diff --git a/gnu/packages/patches/libgxps-CVE-2017-11590.patch b/gnu/packages/patches/libgxps-CVE-2017-11590.patch
deleted file mode 100644
index 9caa79b6f0..0000000000
--- a/gnu/packages/patches/libgxps-CVE-2017-11590.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-Fix CVE-2017-11590:
-
-https://bugzilla.gnome.org/show_bug.cgi?id=785479
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-11590
-
-Patch copied from upstream source repository:
-
-https://git.gnome.org/browse/libgxps/commit/?id=9d5d292055250ed298f3b89dc332d6db4003a031
-
-From 9d5d292055250ed298f3b89dc332d6db4003a031 Mon Sep 17 00:00:00 2001
-From: Marek Kasik <mkasik@redhat.com>
-Date: Wed, 26 Jul 2017 16:23:37 +0200
-Subject: archive: Check for pathname being NULL before dereferencing
-
-Check whether "archive_entry_pathname ()" returns a non-NULL pathname
-before using it to avoid a NULL pointer being dereferenced.
-
-https://bugzilla.gnome.org/show_bug.cgi?id=785479
----
- libgxps/gxps-archive.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/libgxps/gxps-archive.c b/libgxps/gxps-archive.c
-index acf8d7d..e763773 100644
---- a/libgxps/gxps-archive.c
-+++ b/libgxps/gxps-archive.c
-@@ -257,6 +257,7 @@ gxps_archive_initable_init (GInitable     *initable,
- 	GXPSArchive          *archive;
- 	ZipArchive           *zip;
- 	struct archive_entry *entry;
-+	const gchar          *pathname;
- 
- 	archive = GXPS_ARCHIVE (initable);
- 
-@@ -281,7 +282,9 @@ gxps_archive_initable_init (GInitable     *initable,
- 
-         while (gxps_zip_archive_iter_next (zip, &entry)) {
-                 /* FIXME: We can ignore directories here */
--                g_hash_table_add (archive->entries, g_strdup (archive_entry_pathname (entry)));
-+                pathname = archive_entry_pathname (entry);
-+                if (pathname != NULL)
-+                        g_hash_table_add (archive->entries, g_strdup (pathname));
-                 archive_read_data_skip (zip->archive);
-         }
- 
--- 
-cgit v0.12
-
diff --git a/gnu/packages/patches/liblxqt-include.patch b/gnu/packages/patches/liblxqt-include.patch
deleted file mode 100644
index 4e8cf04789..0000000000
--- a/gnu/packages/patches/liblxqt-include.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Patch to fix build with Qt 5.5, taken from upstream:
-   https://github.com/lxde/liblxqt/commit/7303ea207de0771d6f450a31ec4a1ce69202869b
-
-diff -u -r liblxqt-0.9.0.orig/lxqtnotification.h liblxqt-0.9.0/lxqtnotification.h
---- liblxqt-0.9.0.orig/lxqtnotification.h	2015-07-27 22:49:05.365166482 +0200
-+++ liblxqt-0.9.0/lxqtnotification.h	2015-07-27 22:49:36.897606619 +0200
-@@ -25,6 +25,7 @@
- #ifndef LXQTNOTIFICATION_H
- #define LXQTNOTIFICATION_H
- 
-+#include <QObject>
- #include <QStringList>
- #include "lxqtglobals.h"
- 
diff --git a/gnu/packages/patches/libopenshot-tests-with-system-libs.patch b/gnu/packages/patches/libopenshot-tests-with-system-libs.patch
new file mode 100644
index 0000000000..a18c4b8bba
--- /dev/null
+++ b/gnu/packages/patches/libopenshot-tests-with-system-libs.patch
@@ -0,0 +1,95 @@
+Combination of two patches that fix libopenshot tests when built with
+system-provided ffmpeg and jsoncpp.  See
+
+  https://github.com/OpenShot/libopenshot/pull/163
+
+From 0d7691ab53433e1583f6a66ea96683b0f7af8a57 Mon Sep 17 00:00:00 2001
+From: "FeRD (Frank Dana)" <ferdnyc@gmail.com>
+Date: Mon, 17 Sep 2018 14:04:40 -0400
+Subject: [PATCH] tests/CMakeFiles: Use FFMpeg like src/
+
+---
+ tests/CMakeLists.txt | 32 +++++++++++++++++++++++++++++++-
+ 1 file changed, 31 insertions(+), 1 deletion(-)
+
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 2c45550..4df8464 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -79,7 +79,37 @@ ENDIF (ImageMagick_FOUND)
+ FIND_PACKAGE(FFmpeg REQUIRED)
+ 
+ # Include FFmpeg headers (needed for compile)
+-include_directories(${FFMPEG_INCLUDE_DIR})
++message('AVCODEC_FOUND: ${AVCODEC_FOUND}')
++message('AVCODEC_INCLUDE_DIRS: ${AVCODEC_INCLUDE_DIRS}')
++message('AVCODEC_LIBRARIES: ${AVCODEC_LIBRARIES}')
++
++IF (AVCODEC_FOUND)
++	include_directories(${AVCODEC_INCLUDE_DIRS})
++ENDIF (AVCODEC_FOUND)
++IF (AVDEVICE_FOUND)
++	include_directories(${AVDEVICE_INCLUDE_DIRS})
++ENDIF (AVDEVICE_FOUND)
++IF (AVFORMAT_FOUND)
++	include_directories(${AVFORMAT_INCLUDE_DIRS})
++ENDIF (AVFORMAT_FOUND)
++IF (AVFILTER_FOUND)
++	include_directories(${AVFILTER_INCLUDE_DIRS})
++ENDIF (AVFILTER_FOUND)
++IF (AVUTIL_FOUND)
++	include_directories(${AVUTIL_INCLUDE_DIRS})
++ENDIF (AVUTIL_FOUND)
++IF (POSTPROC_FOUND)
++	include_directories(${POSTPROC_INCLUDE_DIRS})
++ENDIF (POSTPROC_FOUND)
++IF (SWSCALE_FOUND)
++	include_directories(${SWSCALE_INCLUDE_DIRS})
++ENDIF (SWSCALE_FOUND)
++IF (SWRESAMPLE_FOUND)
++	include_directories(${SWRESAMPLE_INCLUDE_DIRS})
++ENDIF (SWRESAMPLE_FOUND)
++IF (AVRESAMPLE_FOUND)
++	include_directories(${AVRESAMPLE_INCLUDE_DIRS})
++ENDIF (AVRESAMPLE_FOUND)
+ 
+ ################# LIBOPENSHOT-AUDIO ###################
+ # Find JUCE-based openshot Audio libraries
+
+
+From e9e85cdfd036587adb86341f7f81619dc69f102c Mon Sep 17 00:00:00 2001
+From: "FeRD (Frank Dana)" <ferdnyc@gmail.com>
+Date: Mon, 17 Sep 2018 19:23:25 -0400
+Subject: [PATCH] Use system jsoncpp in tests, too
+
+The tests/ build needs to use the same jsoncpp as the src/ build,
+or tests in Clip_Tests.cpp can fail.
+---
+ tests/CMakeLists.txt | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 4df8464..a1a0356 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -180,12 +180,18 @@ endif(OPENMP_FOUND)
+ # Find ZeroMQ library (used for socket communication & logging)
+ FIND_PACKAGE(ZMQ REQUIRED)
+ 
+-# Include FFmpeg headers (needed for compile)
++# Include ZeroMQ headers (needed for compile)
+ include_directories(${ZMQ_INCLUDE_DIRS})
+ 
+ ################### JSONCPP #####################
+ # Include jsoncpp headers (needed for JSON parsing)
+-include_directories("../thirdparty/jsoncpp/include")
++if (USE_SYSTEM_JSONCPP)
++	find_package(JsonCpp REQUIRED)
++	include_directories(${JSONCPP_INCLUDE_DIRS})
++else()
++	message("Using embedded JsonCpp")
++	include_directories("../thirdparty/jsoncpp/include")
++endif(USE_SYSTEM_JSONCPP)
+ 
+ IF (NOT DISABLE_TESTS)
+ 	###############  SET TEST SOURCE FILES  #################
diff --git a/gnu/packages/patches/libssh-hostname-parser-bug.patch b/gnu/packages/patches/libssh-hostname-parser-bug.patch
index 69f46cbdd6..de2336e86d 100644
--- a/gnu/packages/patches/libssh-hostname-parser-bug.patch
+++ b/gnu/packages/patches/libssh-hostname-parser-bug.patch
@@ -1,31 +1,17 @@
-Fix "Hostname" parsing in OpenSSH config files, as reported
-at <https://red.libssh.org/issues/260>.
-
-From: Niels Ole Salscheider <niels_ole@salscheider-online.de>
-Date: Mon, 8 May 2017 17:36:13 +0200
-Subject: [PATCH] Fix reading of the first parameter
-
-This is a fixup for 7b8b5eb4eac314a3a29be812bef0264c6611f6e7.
-Previously, it would return as long as the parameter was _not_ seen
-before. It also did not handle the case for the unsupported opcode (-1)
+It does not handle the case for the unsupported opcode (-1)
 which would cause a segfault when accessing the "seen" array.
----
- src/config.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/src/config.c b/src/config.c
-index 7c03b27..238a655 100644
+index c5313ec8..72e07639 100644
 --- a/src/config.c
 +++ b/src/config.c
-@@ -218,8 +218,9 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
+@@ -218,7 +218,8 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
    }
  
    opcode = ssh_config_get_opcode(keyword);
 -  if (*parsing == 1 && opcode != SOC_HOST) {
--      if (seen[opcode] == 0) {
 +  if (*parsing == 1 && opcode != SOC_HOST &&
 +      opcode > SOC_UNSUPPORTED && opcode < SOC_END) {
-+      if (seen[opcode] == 1) {
+       if (seen[opcode] != 0) {
            return 0;
        }
-       seen[opcode] = 1;
diff --git a/gnu/packages/patches/libvpx-use-after-free-in-postproc.patch b/gnu/packages/patches/libvpx-use-after-free-in-postproc.patch
new file mode 100644
index 0000000000..04f2a953b7
--- /dev/null
+++ b/gnu/packages/patches/libvpx-use-after-free-in-postproc.patch
@@ -0,0 +1,34 @@
+From 52add5896661d186dec284ed646a4b33b607d2c7 Mon Sep 17 00:00:00 2001
+From: Jerome Jiang <jianj@google.com>
+Date: Wed, 23 May 2018 15:43:00 -0700
+Subject: [PATCH] VP8: Fix use-after-free in postproc.
+
+The pointer in vp8 postproc refers to show_frame_mi which is only
+updated on show frame. However, when there is a no-show frame which also
+changes the size (thus new frame buffers allocated), show_frame_mi is
+not updated with new frame buffer memory.
+
+Change the pointer in postproc to mi which is always updated.
+
+Bug: 842265
+Change-Id: I33874f2112b39f74562cba528432b5f239e6a7bd
+---
+ vp8/common/postproc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/vp8/common/postproc.c b/vp8/common/postproc.c
+index d67ee8a57..8c292d616 100644
+--- a/vp8/common/postproc.c
++++ b/vp8/common/postproc.c
+@@ -65,7 +65,7 @@ void vp8_deblock(VP8_COMMON *cm, YV12_BUFFER_CONFIG *source,
+   double level = 6.0e-05 * q * q * q - .0067 * q * q + .306 * q + .0065;
+   int ppl = (int)(level + .5);
+ 
+-  const MODE_INFO *mode_info_context = cm->show_frame_mi;
++  const MODE_INFO *mode_info_context = cm->mi;
+   int mbr, mbc;
+ 
+   /* The pixel thresholds are adjusted according to if or not the macroblock
+-- 
+2.19.0
+
diff --git a/gnu/packages/patches/lirc-reproducible-build.patch b/gnu/packages/patches/lirc-reproducible-build.patch
new file mode 100644
index 0000000000..20f9344715
--- /dev/null
+++ b/gnu/packages/patches/lirc-reproducible-build.patch
@@ -0,0 +1,72 @@
+Build Lirc reproducibly.
+
+https://sourceforge.net/p/lirc/tickets/301/
+https://sourceforge.net/p/lirc/git/merge-requests/33/
+https://sourceforge.net/p/lirc/git/merge-requests/34/
+https://sourceforge.net/p/lirc/git/merge-requests/36/
+
+Index: lirc-0.10.1/tools/lirc-lsplugins.cpp
+===================================================================
+--- lirc-0.10.1.orig/tools/lirc-lsplugins.cpp
++++ lirc-0.10.1/tools/lirc-lsplugins.cpp
+@@ -415,10 +415,9 @@ static void print_header(void)
+ static void print_yaml_header(void)
+ {
+ 	static const char* const YAML_HEADER =
+-		"#\n# Generated by lirc-lsplugins --yaml (%s) at %s#\n ";
+-	const time_t now = time(NULL);
++		"#\n# Generated by lirc-lsplugins --yaml (%s)#\n ";
+ 
+-	printf(YAML_HEADER, VERSION, ctime(&now));
++	printf(YAML_HEADER, VERSION);
+ 	printf("\ndrivers:\n");
+ }
+ 
+Index: lirc-0.10.1/python-pkg/lirc/database.py
+===================================================================
+--- lirc-0.10.1.orig/python-pkg/lirc/database.py
++++ lirc-0.10.1/python-pkg/lirc/database.py
+@@ -156,7 +156,7 @@ class Database(object):
+             d['device_hint'] = hint
+ 
+         configs = {}
+-        for path in glob.glob(configdir + '/*.conf'):
++        for path in sorted(glob.glob(configdir + '/*.conf')):
+             with open(path) as f:
+                 cf = yaml.load(f.read())
+             configs[cf['config']['id']] = cf['config']
+Index: lirc-0.10.1/tools/irdb-get
+===================================================================
+--- lirc-0.10.1.orig/tools/irdb-get
++++ lirc-0.10.1/tools/irdb-get
+@@ -9,7 +9,6 @@ import fnmatch
+ import os
+ import os.path
+ import sys
+-import time
+ import urllib.error          # pylint: disable=no-name-in-module,F0401,E0611
+ import urllib.request        # pylint: disable=no-name-in-module,F0401,E0611
+ 
+@@ -193,7 +192,7 @@ def do_yaml_config():
+         lircmd_by_driver[driver].append("%s/%s" % (tokens[0], tokens[2]))
+ 
+     print("#")
+-    print("# Created by 'irdb-get yaml-config' at " + time.ctime())
++    print("# Created by 'irdb-get yaml-config'")
+     print("#")
+     print("\nlircd_by_driver:")
+     print_yaml_dict(lircd_by_driver)
+Index: lirc-0.10.1/tools/lirc-make-devinput
+===================================================================
+--- lirc-0.10.1.orig/tools/lirc-make-devinput
++++ lirc-0.10.1/tools/lirc-make-devinput
+@@ -61,8 +61,7 @@ if test -n "$lirc_map"; then
+ fi
+ 
+ 
+-echo "# Generated by $(basename $0) on $(uname -r)"
+-echo "# Date: $(date)"
++echo "# Generated by $(basename $0)"
+ cat <<EOF
+ 
+ begin remote
diff --git a/gnu/packages/patches/m4-gnulib-libio.patch b/gnu/packages/patches/m4-gnulib-libio.patch
new file mode 100644
index 0000000000..a26622ccf3
--- /dev/null
+++ b/gnu/packages/patches/m4-gnulib-libio.patch
@@ -0,0 +1,128 @@
+Adjust the bundled gnulib to cope with removal of libio interface in
+glibc 2.28.
+
+Based on this upstream patch, without hunks that do not apply to m4:
+https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4af4a4a71827c0bc5e0ec67af23edef4f15cee8e
+
+diff --git a/lib/fflush.c b/lib/fflush.c
+index 983ade0..a6edfa1 100644
+--- a/lib/fflush.c
++++ b/lib/fflush.c
+@@ -33,7 +33,7 @@
+ #undef fflush
+ 
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+ /* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
+ static void
+@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
+ 
+ #endif
+ 
+-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
++#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
+ 
+ # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
+   if (stream == NULL || ! freading (stream))
+     return fflush (stream);
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+   clear_ungetc_buffer_preserving_position (stream);
+ 
+diff --git a/lib/fpending.c b/lib/fpending.c
+index c84e3a5..789f50e 100644
+--- a/lib/fpending.c
++++ b/lib/fpending.c
+@@ -32,7 +32,7 @@ __fpending (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   return fp->_IO_write_ptr - fp->_IO_write_base;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+   /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */
+diff --git a/lib/fpurge.c b/lib/fpurge.c
+index b1d417c..3aedcc3 100644
+--- a/lib/fpurge.c
++++ b/lib/fpurge.c
+@@ -62,7 +62,7 @@ fpurge (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   fp->_IO_read_end = fp->_IO_read_ptr;
+   fp->_IO_write_ptr = fp->_IO_write_base;
+   /* Avoid memory leak when there is an active ungetc buffer.  */
+diff --git a/lib/freadahead.c b/lib/freadahead.c
+index c2ecb5b..23ec76e 100644
+--- a/lib/freadahead.c
++++ b/lib/freadahead.c
+@@ -30,7 +30,7 @@ extern size_t __sreadahead (FILE *);
+ size_t
+ freadahead (FILE *fp)
+ {
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   if (fp->_IO_write_ptr > fp->_IO_write_base)
+     return 0;
+   return (fp->_IO_read_end - fp->_IO_read_ptr)
+diff --git a/lib/freading.c b/lib/freading.c
+index 73c28ac..c24d0c8 100644
+--- a/lib/freading.c
++++ b/lib/freading.c
+@@ -31,7 +31,7 @@ freading (FILE *fp)
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   return ((fp->_flags & _IO_NO_WRITES) != 0
+           || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
+               && fp->_IO_read_base != NULL));
+diff --git a/lib/fseeko.c b/lib/fseeko.c
+index 0101ab5..193f4e8 100644
+--- a/lib/fseeko.c
++++ b/lib/fseeko.c
+@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
+ #endif
+ 
+   /* These tests are based on fpurge.c.  */
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   if (fp->_IO_read_end == fp->_IO_read_ptr
+       && fp->_IO_write_ptr == fp->_IO_write_base
+       && fp->_IO_save_base == NULL)
+@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
+           return -1;
+         }
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+       fp->_flags &= ~_IO_EOF_SEEN;
+       fp->_offset = pos;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
+index 78d896e..05c5752 100644
+--- a/lib/stdio-impl.h
++++ b/lib/stdio-impl.h
+@@ -18,6 +18,12 @@
+    the same implementation of stdio extension API, except that some fields
+    have different naming conventions, or their access requires some casts.  */
+ 
++/* Glibc 2.28 made _IO_IN_BACKUP private.  For now, work around this
++   problem by defining it ourselves.  FIXME: Do not rely on glibc
++   internals.  */
++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
++# define _IO_IN_BACKUP 0x100
++#endif
+ 
+ /* BSD stdio derived implementations.  */
+ 
diff --git a/gnu/packages/patches/mailutils-uninitialized-memory.patch b/gnu/packages/patches/mailutils-uninitialized-memory.patch
deleted file mode 100644
index ef4daf94cb..0000000000
--- a/gnu/packages/patches/mailutils-uninitialized-memory.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-Without this patch, the MH test suite would fail when building with
-glibc 2.26, with 'ali' segfaulting like this:
-
-  Core was generated by `/tmp/guix-build-mailutils-3.4.drv-0/mailutils-3.4/mh/.libs/ali -a ./Mail/mh_ali'.
-  Program terminated with signal SIGSEGV, Segmentation fault.
-  #0  0x00007f8eac263a14 in hash (
-      name=0x72642e342e332d73 <error: Cannot access memory at address 0x72642e342e332d73>, hash_num=0) at assoc.c:102
-  102	  for (i = 0; *name; name++)
-  (gdb) bt
-  #0  0x00007f8eac263a14 in hash (
-      name=0x72642e342e332d73 <error: Cannot access memory at address 0x72642e342e332d73>, hash_num=0) at assoc.c:102
-  #1  0x00007f8eac263e6b in assoc_find_slot (assoc=0xaa59e0, 
-      name=0x72642e342e332d73 <error: Cannot access memory at address 0x72642e342e332d73>, install=0x0, slot=0x7ffcddcbf2b8) at assoc.c:219
-  #2  0x00007f8eac264124 in mu_assoc_lookup (assoc=0xaa59e0, 
-      name=0x72642e342e332d73 <error: Cannot access memory at address 0x72642e342e332d73>, dataptr=0x7ffcddcbf2e0) at assoc.c:308
-  #3  0x00007f8eac29e8ac in mu_ident_deref (
-      name=0x72642e342e332d73 <error: Cannot access memory at address 0x72642e342e332d73>) at ident.c:98
-  #4  0x00007f8eac29f8a6 in mu_locus_point_deinit (pt=0xaa5718) at locus.c:48
-  #5  0x00007f8eac29fa1b in mu_locus_range_deinit (lr=0xaa5718) at locus.c:99
-  #6  0x00007f8eac29f9db in mu_locus_range_copy (dest=0xaa5718, 
-      src=0x622be0 <ali_yylloc>) at locus.c:89
-  #7  0x0000000000408a2a in push_source (name=0xaa74bc "mh_aliases2", fail=1)
-      at mh_alias_lex.l:170
-
-commit b330af9008e4c9168b379867b854f5900a539ad7
-Author: Sergey Poznyakoff <gray@gnu.org>
-Date:   Sat Nov 18 10:15:48 2017 +0200
-
-    Fix the use of uninitialized memory
-    
-    * mh/mh_alias_lex.l (push_source): Initialize locus range prior to copying
-    to it.
-    * libmailutils/cfg/parser.y (mu_cfg_tree_create_node): Likewise.
-    * libmu_sieve/util.c: (mu_sieve_value_create): Likewise.
-
-diff --git a/libmailutils/cfg/parser.y b/libmailutils/cfg/parser.y
-index 4503c7781..3436b8d90 100644
---- a/libmailutils/cfg/parser.y
-+++ b/libmailutils/cfg/parser.y
-@@ -1134,10 +1134,9 @@ mu_cfg_tree_create_node (struct mu_cfg_tree *tree,
-   
-   np = mu_alloc (size);
-   np->type = type;
-+  mu_locus_range_init (&np->locus);
-   if (loc)
-     mu_locus_range_copy (&np->locus, loc);
--  else
--    memset (&np->locus, 0, sizeof np->locus);
-   p = (char*) (np + 1);
-   np->tag = p;
-   strcpy (p, tag);
-diff --git a/libmu_sieve/sieve-lex.l b/libmu_sieve/sieve-lex.l
-index fd145bfe1..f14e80194 100644
---- a/libmu_sieve/sieve-lex.l
-+++ b/libmu_sieve/sieve-lex.l
-@@ -190,6 +190,7 @@ push_source (const char *name)
-     {
-       ctx = mu_sieve_malloc (mu_sieve_machine, sizeof (*ctx));
-       ctx->trk = trk;
-+      mu_locus_range_init (&ctx->incl_range);
-       mu_locus_range_copy (&ctx->incl_range, &yylloc);
-       ctx->i_node = sieve_source_inode;
-       ctx->input = input_stream;
-diff --git a/libmu_sieve/util.c b/libmu_sieve/util.c
-index 8d62a60c2..7d71b5509 100644
---- a/libmu_sieve/util.c
-+++ b/libmu_sieve/util.c
-@@ -55,6 +55,7 @@ mu_sieve_value_create (mu_sieve_machine_t mach, mu_sieve_data_type type,
-   val->locus.end.mu_line = locus->end.mu_line;
-   val->locus.end.mu_col = locus->end.mu_col;
-   
-+  mu_locus_range_init (&val->locus);
-   mu_locus_range_copy (&val->locus, locus);
-   switch (type)
-     {
-diff --git a/mh/mh_alias_lex.l b/mh/mh_alias_lex.l
-index 371353ed3..b97264b38 100644
---- a/mh/mh_alias_lex.l
-+++ b/mh/mh_alias_lex.l
-@@ -167,6 +167,7 @@ push_source (const char *name, int fail)
-     {
-       ctx = mu_alloc (sizeof (*ctx));
-       ctx->trk = trk;
-+      mu_locus_range_init (&ctx->incl_range);
-       mu_locus_range_copy (&ctx->incl_range, &yylloc);
-       ctx->exec_p = exec_p;
-       ctx->i_node = ali_source_inode;
diff --git a/gnu/packages/patches/mariadb-gcc-ice.patch b/gnu/packages/patches/mariadb-gcc-ice.patch
deleted file mode 100644
index 59b188f45a..0000000000
--- a/gnu/packages/patches/mariadb-gcc-ice.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Work around this GCC ICE: <https://bugs.gnu.org/31708>.  It shows up
-only when doing native compiles on armhf-linux.
-
---- mariadb-10.1.33/plugin/semisync/semisync_master.cc	2018-07-28 02:13:12.604020250 +0200
-+++ mariadb-10.1.33/plugin/semisync/semisync_master.cc	2018-07-28 02:14:11.907753417 +0200
-@@ -847,6 +847,8 @@
-   return function_exit(kWho, 0);
- }
- 
-+volatile const void *kSyncHeaderPtr = &ReplSemiSyncMaster::kSyncHeader;
-+
- int ReplSemiSyncMaster::reserveSyncHeader(unsigned char *header,
- 					  unsigned long size)
- {
-@@ -873,7 +875,7 @@
-     /* Set the magic number and the sync status.  By default, no sync
-      * is required.
-      */
--    memcpy(header, kSyncHeader, sizeof(kSyncHeader));
-+    memcpy(header, (void *)kSyncHeaderPtr, sizeof(kSyncHeader));
-     hlen= sizeof(kSyncHeader);
-   }
-   return function_exit(kWho, hlen);
-
diff --git a/gnu/packages/patches/meandmyshadow-define-paths-earlier.patch b/gnu/packages/patches/meandmyshadow-define-paths-earlier.patch
new file mode 100644
index 0000000000..505cbd23fe
--- /dev/null
+++ b/gnu/packages/patches/meandmyshadow-define-paths-earlier.patch
@@ -0,0 +1,50 @@
+From: Tobias Geerinckx-Rice <me@tobias.gr>
+Date: Wed, 31 Oct 2018 02:24:26 +0100
+Subject: [PATCH] gnu: meandmyshadow: Define paths earlier.
+
+The following patch was taken verbatim from the upstream repository[0]
+and will be included in the next release.
+
+[0]: https://github.com/acmepjz/meandmyshadow/pull/29
+---
+From 4847e6b5755258a1e0534f2d4b91dce2ce3b459e Mon Sep 17 00:00:00 2001
+From: Dmitry Marakasov <amdmi3@amdmi3.ru>
+Date: Wed, 24 Oct 2018 23:31:19 +0300
+Subject: [PATCH] Define paths earlier in CMakeLists.txt
+
+At the very least, paths should be defined before Configure_File(), otherwise empty DATAROOTDIR is substituted in config.h
+---
+ CMakeLists.txt | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e79639a..6321d9d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -2,6 +2,13 @@ Project (meandmyshadow)
+ CMake_Minimum_Required (VERSION 3.1)

+ Set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

+ 

++#Path options

++Set (BINDIR "bin" CACHE STRING "Where to install binaries")

++Set (DATAROOTDIR "${CMAKE_INSTALL_PREFIX}/share" CACHE STRING "Sets the root of data directories to a non-default location")

++Set (ICONDIR "${DATAROOTDIR}/icons" CACHE STRING "Sets the icon directory for desktop entry to a non-default location.")

++Set (DESKTOPDIR "${DATAROOTDIR}/applications" CACHE STRING "Sets the desktop file directory for desktop entry to a non-default location.")

++

++#Options

+ Option (DEBUG_MODE "Compile the game with debug mode enabled" OFF)

+ Option (DISABLED_DEBUG_STUFF "Enable this you'll see a lot of annoying script debug messages which will lag the game." OFF)

+ 

+@@ -164,12 +171,6 @@ Target_Link_Libraries (
+ 	${LUA_LIBRARIES}

+ )

+ 

+-#Path options

+-Set (BINDIR "bin" CACHE STRING "Where to install binaries")

+-Set (DATAROOTDIR "${CMAKE_INSTALL_PREFIX}/share" CACHE STRING "Sets the root of data directories to a non-default location")

+-Set (ICONDIR "${DATAROOTDIR}/icons" CACHE STRING "Sets the icon directory for desktop entry to a non-default location.")

+-Set (DESKTOPDIR "${DATAROOTDIR}/applications" CACHE STRING "Sets the desktop file directory for desktop entry to a non-default location.")

+-

+ #Install locations

+ Install (DIRECTORY ${PROJECT_SOURCE_DIR}/data DESTINATION ${DATAROOTDIR}/meandmyshadow/)

+ Install (FILES AUTHORS DESTINATION ${DATAROOTDIR}/meandmyshadow/)

diff --git a/gnu/packages/patches/meson-for-build-rpath.patch b/gnu/packages/patches/meson-for-build-rpath.patch
index 59249e294d..ef9a73f07c 100644
--- a/gnu/packages/patches/meson-for-build-rpath.patch
+++ b/gnu/packages/patches/meson-for-build-rpath.patch
@@ -2,10 +2,10 @@ This patch removes a part of meson that clears the rpath upon installation.
 This will only be applied to a special version of meson, used for the
 meson-build-system.
 
-Patch by Peter Mikkelsen <petermikkelsen10@gmail.com>
+Original patch for Meson 0.42.0 by Peter Mikkelsen <petermikkelsen10@gmail.com>
 
---- meson-0.42.0/mesonbuild/minstall.py.orig	2017-09-09 01:49:39.147374148 +0200
-+++ meson-0.42.0/mesonbuild/minstall.py	2017-09-09 01:51:01.209134717 +0200
+--- meson-0.47.1/mesonbuild/minstall.py.old	2018-08-10 11:01:27.812327013 +0200
++++ meson-0.47.1/mesonbuild/minstall.py	2018-08-10 11:01:51.940368505 +0200
 @@ -436,15 +436,6 @@
                          print("Symlink creation does not work on this platform. "
                                "Skipping all symlinking.")
diff --git a/gnu/packages/patches/mono-mdoc-timestamping.patch b/gnu/packages/patches/mono-mdoc-timestamping.patch
new file mode 100644
index 0000000000..d5191a93eb
--- /dev/null
+++ b/gnu/packages/patches/mono-mdoc-timestamping.patch
@@ -0,0 +1,15 @@
+--- mono-4.4.1/mcs/class/monodoc/Monodoc/storage/ZipStorage.cs.orig	2018-11-26 22:16:25.008879747 +0100
++++ mono-4.4.1/mcs/class/monodoc/Monodoc/storage/ZipStorage.cs	2018-11-26 22:21:53.969770985 +0100
+@@ -74,6 +74,12 @@
+ 				id = GetNewCode ();
+ 
+ 			ZipEntry entry = new ZipEntry (id);
++			var SOURCE_DATE_EPOCH_string = Environment.GetEnvironmentVariable("SOURCE_DATE_EPOCH");
++			if (SOURCE_DATE_EPOCH_string != null)
++			{
++				var SOURCE_DATE_EPOCH = Convert.ToInt64(SOURCE_DATE_EPOCH_string);
++				entry.DateTime = new DateTime(SOURCE_DATE_EPOCH, DateTimeKind.Utc);
++			}
+ 			zipOutput.PutNextEntry (entry);
+ 		}
+ 
diff --git a/gnu/packages/patches/myrepos-CVE-2018-7032.patch b/gnu/packages/patches/myrepos-CVE-2018-7032.patch
deleted file mode 100644
index ce9493e5f9..0000000000
--- a/gnu/packages/patches/myrepos-CVE-2018-7032.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-http://source.myrepos.branchable.com/?p=source.git;a=patch;h=40a3df21c73f1bb1b6915cc6fa503f50814664c8
-This can be removed with the next release. It was modified slightly to apply
-
-From 40a3df21c73f1bb1b6915cc6fa503f50814664c8 Mon Sep 17 00:00:00 2001
-From: Paul Wise <pabs3@bonedaddy.net>
-Date: Sun, 11 Feb 2018 21:57:49 +0800
-Subject: [PATCH] Mitigate vulnerabilities caused by some git remotes being
- able to execute code
-
-Set GIT_PROTOCOL_FROM_USER=0 with git versions newer than 2.12.
-
-Prevent remote websites from causing cloning of local repositories.
-
-Manually whitelist known-safe protocols (http, https, git, ssh)
-when using git versions older than 2.12.
-
-Fixes: CVE-2018-7032
-Fixes: https://bugs.debian.org/840014
-Suggestions-by: Jakub Wilk <jwilk@jwilk.net>
-Reported-by: Jakub Wilk <jwilk@jwilk.net>
----
- webcheckout | 22 +++++++++++++++++++++-
- 1 file changed, 21 insertions(+), 1 deletion(-)
-
-diff --git a/webcheckout b/webcheckout
-index e98da5c..de497ba 100755
---- a/webcheckout
-+++ b/webcheckout
-@@ -71,6 +71,16 @@ use Getopt::Long;
- use warnings;
- use strict;
- 
-+# Mitigate some git remote types being dangerous
-+my $git_unsafe = 1;
-+my $git_version = `git --version`;
-+$git_version =~ s{^git version }{};
-+my ($major, $minor) = split(/\./, $git_version);
-+if (int($major) >= 2 && int($minor) >= 12) {
-+	$ENV{GIT_PROTOCOL_FROM_USER} = 0;
-+	$git_unsafe = 0;
-+}
-+
- # What to download.
- my $url;
- 
-@@ -89,7 +99,17 @@ my $destdir;
- 
- # how to perform checkouts
- my %handlers=(
--	git => sub { doit("git", "clone", shift, $destdir) },
--	svn => sub { doit("svn", "checkout", shift, $destdir) },
--	bzr => sub { doit("bzr", "branch", shift, $destdir) },
-+	git => sub {
-+		my $git_url = shift;
-+		# Reject unsafe URLs with older versions of git
-+		# that do not already check the URL safety.
-+		if ($git_unsafe && $git_url !~ m{^(?:(?:https?|git|ssh):[^:]|(?:[-_.A-Za-z0-9]+@)?[-_.A-Za-z0-9]+:(?!:|//))}) {
-+			print STDERR "potentially unsafe git URL, may fail, touch local files or execute arbitrary code\n";
-+			return 1;
-+		}
-+		# Reject cloning local directories too, webcheckout is for remote repos
-+		doit(qw(git -c protocol.file.allow=user clone --), $git_url, $destdir)
-+	},
-+	svn => sub { doit(qw(svn checkout --), shift, $destdir) },
-+	bzr => sub { doit(qw(bzr branch --), shift, $destdir) },
- );
--- 
-2.11.0
-
diff --git a/gnu/packages/patches/netsurf-message-timestamp.patch b/gnu/packages/patches/netsurf-message-timestamp.patch
new file mode 100644
index 0000000000..8df9dbf8f7
--- /dev/null
+++ b/gnu/packages/patches/netsurf-message-timestamp.patch
@@ -0,0 +1,11 @@
+--- netsurf-3.8/utils/split-messages.pl.orig	1969-12-31 18:00:00.000000000 -0600
++++ netsurf-3.8/utils/split-messages.pl	2018-08-30 00:18:58.158367530 -0500
+@@ -238,7 +238,7 @@
+ 
+     if( $opt{gzip} )
+     {
+-        $ofh = new IO::Compress::Gzip( $ofh, AutoClose => 1, -Level => 9 );
++        $ofh = new IO::Compress::Gzip( $ofh, AutoClose => 1, -Level => 9, Time => 0 );
+     }
+ 
+     return $ofh;
diff --git a/gnu/packages/patches/netsurf-system-utf8proc.patch b/gnu/packages/patches/netsurf-system-utf8proc.patch
index 654d45d017..a2ee52ca05 100644
--- a/gnu/packages/patches/netsurf-system-utf8proc.patch
+++ b/gnu/packages/patches/netsurf-system-utf8proc.patch
@@ -17,23 +17,23 @@ Work around upstream's lack of a pkg-config file and update API.
  
  # Optional libraries with pkgconfig
  
---- netsurf-3.6/utils/idna.c
-+++ netsurf-3.6/utils/idna.c
-@@ -26,7 +26,7 @@
- #include <stdint.h>
+--- netsurf-3.8/utils/idna.c
++++ netsurf-3.8/utils/idna.c
+@@ -27,7 +27,7 @@
  #include <stdlib.h>
  #include <string.h>
+ #include <sys/types.h>
 -#include <libutf8proc/utf8proc.h>
 +#include <utf8proc.h>
  
- #include "utils/errors.h"
- #include "utils/idna.h"
---- netsurf-3.7/test/Makefile	2017-10-15 08:39:24.000000000 -0500
-+++ netsurf-3.7/test/Makefile	2017-11-05 11:14:46.219013218 -0600
-@@ -139,14 +139,14 @@
- 	-D_XOPEN_SOURCE=600 \
+ #include "netsurf/inttypes.h"
+ 
+--- netsurf-3.8/test/Makefile
++++ netsurf-3.8/test/Makefile
+@@ -142,14 +142,15 @@
  	-Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
  	-Dnsgtk \
+ 	$(SAN_FLAGS) \
 -	$(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom libnsutils libutf8proc) \
 +	$(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom libnsutils) \
  	$(LIB_CFLAGS)
@@ -43,7 +43,8 @@ Work around upstream's lack of a pkg-config file and update API.
  
  TESTLDFLAGS := -L$(TESTROOT) \
 -	$(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom libnsutils libutf8proc) -lz \
-+	$(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom libnsutils) -lz -lutf8proc \
++	$(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom libnsutils) \
++	$(LDFLAGS) \
+ 	$(SAN_FLAGS) \
  	$(LIB_LDFLAGS)\
  	$(COV_LDFLAGS)
- 
diff --git a/gnu/packages/patches/nyacc-binary-literals.patch b/gnu/packages/patches/nyacc-binary-literals.patch
new file mode 100644
index 0000000000..8159d74032
--- /dev/null
+++ b/gnu/packages/patches/nyacc-binary-literals.patch
@@ -0,0 +1,29 @@
+From 6a08014b77bf435f025ecdac08396580b85f159a Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Date: Sat, 8 Sep 2018 20:22:45 +0200
+Subject: [PATCH] fix binary literals.
+
+---
+ module/nyacc/lex.scm | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/module/nyacc/lex.scm b/module/nyacc/lex.scm
+index 2ec9895..b205212 100644
+--- a/module/nyacc/lex.scm
++++ b/module/nyacc/lex.scm
+@@ -345,10 +345,11 @@
+ 	  ((char-numeric? ch) (iter chl '$fixed ba 1 ch))
+ 	  ((char=? #\. ch) (iter (cons ch chl) #f ba 15 (read-char))) 
+ 	  (else #f)))
+-	((10) ;; allow x after 0
++	((10) ;; allow x, b after 0
+ 	 (cond
+ 	  ((eof-object? ch) (iter chl ty ba 5 ch))
+ 	  ((char=? #\x ch) (iter (cons ch chl) ty 16 1 (read-char)))
++          ((char=? #\b ch) (iter (cons ch chl) ty 2 1 (read-char)))
+ 	  (else (iter chl ty ba 1 ch))))
+ 	((15) ;; got `.' only
+ 	 (cond
+-- 
+2.18.0
+
diff --git a/gnu/packages/patches/oath-toolkit-glibc-compat.patch b/gnu/packages/patches/oath-toolkit-glibc-compat.patch
new file mode 100644
index 0000000000..22814599e5
--- /dev/null
+++ b/gnu/packages/patches/oath-toolkit-glibc-compat.patch
@@ -0,0 +1,90 @@
+Adjust the bundled Gnulib to cope with removal of libio interface in Glibc 2.28.
+
+Based on this upstream gnulib patch:
+https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4af4a4a71827c0bc5e0ec67af23edef4f15cee8e
+
+--- a/liboath/gl/fflush.c
++++ b/liboath/gl/fflush.c
+@@ -33,7 +33,7 @@
+ #undef fflush
+ 
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+ /* Clear the stream's ungetc buffer, preserving the value of ftello (fp).  */
+ static void
+@@ -72,7 +72,7 @@
+ 
+ #endif
+ 
+-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
++#if ! (defined _IO_EOF_SEEN  || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
+ 
+ # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
+ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
+@@ -148,7 +148,7 @@
+   if (stream == NULL || ! freading (stream))
+     return fflush (stream);
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+ 
+   clear_ungetc_buffer_preserving_position (stream);
+ 
+--- a/liboath/gl/fpurge.c
++++ b/liboath/gl/fpurge.c
+@@ -62,7 +62,7 @@
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   fp->_IO_read_end = fp->_IO_read_ptr;
+   fp->_IO_write_ptr = fp->_IO_write_base;
+   /* Avoid memory leak when there is an active ungetc buffer.  */
+--- a/libaoth/gl/freading.c
++++ b/liboath/gl/freading.c
+@@ -31,7 +31,7 @@
+   /* Most systems provide FILE as a struct and the necessary bitmask in
+      <stdio.h>, because they need it for implementing getc() and putc() as
+      fast macros.  */
+-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   return ((fp->_flags & _IO_NO_WRITES) != 0
+           || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
+               && fp->_IO_read_base != NULL));
+--- a/liboath/gl/fseeko.c
++++ b/liboath/gl/fseeko.c
+@@ -47,7 +47,7 @@
+ #endif
+ 
+   /* These tests are based on fpurge.c.  */
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN  || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+   if (fp->_IO_read_end == fp->_IO_read_ptr
+       && fp->_IO_write_ptr == fp->_IO_write_base
+       && fp->_IO_save_base == NULL)
+@@ -123,7 +123,7 @@
+           return -1;
+         }
+ 
+-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
++#if defined _IO_EOF_SEEN  || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+       fp->_flags &= ~_IO_EOF_SEEN;
+       fp->_offset = pos;
+ #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
+--- a/liboath/gl/stdio-impl.h
++++ b/liboath/gl/stdio-impl.h
+@@ -18,6 +18,11 @@
+    the same implementation of stdio extension API, except that some fields
+    have different naming conventions, or their access requires some casts.  */
+ 
++/* Glibc 2.28 made _IO_IN_BACKUP private, so define it here for now.  */
++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
++# define _IO_IN_BACKUP 0x100
++#endif
++
+ /* BSD stdio derived implementations.  */
+ 
+ #if defined __NetBSD__                         /* NetBSD */
diff --git a/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch b/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch
index 2056b42356..fd9a4c9401 100644
--- a/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch
+++ b/gnu/packages/patches/ocaml-bisect-fix-camlp4-in-another-directory.patch
@@ -1,16 +1,28 @@
-From 26cac62fe0154cf65c06faaee10805531e9dade8 Mon Sep 17 00:00:00 2001
+From bc3b353cb2f26cf10aa5c5caebddf6d3d5b1e318 Mon Sep 17 00:00:00 2001
 From: Julien Lepiller <julien@lepiller.eu>
-Date: Wed, 14 Dec 2016 14:14:59 +0100
+Date: Fri, 21 Sep 2018 22:31:29 +0200
 Subject: [PATCH] fix camlp4 in another directory
 
 ---
- Makefile        | 11 ++++++-----
- configure       | 13 ++++++++++++-
- myocamlbuild.ml |  2 +-
- 3 files changed, 19 insertions(+), 7 deletions(-)
+ Makefile                              | 11 ++++++-----
+ configure                             | 13 ++++++++++++-
+ tests/Makefile                        |  2 +-
+ tests/camlp4-comments/Makefile        |  2 +-
+ tests/camlp4-exclude-file/Makefile    |  2 +-
+ tests/camlp4-exclude/Makefile         |  2 +-
+ tests/camlp4-instrument-fast/Makefile |  2 +-
+ tests/camlp4-instrument/Makefile      |  2 +-
+ tests/combine-expr/Makefile           |  2 +-
+ tests/ppx-comments/Makefile           |  2 +-
+ tests/ppx-exclude-file/Makefile       |  2 +-
+ tests/ppx-exclude/Makefile            |  2 +-
+ tests/ppx-instrument-fast/Makefile    |  2 +-
+ tests/ppx-instrument/Makefile         |  2 +-
+ tests/report/Makefile                 |  2 +-
+ 15 files changed, 31 insertions(+), 19 deletions(-)
 
 diff --git a/Makefile b/Makefile
-index 4a8ce17..d94a6d5 100644
+index b0980ee..6697922 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -25,7 +25,7 @@ PATH_BUILD=$(PATH_BASE)/_build
@@ -19,12 +31,12 @@ index 4a8ce17..d94a6d5 100644
  PATH_TESTS=$(PATH_BASE)/tests
 -PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect
 +PATH_INSTALL=$(PREFIX)/lib/ocaml/bisect
-
-
+ 
+ 
  # DEFINITIONS
 @@ -33,7 +33,8 @@ PATH_INSTALL=$(PATH_OCAML_PREFIX)/lib/ocaml/bisect
  PROJECT_NAME=bisect
- OCAMLBUILD=$(PATH_OCAML_PREFIX)/bin/ocamlbuild
+ OCAMLBUILD=ocamlbuild
  OCAMLBUILD_ENV=WARNINGS=$(WARNINGS) PATH_OCAML_PREFIX=$(PATH_OCAML_PREFIX)
 -OCAMLBUILD_FLAGS=-classic-display -no-links
 +CAMLP4_INCLUDE=$(shell test -z $(CAMLP4_LIBDIR) || echo "-cflags -I,$(CAMLP4_LIBDIR)")
@@ -33,22 +45,22 @@ index 4a8ce17..d94a6d5 100644
  MODULES_MLPACK=$(PROJECT_NAME).mlpack
  MODULES_MLPACK_PP=$(PROJECT_NAME)_pp.mlpack
 @@ -80,11 +81,11 @@ veryclean: clean
-	rm -f $(PATH_OCAMLDOC)/*.html $(PATH_OCAMLDOC)/*.css
-
+ 	rm -f $(PATH_OCAMLDOC)/*.html $(PATH_OCAMLDOC)/*.css
+ 
  install: FORCE
 -	cp $(PATH_BUILD)/src/report/report.byte $(PATH_OCAML_PREFIX)/bin/bisect-report; \
 +	cp $(PATH_BUILD)/src/report/report.byte $(PREFIX)/bin/bisect-report; \
-	if [ "$(PPX)" = "TRUE" ]; then \
+ 	if [ "$(PPX)" = "TRUE" ]; then \
 -	  cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PATH_OCAML_PREFIX)/bin; \
 +	  cp $(PATH_BUILD)/src/syntax/bisect_ppx.byte $(PREFIX)/bin; \
-	fi; \
--	(test -x $(PATH_OCAML_PREFIX)/bin/ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PATH_OCAML_PREFIX)/bin/bisect-report.opt || true); \
-+	(test -x $(PATH_OCAML_PREFIX)/bin/ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PREFIX)/bin/bisect-report.opt || true); \
-	if [ -x "$(PATH_OCAMLFIND)" ]; then \
-	  $(PATH_OCAMLFIND) query $(PROJECT_NAME) && $(PATH_OCAMLFIND) remove $(PROJECT_NAME) || true; \
-	  $(PATH_OCAMLFIND) install $(PROJECT_NAME) META -optional \
+ 	fi; \
+-	(which ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PATH_OCAML_PREFIX)/bin/bisect-report.opt || true); \
++	(which ocamlopt && cp $(PATH_BUILD)/src/report/report.native $(PREFIX)/bin/bisect-report.opt || true); \
+ 	if [ -x "$(PATH_OCAMLFIND)" ]; then \
+ 	  $(PATH_OCAMLFIND) query $(PROJECT_NAME) && $(PATH_OCAMLFIND) remove $(PROJECT_NAME) || true; \
+ 	  $(PATH_OCAMLFIND) install $(PROJECT_NAME) META -optional \
 diff --git a/configure b/configure
-index bb7ebf4..61a3095 100755
+index bb7ebf4..43ef46b 100755
 --- a/configure
 +++ b/configure
 @@ -21,7 +21,9 @@
@@ -79,47 +91,193 @@ index bb7ebf4..61a3095 100755
              ppx='TRUE';;
          *)
 -            echo "usage: $0 [-ocaml-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]";
-+            echo "usage: $0 [-prefix <path>] [-ocaml-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]";
++            echo "usage: $0 [-prefix <path>] [-ocaml-prefix <path>] [-camlp4-prefix <path>] [-ocamlfind <path>] [-no-native-dynlink] [-devel]";
              exit 1;;
          esac
          shift
 @@ -57,6 +63,9 @@ if [ "$no_camlp4" = "TRUE" -a "$ppx" = "FALSE" ]; then
    exit 1
  fi
-
+ 
 +# prefix default value
 +test -z $prefix && prefix=$ocaml_prefix
 +
  # make options
  make_quiet=`make -f - <<EOF
  default: gnumake
-@@ -67,11 +76,13 @@ EOF`
+@@ -66,7 +75,9 @@ EOF`
+ 
  # file creation
  echo "# timestamp: `date`" > Makefile.config
++echo "PREFIX=$prefix" >> Makefile.config
  echo "PATH_OCAML_PREFIX=$ocaml_prefix" >> Makefile.config
 +echo "PATH_CAMLP4_PREFIX=$camlp4_prefix" >> Makefile.config
  echo "PATH_OCAMLFIND=$ocamlfind" >> Makefile.config
  echo "NATIVE_DYNLINK=$native_dynlink" >> Makefile.config
  echo "WARNINGS=$devel" >> Makefile.config
- echo "NO_CAMLP4=$no_camlp4" >> Makefile.config
- echo "PPX=$ppx" >> Makefile.config
- echo "MAKE_QUIET=$make_quiet" >> Makefile.config
-+echo "PREFIX=$prefix" >> Makefile.config
- echo "" >> Makefile.config
- echo 'Makefile.config successfully created'
-diff --git a/myocamlbuild.ml b/myocamlbuild.ml
-index 8aa25fd..09a7d48 100644
---- a/myocamlbuild.ml
-+++ b/myocamlbuild.ml
-@@ -70,7 +70,7 @@ let () =
-     | After_rules ->
-         let camlp4of =
-           try
--            let path_bin = Filename.concat (Sys.getenv "PATH_OCAML_PREFIX") "bin" in
-+            let path_bin = Filename.concat (Sys.getenv "PATH_CAMLP4_PREFIX") "bin" in
-             Filename.concat path_bin "camlp4of"
-           with _ -> "camlp4of" in
-         flag ["ocaml"; "compile"; "pp_camlp4of"] (S[A"-pp"; A camlp4of]);
---
-2.7.4
+diff --git a/tests/Makefile b/tests/Makefile
+index 1aba27f..9642323 100644
+--- a/tests/Makefile
++++ b/tests/Makefile
+@@ -41,7 +41,7 @@ one: FORCE
+ 	else \
+ 	  echo "Running tests for '$(NAME)'..." | tee -a _log; \
+           (cd $(NAME) && \
+-	    $(MAKE) PATH_OCAML_BIN=$(PATH_OCAML_PREFIX)/bin \
++	    $(MAKE) PATH_OCAML_BIN=$(PATH_OCAML_PREFIX)/bin PATH_CAMLP4_PREFIX=$(PATH_CAMLP4_PREFIX) \
+ 	    COMPILER=ocamlc EXECUTABLE=bytecode RUN=./ LIB_EXT=cma EXE_SUFFIX='' \
+ 	    REPORT=../../_build/src/report/report.byte && \
+ 	  cd ..) || echo '*** error' >> _log; \
+diff --git a/tests/camlp4-comments/Makefile b/tests/camlp4-comments/Makefile
+index 33fca72..a918118 100644
+--- a/tests/camlp4-comments/Makefile
++++ b/tests/camlp4-comments/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cmp
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cmp
+diff --git a/tests/camlp4-exclude-file/Makefile b/tests/camlp4-exclude-file/Makefile
+index ab13983..e2520fa 100644
+--- a/tests/camlp4-exclude-file/Makefile
++++ b/tests/camlp4-exclude-file/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cmp
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude-file exclusions -o $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude-file exclusions -o $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cmp
+diff --git a/tests/camlp4-exclude/Makefile b/tests/camlp4-exclude/Makefile
+index 18aada4..d71a7bc 100644
+--- a/tests/camlp4-exclude/Makefile
++++ b/tests/camlp4-exclude/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cmp
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude 'f.*' -o $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -exclude 'f.*' -o $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cmp
+diff --git a/tests/camlp4-instrument-fast/Makefile b/tests/camlp4-instrument-fast/Makefile
+index f60767f..8506e38 100644
+--- a/tests/camlp4-instrument-fast/Makefile
++++ b/tests/camlp4-instrument-fast/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cmp
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo -mode fast $$file -o $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo -mode fast $$file -o $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cmp
+diff --git a/tests/camlp4-instrument/Makefile b/tests/camlp4-instrument/Makefile
+index 33fca72..a918118 100644
+--- a/tests/camlp4-instrument/Makefile
++++ b/tests/camlp4-instrument/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cmp
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/camlp4o$(EXE_SUFFIX) str.cma ../../_build/bisect_pp.cmo $$file -o $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cmp
+diff --git a/tests/combine-expr/Makefile b/tests/combine-expr/Makefile
+index 46ae9eb..e8e2af2 100644
+--- a/tests/combine-expr/Makefile
++++ b/tests/combine-expr/Makefile
+@@ -1,4 +1,4 @@
+-COMPILE_FLAGS=-I ../../_build -pp '$(PATH_OCAML_BIN)/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
++COMPILE_FLAGS=-I ../../_build -pp '$(PATH_CAMLP4_PREFIX)/bin/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
+ 
+ default: clean compile run report
+ 
+diff --git a/tests/ppx-comments/Makefile b/tests/ppx-comments/Makefile
+index f8c645a..667526f 100644
+--- a/tests/ppx-comments/Makefile
++++ b/tests/ppx-comments/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cm*
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cm*
+diff --git a/tests/ppx-exclude-file/Makefile b/tests/ppx-exclude-file/Makefile
+index a575a77..0dd1a20 100644
+--- a/tests/ppx-exclude-file/Makefile
++++ b/tests/ppx-exclude-file/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cm*
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -exclude-file exclusions' -dsource $$file 2> $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -exclude-file exclusions' -dsource $$file 2> $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cm*
+diff --git a/tests/ppx-exclude/Makefile b/tests/ppx-exclude/Makefile
+index a517af4..f502a42 100644
+--- a/tests/ppx-exclude/Makefile
++++ b/tests/ppx-exclude/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cm*
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx "../../_build/src/syntax/bisect_ppx.byte -exclude 'f.*'" -dsource $$file 2> $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx "../../_build/src/syntax/bisect_ppx.byte -exclude 'f.*'" -dsource $$file 2> $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cm*
+diff --git a/tests/ppx-instrument-fast/Makefile b/tests/ppx-instrument-fast/Makefile
+index da78bb6..1195988 100644
+--- a/tests/ppx-instrument-fast/Makefile
++++ b/tests/ppx-instrument-fast/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cm*
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -mode fast' -dsource $$file 2> $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte -mode fast' -dsource $$file 2> $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cm*
+diff --git a/tests/ppx-instrument/Makefile b/tests/ppx-instrument/Makefile
+index f8c645a..667526f 100644
+--- a/tests/ppx-instrument/Makefile
++++ b/tests/ppx-instrument/Makefile
+@@ -2,7 +2,7 @@ default:
+ 	@rm -fr *.result *.cm*
+ 	@for file in *.ml; do \
+ 		echo "     testing '$$file' ..."; \
+-		$(PATH_OCAML_BIN)/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
++		$(PATH_CAMLP4_PREFIX)/bin/ocamlc -c -I ../../_build -ppx '../../_build/src/syntax/bisect_ppx.byte' -dsource $$file 2> $$file.result; \
+ 		diff -q $$file.reference $$file.result || exit 1; \
+ 	done
+ 	@rm -fr *.result *.cm*
+diff --git a/tests/report/Makefile b/tests/report/Makefile
+index a7ffe44..a968bf9 100644
+--- a/tests/report/Makefile
++++ b/tests/report/Makefile
+@@ -1,4 +1,4 @@
+-COMPILE_FLAGS=-I ../../_build -pp '$(PATH_OCAML_BIN)/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
++COMPILE_FLAGS=-I ../../_build -pp '$(PATH_CAMLP4_PREFIX)/bin/camlp4o str.cma -I ../../_build bisect_pp.cmo' bisect.$(LIB_EXT) $(FLAGS)
+ XMLLINT=$(shell which xmllint)
+ 
+ default: clean compile run report
+-- 
+2.18.0
 
diff --git a/gnu/packages/patches/openexr-missing-samples.patch b/gnu/packages/patches/openexr-missing-samples.patch
deleted file mode 100644
index 16cc9bb625..0000000000
--- a/gnu/packages/patches/openexr-missing-samples.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-This patch comments out tests that rely on files that are missing
-from the source tarball.
-
---- openexr-2.2.0/IlmImfTest/testSampleImages.cpp	2015-02-25 16:19:21.565105625 +0100
-+++ openexr-2.2.0/IlmImfTest/testSampleImages.cpp	2015-02-25 16:21:46.394128206 +0100
-@@ -162,16 +162,6 @@ testSampleImages (const std::string&)
- 	compareImages (ILM_IMF_TEST_IMAGEDIR "comp_b44.exr",
- 		       ILM_IMF_TEST_IMAGEDIR "comp_b44_piz.exr");
- 
--	compareImages (ILM_IMF_TEST_IMAGEDIR "comp_dwaa_v1.exr",
--		       ILM_IMF_TEST_IMAGEDIR "comp_dwaa_piz.exr");
--	compareImages (ILM_IMF_TEST_IMAGEDIR "comp_dwaa_v2.exr",
--		       ILM_IMF_TEST_IMAGEDIR "comp_dwaa_piz.exr");
--
--	compareImages (ILM_IMF_TEST_IMAGEDIR "comp_dwab_v1.exr",
--		       ILM_IMF_TEST_IMAGEDIR "comp_dwab_piz.exr");
--	compareImages (ILM_IMF_TEST_IMAGEDIR "comp_dwab_v2.exr",
--		       ILM_IMF_TEST_IMAGEDIR "comp_dwab_piz.exr");
--
- 
- 	cout << "ok\n" << endl;
-     }
-
diff --git a/gnu/packages/patches/openssl-1.0.2-CVE-2018-0495.patch b/gnu/packages/patches/openssl-1.0.2-CVE-2018-0495.patch
deleted file mode 100644
index 2d54ed03b9..0000000000
--- a/gnu/packages/patches/openssl-1.0.2-CVE-2018-0495.patch
+++ /dev/null
@@ -1,215 +0,0 @@
-Fix CVE-2018-0495:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-0495
-https://www.nccgroup.trust/us/our-research/technical-advisory-return-of-the-hidden-number-problem/
-
-Patch copied from upstream source repository:
-
-https://github.com/openssl/openssl/commit/949ff36623eafc3523a9f91784992965018ffb05
-
-From 949ff36623eafc3523a9f91784992965018ffb05 Mon Sep 17 00:00:00 2001
-From: Matt Caswell <matt@openssl.org>
-Date: Fri, 25 May 2018 12:10:13 +0100
-Subject: [PATCH] Add blinding to an ECDSA signature
-
-Keegan Ryan (NCC Group) has demonstrated a side channel attack on an
-ECDSA signature operation. During signing the signer calculates:
-
-s:= k^-1 * (m + r * priv_key) mod order
-
-The addition operation above provides a sufficient signal for a
-flush+reload attack to derive the private key given sufficient signature
-operations.
-
-As a mitigation (based on a suggestion from Keegan) we add blinding to
-the operation so that:
-
-s := k^-1 * blind^-1 (blind * m + blind * r * priv_key) mod order
-
-Since this attack is a localhost side channel only no CVE is assigned.
-
-Reviewed-by: Rich Salz <rsalz@openssl.org>
----
- CHANGES                  |  4 ++
- crypto/ecdsa/ecdsatest.c |  9 ++++-
- crypto/ecdsa/ecs_ossl.c  | 82 ++++++++++++++++++++++++++++++++--------
- 3 files changed, 79 insertions(+), 16 deletions(-)
-
-diff --git a/crypto/ecdsa/ecdsatest.c b/crypto/ecdsa/ecdsatest.c
-index 0f301f86d9..a130fc9117 100644
---- a/crypto/ecdsa/ecdsatest.c
-+++ b/crypto/ecdsa/ecdsatest.c
-@@ -137,7 +137,7 @@ int restore_rand(void)
-         return 1;
- }
- 
--static int fbytes_counter = 0;
-+static int fbytes_counter = 0, use_fake = 0;
- static const char *numbers[8] = {
-     "651056770906015076056810763456358567190100156695615665659",
-     "6140507067065001063065065565667405560006161556565665656654",
-@@ -158,6 +158,11 @@ int fbytes(unsigned char *buf, int num)
-     int ret;
-     BIGNUM *tmp = NULL;
- 
-+    if (use_fake == 0)
-+        return old_rand->bytes(buf, num);
-+
-+    use_fake = 0;
-+
-     if (fbytes_counter >= 8)
-         return 0;
-     tmp = BN_new();
-@@ -199,11 +204,13 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
-     /* create the key */
-     if ((key = EC_KEY_new_by_curve_name(nid)) == NULL)
-         goto x962_int_err;
-+    use_fake = 1;
-     if (!EC_KEY_generate_key(key))
-         goto x962_int_err;
-     BIO_printf(out, ".");
-     (void)BIO_flush(out);
-     /* create the signature */
-+    use_fake = 1;
-     signature = ECDSA_do_sign(digest, 20, key);
-     if (signature == NULL)
-         goto x962_int_err;
-diff --git a/crypto/ecdsa/ecs_ossl.c b/crypto/ecdsa/ecs_ossl.c
-index 16d4f59b9b..1d37551803 100644
---- a/crypto/ecdsa/ecs_ossl.c
-+++ b/crypto/ecdsa/ecs_ossl.c
-@@ -252,6 +252,7 @@ static ECDSA_SIG *ecdsa_do_sign(const unsigned char *dgst, int dgst_len,
- {
-     int ok = 0, i;
-     BIGNUM *kinv = NULL, *s, *m = NULL, *tmp = NULL, *order = NULL;
-+    BIGNUM *blind = NULL, *blindm = NULL;
-     const BIGNUM *ckinv;
-     BN_CTX *ctx = NULL;
-     const EC_GROUP *group;
-@@ -269,14 +270,25 @@ static ECDSA_SIG *ecdsa_do_sign(const unsigned char *dgst, int dgst_len,
-     }
- 
-     ret = ECDSA_SIG_new();
--    if (!ret) {
-+    if (ret == NULL) {
-         ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_MALLOC_FAILURE);
-         return NULL;
-     }
-     s = ret->s;
- 
--    if ((ctx = BN_CTX_new()) == NULL || (order = BN_new()) == NULL ||
--        (tmp = BN_new()) == NULL || (m = BN_new()) == NULL) {
-+    ctx = BN_CTX_new();
-+    if (ctx == NULL) {
-+        ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_MALLOC_FAILURE);
-+        goto err;
-+    }
-+
-+    BN_CTX_start(ctx);
-+    order = BN_CTX_get(ctx);
-+    tmp = BN_CTX_get(ctx);
-+    m = BN_CTX_get(ctx);
-+    blind = BN_CTX_get(ctx);
-+    blindm = BN_CTX_get(ctx);
-+    if (blindm == NULL) {
-         ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_MALLOC_FAILURE);
-         goto err;
-     }
-@@ -315,26 +327,70 @@ static ECDSA_SIG *ecdsa_do_sign(const unsigned char *dgst, int dgst_len,
-             }
-         }
- 
--        if (!BN_mod_mul(tmp, priv_key, ret->r, order, ctx)) {
-+        /*
-+         * The normal signature calculation is:
-+         *
-+         *   s := k^-1 * (m + r * priv_key) mod order
-+         *
-+         * We will blind this to protect against side channel attacks
-+         *
-+         *   s := k^-1 * blind^-1 * (blind * m + blind * r * priv_key) mod order
-+         */
-+
-+        /* Generate a blinding value */
-+        do {
-+            if (!BN_rand(blind, BN_num_bits(order) - 1, -1, 0))
-+                goto err;
-+        } while (BN_is_zero(blind));
-+        BN_set_flags(blind, BN_FLG_CONSTTIME);
-+        BN_set_flags(blindm, BN_FLG_CONSTTIME);
-+        BN_set_flags(tmp, BN_FLG_CONSTTIME);
-+
-+        /* tmp := blind * priv_key * r mod order */
-+        if (!BN_mod_mul(tmp, blind, priv_key, order, ctx)) {
-+            ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_BN_LIB);
-+            goto err;
-+        }
-+        if (!BN_mod_mul(tmp, tmp, ret->r, order, ctx)) {
-+            ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_BN_LIB);
-+            goto err;
-+        }
-+
-+        /* blindm := blind * m mod order */
-+        if (!BN_mod_mul(blindm, blind, m, order, ctx)) {
-+            ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_BN_LIB);
-+            goto err;
-+        }
-+
-+        /* s : = (blind * priv_key * r) + (blind * m) mod order */
-+        if (!BN_mod_add_quick(s, tmp, blindm, order)) {
-+            ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_BN_LIB);
-+            goto err;
-+        }
-+
-+        /* s:= s * blind^-1 mod order */
-+        if (BN_mod_inverse(blind, blind, order, ctx) == NULL) {
-             ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_BN_LIB);
-             goto err;
-         }
--        if (!BN_mod_add_quick(s, tmp, m, order)) {
-+        if (!BN_mod_mul(s, s, blind, order, ctx)) {
-             ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_BN_LIB);
-             goto err;
-         }
-+
-+        /* s := s * k^-1 mod order */
-         if (!BN_mod_mul(s, s, ckinv, order, ctx)) {
-             ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_BN_LIB);
-             goto err;
-         }
-+
-         if (BN_is_zero(s)) {
-             /*
-              * if kinv and r have been supplied by the caller don't to
-              * generate new kinv and r values
-              */
-             if (in_kinv != NULL && in_r != NULL) {
--                ECDSAerr(ECDSA_F_ECDSA_DO_SIGN,
--                         ECDSA_R_NEED_NEW_SETUP_VALUES);
-+                ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ECDSA_R_NEED_NEW_SETUP_VALUES);
-                 goto err;
-             }
-         } else
-@@ -349,15 +405,11 @@ static ECDSA_SIG *ecdsa_do_sign(const unsigned char *dgst, int dgst_len,
-         ECDSA_SIG_free(ret);
-         ret = NULL;
-     }
--    if (ctx)
-+    if (ctx != NULL) {
-+        BN_CTX_end(ctx);
-         BN_CTX_free(ctx);
--    if (m)
--        BN_clear_free(m);
--    if (tmp)
--        BN_clear_free(tmp);
--    if (order)
--        BN_free(order);
--    if (kinv)
-+    }
-+    if (kinv != NULL)
-         BN_clear_free(kinv);
-     return ret;
- }
--- 
-2.17.1
-
diff --git a/gnu/packages/patches/openssl-1.0.2-CVE-2018-0732.patch b/gnu/packages/patches/openssl-1.0.2-CVE-2018-0732.patch
deleted file mode 100644
index 50b95306a5..0000000000
--- a/gnu/packages/patches/openssl-1.0.2-CVE-2018-0732.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-Fix CVE-2018-0732:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-0732
-
-Patch copied from upstream source repository:
-
-https://github.com/openssl/openssl/commit/3984ef0b72831da8b3ece4745cac4f8575b19098
-
-From 3984ef0b72831da8b3ece4745cac4f8575b19098 Mon Sep 17 00:00:00 2001
-From: Guido Vranken <guidovranken@gmail.com>
-Date: Mon, 11 Jun 2018 19:38:54 +0200
-Subject: [PATCH] Reject excessively large primes in DH key generation.
-
-CVE-2018-0732
-
-Signed-off-by: Guido Vranken <guidovranken@gmail.com>
-
-(cherry picked from commit 91f7361f47b082ae61ffe1a7b17bb2adf213c7fe)
-
-Reviewed-by: Tim Hudson <tjh@openssl.org>
-Reviewed-by: Matt Caswell <matt@openssl.org>
-(Merged from https://github.com/openssl/openssl/pull/6457)
----
- crypto/dh/dh_key.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c
-index 387558f146..f235e0d682 100644
---- a/crypto/dh/dh_key.c
-+++ b/crypto/dh/dh_key.c
-@@ -130,10 +130,15 @@ static int generate_key(DH *dh)
-     int ok = 0;
-     int generate_new_key = 0;
-     unsigned l;
--    BN_CTX *ctx;
-+    BN_CTX *ctx = NULL;
-     BN_MONT_CTX *mont = NULL;
-     BIGNUM *pub_key = NULL, *priv_key = NULL;
- 
-+    if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS) {
-+        DHerr(DH_F_GENERATE_KEY, DH_R_MODULUS_TOO_LARGE);
-+        return 0;
-+    }
-+
-     ctx = BN_CTX_new();
-     if (ctx == NULL)
-         goto err;
--- 
-2.17.1
-
diff --git a/gnu/packages/patches/openssl-1.1.0-c-rehash-in.patch b/gnu/packages/patches/openssl-1.1-c-rehash-in.patch
index e3a982b7a8..c96493b584 100644
--- a/gnu/packages/patches/openssl-1.1.0-c-rehash-in.patch
+++ b/gnu/packages/patches/openssl-1.1-c-rehash-in.patch
@@ -6,14 +6,14 @@ to create symbolic links to certificates, for instance in the 'nss-certs'
 package.
 
 diff --git a/tools/c_rehash.in b/tools/c_rehash.in
-index 2fef627..9d40eae 100644
+index 421fd89208..93aca4e168 100644
 --- a/tools/c_rehash.in
 +++ b/tools/c_rehash.in
 @@ -1,4 +1,6 @@
--#!{- $config{hashbangperl} -}
+-#!{- $config{HASHBANGPERL} -}
 +eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
 +  & eval 'exec perl -wS "$0" $argv:q'
 +    if 0;
  
  # {- join("\n# ", @autowarntext) -}
- # Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
+ # Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved.
diff --git a/gnu/packages/patches/parted-glibc-compat.patch b/gnu/packages/patches/parted-glibc-compat.patch
new file mode 100644
index 0000000000..edf4afb0d1
--- /dev/null
+++ b/gnu/packages/patches/parted-glibc-compat.patch
@@ -0,0 +1,17 @@
+Include <sys/sysmacros.h> for "major" and "minor".
+
+Taken from upstream:
+https://git.savannah.gnu.org/cgit/parted.git/commit/?id=ba5e0451b51c983e40afd123b6e0d3eddb55e610
+
+diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
+index 31b98ab..7e86b51 100644
+--- a/libparted/arch/linux.c
++++ b/libparted/arch/linux.c
+@@ -41,6 +41,7 @@
+ #include <sys/utsname.h>        /* for uname() */
+ #include <scsi/scsi.h>
+ #include <assert.h>
++#include <sys/sysmacros.h>
+ #ifdef ENABLE_DEVICE_MAPPER
+ #include <libdevmapper.h>
+ #endif
diff --git a/gnu/packages/patches/patchutils-test-perms.patch b/gnu/packages/patches/patchutils-test-perms.patch
new file mode 100644
index 0000000000..c7652b9af2
--- /dev/null
+++ b/gnu/packages/patches/patchutils-test-perms.patch
@@ -0,0 +1,14 @@
+Need to mark one of the tests as PHONY to get permissions set correctly on
+built scripts.
+
+--- a/Makefile.in	2011-02-10 09:44:43.000000000 -0600
++++ b/Makefile.in	2018-11-29 21:52:05.000000000 -0600
+@@ -1106,5 +1108,6 @@
+ 	rm -f $(DESTDIR)$(bindir)/"`echo lsdiff|sed '$(transform)'`"
+ 	rm -f $(DESTDIR)$(bindir)/"`echo grepdiff|sed '$(transform)'`"
+ 
++.PHONY: tests/newline1/run-test
+ tests/newline1/run-test: src/combinediff$(EXEEXT) src/flipdiff$(EXEEXT) \
+ 		src/lsdiff$(EXEEXT) src/grepdiff$(EXEEXT) \
+		scripts/splitdiff
+
diff --git a/gnu/packages/patches/patchutils-xfail-gendiff-tests.patch b/gnu/packages/patches/patchutils-xfail-gendiff-tests.patch
deleted file mode 100644
index b2e77d22f2..0000000000
--- a/gnu/packages/patches/patchutils-xfail-gendiff-tests.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-The gendiff1 and gendiff2 tests need the gendiff script that's distributed
-with the rpm package management tool.  Without that script, these tests are
-expected to fail.
-
-Need to mark one of the tests as PHONY to get permissions set correctly on
-built scripts.
-
---- a/Makefile.in	2011-02-10 09:44:43.000000000 -0600
-+++ b/Makefile.in	2014-03-06 17:27:55.610048953 -0600
-@@ -378,6 +378,8 @@
- # These ones don't work yet.
- # Feel free to send me patches. :-)
- XFAIL_TESTS = \
-+	tests/gendiff1/run-test \
-+	tests/gendiff2/run-test \
- 	tests/delhunk5/run-test \
- 	tests/delhunk6/run-test
- 
-@@ -1106,6 +1108,7 @@
- 	rm -f $(DESTDIR)$(bindir)/"`echo lsdiff|sed '$(transform)'`"
- 	rm -f $(DESTDIR)$(bindir)/"`echo grepdiff|sed '$(transform)'`"
- 
-+.PHONY: tests/combine1/run-test
- tests/combine1/run-test: src/combinediff$(EXEEXT) src/flipdiff$(EXEEXT) \
- 		src/lsdiff$(EXEEXT) src/grepdiff$(EXEEXT)
- 	for script in $(bin_SCRIPTS); do \
diff --git a/gnu/packages/patches/perf-gcc-ice.patch b/gnu/packages/patches/perf-gcc-ice.patch
deleted file mode 100644
index 58ab5359c2..0000000000
--- a/gnu/packages/patches/perf-gcc-ice.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Work around this GCC ICE: <https://bugs.gnu.org/31708>.
-
---- linux-4.16.13/tools/perf/util/header.c	2018-06-04 11:30:39.368146035 +0200
-+++ linux-4.16.13/tools/perf/util/header.c	2018-06-04 11:34:04.667212378 +0200
-@@ -135,7 +135,7 @@ int do_write(struct feat_fd *ff, const v
- int write_padded(struct feat_fd *ff, const void *bf,
- 		 size_t count, size_t count_aligned)
- {
--	static const char zero_buf[NAME_ALIGN];
-+	static const char zero_buf[NAME_ALIGN] = { 0 };
- 	int err = do_write(ff, bf, count);
- 
- 	if (!err)
diff --git a/gnu/packages/patches/perl-archive-tar-CVE-2018-12015.patch b/gnu/packages/patches/perl-archive-tar-CVE-2018-12015.patch
deleted file mode 100644
index 6460cf5855..0000000000
--- a/gnu/packages/patches/perl-archive-tar-CVE-2018-12015.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Fix CVE-2018-12015:
-
-https://security-tracker.debian.org/tracker/CVE-2018-12015
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-12015
-https://rt.cpan.org/Ticket/Display.html?id=125523
-
-Patch taken from this upstream commit and adapted to apply to
-the bundled copy in the Perl distribution:
-
-https://github.com/jib/archive-tar-new/commit/ae65651eab053fc6dc4590dbb863a268215c1fc5
-
-diff --git a/cpan/Archive-Tar/lib/Archive/Tar.pm b/cpan/Archive-Tar/lib/Archive/Tar.pm
-index 6244369..a83975f 100644
---- a/cpan/Archive-Tar/lib/Archive/Tar.pm
-+++ b/cpan/Archive-Tar/lib/Archive/Tar.pm
-@@ -845,6 +845,20 @@ sub _extract_file {
-         return;
-     }
- 
-+    ### If a file system already contains a block device with the same name as
-+    ### the being extracted regular file, we would write the file's content
-+    ### to the block device. So remove the existing file (block device) now.
-+    ### If an archive contains multiple same-named entries, the last one
-+    ### should replace the previous ones. So remove the old file now.
-+    ### If the old entry is a symlink to a file outside of the CWD, the new
-+    ### entry would create a file there. This is CVE-2018-12015
-+    ### <https://rt.cpan.org/Ticket/Display.html?id=125523>.
-+    if (-l $full || -e _) {
-+	if (!unlink $full) {
-+	    $self->_error( qq[Could not remove old file '$full': $!] );
-+	    return;
-+	}
-+    }
-     if( length $entry->type && $entry->is_file ) {
-         my $fh = IO::File->new;
-         $fh->open( $full, '>' ) or (
diff --git a/gnu/packages/patches/perl-deterministic-ordering.patch b/gnu/packages/patches/perl-deterministic-ordering.patch
index 92e33ef135..be63d5cde3 100644
--- a/gnu/packages/patches/perl-deterministic-ordering.patch
+++ b/gnu/packages/patches/perl-deterministic-ordering.patch
@@ -12,10 +12,10 @@ reproducibility.
  cpan/Devel-PPPort/PPPort_xs.PL | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/cpan/Devel-PPPort/PPPort_xs.PL b/cpan/Devel-PPPort/PPPort_xs.PL
+diff --git a/dist/Devel-PPPort/PPPort_xs.PL b/dist/Devel-PPPort/PPPort_xs.PL
 index 5f18940..149f2fe 100644
---- a/cpan/Devel-PPPort/PPPort_xs.PL
-+++ b/cpan/Devel-PPPort/PPPort_xs.PL
+--- a/dist/Devel-PPPort/PPPort_xs.PL
++++ b/dist/Devel-PPPort/PPPort_xs.PL
 @@ -38,7 +38,7 @@ END
  my $file;
  my $sec;
diff --git a/gnu/packages/patches/perl-file-path-CVE-2017-6512.patch b/gnu/packages/patches/perl-file-path-CVE-2017-6512.patch
deleted file mode 100644
index 28ab067599..0000000000
--- a/gnu/packages/patches/perl-file-path-CVE-2017-6512.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-Fix CVE-2017-6512:
-
-https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-6512
-https://rt.cpan.org/Public/Bug/Display.html?id=121951
-
-Patch copied from Debian, adapted to apply to the copy of File::Path in Perl
-5.24.0.
-
-https://github.com/jkeenan/File-Path/commit/e5ef95276ee8ad471c66ee574a5d42552b3a6af2
-https://anonscm.debian.org/cgit/perl/perl.git/diff/debian/patches/fixes/file_path_chmod_race.diff?id=e7b50f8fb6413f8ddfbbfda2d531615fb029e2d3
-
-From d760748be0efca7c05454440e24f3df77bf7cf5d Mon Sep 17 00:00:00 2001
-From: John Lightsey <john@nixnuts.net>
-Date: Tue, 2 May 2017 12:03:52 -0500
-Subject: Prevent directory chmod race attack.
-
-CVE-2017-6512 is a race condition attack where the chmod() of directories
-that cannot be entered is misused to change the permissions on other
-files or directories on the system. This has been corrected by limiting
-the directory-permission loosening logic to systems where fchmod() is
-supported.
-
-[Backported (whitespace adjustments) to File-Path 2.12 / perl 5.24 by
-Dominic Hargreaves for Debian.]
-
-Bug: https://rt.cpan.org/Public/Bug/Display.html?id=121951
-Bug-Debian: https://bugs.debian.org/863870
-Patch-Name: fixes/file_path_chmod_race.diff
----
- cpan/File-Path/lib/File/Path.pm | 39 +++++++++++++++++++++++++--------------
- cpan/File-Path/t/Path.t         | 40 ++++++++++++++++++++++++++--------------
- 2 files changed, 51 insertions(+), 28 deletions(-)
-
-diff --git a/cpan/File-Path/lib/File/Path.pm b/cpan/File-Path/lib/File/Path.pm
-index 034da1e..a824cc8 100644
---- a/cpan/File-Path/lib/File/Path.pm
-+++ b/cpan/File-Path/lib/File/Path.pm
-@@ -354,21 +354,32 @@ sub _rmtree {
- 
-                 # see if we can escalate privileges to get in
-                 # (e.g. funny protection mask such as -w- instead of rwx)
--                $perm &= oct '7777';
--                my $nperm = $perm | oct '700';
--                if (
--                    !(
--                           $arg->{safe}
--                        or $nperm == $perm
--                        or chmod( $nperm, $root )
--                    )
--                  )
--                {
--                    _error( $arg,
--                        "cannot make child directory read-write-exec", $canon );
--                    next ROOT_DIR;
-+                # This uses fchmod to avoid traversing outside of the proper
-+                # location (CVE-2017-6512)
-+                my $root_fh;
-+                if (open($root_fh, '<', $root)) {
-+                    my ($fh_dev, $fh_inode) = (stat $root_fh )[0,1];
-+                    $perm &= oct '7777';
-+                    my $nperm = $perm | oct '700';
-+                    local $@;
-+                    if (
-+                        !(
-+                            $arg->{safe}
-+                           or $nperm == $perm
-+                           or !-d _
-+                           or $fh_dev ne $ldev
-+                           or $fh_inode ne $lino
-+                           or eval { chmod( $nperm, $root_fh ) }
-+                        )
-+                      )
-+                    {
-+                        _error( $arg,
-+                            "cannot make child directory read-write-exec", $canon );
-+                        next ROOT_DIR;
-+                    }
-+                    close $root_fh;
-                 }
--                elsif ( !chdir($root) ) {
-+                if ( !chdir($root) ) {
-                     _error( $arg, "cannot chdir to child", $canon );
-                     next ROOT_DIR;
-                 }
-diff --git a/cpan/File-Path/t/Path.t b/cpan/File-Path/t/Path.t
-index ff52fd6..956ca09 100644
---- a/cpan/File-Path/t/Path.t
-+++ b/cpan/File-Path/t/Path.t
-@@ -3,7 +3,7 @@
- 
- use strict;
- 
--use Test::More tests => 127;
-+use Test::More tests => 126;
- use Config;
- use Fcntl ':mode';
- use lib 't/';
-@@ -18,6 +18,13 @@ BEGIN {
- 
- my $Is_VMS = $^O eq 'VMS';
- 
-+my $fchmod_supported = 0;
-+if (open my $fh, curdir()) {
-+    my ($perm) = (stat($fh))[2];
-+    $perm &= 07777;
-+    eval { $fchmod_supported = chmod( $perm, $fh); };
-+}
-+
- # first check for stupid permissions second for full, so we clean up
- # behind ourselves
- for my $perm (0111,0777) {
-@@ -299,16 +306,19 @@ is($created[0], $dir, "created directory (old style 3 mode undef) cross-check");
- 
- is(rmtree($dir, 0, undef), 1, "removed directory 3 verbose undef");
- 
--$dir = catdir($tmp_base,'G');
--$dir = VMS::Filespec::unixify($dir) if $Is_VMS;
-+SKIP: {
-+    skip "fchmod of directories not supported on this platform", 3 unless $fchmod_supported;
-+    $dir = catdir($tmp_base,'G');
-+    $dir = VMS::Filespec::unixify($dir) if $Is_VMS;
- 
--@created = mkpath($dir, undef, 0200);
-+    @created = mkpath($dir, undef, 0400);
- 
--is(scalar(@created), 1, "created write-only dir");
-+    is(scalar(@created), 1, "created read-only dir");
- 
--is($created[0], $dir, "created write-only directory cross-check");
-+    is($created[0], $dir, "created read-only directory cross-check");
- 
--is(rmtree($dir), 1, "removed write-only dir");
-+    is(rmtree($dir), 1, "removed read-only dir");
-+}
- 
- # borderline new-style heuristics
- if (chdir $tmp_base) {
-@@ -450,26 +460,28 @@ SKIP: {
- }
- 
- SKIP : {
--    my $skip_count = 19;
-+    my $skip_count = 18;
-     # this test will fail on Windows, as per:
-     #   http://perldoc.perl.org/perlport.html#chmod
- 
-     skip "Windows chmod test skipped", $skip_count
-         if $^O eq 'MSWin32';
-+    skip "fchmod() on directories is not supported on this platform", $skip_count
-+        unless $fchmod_supported;
-     my $mode;
-     my $octal_mode;
-     my @inputs = (
--      0777, 0700, 0070, 0007,
--      0333, 0300, 0030, 0003,
--      0111, 0100, 0010, 0001,
--      0731, 0713, 0317, 0371, 0173, 0137,
--      00 );
-+      0777, 0700, 0470, 0407,
-+      0433, 0400, 0430, 0403,
-+      0111, 0100, 0110, 0101,
-+      0731, 0713, 0317, 0371,
-+      0173, 0137);
-     my $input;
-     my $octal_input;
--    $dir = catdir($tmp_base, 'chmod_test');
- 
-     foreach (@inputs) {
-         $input = $_;
-+        $dir = catdir($tmp_base, sprintf("chmod_test%04o", $input));
-         # We can skip from here because 0 is last in the list.
-         skip "Mode of 0 means assume user defaults on VMS", 1
-           if ($input == 0 && $Is_VMS);
diff --git a/gnu/packages/patches/pinentry-efl.patch b/gnu/packages/patches/pinentry-efl.patch
new file mode 100644
index 0000000000..5ba79e28df
--- /dev/null
+++ b/gnu/packages/patches/pinentry-efl.patch
@@ -0,0 +1,798 @@
+https://git.gnupg.org/cgi-bin/gitweb.cgi?p=pinentry.git;a=commit;h=948105b7a34ec9a9e5479d376b7c86bafee50a01
+This patch can be removed with the next release of pinentry.
+
+From 948105b7a34ec9a9e5479d376b7c86bafee50a01 Mon Sep 17 00:00:00 2001
+From: "William L. Thomson Jr" <wlt@o-sinc.com>
+Date: Tue, 29 May 2018 22:50:47 +0100
+Subject: [PATCH] efl: Add an EFL-based pinentry.
+
+* NEWS: Update.
+* Makefile.am: Add new efl subdirectory.
+* configure.ac: Add --enable-pinentry-efl option.
+* efl/Makefile.am: New file.
+* efl/pinentry-efl.c: New file.
+
+Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
+---
+ Makefile.am        |   8 +-
+ configure.ac       |  44 +++-
+ efl/Makefile.am    |  38 ++++
+ efl/pinentry-efl.c | 623 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 6 files changed, 716 insertions(+), 2 deletions(-)
+ create mode 100644 efl/Makefile.am
+ create mode 100644 efl/pinentry-efl.c
+
+diff --git a/Makefile.am b/Makefile.am
+index 8c8b8e5..b8fd0e1 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -82,10 +82,16 @@ else
+ pinentry_fltk =
+ endif
+ 
++if BUILD_PINENTRY_EFL
++pinentry_efl = efl
++else
++pinentry_efl =
++endif
++
+ SUBDIRS = m4 secmem pinentry ${pinentry_curses} ${pinentry_tty} \
+ 	${pinentry_emacs} ${pinentry_gtk_2} ${pinentry_gnome_3} \
+ 	${pinentry_qt} ${pinentry_tqt} ${pinentry_w32} \
+-	${pinentry_fltk} doc
++	${pinentry_fltk} ${pinentry_efl} doc
+ 
+ 
+ install-exec-local:
+diff --git a/configure.ac b/configure.ac
+index ff6c2e0..e305e44 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -419,6 +419,42 @@ fi
+ 
+ 
+ dnl
++dnl Check for EFL pinentry programs.
++dnl
++AC_ARG_ENABLE(pinentry-efl,
++            AC_HELP_STRING([--enable-pinentry-efl], [build EFL pinentry]),
++            pinentry_efl=$enableval, pinentry_efl=maybe)
++
++dnl check for pkg-config
++if test "$pinentry_efl" != "no"; then
++	AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
++	if test x"${PKG_CONFIG}" = xno ; then
++		pinentry_efl=no
++	fi
++fi
++
++if test "$pinentry_efl" != "no"; then
++	AC_MSG_CHECKING([for efl])
++	"${PKG_CONFIG}" --exists 'elementary >= 1.18'
++	if test $? -ne 0 ; then
++		AC_MSG_RESULT([no])
++		AC_MSG_WARN([efl >= 1.18 is required for efl pinentry])
++		pinentry_efl=no
++	else
++		AC_MSG_RESULT([yes])
++		EFL_CFLAGS=`"${PKG_CONFIG}" --cflags ecore-x elementary`
++		EFL_LIBS=`"${PKG_CONFIG}" --libs ecore-x elementary`
++		AC_SUBST(EFL_CFLAGS)
++		AC_SUBST(EFL_LIBS)
++		if test "$pinentry_efl" != "no"
++		then
++			pinentry_efl=yes
++		fi
++	fi
++fi
++AM_CONDITIONAL(BUILD_PINENTRY_EFL, test "$pinentry_efl" = "yes")
++
++dnl
+ dnl Check for GTK+-2 / GNOME3 pinentry programs.
+ dnl
+ AC_ARG_ENABLE(pinentry-gtk2,
+@@ -645,7 +681,11 @@ else
+               if test "$pinentry_tqt" = "yes"; then
+                 PINENTRY_DEFAULT=pinentry-tqt
+               else
+-                AC_MSG_ERROR([[No pinentry enabled.]])
++                if test "$pinentry_efl" = "yes"; then
++                  PINENTRY_DEFAULT=pinentry-efl
++                else
++                  AC_MSG_ERROR([[No pinentry enabled.]])
++                fi
+               fi
+             fi
+           fi
+@@ -721,6 +761,7 @@ secmem/Makefile
+ pinentry/Makefile
+ curses/Makefile
+ tty/Makefile
++efl/Makefile
+ emacs/Makefile
+ gtk+-2/Makefile
+ gnome3/Makefile
+@@ -744,6 +785,7 @@ AC_MSG_NOTICE([
+ 	Curses Pinentry ..: $pinentry_curses
+ 	TTY Pinentry .....: $pinentry_tty
+ 	Emacs Pinentry ...: $pinentry_emacs
++	EFL Pinentry .....: $pinentry_efl
+ 	GTK+-2 Pinentry ..: $pinentry_gtk_2
+ 	GNOME 3 Pinentry .: $pinentry_gnome_3
+ 	Qt Pinentry ......: $pinentry_qt $pinentry_qt_lib_version
+diff --git a/efl/Makefile.am b/efl/Makefile.am
+new file mode 100644
+index 0000000..b986a04
+--- /dev/null
++++ b/efl/Makefile.am
+@@ -0,0 +1,38 @@
++# Makefile.am - PIN entry EFL frontend.
++# Copyright (C) 2017 Obsidian-Studios, Inc.
++# Author William L. Thomson Jr. <wlt@o-sinc.com>
++#
++# This file is part of PINENTRY.
++#
++# PINENTRY is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# PINENTRY is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
++
++## Process this file with automake to produce Makefile.in
++
++bin_PROGRAMS = pinentry-efl
++
++if FALLBACK_CURSES
++ncurses_include = $(NCURSES_INCLUDE)
++libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV)
++else
++ncurses_include =
++libcurses =
++endif
++
++AM_CPPFLAGS = $(COMMON_CFLAGS) $(EFL_CFLAGS) $(ncurses_include) \
++	-I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry
++LDADD = ../pinentry/libpinentry.a ../secmem/libsecmem.a \
++	$(COMMON_LIBS) $(LIBCAP) $(EFL_LIBS) $(libcurses)
++
++pinentry_efl_SOURCES = pinentry-efl.c
+diff --git a/efl/pinentry-efl.c b/efl/pinentry-efl.c
+new file mode 100644
+index 0000000..ca99693
+--- /dev/null
++++ b/efl/pinentry-efl.c
+@@ -0,0 +1,623 @@
++/* pinentry-efl.c
++   Copyright (C) 2017 Obsidian-Studios, Inc.
++     Author William L. Thomson Jr. <wlt@o-sinc.com>
++
++   Based on pinentry-gtk2.c
++   Copyright (C) 1999 Robert Bihlmeyer <robbe@orcus.priv.at>
++   Copyright (C) 2001, 2002, 2007, 2015 g10 Code GmbH
++   Copyright (C) 2004 by Albrecht Dreß <albrecht.dress@arcor.de>
++
++   pinentry-efl is a pinentry application for the EFL widget set.
++   It tries to follow the Gnome Human Interface Guide as close as
++   possible.
++
++   This program is free software; you can redistribute it and/or modify
++   it under the terms of the GNU General Public License as published by
++   the Free Software Foundation; either version 2 of the License, or
++   (at your option) any later version.
++
++   This program is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++   GNU General Public License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with this program; if not, write to the Free Software
++   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++#include <Elementary.h>
++#include <Ecore_X.h>
++#include <gpg-error.h>
++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wstrict-prototypes"
++#endif
++#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
++#pragma GCC diagnostic pop
++#endif
++
++#ifdef HAVE_GETOPT_H
++#include <getopt.h>
++#else
++#include "getopt.h"
++#endif /* HAVE_GETOPT_H */
++
++#include "pinentry.h"
++
++#ifdef FALLBACK_CURSES
++#include "pinentry-curses.h"
++#endif
++
++#define PGMNAME "pinentry-efl"
++
++#ifndef VERSION
++#define VERSION
++#endif
++
++#define ENTRY_HIDE "Hide entry"
++#define ENTRY_SHOW "Show entry"
++
++typedef enum { CONFIRM_CANCEL, CONFIRM_OK, CONFIRM_NOTOK } confirm_value_t;
++
++static const int WIDTH = 480;
++static const int BUTTON_HEIGHT = 27;
++static const int BUTTON_WIDTH = 70;
++static const int BUTTON_ICON_SIZE = 13;
++static const int PADDING = 5;
++
++static Eina_Bool got_input;
++static Ecore_Timer *timer;
++static Evas_Object *check_label;
++static Evas_Object *error_label;
++static Evas_Object *entry;
++static Evas_Object *repeat_entry;
++static Evas_Object *qualitybar;
++static Evas_Object *win;
++static char **pargv;
++static int grab_failed;
++static int passphrase_ok;
++static int confirm_mode;
++static int pargc;
++static confirm_value_t confirm_value;
++static pinentry_t pinentry;
++
++pinentry_cmd_handler_t pinentry_cmd_handler;
++
++static void
++quit (void)
++{
++  evas_object_del(win);
++  elm_exit();
++  ecore_main_loop_quit ();
++}
++
++static void
++delete_event (void *data EINA_UNUSED,
++              Evas_Object *obj EINA_UNUSED,
++              void *event EINA_UNUSED)
++{
++  pinentry->close_button = 1;
++  quit ();
++}
++
++static void
++changed_text_handler (void *data EINA_UNUSED,
++                      Evas_Object *obj,
++                      void *event EINA_UNUSED)
++{
++  const char *s;
++  int length;
++  int percent;
++
++  got_input = EINA_TRUE;
++
++  if (pinentry->repeat_passphrase && repeat_entry)
++    {
++      elm_object_text_set (repeat_entry, "");
++      elm_object_text_set (error_label, "");
++    }
++
++  if (!qualitybar || !pinentry->quality_bar)
++    return;
++
++  s = elm_object_text_get (obj);
++  if (!s)
++    s = "";
++  length = strlen (s);
++  percent = length? pinentry_inq_quality (pinentry, s, length) : 0;
++  evas_object_color_set(qualitybar,
++                        255 - ( 2.55 * percent ),
++                        2.55 * percent, 0, 255);
++  elm_progressbar_value_set (qualitybar, (double) percent / 100.0);
++}
++
++static void
++on_check (void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
++{
++  if(elm_check_state_get(obj))
++    {
++        elm_entry_password_set(entry, EINA_FALSE);
++        elm_object_text_set(check_label,ENTRY_HIDE);
++    }
++  else
++    {
++        elm_entry_password_set(entry, EINA_TRUE);
++        elm_object_text_set(check_label,ENTRY_SHOW);
++    }
++  evas_object_size_hint_min_set(check_label,
++                                ELM_SCALE_SIZE(BUTTON_WIDTH),
++                                ELM_SCALE_SIZE(BUTTON_HEIGHT));
++  evas_object_size_hint_align_set(check_label, 0, 1);
++}
++
++static void
++on_click (void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
++{
++  if (confirm_mode)
++    {
++      confirm_value = (confirm_value_t) data;
++      quit ();
++      return;
++    }
++
++  if (data)
++    {
++      const char *s;
++      const char *s2;
++
++      s = elm_entry_entry_get (entry);
++      if (!s)
++	s = "";
++
++      if (pinentry->repeat_passphrase && repeat_entry)
++	{
++	  s2 = elm_entry_entry_get (repeat_entry);
++	  if (!s2)
++	    s2 = "";
++	  if (strcmp (s, s2))
++	    {
++              elm_object_text_set(error_label,
++                                  pinentry->repeat_error_string?
++                                  pinentry->repeat_error_string:
++				   "not correctly repeated");
++              elm_object_focus_set(entry,EINA_TRUE);
++              return;
++	    }
++	  pinentry->repeat_okay = 1;
++	}
++
++      passphrase_ok = 1;
++      pinentry_setbufferlen (pinentry, strlen (s) + 1);
++      if (pinentry->pin)
++	strncpy (pinentry->pin, s, strlen(s) + 1);
++    }
++  quit ();
++}
++
++static void
++enter_callback (void *data, Evas_Object * obj, void *event_info EINA_UNUSED)
++{
++  if (data)
++    elm_object_focus_set (data, 1);
++  else
++    on_click ((void *) CONFIRM_OK, obj, NULL);
++}
++
++static Eina_Bool
++timeout_cb (const void * data)
++{
++  pinentry_t pe = (pinentry_t)data;
++  if (!got_input)
++    {
++      ecore_main_loop_quit();
++      if (pe)
++        pe->specific_err = gpg_error (GPG_ERR_TIMEOUT);
++    }
++
++  timer = NULL;
++  return ECORE_CALLBACK_DONE;
++}
++
++static void
++create_window (void)
++{
++  char *txt;
++  Evas_Object *icon;
++  Evas_Object *obj;
++  Evas_Object *table;
++  int btn_txt_len = 0;
++  int row = 0;
++  int ok_len = 0;
++
++  win = elm_win_util_dialog_add(NULL,"pinentry","enter pin");
++  elm_win_autodel_set(win, EINA_TRUE);
++  elm_win_center(win,EINA_TRUE,EINA_TRUE);
++  evas_object_smart_callback_add(win, "delete,request", delete_event, NULL);
++
++  table = elm_table_add(win);
++  elm_table_padding_set(table,ELM_SCALE_SIZE(PADDING),0);
++  evas_object_size_hint_padding_set (table,
++                                     ELM_SCALE_SIZE(PADDING),
++                                     ELM_SCALE_SIZE(PADDING),
++                                     ELM_SCALE_SIZE(PADDING),
++                                     ELM_SCALE_SIZE(PADDING));
++  evas_object_show(table);
++
++  if (pinentry->title)
++    {
++      txt = pinentry_utf8_to_local (pinentry->lc_ctype,
++                                    pinentry->title);
++      elm_win_title_set ( win, txt );
++      free (txt);
++    }
++
++  /* Description Label */
++  if (pinentry->description)
++    {
++      char* aligned;
++      int len;
++
++      obj = elm_label_add(table);
++      elm_label_line_wrap_set (obj, ELM_WRAP_WORD);
++      txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->description);
++      len = strlen(txt)+20; // 20 chars for align tag
++      aligned = calloc(len+1,sizeof(char));
++      if(aligned)
++        {
++          snprintf(aligned,len, "<align=left>%s</align>",txt);
++          elm_object_text_set(obj,aligned);
++          free (aligned);
++        } else
++          elm_object_text_set(obj,txt);
++      free (txt);
++      evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, 0);
++      evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0);
++      elm_table_pack(table, obj, 1, row, 5, 1);
++      evas_object_show(obj);
++      row++;
++    }
++  if (!confirm_mode && (pinentry->error || pinentry->repeat_passphrase))
++    {
++    /* Error Label */
++    if (pinentry->error)
++        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->error);
++      else
++        txt = "";
++      obj = elm_label_add(table);
++      evas_object_color_set(obj, 255, 0, 0, 255);
++      elm_object_text_set(obj,txt);
++      elm_object_style_set(obj,"slide_bounce");
++      elm_label_slide_duration_set(obj, 10);
++      elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_ALWAYS);
++      elm_label_slide_go(obj);
++      evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, 0);
++      evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0);
++      elm_table_pack(table, obj, 1, row, 5, 1);
++      evas_object_show(obj);
++      if (pinentry->error)
++        free (txt);
++      row++;
++    }
++
++  qualitybar = NULL;
++
++  if (!confirm_mode)
++    {
++
++    if (pinentry->prompt)
++      {
++        /* Entry/Prompt Label */
++        obj = elm_label_add(table);
++        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->prompt);
++        elm_object_text_set(obj,txt);
++        free (txt);
++        evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
++        evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
++        elm_table_pack(table, obj, 1, row, 1, 1);
++        evas_object_show(obj);
++      }
++
++      entry = elm_entry_add(table);
++      elm_entry_scrollable_set(entry, EINA_TRUE);
++      elm_scroller_policy_set(entry,
++                              ELM_SCROLLER_POLICY_OFF,
++                              ELM_SCROLLER_POLICY_OFF);
++      elm_entry_password_set(entry, EINA_TRUE);
++      elm_entry_single_line_set(entry, EINA_TRUE);
++      evas_object_size_hint_weight_set(entry, 0, 0);
++      evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0);
++      elm_table_pack(table, entry, 2, row, 4, 1);
++      evas_object_smart_callback_add(entry,
++                                     "changed",
++                                     changed_text_handler,
++                                     NULL);
++      evas_object_show(entry);
++      row++;
++
++      /* Check box */
++      obj = elm_check_add(table);
++      evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
++      elm_table_pack(table, obj, 1, row, 1, 1);
++      evas_object_smart_callback_add(obj, "changed", on_check, NULL);
++      evas_object_show(obj);
++
++      /* Check Label */
++      check_label = elm_label_add(table);
++      on_check((void *)NULL, obj, (void *)NULL);
++      elm_table_pack(table, check_label, 2, row, 4, 1);
++      evas_object_show(check_label);
++      row++;
++
++      if (pinentry->quality_bar)
++	{
++          /* Quality Bar Label */
++	  obj = elm_label_add(table);
++          txt = pinentry_utf8_to_local (pinentry->lc_ctype,
++                                        pinentry->quality_bar);
++          elm_object_text_set(obj,txt);
++          free (txt);
++          evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
++          evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
++          elm_table_pack(table, obj, 1, row, 1, 1);
++          evas_object_show(obj);
++
++	  qualitybar = elm_progressbar_add(table);
++          evas_object_color_set(qualitybar, 255, 0, 0, 255);
++          evas_object_show(qualitybar);
++          if (pinentry->quality_bar_tt)
++	    elm_object_tooltip_text_set (qualitybar,
++					 pinentry->quality_bar_tt);
++          evas_object_size_hint_weight_set(qualitybar, EVAS_HINT_EXPAND, 0);
++          evas_object_size_hint_align_set(qualitybar, EVAS_HINT_FILL, 0);
++          elm_table_pack(table, qualitybar, 2, row, 4, 1);
++          row++;
++	}
++
++      if (pinentry->repeat_passphrase)
++        {
++          /* Repeat Label */
++	  obj = elm_label_add(table);
++          txt = pinentry_utf8_to_local (pinentry->lc_ctype,
++                                        pinentry->repeat_passphrase);
++          elm_object_text_set(obj,txt);
++          free (txt);
++          evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
++          evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
++          elm_table_pack(table, obj, 1, row, 1, 1);
++          evas_object_show(obj);
++
++          repeat_entry = elm_entry_add(table);
++          elm_entry_scrollable_set(repeat_entry, EINA_TRUE);
++          elm_scroller_policy_set(repeat_entry,
++                                  ELM_SCROLLER_POLICY_OFF,
++                                  ELM_SCROLLER_POLICY_OFF);
++          elm_entry_password_set(repeat_entry, EINA_TRUE);
++          elm_entry_single_line_set(repeat_entry, EINA_TRUE);
++          evas_object_size_hint_weight_set(repeat_entry, 0, 0);
++          evas_object_size_hint_align_set(repeat_entry, EVAS_HINT_FILL, 0);
++          elm_table_pack(table, repeat_entry, 2, row, 4, 1);
++	  evas_object_smart_callback_add (repeat_entry, "activated",
++					  enter_callback, NULL);
++          evas_object_show(repeat_entry);
++          evas_object_smart_callback_add (entry,
++                                          "activated",
++                                          enter_callback,
++                                          repeat_entry);
++          evas_object_smart_callback_add(repeat_entry,
++                                         "activated",
++                                         on_click,
++                                         (void *) CONFIRM_OK);
++          row++;
++        }
++      else
++        evas_object_smart_callback_add(entry,
++                                       "activated",
++                                       on_click,
++                                       (void *) CONFIRM_OK);
++  }
++
++  /* Cancel Button */
++  if (!pinentry->one_button)
++    {
++      obj = elm_button_add(table);
++      icon = elm_icon_add (table);
++      evas_object_size_hint_aspect_set (icon, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
++      if (elm_icon_standard_set (icon, "dialog-cancel") ||
++          elm_icon_standard_set (icon, "window-close"))
++        {
++          evas_object_size_hint_min_set(icon,
++                                        ELM_SCALE_SIZE(BUTTON_ICON_SIZE),
++                                        ELM_SCALE_SIZE(BUTTON_ICON_SIZE));
++          elm_object_part_content_set(obj, "icon", icon);
++          evas_object_show (icon);
++        }
++      else
++        evas_object_del(icon);
++      if (pinentry->cancel || pinentry->default_cancel)
++        {
++          if(pinentry->cancel)
++            txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->cancel);
++          else
++            txt = pinentry_utf8_to_local (pinentry->lc_ctype,
++                                          pinentry->default_cancel);
++          if(txt[0]=='_')
++            elm_object_text_set(obj,txt+1);
++          else
++            elm_object_text_set(obj,txt);
++          btn_txt_len = ELM_SCALE_SIZE(strlen(txt) * (PADDING * 1.5));
++          free (txt);
++        }
++      else
++        elm_object_text_set(obj, "Cancel"); //STOCK_CANCEL
++      evas_object_size_hint_align_set(obj, 0, 0);
++      if(btn_txt_len>ELM_SCALE_SIZE(BUTTON_WIDTH))
++        evas_object_size_hint_min_set(obj,
++                                      btn_txt_len,
++                                      ELM_SCALE_SIZE(BUTTON_HEIGHT));
++      else
++        evas_object_size_hint_min_set(obj,
++                                      ELM_SCALE_SIZE(BUTTON_WIDTH),
++                                      ELM_SCALE_SIZE(BUTTON_HEIGHT));
++      elm_table_pack(table, obj, 4, row, 1, 1);
++      evas_object_smart_callback_add(obj,
++                                     "clicked",
++                                     on_click,
++                                     (void *) CONFIRM_CANCEL);
++      evas_object_show(obj);
++    }
++
++  /* OK Button */
++  obj = elm_button_add(table);
++  icon = elm_icon_add (table);
++  evas_object_size_hint_aspect_set (icon, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
++  if (elm_icon_standard_set (icon, "dialog-ok") ||
++      elm_icon_standard_set (icon, "list-add"))
++    {
++      evas_object_size_hint_min_set(icon,
++                                    ELM_SCALE_SIZE(BUTTON_ICON_SIZE),
++                                    ELM_SCALE_SIZE(BUTTON_ICON_SIZE));
++      elm_object_part_content_set(obj, "icon", icon);
++      evas_object_show (icon);
++    }
++  else
++    evas_object_del(icon);
++  if (pinentry->ok || pinentry->default_ok)
++    {
++      if(pinentry->ok)
++        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->ok);
++      else
++        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->default_ok);
++      if(txt[0]=='_')
++        elm_object_text_set(obj,txt+1);
++      else
++        elm_object_text_set(obj,txt);
++      ok_len = ELM_SCALE_SIZE(strlen(txt) * (PADDING * 1.5));
++      if(ok_len>btn_txt_len)
++        btn_txt_len = ok_len;
++      free (txt);
++    }
++  else
++    elm_object_text_set(obj,"OK"); //STOCK_OK
++  evas_object_size_hint_align_set(obj, 0, 0);
++  if(btn_txt_len>ELM_SCALE_SIZE(BUTTON_WIDTH))
++    evas_object_size_hint_min_set(obj,
++                                  btn_txt_len,
++                                  ELM_SCALE_SIZE(BUTTON_HEIGHT));
++  else
++    evas_object_size_hint_min_set(obj,
++                                  ELM_SCALE_SIZE(BUTTON_WIDTH),
++                                  ELM_SCALE_SIZE(BUTTON_HEIGHT));
++  elm_table_pack(table, obj, 5, row, 1, 1);
++  evas_object_smart_callback_add(obj, "clicked", on_click, (void *) CONFIRM_OK);
++  evas_object_show(obj);
++
++  /* Key/Lock Icon */
++  obj = elm_icon_add (win);
++  evas_object_size_hint_aspect_set (obj, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
++  if (elm_icon_standard_set (obj, "dialog-password"))
++    {
++      double ic_size = WIDTH/5;
++      if(row==0)
++        ic_size = ic_size/3.5;
++      else if(row<4)
++        ic_size = ic_size - ic_size/row;
++      evas_object_size_hint_min_set(obj,
++                                    ELM_SCALE_SIZE(ic_size),
++                                    ELM_SCALE_SIZE(ic_size));
++      evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
++      evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0.5);
++      elm_table_pack(table, obj, 0, 0, 1, row? row:1);
++      evas_object_show (obj);
++    }
++  else
++      evas_object_del(obj);
++
++  /* Box for padding */
++  obj = elm_box_add (win);
++  elm_box_pack_end (obj, table);
++  evas_object_show (obj);
++
++  elm_win_resize_object_add(win,obj);
++  evas_object_show(win);
++
++  if(entry)
++    elm_object_focus_set (entry, EINA_TRUE);
++
++  if (pinentry->timeout > 0)
++    timer = ecore_timer_add (pinentry->timeout,
++                             (Ecore_Task_Cb)timeout_cb,
++                             pinentry);
++}
++
++static int
++efl_cmd_handler (pinentry_t pe)
++{
++  int want_pass = !!pe->pin;
++
++  got_input = EINA_FALSE;
++  pinentry = pe;
++  confirm_value = CONFIRM_CANCEL;
++  passphrase_ok = 0;
++  confirm_mode = want_pass ? 0 : 1;
++  /* init ecore-x explicitly using DISPLAY since this can launch
++   * from console
++   */
++  if (pe->display)
++    ecore_x_init (pe->display);
++  elm_init (pargc, pargv);
++  create_window ();
++  ecore_main_loop_begin ();
++
++  if (timer)
++    {
++      ecore_timer_del (timer);
++      timer = NULL;
++    }
++
++  if (confirm_value == CONFIRM_CANCEL || grab_failed)
++    pe->canceled = 1;
++
++  pinentry = NULL;
++  if (want_pass)
++    {
++      if (passphrase_ok && pe->pin)
++	return strlen (pe->pin);
++      else
++	return -1;
++    }
++  else
++    return (confirm_value == CONFIRM_OK) ? 1 : 0;
++}
++
++int
++main (int argc, char *argv[])
++{
++  pinentry_init (PGMNAME);
++
++#ifdef FALLBACK_CURSES
++  if (pinentry_have_display (argc, argv))
++    {
++#endif
++
++  pinentry_cmd_handler = efl_cmd_handler;
++  pargc = argc;
++  pargv = argv;
++
++#ifdef FALLBACK_CURSES
++    }
++  else
++    {
++      pinentry_cmd_handler = curses_cmd_handler;
++    }
++#endif
++
++  pinentry_parse_opts (argc, argv);
++  if (pinentry_loop ())
++    return 1;
++
++  return 0;
++}
+-- 
+2.8.0.rc3
+
diff --git a/gnu/packages/patches/podofo-cmake-3.12.patch b/gnu/packages/patches/podofo-cmake-3.12.patch
new file mode 100644
index 0000000000..0a3c19b21a
--- /dev/null
+++ b/gnu/packages/patches/podofo-cmake-3.12.patch
@@ -0,0 +1,19 @@
+The build fails with cmake 3.12.0.  This patch will be obsolete with the next
+release.
+
+https://sourceforge.net/p/podofo/tickets/24/attachment/podofo-cmake-3.12.patch
+
+
+--- a/test/TokenizerTest/CMakeLists.txt	2018-07-20 18:26:02.921494293 +0200
++++ b/test/TokenizerTest/CMakeLists.txt	2018-07-20 18:34:53.727136443 +0200
+@@ -2,10 +2,3 @@
+ TARGET_LINK_LIBRARIES(TokenizerTest ${PODOFO_LIB} ${PODOFO_LIB_DEPENDS})
+ SET_TARGET_PROPERTIES(TokenizerTest PROPERTIES COMPILE_FLAGS "${PODOFO_CFLAGS}")
+ ADD_DEPENDENCIES(TokenizerTest ${PODOFO_DEPEND_TARGET})
+-
+-# Copy the test samples over to the build tree
+-ADD_CUSTOM_COMMAND(
+-    TARGET TokenizerTest
+-    POST_BUILD
+-    COMMAND "${CMAKE_COMMAND}" -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/objects" "${CMAKE_CURRENT_BINARY_DIR}/objects"
+-    )
diff --git a/gnu/packages/patches/poppler-CVE-2018-19149.patch b/gnu/packages/patches/poppler-CVE-2018-19149.patch
new file mode 100644
index 0000000000..3641f5f078
--- /dev/null
+++ b/gnu/packages/patches/poppler-CVE-2018-19149.patch
@@ -0,0 +1,80 @@
+Fix CVE-2018-19149:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-19149
+https://gitlab.freedesktop.org/poppler/poppler/issues/664
+
+Patch copied from upstream source repository:
+
+https://gitlab.freedesktop.org/poppler/poppler/commit/f162ecdea0dda5dbbdb45503c1d55d9afaa41d44
+
+From f162ecdea0dda5dbbdb45503c1d55d9afaa41d44 Mon Sep 17 00:00:00 2001
+From: Marek Kasik <mkasik@redhat.com>
+Date: Fri, 20 Apr 2018 11:38:13 +0200
+Subject: [PATCH] Fix crash on missing embedded file
+
+Check whether an embedded file is actually present in the PDF
+and show warning in that case.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=106137
+https://gitlab.freedesktop.org/poppler/poppler/issues/236
+---
+ glib/poppler-attachment.cc | 26 +++++++++++++++++---------
+ glib/poppler-document.cc   |  3 ++-
+ 2 files changed, 19 insertions(+), 10 deletions(-)
+
+diff --git a/glib/poppler-attachment.cc b/glib/poppler-attachment.cc
+index c6502e9d..11ba5bb5 100644
+--- a/glib/poppler-attachment.cc
++++ b/glib/poppler-attachment.cc
+@@ -111,17 +111,25 @@ _poppler_attachment_new (FileSpec *emb_file)
+     attachment->description = _poppler_goo_string_to_utf8 (emb_file->getDescription ());
+ 
+   embFile = emb_file->getEmbeddedFile();
+-  attachment->size = embFile->size ();
++  if (embFile != NULL && embFile->streamObject()->isStream())
++    {
++      attachment->size = embFile->size ();
+ 
+-  if (embFile->createDate ())
+-    _poppler_convert_pdf_date_to_gtime (embFile->createDate (), (time_t *)&attachment->ctime);
+-  if (embFile->modDate ())
+-    _poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime);
++      if (embFile->createDate ())
++        _poppler_convert_pdf_date_to_gtime (embFile->createDate (), (time_t *)&attachment->ctime);
++      if (embFile->modDate ())
++        _poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime);
+ 
+-  if (embFile->checksum () && embFile->checksum ()->getLength () > 0)
+-    attachment->checksum = g_string_new_len (embFile->checksum ()->getCString (),
+-                                             embFile->checksum ()->getLength ());
+-  priv->obj_stream = embFile->streamObject()->copy();
++      if (embFile->checksum () && embFile->checksum ()->getLength () > 0)
++        attachment->checksum = g_string_new_len (embFile->checksum ()->getCString (),
++                                                 embFile->checksum ()->getLength ());
++      priv->obj_stream = embFile->streamObject()->copy();
++    }
++  else
++    {
++      g_warning ("Missing stream object for embedded file");
++      g_clear_object (&attachment);
++    }
+ 
+   return attachment;
+ }
+diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
+index 83f6aea6..ea319344 100644
+--- a/glib/poppler-document.cc
++++ b/glib/poppler-document.cc
+@@ -670,7 +670,8 @@ poppler_document_get_attachments (PopplerDocument *document)
+       attachment = _poppler_attachment_new (emb_file);
+       delete emb_file;
+ 
+-      retval = g_list_prepend (retval, attachment);
++      if (attachment != NULL)
++        retval = g_list_prepend (retval, attachment);
+     }
+   return g_list_reverse (retval);
+ }
+-- 
+2.19.1
+
diff --git a/gnu/packages/patches/python-CVE-2018-14647.patch b/gnu/packages/patches/python-CVE-2018-14647.patch
new file mode 100644
index 0000000000..24f8d21820
--- /dev/null
+++ b/gnu/packages/patches/python-CVE-2018-14647.patch
@@ -0,0 +1,61 @@
+Fix CVE-2018-14647:
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-14647
+https://bugs.python.org/issue34623
+
+Taken from upstream:
+https://github.com/python/cpython/commit/f7666e828cc3d5873136473ea36ba2013d624fa1
+
+diff --git Include/pyexpat.h Include/pyexpat.h
+index 44259bf6d7..07020b5dc9 100644
+--- Include/pyexpat.h
++++ Include/pyexpat.h
+@@ -3,7 +3,7 @@
+ 
+ /* note: you must import expat.h before importing this module! */
+ 
+-#define PyExpat_CAPI_MAGIC  "pyexpat.expat_CAPI 1.0"
++#define PyExpat_CAPI_MAGIC  "pyexpat.expat_CAPI 1.1"
+ #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
+ 
+ struct PyExpat_CAPI
+@@ -48,6 +48,8 @@ struct PyExpat_CAPI
+     enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding);
+     int (*DefaultUnknownEncodingHandler)(
+         void *encodingHandlerData, const XML_Char *name, XML_Encoding *info);
++    /* might be none for expat < 2.1.0 */
++    int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt);
+     /* always add new stuff to the end! */
+ };
+ 
+diff --git Modules/_elementtree.c Modules/_elementtree.c
+index 707ab2912b..53f05f937f 100644
+--- Modules/_elementtree.c
++++ Modules/_elementtree.c
+@@ -3261,6 +3261,11 @@ _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *html,
+         PyErr_NoMemory();
+         return -1;
+     }
++    /* expat < 2.1.0 has no XML_SetHashSalt() */
++    if (EXPAT(SetHashSalt) != NULL) {
++        EXPAT(SetHashSalt)(self->parser,
++                           (unsigned long)_Py_HashSecret.expat.hashsalt);
++    }
+ 
+     if (target) {
+         Py_INCREF(target);
+diff --git Modules/pyexpat.c Modules/pyexpat.c
+index 47c3e86c20..aa21d93c11 100644
+--- Modules/pyexpat.c
++++ Modules/pyexpat.c
+@@ -1887,6 +1887,11 @@ MODULE_INITFUNC(void)
+     capi.SetStartDoctypeDeclHandler = XML_SetStartDoctypeDeclHandler;
+     capi.SetEncoding = XML_SetEncoding;
+     capi.DefaultUnknownEncodingHandler = PyUnknownEncodingHandler;
++#if XML_COMBINED_VERSION >= 20100
++    capi.SetHashSalt = XML_SetHashSalt;
++#else
++    capi.SetHashSalt = NULL;
++#endif
+ 
+     /* export using capsule */
+     capi_object = PyCapsule_New(&capi, PyExpat_CAPSULE_NAME, NULL);
diff --git a/gnu/packages/patches/python-cffi-x87-stack-clean.patch b/gnu/packages/patches/python-cffi-x87-stack-clean.patch
new file mode 100644
index 0000000000..50243505ee
--- /dev/null
+++ b/gnu/packages/patches/python-cffi-x87-stack-clean.patch
@@ -0,0 +1,29 @@
+Fix test that fails on i686:
+
+https://bitbucket.org/cffi/cffi/issues/382
+
+This is a squashed version of these commits:
+https://bitbucket.org/cffi/cffi/commits/ef09637b2314
+https://bitbucket.org/cffi/cffi/commits/7a76a3815340
+
+diff -r 99940f1f5402 testing/cffi0/test_function.py
+--- a/testing/cffi0/test_function.py	Tue Feb 27 21:18:33 2018 +0100
++++ b/testing/cffi0/test_function.py	Sun Nov 11 16:26:23 2018 +0100
+@@ -45,14 +45,14 @@
+         assert x != math.sin(1.23)    # rounding effects
+         assert abs(x - math.sin(1.23)) < 1E-6
+ 
+-    def test_sin_no_return_value(self):
++    def test_lround_no_return_value(self):
+         # check that 'void'-returning functions work too
+         ffi = FFI(backend=self.Backend())
+         ffi.cdef("""
+-            void sin(double x);
++            void lround(double x);
+         """)
+         m = ffi.dlopen(lib_m)
+-        x = m.sin(1.23)
++        x = m.lround(1.23)
+         assert x is None
+ 
+     def test_dlopen_filename(self):
diff --git a/gnu/packages/patches/python-genshi-add-support-for-python-3.4-AST.patch b/gnu/packages/patches/python-genshi-add-support-for-python-3.4-AST.patch
deleted file mode 100644
index 4e40c1daa1..0000000000
--- a/gnu/packages/patches/python-genshi-add-support-for-python-3.4-AST.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-From 86b98a11559da7d1b21dc9b4c6b10511b9095bc4 Mon Sep 17 00:00:00 2001
-From: Simon Cross <hodgestar@gmail.com>
-Date: Sun, 16 Feb 2014 18:46:15 +0000
-Subject: [PATCH 05/16] Add support for Python 3.4 AST (support for
- NameConstants and changes to existing to arguments node attributes).
-
----
- genshi/template/astutil.py | 31 ++++++++++++++++++++++++++++---
- genshi/template/eval.py    | 34 +++++++++++++++++++---------------
- 2 files changed, 47 insertions(+), 18 deletions(-)
-
-diff --git a/genshi/template/astutil.py b/genshi/template/astutil.py
-index a4c21c8..a3946b4 100644
---- a/genshi/template/astutil.py
-+++ b/genshi/template/astutil.py
-@@ -21,7 +21,7 @@ else:
-     def parse(source, mode):
-         return compile(source, '', mode, _ast.PyCF_ONLY_AST)
- 
--from genshi.compat import IS_PYTHON2
-+from genshi.compat import IS_PYTHON2, isstring
- 
- __docformat__ = 'restructuredtext en'
- 
-@@ -103,8 +103,13 @@ class ASTCodeGenerator(object):
-         self._new_line()
-         return self.visit(node.body)
- 
-+    # Python < 3.4
-     # arguments = (expr* args, identifier? vararg,
-     #              identifier? kwarg, expr* defaults)
-+    #
-+    # Python >= 3.4
-+    # arguments = (arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults,
-+    #              arg? kwarg, expr* defaults)
-     def visit_arguments(self, node):
-         first = True
-         no_default_count = len(node.args) - len(node.defaults)
-@@ -122,13 +127,21 @@ class ASTCodeGenerator(object):
-                 self._write(', ')
-             else:
-                 first = False
--            self._write('*' + node.vararg)
-+            self._write('*')
-+            if isstring(node.vararg):
-+                self._write(node.vararg)
-+            else:
-+                self.visit(node.vararg)
-         if getattr(node, 'kwarg', None):
-             if not first:
-                 self._write(', ')
-             else:
-                 first = False
--            self._write('**' + node.kwarg)
-+            self._write('**')
-+            if isstring(node.kwarg):
-+                self._write(node.kwarg)
-+            else:
-+                self.visit(node.kwarg)
- 
-     if not IS_PYTHON2:
-         # In Python 3 arguments get a special node
-@@ -724,6 +737,17 @@ class ASTCodeGenerator(object):
-     def visit_Name(self, node):
-         self._write(node.id)
- 
-+    # NameConstant(singleton value)
-+    def visit_NameConstant(self, node):
-+        if node.value is None:
-+            self._write('None')
-+        elif node.value is True:
-+            self._write('True')
-+        elif node.value is False:
-+            self._write('False')
-+        else:
-+            raise Exception("Unknown NameConstant %r" % (node.value,))
-+
-     # List(expr* elts, expr_context ctx)
-     def visit_List(self, node):
-         self._write('[')
-@@ -829,6 +853,7 @@ class ASTTransformer(object):
-     visit_Attribute = _clone
-     visit_Subscript = _clone
-     visit_Name = _clone
-+    visit_NameConstant = _clone
-     visit_List = _clone
-     visit_Tuple = _clone
- 
-diff --git a/genshi/template/eval.py b/genshi/template/eval.py
-index 89aec49..de4bc86 100644
---- a/genshi/template/eval.py
-+++ b/genshi/template/eval.py
-@@ -24,7 +24,8 @@ from genshi.template.astutil import ASTTransformer, ASTCodeGenerator, \
- from genshi.template.base import TemplateRuntimeError
- from genshi.util import flatten
- 
--from genshi.compat import get_code_params, build_code_chunk, IS_PYTHON2
-+from genshi.compat import get_code_params, build_code_chunk, isstring, \
-+                          IS_PYTHON2
- 
- __all__ = ['Code', 'Expression', 'Suite', 'LenientLookup', 'StrictLookup',
-            'Undefined', 'UndefinedError']
-@@ -495,28 +496,31 @@ class TemplateASTTransformer(ASTTransformer):
-     def __init__(self):
-         self.locals = [CONSTANTS]
- 
-+    def _process(self, names, node):
-+        if not IS_PYTHON2 and isinstance(node, _ast.arg):
-+            names.add(node.arg)
-+        elif isstring(node):
-+            names.add(node)
-+        elif isinstance(node, _ast.Name):
-+            names.add(node.id)
-+        elif isinstance(node, _ast.alias):
-+            names.add(node.asname or node.name)
-+        elif isinstance(node, _ast.Tuple):
-+            for elt in node.elts:
-+                self._process(names, elt)
-+
-     def _extract_names(self, node):
-         names = set()
--        def _process(node):
--            if not IS_PYTHON2 and isinstance(node, _ast.arg):
--                names.add(node.arg)
--            if isinstance(node, _ast.Name):
--                names.add(node.id)
--            elif isinstance(node, _ast.alias):
--                names.add(node.asname or node.name)
--            elif isinstance(node, _ast.Tuple):
--                for elt in node.elts:
--                    _process(elt)
-         if hasattr(node, 'args'):
-             for arg in node.args:
--                _process(arg)
-+                self._process(names, arg)
-             if hasattr(node, 'vararg'):
--                names.add(node.vararg)
-+                self._process(names, node.vararg)
-             if hasattr(node, 'kwarg'):
--                names.add(node.kwarg)
-+                self._process(names, node.kwarg)
-         elif hasattr(node, 'names'):
-             for elt in node.names:
--                _process(elt)
-+                self._process(names, elt)
-         return names
- 
-     def visit_Str(self, node):
--- 
-2.12.0
-
diff --git a/gnu/packages/patches/python-genshi-buildable-on-python-2.7.patch b/gnu/packages/patches/python-genshi-buildable-on-python-2.7.patch
deleted file mode 100644
index 2bc516c697..0000000000
--- a/gnu/packages/patches/python-genshi-buildable-on-python-2.7.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 32bfaa7cc1c736fd62fcbb6414de9498dc20ed07 Mon Sep 17 00:00:00 2001
-From: Adriano Peluso <catonano@gmail.com>
-Date: Wed, 5 Apr 2017 15:13:06 +0200
-Subject: [PATCH 2/2] buildable on python27 too
-
----
- genshi/template/directives.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/genshi/template/directives.py b/genshi/template/directives.py
-index 6fd0f28..1f70ef6 100644
---- a/genshi/template/directives.py
-+++ b/genshi/template/directives.py
-@@ -266,7 +266,7 @@ class DefDirective(Directive):
-         if isinstance(ast, _ast.Call):
-             self.name = ast.func.id
-             for arg in ast.args:
--                if isinstance(arg, _ast.Starred):
-+                if hasattr(_ast, 'Starred') and isinstance(arg, _ast.Starred):
-                     # Python 3.5+
-                     self.star_args = arg.value.id
-                 else:
--- 
-2.12.0
-
diff --git a/gnu/packages/patches/python-genshi-disable-speedups-on-python-3.3.patch b/gnu/packages/patches/python-genshi-disable-speedups-on-python-3.3.patch
deleted file mode 100644
index c25c3bd7a9..0000000000
--- a/gnu/packages/patches/python-genshi-disable-speedups-on-python-3.3.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From cef2c8df44166195e1705638f9f17033a4943bb7 Mon Sep 17 00:00:00 2001
-From: Simon Cross <hodgestar@gmail.com>
-Date: Sun, 16 Feb 2014 18:32:21 +0000
-Subject: [PATCH 02/15] Disable the speedups C extension on CPython >= 3.3
- since Genshi doesn't support the new Unicode C API yet.
-
----
- setup.py | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/setup.py b/setup.py
-index 123a2cb..a3d748c 100755
---- a/setup.py
-+++ b/setup.py
-@@ -65,9 +65,13 @@ available.""")
- 
- 
- if Feature:
-+    # Optional C extension module for speeding up Genshi:
-+    # Not activated by default on:
-+    # - PyPy (where it harms performance)
-+    # - CPython >= 3.3 (the new Unicode C API is not supported yet)
-     speedups = Feature(
-         "optional C speed-enhancements",
--        standard = not is_pypy,
-+        standard = not is_pypy and sys.version_info < (3, 3),
-         ext_modules = [
-             Extension('genshi._speedups', ['genshi/_speedups.c']),
-         ],
--- 
-2.12.0
-
diff --git a/gnu/packages/patches/python-genshi-fix-tests-on-python-3.5.patch b/gnu/packages/patches/python-genshi-fix-tests-on-python-3.5.patch
deleted file mode 100644
index 05be080cdf..0000000000
--- a/gnu/packages/patches/python-genshi-fix-tests-on-python-3.5.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-From ce796ad4bae5c47011876778674ad036357febdf Mon Sep 17 00:00:00 2001
-From: Adriano Peluso <catonano@gmail.com>
-Date: Wed, 5 Apr 2017 15:10:06 +0200
-Subject: [PATCH 1/2] fixing the tests on python35
-
----
- genshi/filters/i18n.py        |  6 ++++--
- genshi/template/astutil.py    | 14 +++++++++++---
- genshi/template/directives.py | 20 ++++++++++++++------
- genshi/template/eval.py       |  5 +++++
- 4 files changed, 34 insertions(+), 11 deletions(-)
-
-diff --git a/genshi/filters/i18n.py b/genshi/filters/i18n.py
-index 526fda4..5387fcf 100644
---- a/genshi/filters/i18n.py
-+++ b/genshi/filters/i18n.py
-@@ -1194,8 +1194,10 @@ def extract_from_code(code, gettext_functions):
-                 elif arg:
-                     strings.append(None)
-             [_add(arg) for arg in node.args]
--            _add(node.starargs)
--            _add(node.kwargs)
-+            if hasattr(node, 'starargs'):
-+                _add(node.starargs)
-+            if hasattr(node, 'kwargs'):
-+                _add(node.kwargs)
-             if len(strings) == 1:
-                 strings = strings[0]
-             else:
-diff --git a/genshi/template/astutil.py b/genshi/template/astutil.py
-index f4e1edd..e561846 100644
---- a/genshi/template/astutil.py
-+++ b/genshi/template/astutil.py
-@@ -151,6 +151,10 @@ class ASTCodeGenerator(object):
-         def visit_arg(self, node):
-             self._write(node.arg)
- 
-+    def visit_Starred(self, node):
-+        self._write('*')
-+        self.visit(node.value)
-+
-     # FunctionDef(identifier name, arguments args,
-     #                           stmt* body, expr* decorator_list)
-     def visit_FunctionDef(self, node):
-@@ -664,9 +668,13 @@ class ASTCodeGenerator(object):
-             if not first:
-                 self._write(', ')
-             first = False
--            # keyword = (identifier arg, expr value)
--            self._write(keyword.arg)
--            self._write('=')
-+            if not keyword.arg:
-+                # Python 3.5+ star-star args
-+                self._write('**')
-+            else:
-+                # keyword = (identifier arg, expr value)
-+                self._write(keyword.arg)
-+                self._write('=')
-             self.visit(keyword.value)
-         if getattr(node, 'starargs', None):
-             if not first:
-diff --git a/genshi/template/directives.py b/genshi/template/directives.py
-index 7301c2d..6fd0f28 100644
---- a/genshi/template/directives.py
-+++ b/genshi/template/directives.py
-@@ -266,13 +266,21 @@ class DefDirective(Directive):
-         if isinstance(ast, _ast.Call):
-             self.name = ast.func.id
-             for arg in ast.args:
--                # only names
--                self.args.append(arg.id)
-+                if isinstance(arg, _ast.Starred):
-+                    # Python 3.5+
-+                    self.star_args = arg.value.id
-+                else:
-+                    # only names
-+                    self.args.append(arg.id)
-             for kwd in ast.keywords:
--                self.args.append(kwd.arg)
--                exp = Expression(kwd.value, template.filepath,
--                                 lineno, lookup=template.lookup)
--                self.defaults[kwd.arg] = exp
-+                if kwd.arg is None:
-+                    # Python 3.5+
-+                    self.dstar_args = kwd.value.id
-+                else:
-+                    self.args.append(kwd.arg)
-+                    exp = Expression(kwd.value, template.filepath,
-+                                     lineno, lookup=template.lookup)
-+                    self.defaults[kwd.arg] = exp
-             if getattr(ast, 'starargs', None):
-                 self.star_args = ast.starargs.id
-             if getattr(ast, 'kwargs', None):
-diff --git a/genshi/template/eval.py b/genshi/template/eval.py
-index d378419..81644a7 100644
---- a/genshi/template/eval.py
-+++ b/genshi/template/eval.py
-@@ -600,6 +600,11 @@ class TemplateASTTransformer(ASTTransformer):
-         finally:
-             self.locals.pop()
- 
-+    # Only used in Python 3.5+
-+    def visit_Starred(self, node):
-+        node.value = self.visit(node.value)
-+        return node
-+
-     def visit_Name(self, node):
-         # If the name refers to a local inside a lambda, list comprehension, or
-         # generator expression, leave it alone
--- 
-2.12.0
-
diff --git a/gnu/packages/patches/python-genshi-isstring-helper.patch b/gnu/packages/patches/python-genshi-isstring-helper.patch
deleted file mode 100644
index 4f6c19bba9..0000000000
--- a/gnu/packages/patches/python-genshi-isstring-helper.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From cc5e07284f44cdd9beec178c69070a53f55d1323 Mon Sep 17 00:00:00 2001
-From: Simon Cross <hodgestar@gmail.com>
-Date: Sun, 16 Feb 2014 18:43:20 +0000
-Subject: [PATCH 03/15] Add isstring helper.
-
----
- genshi/compat.py | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/genshi/compat.py b/genshi/compat.py
-index 9787325..6574e39 100644
---- a/genshi/compat.py
-+++ b/genshi/compat.py
-@@ -35,6 +35,15 @@ else:
-                 'Python 2 compatibility function. Not usable in Python 3.')
- 
- 
-+# We need to test if an object is an instance of a string type in places
-+
-+if IS_PYTHON2:
-+    def isstring(obj):
-+        return isinstance(obj, basestring)
-+else:
-+    def isstring(obj):
-+        return isinstance(obj, str)
-+
- # We need to differentiate between StringIO and BytesIO in places
- 
- if IS_PYTHON2:
-@@ -112,4 +121,3 @@ except NameError:
-             if not x:
-                 return False
-         return True
--
--- 
-2.12.0
-
diff --git a/gnu/packages/patches/python-genshi-stripping-of-unsafe-script-tags.patch b/gnu/packages/patches/python-genshi-stripping-of-unsafe-script-tags.patch
deleted file mode 100644
index 29951a6149..0000000000
--- a/gnu/packages/patches/python-genshi-stripping-of-unsafe-script-tags.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 0769be04c3891ae5c724c6779ba13d1d0f53b4ae Mon Sep 17 00:00:00 2001
-From: Simon Cross <hodgestar@gmail.com>
-Date: Sun, 16 Feb 2014 18:25:17 +0000
-Subject: [PATCH 01/15] Also allow stripping of unsafe script tags (Python 3.4
- parses the second example as a tag whose name is script&xyz).
-
----
- genshi/filters/tests/test_html.py | 14 ++++++++++----
- 1 file changed, 10 insertions(+), 4 deletions(-)
-
-diff --git a/genshi/filters/tests/test_html.py b/genshi/filters/tests/test_html.py
-index 0c6cfe1..45ec0da 100644
---- a/genshi/filters/tests/test_html.py
-+++ b/genshi/filters/tests/test_html.py
-@@ -368,12 +368,16 @@ def StyleSanitizer():
- 
- class HTMLSanitizerTestCase(unittest.TestCase):
- 
--    def assert_parse_error_or_equal(self, expected, exploit):
-+    def assert_parse_error_or_equal(self, expected, exploit,
-+                                    allow_strip=False):
-         try:
-             html = HTML(exploit)
-         except ParseError:
-             return
--        self.assertEquals(expected, (html | HTMLSanitizer()).render())
-+        sanitized_html = (html | HTMLSanitizer()).render()
-+        if not sanitized_html and allow_strip:
-+            return
-+        self.assertEquals(expected, sanitized_html)
- 
-     def test_sanitize_unchanged(self):
-         html = HTML(u'<a href="#">fo<br />o</a>')
-@@ -416,10 +420,12 @@ class HTMLSanitizerTestCase(unittest.TestCase):
-         html = HTML(u'<SCRIPT SRC="http://example.com/"></SCRIPT>')
-         self.assertEquals('', (html | HTMLSanitizer()).render())
-         src = u'<SCR\0IPT>alert("foo")</SCR\0IPT>'
--        self.assert_parse_error_or_equal('&lt;SCR\x00IPT&gt;alert("foo")', src)
-+        self.assert_parse_error_or_equal('&lt;SCR\x00IPT&gt;alert("foo")', src,
-+                                         allow_strip=True)
-         src = u'<SCRIPT&XYZ SRC="http://example.com/"></SCRIPT>'
-         self.assert_parse_error_or_equal('&lt;SCRIPT&amp;XYZ; '
--                                         'SRC="http://example.com/"&gt;', src)
-+                                         'SRC="http://example.com/"&gt;', src,
-+                                         allow_strip=True)
- 
-     def test_sanitize_remove_onclick_attr(self):
-         html = HTML(u'<div onclick=\'alert("foo")\' />')
--- 
-2.12.0
-
diff --git a/gnu/packages/patches/python-networkx2-reproducible-build.patch b/gnu/packages/patches/python-networkx2-reproducible-build.patch
deleted file mode 100644
index 8274767ab8..0000000000
--- a/gnu/packages/patches/python-networkx2-reproducible-build.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From c065b972ed294769a41936d6b9feb336473af5d1 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?G=C3=A1bor=20Boskovits?= <boskovits@gmail.com>
-Date: Sat, 4 Nov 2017 15:28:47 +0100
-Subject: Fix SOURCE_DATE_EPOCH ignored bug (#2735)
-
-* Fix SOURCE_DATE_EPOCH ignored bug
-
-Fix a bug in networkx/release.py that makes build
-non-reproducible.
----
- networkx/release.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/networkx/release.py b/networkx/release.py
-index e81fc0c0..6322cf0d 100644
---- a/networkx/release.py
-+++ b/networkx/release.py
-@@ -135,7 +135,7 @@ def get_revision():
- 
- def get_info(dynamic=True):
-     # Date information
--    date_info = datetime.datetime.now()
-+    date_info = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
-     date = time.asctime(date_info.timetuple())
- 
-     revision, version, version_info, vcs_info = None, None, None, None
--- 
-2.14.2
-
diff --git a/gnu/packages/patches/python-paste-remove-website-test.patch b/gnu/packages/patches/python-paste-remove-website-test.patch
deleted file mode 100644
index 93417fbe75..0000000000
--- a/gnu/packages/patches/python-paste-remove-website-test.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Remove the test to see if the Python Paste website is up.
-
-Obviously without network access there is no way for us to check this, and
-it's pretty strange to test a project's website when you really mean to test
-the project anyhow...
-
---- a/tests/test_proxy.py	2016-02-22 19:13:04.040117767 -0800
-+++ b/tests/test_proxy.py	2016-02-22 19:13:04.040117767 -0800
-@@ -1,12 +1,3 @@
- from paste import proxy
- from paste.fixture import TestApp
-
--def test_paste_website():
--    # Not the most robust test...
--    # need to test things like POSTing to pages, and getting from pages
--    # that don't set content-length.
--    app = proxy.Proxy('http://pythonpaste.org')
--    app = TestApp(app)
--    res = app.get('/')
--    assert 'documentation' in res
--
diff --git a/gnu/packages/patches/python-pillow-fix-failing-tests.patch b/gnu/packages/patches/python-pillow-fix-failing-tests.patch
deleted file mode 100644
index 2575d6f612..0000000000
--- a/gnu/packages/patches/python-pillow-fix-failing-tests.patch
+++ /dev/null
Binary files differdiff --git a/gnu/packages/patches/python-pygit2-disable-network-tests.patch b/gnu/packages/patches/python-pygit2-disable-network-tests.patch
deleted file mode 100644
index 5578e4c375..0000000000
--- a/gnu/packages/patches/python-pygit2-disable-network-tests.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-Disable tests trying to look up remote servers.
-
-diff --git a/test/test_credentials.py b/test/test_credentials.py
---- a/test/test_credentials.py
-+++ b/test/test_credentials.py
-@@ -68,6 +68,7 @@ class CredentialCreateTest(utils.NoRepoTestCase):
-         self.assertEqual((username, None, None, None), cred.credential_tuple)
- 
- 
-+@unittest.skipIf(True, "network tests are not supported in Guix")
- class CredentialCallback(utils.RepoTestCase):
-     def test_callback(self):
-         class MyCallbacks(pygit2.RemoteCallbacks):
-@@ -92,6 +93,7 @@ class CredentialCallback(utils.RepoTestCase):
-         remote = self.repo.create_remote("github", url)
-         self.assertRaises(TypeError, lambda: remote.fetch(callbacks=MyCallbacks()))
- 
-+@unittest.skipIf(True, "network tests are not supported in Guix")
- class CallableCredentialTest(utils.RepoTestCase):
- 
-     def test_user_pass(self):
-diff --git a/test/test_repository.py b/test/test_repository.py
---- a/test/test_repository.py
-+++ b/test/test_repository.py
-@@ -573,6 +573,7 @@ class CloneRepositoryTest(utils.NoRepoTestCase):
-         self.assertTrue('refs/remotes/custom_remote/master' in repo.listall_references())
-         self.assertIsNotNone(repo.remotes["custom_remote"])
- 
-+    @unittest.skipIf(True, "network tests are not supported in Guix")
-     def test_clone_with_credentials(self):
-         repo = clone_repository(
-             "https://bitbucket.org/libgit2/testgitrepository.git",
-diff --git a/test/test_submodule.py b/test/test_submodule.py
---- a/test/test_submodule.py
-+++ b/test/test_submodule.py
-@@ -42,6 +42,7 @@ SUBM_PATH = 'submodule'
- SUBM_URL = 'https://github.com/libgit2/pygit2'
- SUBM_HEAD_SHA = '819cbff552e46ac4b8d10925cc422a30aa04e78e'
- 
-+@unittest.skipIf(True, "network tests are not supported in Guix")
- class SubmoduleTest(utils.SubmoduleRepoTestCase):
- 
-     def test_lookup_submodule(self):
diff --git a/gnu/packages/patches/python-scikit-learn-fix-test-non-determinism.patch b/gnu/packages/patches/python-scikit-learn-fix-test-non-determinism.patch
deleted file mode 100644
index 90328cc0eb..0000000000
--- a/gnu/packages/patches/python-scikit-learn-fix-test-non-determinism.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-This patch stops a test sometimes failing because of non-determinism.  See
-https://github.com/scikit-learn/scikit-learn/pull/9542
-
-From ff9f6db6e8b59c2b3528c8137ed4054f57c1d7c4 Mon Sep 17 00:00:00 2001
-From: Hanmin Qin <qinhanmin2005@sina.com>
-Date: Sun, 13 Aug 2017 22:13:49 +0800
-Subject: [PATCH] add random_state
-
----
- sklearn/tests/test_kernel_ridge.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sklearn/tests/test_kernel_ridge.py b/sklearn/tests/test_kernel_ridge.py
-index 4750a096ac6..979875870b6 100644
---- a/sklearn/tests/test_kernel_ridge.py
-+++ b/sklearn/tests/test_kernel_ridge.py
-@@ -10,7 +10,7 @@
- from sklearn.utils.testing import assert_array_almost_equal
- 
- 
--X, y = make_regression(n_features=10)
-+X, y = make_regression(n_features=10, random_state=0)
- Xcsr = sp.csr_matrix(X)
- Xcsc = sp.csc_matrix(X)
- Y = np.array([y, y]).T
diff --git a/gnu/packages/patches/python-testtools.patch b/gnu/packages/patches/python-testtools.patch
new file mode 100644
index 0000000000..42536e50f9
--- /dev/null
+++ b/gnu/packages/patches/python-testtools.patch
@@ -0,0 +1,57 @@
+https://github.com/testing-cabal/testtools/commit/29004731f9c480b7c44a9c2605513d50d372898f.patch
+Should be fixed in the next release
+
+From 29004731f9c480b7c44a9c2605513d50d372898f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Thu, 17 May 2018 17:52:26 +0200
+Subject: [PATCH] Fix the tests on Python 3.7
+
+Exception's repr got changed not to include trailing comma
+
+Fixes https://github.com/testing-cabal/testtools/issues/270
+---
+ .travis.yml                                |  1 +
+ testtools/tests/matchers/test_exception.py | 11 +++++++++--
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/.travis.yml b/.travis.yml
+index 7f1f4db7..784608e0 100644
+--- a/.travis.yml
++++ b/.travis.yml
+@@ -5,6 +5,7 @@ python:
+   - "3.4"
+   - "3.5"
+   - "3.6"
++  - "3.7-dev"
+   - "pypy"
+ 
+ install:
+diff --git a/testtools/tests/matchers/test_exception.py b/testtools/tests/matchers/test_exception.py
+index 6cd80af1..acd39252 100644
+--- a/testtools/tests/matchers/test_exception.py
++++ b/testtools/tests/matchers/test_exception.py
+@@ -32,15 +32,22 @@ class TestMatchesExceptionInstanceInterface(TestCase, TestMatchersInterface):
+     matches_matches = [error_foo]
+     matches_mismatches = [error_bar, error_base_foo]
+ 
++    if sys.version_info >= (3, 7):
++        # exception's repr has changed
++        _e = ''
++    else:
++        _e = ','
++
+     str_examples = [
+-        ("MatchesException(Exception('foo',))",
++        ("MatchesException(Exception('foo'%s))" % _e,
+          MatchesException(Exception('foo')))
+         ]
+     describe_examples = [
+         ("%r is not a %r" % (Exception, ValueError),
+          error_base_foo,
+          MatchesException(ValueError("foo"))),
+-        ("ValueError('bar',) has different arguments to ValueError('foo',).",
++        ("ValueError('bar'%s) has different arguments to ValueError('foo'%s)."
++         % (_e, _e),
+          error_bar,
+          MatchesException(ValueError("foo"))),
+         ]
diff --git a/gnu/packages/patches/python2-CVE-2018-1000802.patch b/gnu/packages/patches/python2-CVE-2018-1000802.patch
new file mode 100644
index 0000000000..0d5bc77c84
--- /dev/null
+++ b/gnu/packages/patches/python2-CVE-2018-1000802.patch
@@ -0,0 +1,47 @@
+Fix CVE-2018-1000802:
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-1000802
+
+Taken from upstream commit (sans NEWS):
+https://github.com/python/cpython/commit/d8b103b8b3ef9644805341216963a64098642435
+
+diff --git a/Lib/shutil.py b/Lib/shutil.py
+index 3462f7c5e9..0ab1a06f52 100644
+--- a/Lib/shutil.py
++++ b/Lib/shutil.py
+@@ -413,17 +413,21 @@ def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
+ 
+     return archive_name
+ 
+-def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):
++def _call_external_zip(base_dir, zip_filename, verbose, dry_run, logger):
+     # XXX see if we want to keep an external call here
+     if verbose:
+         zipoptions = "-r"
+     else:
+         zipoptions = "-rq"
+-    from distutils.errors import DistutilsExecError
+-    from distutils.spawn import spawn
++    cmd = ["zip", zipoptions, zip_filename, base_dir]
++    if logger is not None:
++        logger.info(' '.join(cmd))
++    if dry_run:
++        return
++    import subprocess
+     try:
+-        spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run)
+-    except DistutilsExecError:
++        subprocess.check_call(cmd)
++    except subprocess.CalledProcessError:
+         # XXX really should distinguish between "couldn't find
+         # external 'zip' command" and "zip failed".
+         raise ExecError, \
+@@ -458,7 +462,7 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None):
+         zipfile = None
+ 
+     if zipfile is None:
+-        _call_external_zip(base_dir, zip_filename, verbose, dry_run)
++        _call_external_zip(base_dir, zip_filename, verbose, dry_run, logger)
+     else:
+         if logger is not None:
+             logger.info("creating '%s' and adding '%s' to it",
diff --git a/gnu/packages/patches/python2-CVE-2018-14647.patch b/gnu/packages/patches/python2-CVE-2018-14647.patch
new file mode 100644
index 0000000000..6226b06aca
--- /dev/null
+++ b/gnu/packages/patches/python2-CVE-2018-14647.patch
@@ -0,0 +1,61 @@
+Fix CVE-2018-14647:
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-14647
+https://bugs.python.org/issue34623
+
+Taken from upstream:
+https://github.com/python/cpython/commit/18b20bad75b4ff0486940fba4ec680e96e70f3a2
+
+diff --git a/Include/pyexpat.h b/Include/pyexpat.h
+index 5340ef5fa3..3fc5fa54da 100644
+--- a/Include/pyexpat.h
++++ b/Include/pyexpat.h
+@@ -3,7 +3,7 @@
+ 
+ /* note: you must import expat.h before importing this module! */
+ 
+-#define PyExpat_CAPI_MAGIC  "pyexpat.expat_CAPI 1.0"
++#define PyExpat_CAPI_MAGIC  "pyexpat.expat_CAPI 1.1"
+ #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
+ 
+ struct PyExpat_CAPI 
+@@ -43,6 +43,8 @@ struct PyExpat_CAPI
+         XML_Parser parser, XML_UnknownEncodingHandler handler,
+         void *encodingHandlerData);
+     void (*SetUserData)(XML_Parser parser, void *userData);
++    /* might be none for expat < 2.1.0 */
++    int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt);
+     /* always add new stuff to the end! */
+ };
+ 
+diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
+index f7f992dd3a..b38e0ab329 100644
+--- a/Modules/_elementtree.c
++++ b/Modules/_elementtree.c
+@@ -2574,6 +2574,11 @@ xmlparser(PyObject* self_, PyObject* args, PyObject* kw)
+         PyErr_NoMemory();
+         return NULL;
+     }
++    /* expat < 2.1.0 has no XML_SetHashSalt() */
++    if (EXPAT(SetHashSalt) != NULL) {
++        EXPAT(SetHashSalt)(self->parser,
++                           (unsigned long)_Py_HashSecret.prefix);
++    }
+ 
+     ALLOC(sizeof(XMLParserObject), "create expatparser");
+ 
+diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
+index 2b4d31293c..1f8c0d70a5 100644
+--- a/Modules/pyexpat.c
++++ b/Modules/pyexpat.c
+@@ -2042,6 +2042,11 @@ MODULE_INITFUNC(void)
+     capi.SetProcessingInstructionHandler = XML_SetProcessingInstructionHandler;
+     capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;
+     capi.SetUserData = XML_SetUserData;
++#if XML_COMBINED_VERSION >= 20100
++    capi.SetHashSalt = XML_SetHashSalt;
++#else
++    capi.SetHashSalt = NULL;
++#endif
+ 
+     /* export using capsule */
+     capi_object = PyCapsule_New(&capi, PyExpat_CAPSULE_NAME, NULL);
diff --git a/gnu/packages/patches/qt-5-renameat2.patch b/gnu/packages/patches/qt-5-renameat2.patch
new file mode 100644
index 0000000000..036070c7ff
--- /dev/null
+++ b/gnu/packages/patches/qt-5-renameat2.patch
@@ -0,0 +1,35 @@
+Avoid conflicting declaration of 'renameat2' on glibc 2.28
+(see <https://github.com/meta-qt5/meta-qt5/issues/94>.)
+
+Patch from <https://github.com/meta-qt5/meta-qt5/pull/95>
+by Andreas Müller <schnitzeltony@gmail.com>.
+
+---
+ src/corelib/io/qfilesystemengine_unix.cpp | 11 ++++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
+index be6ce48d0cb..1bf1bebc7f1 100644
+--- a/qtbase/src/corelib/io/qfilesystemengine_unix.cpp
++++ b/qtbase/src/corelib/io/qfilesystemengine_unix.cpp
+@@ -98,6 +98,17 @@ extern "C" NSString *NSTemporaryDirectory();
+ #  define FICLONE       _IOW(0x94, 9, int)
+ #endif
+ 
++// renameat2/statx features for non bootstrapped build
++#ifndef QT_BOOTSTRAPPED
++#ifdef __GLIBC_PREREQ
++# define QT_FEATURE_renameat2 (__GLIBC_PREREQ(2, 28) ? 1 : -1)
++# define QT_FEATURE_statx (__GLIBC_PREREQ(2, 28) ? 1 : -1)
++#else
++# define QT_FEATURE_renameat2 -1
++# define QT_FEATURE_statx -1
++#endif
++#endif
++
+ #  if defined(Q_OS_ANDROID)
+ // renameat2() and statx() are disabled on Android because quite a few systems
+ // come with sandboxes that kill applications that make system calls outside a
+-- 
+2.14.4
+
diff --git a/gnu/packages/patches/quilt-compat-getopt-fix-option-with-nondigit-param.patch b/gnu/packages/patches/quilt-compat-getopt-fix-option-with-nondigit-param.patch
new file mode 100644
index 0000000000..6bbec67e75
--- /dev/null
+++ b/gnu/packages/patches/quilt-compat-getopt-fix-option-with-nondigit-param.patch
@@ -0,0 +1,45 @@
+From: Jean Delvare <jdelvare@suse.de>
+Subject: compat/getopt: Allow non-digit parameter embedded in short option
+
+The compatibility getopt script allows only digit parameters to be
+embedded in short options. Util-linux's getopt implementation does
+not have such a restriction and allows any parameter to be embedded
+in short options. As a consequence, using the compatibility getopt
+script would choke for example on "-pab", which is a legal option
+of the "quilt refresh" command.
+
+Remove the limitation on digits so that the compatibility getopt
+script allows what util-linux allows. This fixes the second half
+of bug #54772:
+https://savannah.nongnu.org/bugs/index.php?54772
+
+As a side note, this feature of the compatibility script was broken
+anyway, as it would output the digits in reverse order.
+
+Signed-off-by: Jean Delvare <jdelvare@suse.de>
+---
+ compat/getopt.in |   13 ++++---------
+ 1 file changed, 4 insertions(+), 9 deletions(-)
+
+--- quilt.orig/compat/getopt.in	2018-10-03 16:05:56.818667040 +0200
++++ quilt/compat/getopt.in	2018-10-03 16:12:17.624841732 +0200
+@@ -108,15 +108,10 @@ foreach my $word (@words) {
+ 				if (scalar(@letters) == 0) {
+ 					$need_param = $letter;
+ 				} else {
+-					# short options can have numerical args
+-					# embedded in the short option list: -UO
+-					die "unexpected character after option $letter"
+-						if ($letters[$#letters] !~ /[0-9]/);
+-					my @digits;
+-					while (scalar(@letters) && ($letters[$#letters] =~ /[0-9]/)) {
+-						push @digits, pop @letters;
+-					}
+-					push @options, quote_word(join('', reverse @digits));
++					# short options can have args
++					# embedded in the short option list
++					push @options, quote_word(join('', reverse @letters));
++					@letters = ();
+ 				}
+ 			}
+ 		}
diff --git a/gnu/packages/patches/quilt-compat-getopt-fix-second-separator.patch b/gnu/packages/patches/quilt-compat-getopt-fix-second-separator.patch
new file mode 100644
index 0000000000..cde2c8d41c
--- /dev/null
+++ b/gnu/packages/patches/quilt-compat-getopt-fix-second-separator.patch
@@ -0,0 +1,58 @@
+From: Jean Delvare <jdelvare@suse.de>
+Subject: compat/getopt: Handle a second separator
+
+getopt can be passed 2 '--' separators. The first one tells that
+getopt options are over and target program options start. The second
+one tells that the target program's options are over and following
+arguments should be treated as non-options even if they look like
+options.
+
+This second separator was not handled, causing the compatibility
+getopt script to treat the following arguments as options, eventually
+failing one way or another.
+
+Properly detect and handle the second separator. This fixes the first
+half of bug #54772:
+https://savannah.nongnu.org/bugs/index.php?54772
+
+Signed-off-by: Jean Delvare <jdelvare@suse.de>
+---
+ compat/getopt.in |   13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+--- quilt.orig/compat/getopt.in	2018-10-03 15:23:21.147620172 +0200
++++ quilt/compat/getopt.in	2018-10-03 16:05:56.818667040 +0200
+@@ -8,12 +8,12 @@
+ 
+ use strict;
+ 
+-my $opts;
++my $opts = '';
+ my @words;
+ my $found_sep = 0;
+ 
+ foreach my $arg (@ARGV) {
+-  if ($arg eq '--') {
++  if (!$found_sep && $arg eq '--') {
+     $found_sep = 1;
+   }
+   else {
+@@ -62,10 +62,17 @@ sub quote_word
+ 	return "'$word'";
+ }
+ 
++# there can be a second separator, to inhibit processing following arguments
++# as options
++$found_sep = 0;
+ foreach my $word (@words) {
++	if ($word eq '--') {
++		$found_sep = 1;
++		next;
++	}
+ 
+ 	# allow '-' to be an option value
+-	if (!$need_param && $word !~ /^-./) {
++	if ($found_sep || (!$need_param && $word !~ /^-./)) {
+ 		push @barewords, quote_word($word);
+ 		next;
+ 	}
diff --git a/gnu/packages/patches/quilt-test-fix-regex.patch b/gnu/packages/patches/quilt-test-fix-regex.patch
new file mode 100644
index 0000000000..2e249ac55b
--- /dev/null
+++ b/gnu/packages/patches/quilt-test-fix-regex.patch
@@ -0,0 +1,41 @@
+From 5193b137b5a9034ce79946edd40760df2f63a82a Mon Sep 17 00:00:00 2001
+From: Jean Delvare <jdelvare@suse.de>
+Date: Tue, 25 Apr 2017 15:17:53 +0200
+Subject: test: Escape curly braces in regex
+
+Curly braces in perl regex are supposed to be escaped, recent
+versions of perl complain when they aren't:
+
+Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE (\w+)}/ at ./run line 114.
+Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/%{ <-- HERE \?}/ at ./run line 290.
+
+Signed-off-by: Jean Delvare <jdelvare@suse.de>
+---
+ test/run | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/test/run b/test/run
+index 942014e..03afc7a 100755
+--- a/test/run
++++ b/test/run
+@@ -112,7 +112,7 @@ sub flush_output()
+ sub substitute_vars($)
+ {
+ 	my ($line) = @_;
+-	$line =~ s[%{(\w+)}][defined $ENV{$1} ? $ENV{$1} : ""]eg;
++	$line =~ s[%\{(\w+)\}][defined $ENV{$1} ? $ENV{$1} : ""]eg;
+ 	return $line;
+ }
+ 
+@@ -288,7 +288,7 @@ while (defined(my $line = <SOURCE>)) {
+ 	# Parse the next command
+ 	if ($line =~ s/^\s*\$ ?//) {
+ 		# Substitute %{?} with the last command's status
+-		$line =~ s[%{\?}][$last_status]eg;
++		$line =~ s[%\{\?\}][$last_status]eg;
+ 
+ 		chomp($prog = substitute_vars($line));
+ 		$prog_line = $lineno;
+-- 
+cgit v1.0-41-gc330
+
diff --git a/gnu/packages/patches/randomjungle-disable-static-build.patch b/gnu/packages/patches/randomjungle-disable-static-build.patch
new file mode 100644
index 0000000000..3de6c269fd
--- /dev/null
+++ b/gnu/packages/patches/randomjungle-disable-static-build.patch
@@ -0,0 +1,14 @@
+Drop build time dependency on the static executables.
+
+--- a/src/Makefile.in	2018-11-25 20:27:10.691508925 +0100
++++ b/src/Makefile.in	2018-11-25 20:27:43.565631413 +0100
+@@ -34,8 +34,7 @@
+ POST_UNINSTALL = :
+ build_triplet = @build@
+ host_triplet = @host@
+-bin_PROGRAMS = rjungle$(EXEEXT) rjungle_static$(EXEEXT) \
+-	rjunglesparse$(EXEEXT) rjunglesparse_static$(EXEEXT)
++bin_PROGRAMS = rjungle$(EXEEXT) rjunglesparse$(EXEEXT)
+ subdir = src
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
diff --git a/gnu/packages/patches/rsem-makefile.patch b/gnu/packages/patches/rsem-makefile.patch
deleted file mode 100644
index 5481dc685f..0000000000
--- a/gnu/packages/patches/rsem-makefile.patch
+++ /dev/null
@@ -1,682 +0,0 @@
-This patch simplifies the Makefile, making it much easier to build rsem
-without the bundled version of samtools.  It has already been submitted
-upstream: https://github.com/bli25wisc/RSEM/pull/11
-
-From 161894e91a16c7e15af57e4fcfe8cb613711c7fa Mon Sep 17 00:00:00 2001
-From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
-Date: Wed, 22 Apr 2015 14:51:07 +0200
-Subject: [PATCH 1/7] remove all headers from Makefile
-
----
- Makefile | 95 +++++++++++-----------------------------------------------------
- 1 file changed, 16 insertions(+), 79 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 54e2603..3a55ed8 100644
---- a/Makefile
-+++ b/Makefile
-@@ -10,133 +10,70 @@ all : $(PROGRAMS)
- sam/libbam.a :
- 	cd sam ; ${MAKE} all
- 
--Transcript.h : utils.h
--
--Transcripts.h : utils.h my_assert.h Transcript.h
--
--rsem-extract-reference-transcripts : utils.h my_assert.h GTFItem.h Transcript.h Transcripts.h extractRef.cpp
-+rsem-extract-reference-transcripts : extractRef.cpp
- 	$(CC) -Wall -O3 extractRef.cpp -o rsem-extract-reference-transcripts
- 
--rsem-synthesis-reference-transcripts : utils.h my_assert.h Transcript.h Transcripts.h synthesisRef.cpp
-+rsem-synthesis-reference-transcripts : synthesisRef.cpp
- 	$(CC) -Wall -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
- 
--BowtieRefSeqPolicy.h : RefSeqPolicy.h
--
--RefSeq.h : utils.h
--
--Refs.h : utils.h RefSeq.h RefSeqPolicy.h PolyARules.h
--
--
- rsem-preref : preRef.o
- 	$(CC) preRef.o -o rsem-preref
- 
--preRef.o : utils.h RefSeq.h Refs.h PolyARules.h RefSeqPolicy.h AlignerRefSeqPolicy.h preRef.cpp
-+preRef.o : preRef.cpp
- 	$(CC) $(COFLAGS) preRef.cpp
- 
--
--SingleRead.h : Read.h
--
--SingleReadQ.h : Read.h
--
--PairedEndRead.h : Read.h SingleRead.h
--
--PairedEndReadQ.h : Read.h SingleReadQ.h
--
--
--PairedEndHit.h : SingleHit.h
--
--HitContainer.h : GroupInfo.h
--
--
--SamParser.h : sam/sam.h sam/bam.h utils.h my_assert.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h SingleHit.h PairedEndHit.h Transcripts.h
--
--
- rsem-parse-alignments : parseIt.o sam/libbam.a
- 	$(CC) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread 
- 
--parseIt.o : utils.h GroupInfo.h Read.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h SingleHit.h PairedEndHit.h HitContainer.h SamParser.h Transcripts.h sam/sam.h sam/bam.h parseIt.cpp
-+parseIt.o : parseIt.cpp
- 	$(CC) -Wall -O2 -c -I. parseIt.cpp
- 
--
--rsem-build-read-index : utils.h buildReadIndex.cpp
-+rsem-build-read-index : buildReadIndex.cpp
- 	$(CC) -O3 buildReadIndex.cpp -o rsem-build-read-index
- 
--
--simul.h : boost/random.hpp
--
--ReadReader.h : SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h ReadIndex.h
--
--SingleModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h Profile.h NoiseProfile.h ModelParams.h RefSeq.h Refs.h SingleRead.h SingleHit.h ReadReader.h simul.h
--
--SingleQModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h ModelParams.h RefSeq.h Refs.h SingleReadQ.h SingleHit.h ReadReader.h simul.h
--
--PairedEndModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h Profile.h NoiseProfile.h ModelParams.h RefSeq.h Refs.h SingleRead.h PairedEndRead.h PairedEndHit.h ReadReader.h simul.h 
--
--PairedEndQModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h ModelParams.h RefSeq.h Refs.h SingleReadQ.h PairedEndReadQ.h PairedEndHit.h ReadReader.h simul.h
--
--HitWrapper.h : HitContainer.h
--
--sam_rsem_aux.h : sam/bam.h
--
--sam_rsem_cvt.h : sam/bam.h Transcript.h Transcripts.h
--
--BamWriter.h : sam/sam.h sam/bam.h sam_rsem_aux.h sam_rsem_cvt.h SingleHit.h PairedEndHit.h HitWrapper.h Transcript.h Transcripts.h
--
--sampling.h : boost/random.hpp
--
--WriteResults.h : utils.h my_assert.h GroupInfo.h Transcript.h Transcripts.h RefSeq.h Refs.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h
--
- rsem-run-em : EM.o sam/libbam.a
- 	$(CC) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
- 
--EM.o : utils.h my_assert.h Read.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h SingleHit.h PairedEndHit.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h Refs.h GroupInfo.h HitContainer.h ReadIndex.h ReadReader.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h ModelParams.h RefSeq.h RefSeqPolicy.h PolyARules.h Profile.h NoiseProfile.h Transcript.h Transcripts.h HitWrapper.h BamWriter.h sam/bam.h sam/sam.h simul.h sam_rsem_aux.h sampling.h boost/random.hpp WriteResults.h EM.cpp
-+EM.o : EM.cpp
- 	$(CC) $(COFLAGS) EM.cpp
- 
--bc_aux.h : sam/bam.h
--
--BamConverter.h : utils.h my_assert.h sam/sam.h sam/bam.h sam_rsem_aux.h sam_rsem_cvt.h bc_aux.h Transcript.h Transcripts.h
--
--rsem-tbam2gbam : utils.h Transcripts.h Transcript.h bc_aux.h BamConverter.h sam/sam.h sam/bam.h sam/libbam.a sam_rsem_aux.h sam_rsem_cvt.h tbam2gbam.cpp sam/libbam.a
-+rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
- 	$(CC) -O3 -Wall tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
- 
--rsem-bam2wig : utils.h my_assert.h wiggle.h wiggle.o sam/libbam.a bam2wig.cpp
-+rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
- 	$(CC) -O3 -Wall bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
- 
--rsem-bam2readdepth : utils.h my_assert.h wiggle.h wiggle.o sam/libbam.a bam2readdepth.cpp
-+rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
- 	$(CC) -O3 -Wall bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
- 
--wiggle.o: sam/bam.h sam/sam.h wiggle.cpp wiggle.h
-+wiggle.o: wiggle.cpp
- 	$(CC) $(COFLAGS) wiggle.cpp
- 
- rsem-simulate-reads : simulation.o
- 	$(CC) -o rsem-simulate-reads simulation.o
- 
--simulation.o : utils.h Read.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h Refs.h RefSeq.h GroupInfo.h Transcript.h Transcripts.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h Profile.h NoiseProfile.h simul.h boost/random.hpp WriteResults.h simulation.cpp
-+simulation.o : simulation.cpp
- 	$(CC) $(COFLAGS) simulation.cpp
- 
- rsem-run-gibbs : Gibbs.o
- 	$(CC) -o rsem-run-gibbs Gibbs.o -lpthread
- 
--#some header files are omitted
--Gibbs.o : utils.h my_assert.h boost/random.hpp sampling.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h RefSeq.h RefSeqPolicy.h PolyARules.h Refs.h GroupInfo.h WriteResults.h Gibbs.cpp 
-+Gibbs.o : Gibbs.cpp
- 	$(CC) $(COFLAGS) Gibbs.cpp
- 
--Buffer.h : my_assert.h
--
- rsem-calculate-credibility-intervals : calcCI.o
- 	$(CC) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
- 
--#some header files are omitted
--calcCI.o : utils.h my_assert.h boost/random.hpp sampling.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h RefSeq.h RefSeqPolicy.h PolyARules.h Refs.h GroupInfo.h WriteResults.h Buffer.h calcCI.cpp
-+calcCI.o : calcCI.cpp
- 	$(CC) $(COFLAGS) calcCI.cpp
- 
--rsem-get-unique : sam/bam.h sam/sam.h getUnique.cpp sam/libbam.a
-+rsem-get-unique : getUnique.cpp sam/libbam.a
- 	$(CC) -O3 -Wall getUnique.cpp sam/libbam.a -lz -lpthread -o $@
- 
--rsem-sam-validator : sam/bam.h sam/sam.h my_assert.h samValidator.cpp sam/libbam.a
-+rsem-sam-validator : samValidator.cpp sam/libbam.a
- 	$(CC) -O3 -Wall samValidator.cpp sam/libbam.a -lz -lpthread -o $@
- 
--rsem-scan-for-paired-end-reads : sam/bam.h sam/sam.h my_assert.h scanForPairedEndReads.cpp sam/libbam.a
-+rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
- 	$(CC) -O3 -Wall scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
- 
- ebseq :
-
-From ec136638a727632e20abfaeb65c22c46d15ca8c4 Mon Sep 17 00:00:00 2001
-From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
-Date: Wed, 22 Apr 2015 15:06:41 +0200
-Subject: [PATCH 2/7] include current dir, ./sam and ./boost by default
-
----
- Makefile | 48 ++++++++++++++++++++++++------------------------
- 1 file changed, 24 insertions(+), 24 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 3a55ed8..1dd97ca 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,6 +1,6 @@
- CC = g++
--CFLAGS = -Wall -c -I.
--COFLAGS = -Wall -O3 -ffast-math -c -I.
-+CFLAGS = -Wall -I. -I./sam -I./boost
-+COFLAGS = -O3 -ffast-math -c
- PROGRAMS = rsem-extract-reference-transcripts rsem-synthesis-reference-transcripts rsem-preref rsem-parse-alignments rsem-build-read-index rsem-run-em rsem-tbam2gbam rsem-run-gibbs rsem-calculate-credibility-intervals rsem-simulate-reads rsem-bam2wig rsem-get-unique rsem-bam2readdepth rsem-sam-validator rsem-scan-for-paired-end-reads
- 
- .PHONY : all ebseq clean
-@@ -11,70 +11,70 @@ sam/libbam.a :
- 	cd sam ; ${MAKE} all
- 
- rsem-extract-reference-transcripts : extractRef.cpp
--	$(CC) -Wall -O3 extractRef.cpp -o rsem-extract-reference-transcripts
-+	$(CC) $(CFLAGS) -O3 extractRef.cpp -o rsem-extract-reference-transcripts
- 
- rsem-synthesis-reference-transcripts : synthesisRef.cpp
--	$(CC) -Wall -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
-+	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
- 
- rsem-preref : preRef.o
--	$(CC) preRef.o -o rsem-preref
-+	$(CC) $(CFLAGS) preRef.o -o rsem-preref
- 
- preRef.o : preRef.cpp
--	$(CC) $(COFLAGS) preRef.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
- 
- rsem-parse-alignments : parseIt.o sam/libbam.a
--	$(CC) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread 
-+	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread
- 
- parseIt.o : parseIt.cpp
--	$(CC) -Wall -O2 -c -I. parseIt.cpp
-+	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
- 
- rsem-build-read-index : buildReadIndex.cpp
--	$(CC) -O3 buildReadIndex.cpp -o rsem-build-read-index
-+	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
- 
- rsem-run-em : EM.o sam/libbam.a
--	$(CC) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
-+	$(CC) $(CFLAGS) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
- 
- EM.o : EM.cpp
--	$(CC) $(COFLAGS) EM.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
- 
- rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
--	$(CC) -O3 -Wall tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
- 
- rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
--	$(CC) -O3 -Wall bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
- 
- rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
--	$(CC) -O3 -Wall bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
- 
- wiggle.o: wiggle.cpp
--	$(CC) $(COFLAGS) wiggle.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
- 
- rsem-simulate-reads : simulation.o
--	$(CC) -o rsem-simulate-reads simulation.o
-+	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
- 
- simulation.o : simulation.cpp
--	$(CC) $(COFLAGS) simulation.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
- 
- rsem-run-gibbs : Gibbs.o
--	$(CC) -o rsem-run-gibbs Gibbs.o -lpthread
-+	$(CC) $(CFLAGS) -o rsem-run-gibbs Gibbs.o -lpthread
- 
- Gibbs.o : Gibbs.cpp
--	$(CC) $(COFLAGS) Gibbs.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
- 
- rsem-calculate-credibility-intervals : calcCI.o
--	$(CC) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
-+	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
- 
- calcCI.o : calcCI.cpp
--	$(CC) $(COFLAGS) calcCI.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
- 
- rsem-get-unique : getUnique.cpp sam/libbam.a
--	$(CC) -O3 -Wall getUnique.cpp sam/libbam.a -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 getUnique.cpp sam/libbam.a -lz -lpthread -o $@
- 
- rsem-sam-validator : samValidator.cpp sam/libbam.a
--	$(CC) -O3 -Wall samValidator.cpp sam/libbam.a -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 samValidator.cpp sam/libbam.a -lz -lpthread -o $@
- 
- rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
--	$(CC) -O3 -Wall scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
- 
- ebseq :
- 	cd EBSeq ; ${MAKE} all
-
-From d366614ea50f79fdd93e3c76383ccb6fcdeaa8e0 Mon Sep 17 00:00:00 2001
-From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
-Date: Wed, 22 Apr 2015 15:10:49 +0200
-Subject: [PATCH 3/7] separate object rules from rules for executables
-
----
- Makefile | 50 ++++++++++++++++++++++++++------------------------
- 1 file changed, 26 insertions(+), 24 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 1dd97ca..ae4de3b 100644
---- a/Makefile
-+++ b/Makefile
-@@ -10,6 +10,32 @@ all : $(PROGRAMS)
- sam/libbam.a :
- 	cd sam ; ${MAKE} all
- 
-+ebseq :
-+	cd EBSeq ; ${MAKE} all
-+
-+
-+calcCI.o : calcCI.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
-+
-+EM.o : EM.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
-+
-+Gibbs.o : Gibbs.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
-+
-+preRef.o : preRef.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
-+
-+parseIt.o : parseIt.cpp
-+	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
-+
-+simulation.o : simulation.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
-+
-+wiggle.o: wiggle.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
-+
-+
- rsem-extract-reference-transcripts : extractRef.cpp
- 	$(CC) $(CFLAGS) -O3 extractRef.cpp -o rsem-extract-reference-transcripts
- 
-@@ -19,24 +45,15 @@ rsem-synthesis-reference-transcripts : synthesisRef.cpp
- rsem-preref : preRef.o
- 	$(CC) $(CFLAGS) preRef.o -o rsem-preref
- 
--preRef.o : preRef.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
--
- rsem-parse-alignments : parseIt.o sam/libbam.a
- 	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread
- 
--parseIt.o : parseIt.cpp
--	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
--
- rsem-build-read-index : buildReadIndex.cpp
- 	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
- 
- rsem-run-em : EM.o sam/libbam.a
- 	$(CC) $(CFLAGS) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
- 
--EM.o : EM.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
--
- rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
- 	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
- 
-@@ -46,27 +63,15 @@ rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
- rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
- 	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
- 
--wiggle.o: wiggle.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
--
- rsem-simulate-reads : simulation.o
- 	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
- 
--simulation.o : simulation.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
--
- rsem-run-gibbs : Gibbs.o
- 	$(CC) $(CFLAGS) -o rsem-run-gibbs Gibbs.o -lpthread
- 
--Gibbs.o : Gibbs.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
--
- rsem-calculate-credibility-intervals : calcCI.o
- 	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
- 
--calcCI.o : calcCI.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
--
- rsem-get-unique : getUnique.cpp sam/libbam.a
- 	$(CC) $(CFLAGS) -O3 getUnique.cpp sam/libbam.a -lz -lpthread -o $@
- 
-@@ -76,9 +81,6 @@ rsem-sam-validator : samValidator.cpp sam/libbam.a
- rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
- 	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
- 
--ebseq :
--	cd EBSeq ; ${MAKE} all
--
- clean :
- 	rm -f *.o *~ $(PROGRAMS)
- 	cd sam ; ${MAKE} clean
-
-From 6ba1c33cccdf7c8e7df7a3189e7db204be3b1e8d Mon Sep 17 00:00:00 2001
-From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
-Date: Wed, 22 Apr 2015 15:28:30 +0200
-Subject: [PATCH 4/7] add ./sam to library directories, link with -lbam
-
----
- Makefile | 36 ++++++++++++++++++------------------
- 1 file changed, 18 insertions(+), 18 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index ae4de3b..a87cc4d 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,11 +1,11 @@
- CC = g++
--CFLAGS = -Wall -I. -I./sam -I./boost
-+CFLAGS = -Wall -I. -I./sam -I./boost -L./sam
- COFLAGS = -O3 -ffast-math -c
- PROGRAMS = rsem-extract-reference-transcripts rsem-synthesis-reference-transcripts rsem-preref rsem-parse-alignments rsem-build-read-index rsem-run-em rsem-tbam2gbam rsem-run-gibbs rsem-calculate-credibility-intervals rsem-simulate-reads rsem-bam2wig rsem-get-unique rsem-bam2readdepth rsem-sam-validator rsem-scan-for-paired-end-reads
- 
- .PHONY : all ebseq clean
- 
--all : $(PROGRAMS)
-+all : sam/libbam.a $(PROGRAMS)
- 
- sam/libbam.a :
- 	cd sam ; ${MAKE} all
-@@ -45,23 +45,23 @@ rsem-synthesis-reference-transcripts : synthesisRef.cpp
- rsem-preref : preRef.o
- 	$(CC) $(CFLAGS) preRef.o -o rsem-preref
- 
--rsem-parse-alignments : parseIt.o sam/libbam.a
--	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread
-+rsem-parse-alignments : parseIt.o
-+	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o -lbam -lz -lpthread
- 
- rsem-build-read-index : buildReadIndex.cpp
- 	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
- 
--rsem-run-em : EM.o sam/libbam.a
--	$(CC) $(CFLAGS) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
-+rsem-run-em : EM.o
-+	$(CC) $(CFLAGS) -o rsem-run-em EM.o -lbam -lz -lpthread
- 
--rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
--	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
-+rsem-tbam2gbam : tbam2gbam.cpp
-+	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp -lbam -lz -lpthread -o $@
- 
--rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
--	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
-+rsem-bam2wig : wiggle.o bam2wig.cpp
-+	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o -lbam -lz -lpthread -o $@
- 
--rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
--	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
-+rsem-bam2readdepth : wiggle.o bam2readdepth.cpp
-+	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o -lbam -lz -lpthread -o $@
- 
- rsem-simulate-reads : simulation.o
- 	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
-@@ -72,14 +72,14 @@ rsem-run-gibbs : Gibbs.o
- rsem-calculate-credibility-intervals : calcCI.o
- 	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
- 
--rsem-get-unique : getUnique.cpp sam/libbam.a
--	$(CC) $(CFLAGS) -O3 getUnique.cpp sam/libbam.a -lz -lpthread -o $@
-+rsem-get-unique : getUnique.cpp
-+	$(CC) $(CFLAGS) -O3 getUnique.cpp -lbam -lz -lpthread -o $@
- 
--rsem-sam-validator : samValidator.cpp sam/libbam.a
--	$(CC) $(CFLAGS) -O3 samValidator.cpp sam/libbam.a -lz -lpthread -o $@
-+rsem-sam-validator : samValidator.cpp
-+	$(CC) $(CFLAGS) -O3 samValidator.cpp -lbam -lz -lpthread -o $@
- 
--rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
--	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
-+rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp
-+	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp -lbam -lz -lpthread -o $@
- 
- clean :
- 	rm -f *.o *~ $(PROGRAMS)
-
-From 5402b88c269df79ee245c1c59e15f3c8282a0220 Mon Sep 17 00:00:00 2001
-From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
-Date: Wed, 22 Apr 2015 15:33:02 +0200
-Subject: [PATCH 5/7] do not repeat target name, use $@ instead
-
----
- Makefile | 18 +++++++++---------
- 1 file changed, 9 insertions(+), 9 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index a87cc4d..7ec90a3 100644
---- a/Makefile
-+++ b/Makefile
-@@ -37,22 +37,22 @@ wiggle.o: wiggle.cpp
- 
- 
- rsem-extract-reference-transcripts : extractRef.cpp
--	$(CC) $(CFLAGS) -O3 extractRef.cpp -o rsem-extract-reference-transcripts
-+	$(CC) $(CFLAGS) -O3 extractRef.cpp -o $@
- 
- rsem-synthesis-reference-transcripts : synthesisRef.cpp
--	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
-+	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o $@
- 
- rsem-preref : preRef.o
--	$(CC) $(CFLAGS) preRef.o -o rsem-preref
-+	$(CC) $(CFLAGS) preRef.o -o $@
- 
- rsem-parse-alignments : parseIt.o
--	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o -lbam -lz -lpthread
-+	$(CC) $(CFLAGS) -o $@ parseIt.o -lbam -lz -lpthread
- 
- rsem-build-read-index : buildReadIndex.cpp
--	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
-+	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o $@
- 
- rsem-run-em : EM.o
--	$(CC) $(CFLAGS) -o rsem-run-em EM.o -lbam -lz -lpthread
-+	$(CC) $(CFLAGS) -o $@ EM.o -lbam -lz -lpthread
- 
- rsem-tbam2gbam : tbam2gbam.cpp
- 	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp -lbam -lz -lpthread -o $@
-@@ -64,13 +64,13 @@ rsem-bam2readdepth : wiggle.o bam2readdepth.cpp
- 	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o -lbam -lz -lpthread -o $@
- 
- rsem-simulate-reads : simulation.o
--	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
-+	$(CC) $(CFLAGS) -o $@ simulation.o
- 
- rsem-run-gibbs : Gibbs.o
--	$(CC) $(CFLAGS) -o rsem-run-gibbs Gibbs.o -lpthread
-+	$(CC) $(CFLAGS) -o $@ Gibbs.o -lpthread
- 
- rsem-calculate-credibility-intervals : calcCI.o
--	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
-+	$(CC) $(CFLAGS) -o $@ calcCI.o -lpthread
- 
- rsem-get-unique : getUnique.cpp
- 	$(CC) $(CFLAGS) -O3 getUnique.cpp -lbam -lz -lpthread -o $@
-
-From f60784bc7aa303cc825bd87dd3f5d7d26c51bded Mon Sep 17 00:00:00 2001
-From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
-Date: Wed, 22 Apr 2015 15:44:53 +0200
-Subject: [PATCH 6/7] use automatic variables to refer to prerequisites
-
----
- Makefile | 44 ++++++++++++++++++++++----------------------
- 1 file changed, 22 insertions(+), 22 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index 7ec90a3..6540d81 100644
---- a/Makefile
-+++ b/Makefile
-@@ -15,71 +15,71 @@ ebseq :
- 
- 
- calcCI.o : calcCI.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) $<
- 
- EM.o : EM.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) $<
- 
- Gibbs.o : Gibbs.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) $<
- 
- preRef.o : preRef.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) $<
- 
- parseIt.o : parseIt.cpp
--	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
-+	$(CC) $(CFLAGS) -O2 -c $<
- 
- simulation.o : simulation.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) $<
- 
- wiggle.o: wiggle.cpp
--	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
-+	$(CC) $(CFLAGS) $(COFLAGS) $<
- 
- 
- rsem-extract-reference-transcripts : extractRef.cpp
--	$(CC) $(CFLAGS) -O3 extractRef.cpp -o $@
-+	$(CC) $(CFLAGS) -O3 $< -o $@
- 
- rsem-synthesis-reference-transcripts : synthesisRef.cpp
--	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o $@
-+	$(CC) $(CFLAGS) -O3 $< -o $@
- 
- rsem-preref : preRef.o
--	$(CC) $(CFLAGS) preRef.o -o $@
-+	$(CC) $(CFLAGS) $< -o $@
- 
- rsem-parse-alignments : parseIt.o
--	$(CC) $(CFLAGS) -o $@ parseIt.o -lbam -lz -lpthread
-+	$(CC) $(CFLAGS) -o $@ $< -lbam -lz -lpthread
- 
- rsem-build-read-index : buildReadIndex.cpp
--	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o $@
-+	$(CC) $(CFLAGS) -O3 $< -o $@
- 
- rsem-run-em : EM.o
--	$(CC) $(CFLAGS) -o $@ EM.o -lbam -lz -lpthread
-+	$(CC) $(CFLAGS) -o $@ $< -lbam -lz -lpthread
- 
- rsem-tbam2gbam : tbam2gbam.cpp
--	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp -lbam -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
- 
- rsem-bam2wig : wiggle.o bam2wig.cpp
--	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o -lbam -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 $^ -lbam -lz -lpthread -o $@
- 
- rsem-bam2readdepth : wiggle.o bam2readdepth.cpp
--	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o -lbam -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 $^ -lbam -lz -lpthread -o $@
- 
- rsem-simulate-reads : simulation.o
--	$(CC) $(CFLAGS) -o $@ simulation.o
-+	$(CC) $(CFLAGS) -o $@ $<
- 
- rsem-run-gibbs : Gibbs.o
--	$(CC) $(CFLAGS) -o $@ Gibbs.o -lpthread
-+	$(CC) $(CFLAGS) -o $@ $< -lpthread
- 
- rsem-calculate-credibility-intervals : calcCI.o
--	$(CC) $(CFLAGS) -o $@ calcCI.o -lpthread
-+	$(CC) $(CFLAGS) -o $@ $< -lpthread
- 
- rsem-get-unique : getUnique.cpp
--	$(CC) $(CFLAGS) -O3 getUnique.cpp -lbam -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
- 
- rsem-sam-validator : samValidator.cpp
--	$(CC) $(CFLAGS) -O3 samValidator.cpp -lbam -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
- 
- rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp
--	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp -lbam -lz -lpthread -o $@
-+	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
- 
- clean :
- 	rm -f *.o *~ $(PROGRAMS)
-
-From 0cf9721077f67fb4ca15fdc59cbfbf24a944debd Mon Sep 17 00:00:00 2001
-From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
-Date: Wed, 22 Apr 2015 15:49:19 +0200
-Subject: [PATCH 7/7] split long line
-
----
- Makefile | 17 ++++++++++++++++-
- 1 file changed, 16 insertions(+), 1 deletion(-)
-
-diff --git a/Makefile b/Makefile
-index 6540d81..0ab04a5 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,7 +1,22 @@
- CC = g++
- CFLAGS = -Wall -I. -I./sam -I./boost -L./sam
- COFLAGS = -O3 -ffast-math -c
--PROGRAMS = rsem-extract-reference-transcripts rsem-synthesis-reference-transcripts rsem-preref rsem-parse-alignments rsem-build-read-index rsem-run-em rsem-tbam2gbam rsem-run-gibbs rsem-calculate-credibility-intervals rsem-simulate-reads rsem-bam2wig rsem-get-unique rsem-bam2readdepth rsem-sam-validator rsem-scan-for-paired-end-reads
-+PROGRAMS = \
-+  rsem-extract-reference-transcripts \
-+  rsem-synthesis-reference-transcripts \
-+  rsem-preref \
-+  rsem-parse-alignments \
-+  rsem-build-read-index \
-+  rsem-run-em \
-+  rsem-tbam2gbam \
-+  rsem-run-gibbs \
-+  rsem-calculate-credibility-intervals \
-+  rsem-simulate-reads \
-+  rsem-bam2wig \
-+  rsem-get-unique \
-+  rsem-bam2readdepth \
-+  rsem-sam-validator \
-+  rsem-scan-for-paired-end-reads
- 
- .PHONY : all ebseq clean
- 
diff --git a/gnu/packages/patches/rust-1.19-mrustc.patch b/gnu/packages/patches/rust-1.19-mrustc.patch
new file mode 100644
index 0000000000..261162172e
--- /dev/null
+++ b/gnu/packages/patches/rust-1.19-mrustc.patch
@@ -0,0 +1,28 @@
+See https://github.com/thepowersgang/mrustc/archive/v0.8.0.tar.gz
+
+--- rustc-1.19.0-src-orig/src/libcore/intrinsics.rs
++++ rustc-1.19.0-src/src/libcore/intrinsics.rs
+@@ -678,5 +678,9 @@
+     pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;
+ 
++    /// Obtain the length of a slice pointer
++    #[cfg(rust_compiler="mrustc")]
++    pub fn mrustc_slice_len<T>(pointer: *const [T]) -> usize;
++
+     /// Gets a static string slice containing the name of a type.
+     pub fn type_name<T: ?Sized>() -> &'static str;
+
+--- rustc-1.19.0-src-orig/src/libcore/slice/mod.rs
++++ rustc-1.19.0-src/src/libcore/slice/mod.rs
+@@ -413,6 +413,8 @@
+     #[inline]
+     fn len(&self) -> usize {
+-        unsafe {
+-            mem::transmute::<&[T], Repr<T>>(self).len
+-        }
++        #[cfg(not(rust_compiler="mrustc"))]
++        let rv = unsafe { mem::transmute::<&[T], Repr<T>>(self).len };
++        #[cfg(rust_compiler="mrustc")]
++        let rv = unsafe { ::intrinsics::mrustc_slice_len(self) };
++        rv
+     }
diff --git a/gnu/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch b/gnu/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch
new file mode 100644
index 0000000000..a2bad55117
--- /dev/null
+++ b/gnu/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch
@@ -0,0 +1,111 @@
+GDB responds with some overly detailed lines - which makes the tests fail.
+Patch rust to accept those instead.
+See <https://github.com/rust-lang/rust/issues/54178>.
+diff -ur orig/rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs
+--- orig/rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs	2018-09-13 10:24:33.775565159 +0200
++++ rustc-1.25.0-src/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs	2018-09-13 10:25:56.322513658 +0200
+@@ -19,36 +19,36 @@
+ 
+ // gdb-command:print eight_bytes1
+ // gdbg-check:$1 = {{RUST$ENUM$DISR = Variant1, __0 = 100}, {RUST$ENUM$DISR = Variant1, __0 = 100}}
+-// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum::Variant1(100)
++// gdbr-check:$1 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant1(100)
+ 
+ // gdb-command:print four_bytes1
+ // gdbg-check:$2 = {{RUST$ENUM$DISR = Variant1, __0 = 101}, {RUST$ENUM$DISR = Variant1, __0 = 101}}
+-// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum::Variant1(101)
++// gdbr-check:$2 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant1(101)
+ 
+ // gdb-command:print two_bytes1
+ // gdbg-check:$3 = {{RUST$ENUM$DISR = Variant1, __0 = 102}, {RUST$ENUM$DISR = Variant1, __0 = 102}}
+-// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum::Variant1(102)
++// gdbr-check:$3 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant1(102)
+ 
+ // gdb-command:print one_byte1
+ // gdbg-check:$4 = {{RUST$ENUM$DISR = Variant1, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant1, __0 = 65 'A'}}
+-// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum::Variant1(65)
++// gdbr-check:$4 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant1(65)
+ 
+ 
+ // gdb-command:print eight_bytes2
+ // gdbg-check:$5 = {{RUST$ENUM$DISR = Variant2, __0 = 100}, {RUST$ENUM$DISR = Variant2, __0 = 100}}
+-// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum::Variant2(100)
++// gdbr-check:$5 = generic_enum_with_different_disr_sizes::Enum<f64>::Variant2(100)
+ 
+ // gdb-command:print four_bytes2
+ // gdbg-check:$6 = {{RUST$ENUM$DISR = Variant2, __0 = 101}, {RUST$ENUM$DISR = Variant2, __0 = 101}}
+-// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum::Variant2(101)
++// gdbr-check:$6 = generic_enum_with_different_disr_sizes::Enum<i32>::Variant2(101)
+ 
+ // gdb-command:print two_bytes2
+ // gdbg-check:$7 = {{RUST$ENUM$DISR = Variant2, __0 = 102}, {RUST$ENUM$DISR = Variant2, __0 = 102}}
+-// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum::Variant2(102)
++// gdbr-check:$7 = generic_enum_with_different_disr_sizes::Enum<i16>::Variant2(102)
+ 
+ // gdb-command:print one_byte2
+ // gdbg-check:$8 = {{RUST$ENUM$DISR = Variant2, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant2, __0 = 65 'A'}}
+-// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum::Variant2(65)
++// gdbr-check:$8 = generic_enum_with_different_disr_sizes::Enum<u8>::Variant2(65)
+ 
+ // gdb-command:continue
+ 
+diff -ur orig/rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs
+--- orig/rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs	2018-09-13 10:24:33.775565159 +0200
++++ rustc-1.25.0-src/src/test/debuginfo/generic-struct-style-enum.rs	2018-09-13 10:27:43.353108111 +0200
+@@ -19,15 +19,15 @@
+ 
+ // gdb-command:print case1
+ // gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, a = 0, b = 31868, c = 31868, d = 31868, e = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
+-// gdbr-check:$1 = generic_struct_style_enum::Regular::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
++// gdbr-check:$1 = generic_struct_style_enum::Regular<u16, u32, i64>::Case1{a: 0, b: 31868, c: 31868, d: 31868, e: 31868}
+ 
+ // gdb-command:print case2
+ // gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, a = 0, b = 286331153, c = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
+-// gdbr-check:$2 = generic_struct_style_enum::Regular::Case2{a: 0, b: 286331153, c: 286331153}
++// gdbr-check:$2 = generic_struct_style_enum::Regular<i16, u32, i64>::Case2{a: 0, b: 286331153, c: 286331153}
+ 
+ // gdb-command:print case3
+ // gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, a = 0, b = 6438275382588823897}}
+-// gdbr-check:$3 = generic_struct_style_enum::Regular::Case3{a: 0, b: 6438275382588823897}
++// gdbr-check:$3 = generic_struct_style_enum::Regular<u16, i32, u64>::Case3{a: 0, b: 6438275382588823897}
+ 
+ // gdb-command:print univariant
+ // gdbg-check:$4 = {{a = -1}}
+diff -ur orig/rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs
+--- orig/rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs	2018-09-13 10:24:33.775565159 +0200
++++ rustc-1.25.0-src/src/test/debuginfo/generic-tuple-style-enum.rs	2018-09-13 10:28:26.328546298 +0200
+@@ -21,15 +21,15 @@
+ 
+ // gdb-command:print case1
+ // gdbg-check:$1 = {{RUST$ENUM$DISR = Case1, __0 = 0, __1 = 31868, __2 = 31868, __3 = 31868, __4 = 31868}, {RUST$ENUM$DISR = Case1, [...]}, {RUST$ENUM$DISR = Case1, [...]}}
+-// gdbr-check:$1 = generic_tuple_style_enum::Regular::Case1(0, 31868, 31868, 31868, 31868)
++// gdbr-check:$1 = generic_tuple_style_enum::Regular<u16, u32, u64>::Case1(0, 31868, 31868, 31868, 31868)
+ 
+ // gdb-command:print case2
+ // gdbg-check:$2 = {{RUST$ENUM$DISR = Case2, [...]}, {RUST$ENUM$DISR = Case2, __0 = 0, __1 = 286331153, __2 = 286331153}, {RUST$ENUM$DISR = Case2, [...]}}
+-// gdbr-check:$2 = generic_tuple_style_enum::Regular::Case2(0, 286331153, 286331153)
++// gdbr-check:$2 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case2(0, 286331153, 286331153)
+ 
+ // gdb-command:print case3
+ // gdbg-check:$3 = {{RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, [...]}, {RUST$ENUM$DISR = Case3, __0 = 0, __1 = 6438275382588823897}}
+-// gdbr-check:$3 = generic_tuple_style_enum::Regular::Case3(0, 6438275382588823897)
++// gdbr-check:$3 = generic_tuple_style_enum::Regular<i16, i32, i64>::Case3(0, 6438275382588823897)
+ 
+ // gdb-command:print univariant
+ // gdbg-check:$4 = {{__0 = -1}}
+--- orig/rustc-1.25.0-src/src/test/debuginfo/nil-enum.rs	2018-09-13 10:24:33.783565071 +0200
++++ rustc-1.25.0-src/src/test/debuginfo/nil-enum.rs	2018-10-26 18:19:20.404564587 +0200
+@@ -17,11 +17,11 @@
+ 
+ // gdb-command:print first
+ // gdbg-check:$1 = {<No data fields>}
+-// gdbr-check:$1 = <error reading variable>
++// gdbr-check:$1 = nil_enum::ANilEnum
+ 
+ // gdb-command:print second
+ // gdbg-check:$2 = {<No data fields>}
+-// gdbr-check:$2 = <error reading variable>
++// gdbr-check:$2 = nil_enum::AnotherNilEnum
+ 
+ #![allow(unused_variables)]
+ #![feature(omit_gdb_pretty_printer_section)]
diff --git a/gnu/packages/patches/rust-reproducible-builds.patch b/gnu/packages/patches/rust-reproducible-builds.patch
new file mode 100644
index 0000000000..ef7bf53b5d
--- /dev/null
+++ b/gnu/packages/patches/rust-reproducible-builds.patch
@@ -0,0 +1,25 @@
+From b9ca108fcae2b738ca3f0c88c84ae5dc5a6f843f Mon Sep 17 00:00:00 2001
+From: Tim Ryan <id@timryan.org>
+Date: Mon, 14 May 2018 06:22:21 -0400
+Subject: [PATCH] Support reproducible builds by forcing window.search to use
+ stable key ordering. (#692)
+See <https://github.com/rust-lang-nursery/mdBook/pull/692>
+---
+ src/vendor/mdbook/src/renderer/html_handlebars/search.rs | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/vendor/mdbook/src/renderer/html_handlebars/search.rs b/src/vendor/mdbook/src/renderer/html_handlebars/search.rs
+index d49772f8b..1ee66a511 100644
+--- a/src/vendor/mdbook/src/renderer/html_handlebars/search.rs
++++ b/src/vendor/mdbook/src/renderer/html_handlebars/search.rs
+@@ -205,6 +205,10 @@ fn write_to_js(index: Index, search_config: &Search) -> Result<String> {
+         searchoptions,
+         index,
+     };
++
++    // By converting to serde_json::Value as an intermediary, we use a
++    // BTreeMap internally and can force a stable ordering of map keys.
++    let json_contents = serde_json::to_value(&json_contents)?;
+     let json_contents = serde_json::to_string(&json_contents)?;
+ 
+     Ok(format!("window.search = {};", json_contents))
diff --git a/gnu/packages/patches/scribus-poppler.patch b/gnu/packages/patches/scribus-poppler.patch
new file mode 100644
index 0000000000..9b969e4cb6
--- /dev/null
+++ b/gnu/packages/patches/scribus-poppler.patch
@@ -0,0 +1,72 @@
+Fix build with recent Poppler.
+
+From d867ec3c386baaed1b8e076dd70b278863411480 Mon Sep 17 00:00:00 2001
+From: Jean Ghali <jghali@libertysurf.fr>
+Date: Mon, 30 Apr 2018 09:19:33 +0000
+Subject: [PATCH] =?UTF-8?q?#15289:=20FTBFS=201.5.4=20with=20error:=20inval?=
+ =?UTF-8?q?id=20conversion=20from=20=E2=80=98const=20GooString*=E2=80=99?=
+ =?UTF-8?q?=20to=20=E2=80=98GooString*=E2=80=99?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+git-svn-id: svn://scribus.net/trunk/Scribus@22498 11d20701-8431-0410-a711-e3c959e3b870
+---
+ scribus/plugins/import/pdf/importpdf.cpp | 2 +-
+ scribus/plugins/import/pdf/importpdf.h   | 2 +-
+ scribus/plugins/import/pdf/slaoutput.cpp | 2 +-
+ scribus/plugins/import/pdf/slaoutput.h   | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
+index c1802861aa..d4c5a9ba49 100644
+--- a/scribus/plugins/import/pdf/importpdf.cpp
++++ b/scribus/plugins/import/pdf/importpdf.cpp
+@@ -1081,7 +1081,7 @@ QRectF PdfPlug::getCBox(int box, int pgNum)
+ 	return cRect;

+ }

+ 

+-QString PdfPlug::UnicodeParsedString(GooString *s1)

++QString PdfPlug::UnicodeParsedString(const GooString *s1)

+ {

+ 	if ( !s1 || s1->getLength() == 0 )

+ 		return QString();

+diff --git a/scribus/plugins/import/pdf/importpdf.h b/scribus/plugins/import/pdf/importpdf.h
+index c8c5efcd0d..5249562692 100644
+--- a/scribus/plugins/import/pdf/importpdf.h
++++ b/scribus/plugins/import/pdf/importpdf.h
+@@ -81,7 +81,7 @@ class PdfPlug : public QObject
+ private:
+ 	bool convert(const QString& fn);
+ 	QRectF getCBox(int box, int pgNum);
+-	QString UnicodeParsedString(GooString *s1);
++	QString UnicodeParsedString(const GooString *s1);
+ 	
+ 	QList<PageItem*> Elements;
+ 	double baseX, baseY;
+diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
+index be1815dc29..17b6357246 100644
+--- a/scribus/plugins/import/pdf/slaoutput.cpp
++++ b/scribus/plugins/import/pdf/slaoutput.cpp
+@@ -4252,7 +4252,7 @@ void SlaOutputDev::pushGroup(QString maskName, GBool forSoftMask, GBool alpha, b
+ 	m_groupStack.push(gElements);

+ }

+ 

+-QString SlaOutputDev::UnicodeParsedString(GooString *s1)

++QString SlaOutputDev::UnicodeParsedString(const GooString *s1)

+ {

+ 	if ( !s1 || s1->getLength() == 0 )

+ 		return QString();

+diff --git a/scribus/plugins/import/pdf/slaoutput.h b/scribus/plugins/import/pdf/slaoutput.h
+index 20e8b2d311..6698c030e0 100644
+--- a/scribus/plugins/import/pdf/slaoutput.h
++++ b/scribus/plugins/import/pdf/slaoutput.h
+@@ -266,7 +266,7 @@ class SlaOutputDev : public OutputDev
+ 	int getBlendMode(GfxState *state);
+ 	void applyMask(PageItem *ite);
+ 	void pushGroup(QString maskName = "", GBool forSoftMask = gFalse, GBool alpha = gFalse, bool inverted = false);
+-	QString UnicodeParsedString(GooString *s1);
++	QString UnicodeParsedString(const GooString *s1);
+ 	bool checkClip();
+ 	bool pathIsClosed;
+ 	QString CurrColorFill;
diff --git a/gnu/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch b/gnu/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch
new file mode 100644
index 0000000000..561763dabe
--- /dev/null
+++ b/gnu/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch
@@ -0,0 +1,36 @@
+From: Tobias Geerinckx-Rice <me@tobias.gr>
+Date: Sun, 26 Aug 2018 17:24:42 +0200
+Subject: [PATCH] snappy: Add O2 flag in CmakeLists.txt.
+
+Use ‘-O2’ optimisation when building with CMake, as is already done when
+using the Makefile. This patch was copied verbatim from the Snappy
+mailing list[0].
+
+[0]: <snappy-compression@googlegroups.com>
+
+From 903c72fb29b2db07b4abc38a5feb83d88f739d80 Mon Sep 17 00:00:00 2001
+From: huangwenjun <huangwenjun-hf@loongson.cn>
+Date: Fri, 10 Aug 2018 17:17:35 +0800
+Subject: [PATCH] Add O2 optimize flag in CmakeLists.txt.
+
+---
+ CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 62ecd09..29e0cdc 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,9 @@ set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+ set(CMAKE_CXX_EXTENSIONS OFF)
+ 
++SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
++SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
++
+ # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
+ # it prominent in the GUI.
+ option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)
+-- 
+2.1.0
+
diff --git a/gnu/packages/patches/soundconverter-remove-gconf-dependency.patch b/gnu/packages/patches/soundconverter-remove-gconf-dependency.patch
new file mode 100644
index 0000000000..f065b9a3d4
--- /dev/null
+++ b/gnu/packages/patches/soundconverter-remove-gconf-dependency.patch
@@ -0,0 +1,83 @@
+From: Sebastian Ramacher <sebastian@ramacher.at>
+Date: Fri, 6 Apr 2018 13:25:35 +0200
+Subject: Only fetch profiles if GConf is still available
+
+---
+ bin/soundconverter.py       |  1 -
+ soundconverter/gstreamer.py | 44 ++++++++++++++++++++++++--------------------
+ 2 files changed, 24 insertions(+), 21 deletions(-)
+
+diff --git a/bin/soundconverter.py b/bin/soundconverter.py
+index 39055ce..5198443 100644
+--- a/bin/soundconverter.py
++++ b/bin/soundconverter.py
+@@ -66,7 +66,6 @@ def _check_libs():
+         import gi
+         gi.require_version('Gst', '1.0')
+         gi.require_version('Gtk', '3.0')
+-        gi.require_version('GConf', '2.0')
+         from gi.repository import GObject
+         # force GIL creation - see https://bugzilla.gnome.org/show_bug.cgi?id=710447
+         import threading
+diff --git a/soundconverter/gstreamer.py b/soundconverter/gstreamer.py
+index 23aaa9b..211b052 100644
+--- a/soundconverter/gstreamer.py
++++ b/soundconverter/gstreamer.py
+@@ -25,7 +25,7 @@ from urllib.parse import urlparse
+ from gettext import gettext as _
+ 
+ import gi
+-from gi.repository import Gst, Gtk, GObject, GConf, Gio
++from gi.repository import Gst, Gtk, GObject, Gio
+ 
+ from soundconverter.fileoperations import vfs_encode_filename, file_encode_filename
+ from soundconverter.fileoperations import unquote_filename, vfs_makedirs, vfs_unlink
+@@ -66,25 +66,29 @@ _GCONF_PROFILE_LIST_PATH = "/system/gstreamer/1.0/audio/global/profile_list"
+ audio_profiles_list = []
+ audio_profiles_dict = {}
+ 
+-_GCONF = GConf.Client.get_default()
+-profiles = _GCONF.all_dirs(_GCONF_PROFILE_LIST_PATH)
+-for name in profiles:
+-    if _GCONF.get_bool(_GCONF_PROFILE_PATH + name + "/active"):
+-        # get profile
+-        description = _GCONF.get_string(_GCONF_PROFILE_PATH + name + "/name")
+-        extension = _GCONF.get_string(_GCONF_PROFILE_PATH + name + "/extension")
+-        pipeline = _GCONF.get_string(_GCONF_PROFILE_PATH + name + "/pipeline")
+-        # check profile validity
+-        if not extension or not pipeline:
+-            continue
+-        if not description:
+-            description = extension
+-        if description in audio_profiles_dict:
+-            continue
+-            # store
+-        profile = description, extension, pipeline
+-        audio_profiles_list.append(profile)
+-        audio_profiles_dict[description] = profile
++try:
++    from gi.repository import GConf
++    _GCONF = GConf.Client.get_default()
++    profiles = _GCONF.all_dirs(_GCONF_PROFILE_LIST_PATH)
++    for name in profiles:
++        if _GCONF.get_bool(_GCONF_PROFILE_PATH + name + "/active"):
++            # get profile
++            description = _GCONF.get_string(_GCONF_PROFILE_PATH + name + "/name")
++            extension = _GCONF.get_string(_GCONF_PROFILE_PATH + name + "/extension")
++            pipeline = _GCONF.get_string(_GCONF_PROFILE_PATH + name + "/pipeline")
++            # check profile validity
++            if not extension or not pipeline:
++                continue
++            if not description:
++                description = extension
++            if description in audio_profiles_dict:
++                continue
++                # store
++            profile = description, extension, pipeline
++            audio_profiles_list.append(profile)
++            audio_profiles_dict[description] = profile
++except ImportError:
++    pass
+ 
+ required_elements = ('decodebin', 'fakesink', 'audioconvert', 'typefind', 'audiorate')
+ for element in required_elements:
diff --git a/gnu/packages/patches/swig-guile-gc.patch b/gnu/packages/patches/swig-guile-gc.patch
new file mode 100644
index 0000000000..0e745a6247
--- /dev/null
+++ b/gnu/packages/patches/swig-guile-gc.patch
@@ -0,0 +1,76 @@
+Fix garbage collection for Guile versions >= 2.0.12.  This issue showed
+up when running the tests on i686-linux.
+
+Taken from this upstream commit:
+https://github.com/swig/swig/commit/38f2ab0c30e369e63bbd0a6152108488d0de68e1
+
+diff --git a/Lib/guile/guile_scm_run.swg b/Lib/guile/guile_scm_run.swg
+index 274f197158..0d04cb7c62 100644
+--- a/Lib/guile/guile_scm_run.swg
++++ b/Lib/guile/guile_scm_run.swg
+@@ -99,6 +99,7 @@ SWIG_Guile_scm2newstr(SCM str, size_t *len) {
+ static int swig_initialized = 0;
+ static scm_t_bits swig_tag = 0;
+ static scm_t_bits swig_collectable_tag = 0;
++static scm_t_bits swig_finalized_tag = 0;
+ static scm_t_bits swig_destroyed_tag = 0;
+ static scm_t_bits swig_member_function_tag = 0;
+ static SCM swig_make_func = SCM_EOL;
+@@ -163,7 +164,19 @@ SWIG_Guile_PointerType(SCM object)
+   }
+   else scm_wrong_type_arg("SWIG-Guile-PointerType", 1, object);
+ }
+-  
++
++SWIGINTERN int
++SWIG_Guile_IsValidSmob(SCM smob)
++{
++  /* We do not accept smobs representing destroyed pointers, but we have to
++     allow finalized smobs because Guile >= 2.0.12 sets all smob instances
++     to the 'finalized' type before calling their 'free' function. This change
++     was introduced to Guile in commit 8dff3af087c6eaa83ae0d72aa8b22aef5c65d65d */
++  return SCM_SMOB_PREDICATE(swig_tag, smob)
++    || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
++    || SCM_SMOB_PREDICATE(swig_finalized_tag, smob);
++}
++
+ SWIGINTERN int
+ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
+ {
+@@ -179,8 +192,7 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
+     *result = SCM_POINTER_VALUE(s);
+     return SWIG_OK;
+ #endif /* if SCM_MAJOR_VERSION >= 2 */
+-  } else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
+-    /* we do not accept smobs representing destroyed pointers */
++  } else if (SWIG_Guile_IsValidSmob(smob)) {
+     from = (swig_type_info *) SCM_CELL_WORD_2(smob);
+     if (!from) return SWIG_ERROR;
+     if (type) {
+@@ -239,7 +251,7 @@ SWIG_Guile_MarkPointerNoncollectable(SCM s)
+ {
+   SCM smob = SWIG_Guile_GetSmob(s);
+   if (!SCM_NULLP(smob)) {
+-    if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
++    if (SWIG_Guile_IsValidSmob(smob)) {
+       SCM_SET_CELL_TYPE(smob, swig_tag);
+     }
+     else scm_wrong_type_arg(NULL, 0, s);
+@@ -252,7 +264,7 @@ SWIG_Guile_MarkPointerDestroyed(SCM s)
+ {
+   SCM smob = SWIG_Guile_GetSmob(s);
+   if (!SCM_NULLP(smob)) {
+-    if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
++    if (SWIG_Guile_IsValidSmob(smob)) {
+       SCM_SET_CELL_TYPE(smob, swig_destroyed_tag);
+     }
+     else scm_wrong_type_arg(NULL, 0, s);
+@@ -419,6 +431,8 @@ SWIG_Guile_Init ()
+     scm_set_smob_print(swig_collectable_tag, print_collectable_swig);
+     scm_set_smob_equalp(swig_collectable_tag, equalp_swig);
+     scm_set_smob_free(swig_collectable_tag, free_swig);
++    /* For Guile >= 2.0.12. See libguile/smob.c:clear_smobnum */
++    swig_finalized_tag = swig_collectable_tag & ~0xff00;
+   }
+   if (ensure_smob_tag(swig_module, &swig_destroyed_tag,
+ 		      "destroyed-swig-pointer", "destroyed-swig-pointer-tag")) {
diff --git a/gnu/packages/patches/teeworlds-use-latest-wavpack.patch b/gnu/packages/patches/teeworlds-use-latest-wavpack.patch
index e9fd991087..3ad1340d2e 100644
--- a/gnu/packages/patches/teeworlds-use-latest-wavpack.patch
+++ b/gnu/packages/patches/teeworlds-use-latest-wavpack.patch
@@ -1,10 +1,20 @@
-Downloaded from https://anonscm.debian.org/cgit/pkg-games/teeworlds.git/plain/debian/patches/new-wavpack.patch.
+Downloaded from https://salsa.debian.org/games-team/teeworlds/raw/master/debian/patches/new-wavpack.patch.
 
-This patch lets us build teeworlds with wavpack 5.1.0.
+From: Markus Koschany <apo@debian.org>
+Date: Thu, 25 Oct 2018 20:52:27 +0200
+Subject: new-wavpack
 
+Make wavpack compatible with Debian's version.
+---
+ src/engine/client/sound.cpp | 33 +++++++++++++++------------------
+ src/engine/client/sound.h   |  4 ----
+ 2 files changed, 15 insertions(+), 22 deletions(-)
+
+diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp
+index 048ec24..80de3c5 100644
 --- a/src/engine/client/sound.cpp
 +++ b/src/engine/client/sound.cpp
-@@ -328,17 +328,14 @@ void CSound::RateConvert(int SampleID)
+@@ -325,10 +325,6 @@ void CSound::RateConvert(int SampleID)
  	pSample->m_NumFrames = NumFrames;
  }
  
@@ -12,10 +22,10 @@ This patch lets us build teeworlds with wavpack 5.1.0.
 -{
 -	return io_read(ms_File, pBuffer, Size);
 -}
--
- int CSound::LoadWV(const char *pFilename)
+ 
+ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
  {
- 	CSample *pSample;
+@@ -336,6 +332,8 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
  	int SampleID = -1;
  	char aError[100];
  	WavpackContext *pContext;
@@ -24,17 +34,18 @@ This patch lets us build teeworlds with wavpack 5.1.0.
  
  	// don't waste memory on sound when we are stress testing
  	if(g_Config.m_DbgStress)
-@@ -351,19 +348,23 @@ int CSound::LoadWV(const char *pFilename
- 	if(!m_pStorage)
- 		return -1;
+@@ -349,25 +347,29 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
+ 		return CSampleHandle();
  
+ 	lock_wait(m_SoundLock);
 -	ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
 -	if(!ms_File)
 +	File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL, aWholePath, sizeof(aWholePath));
 +	if(!File)
  	{
  		dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename);
- 		return -1;
+ 		lock_unlock(m_SoundLock);
+ 		return CSampleHandle();
  	}
 +	else
 +	{
@@ -43,7 +54,14 @@ This patch lets us build teeworlds with wavpack 5.1.0.
  
  	SampleID = AllocID();
  	if(SampleID < 0)
- 		return -1;
+ 	{
+-		io_close(ms_File);
+-		ms_File = 0;
++		io_close(File);
++		File = 0;
+ 		lock_unlock(m_SoundLock);
+ 		return CSampleHandle();
+ 	}
  	pSample = &m_aSamples[SampleID];
  
 -	pContext = WavpackOpenFileInput(ReadData, aError);
@@ -51,7 +69,29 @@ This patch lets us build teeworlds with wavpack 5.1.0.
  	if (pContext)
  	{
  		int m_aSamples = WavpackGetNumSamples(pContext);
-@@ -419,9 +420,6 @@ int CSound::LoadWV(const char *pFilename
+@@ -385,8 +387,8 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
+ 		if(pSample->m_Channels > 2)
+ 		{
+ 			dbg_msg("sound/wv", "file is not mono or stereo. filename='%s'", pFilename);
+-			io_close(ms_File);
+-			ms_File = 0;
++			io_close(File);
++			File = 0;
+ 			lock_unlock(m_SoundLock);
+ 			return CSampleHandle();
+ 		}
+@@ -401,8 +403,8 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
+ 		if(BitsPerSample != 16)
+ 		{
+ 			dbg_msg("sound/wv", "bps is %d, not 16, filname='%s'", BitsPerSample, pFilename);
+-			io_close(ms_File);
+-			ms_File = 0;
++			io_close(File);
++			File = 0;
+ 			lock_unlock(m_SoundLock);
+ 			return CSampleHandle();
+ 		}
+@@ -429,9 +431,6 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
  		dbg_msg("sound/wv", "failed to open %s: %s", pFilename, aError);
  	}
  
@@ -61,14 +101,16 @@ This patch lets us build teeworlds with wavpack 5.1.0.
  	if(g_Config.m_Debug)
  		dbg_msg("sound/wv", "loaded %s", pFilename);
  
-@@ -527,7 +525,5 @@ void CSound::StopAll()
- 	lock_unlock(m_SoundLock);
+@@ -560,7 +559,5 @@ bool CSound::IsPlaying(CSampleHandle SampleID)
+ 	return Ret;
  }
  
 -IOHANDLE CSound::ms_File = 0;
 -
  IEngineSound *CreateEngineSound() { return new CSound; }
  
+diff --git a/src/engine/client/sound.h b/src/engine/client/sound.h
+index ff357c0..cec2cde 100644
 --- a/src/engine/client/sound.h
 +++ b/src/engine/client/sound.h
 @@ -21,10 +21,6 @@ public:
@@ -81,4 +123,4 @@ This patch lets us build teeworlds with wavpack 5.1.0.
 -
  	virtual bool IsSoundEnabled() { return m_SoundEnabled != 0; }
  
- 	virtual int LoadWV(const char *pFilename);
+ 	virtual CSampleHandle LoadWV(const char *pFilename);
diff --git a/gnu/packages/patches/telegram-purple-adjust-test.patch b/gnu/packages/patches/telegram-purple-adjust-test.patch
new file mode 100644
index 0000000000..db3b497d5d
--- /dev/null
+++ b/gnu/packages/patches/telegram-purple-adjust-test.patch
@@ -0,0 +1,14 @@
+This test incorrectly expects the libpurple search path to initially
+contain exactly one element.  Remove this incorrect assertion.
+
+--- telegram-purple-1.3.1-checkout/test/loadtest.c	2018-10-27 16:25:06.258459600 +0200
++++ telegram-purple-1.3.1-checkout/test/loadtest.c	2018-10-27 16:25:11.830434770 +0200
+@@ -156,7 +156,7 @@ static void tdf_inject_plugin (void) {
+   printf ("Injecting our module into purple_plugins_* ...\n");
+   purple_plugins_init ();
+   GList *search_paths = purple_plugins_get_search_paths ();
+-  assert (!search_paths->prev && !search_paths->next && search_paths->data);
++  assert (!search_paths->prev && search_paths->data);
+   GList *new_paths = g_list_append (search_paths, g_strdup ("bin/"));
+   assert (new_paths == search_paths);
+   // Load "my" path before the default.
diff --git a/gnu/packages/patches/texinfo-5-perl-compat.patch b/gnu/packages/patches/texinfo-5-perl-compat.patch
new file mode 100644
index 0000000000..f16d6b4da8
--- /dev/null
+++ b/gnu/packages/patches/texinfo-5-perl-compat.patch
@@ -0,0 +1,19 @@
+Fix a deprecation warning with newer Perl that breaks some tests.
+
+--- a/tp/Texinfo/Parser.pm
++++ b/tp/Texinfo/Parser.pm
+@@ -5438,12 +5438,12 @@
+     }
+   } elsif ($command eq 'clickstyle') {
+     # REMACRO
+-    if ($line =~ /^\s+@([[:alnum:]][[:alnum:]\-]*)({})?\s*/) {
++    if ($line =~ /^\s+@([[:alnum:]][[:alnum:]\-]*)(\{})?\s*/) {
+       $args = ['@'.$1];
+       $self->{'clickstyle'} = $1
+         unless(_ignore_global_commands($self));
+       $remaining = $line;
+-      $remaining =~ s/^\s+@([[:alnum:]][[:alnum:]\-]*)({})?\s*(\@(c|comment)((\@|\s+).*)?)?//;
++      $remaining =~ s/^\s+@([[:alnum:]][[:alnum:]\-]*)(\{})?\s*(\@(c|comment)((\@|\s+).*)?)?//;
+       $has_comment = 1 if (defined($4));
+     } else {
+       $self->line_error (sprintf($self->__(
diff --git a/gnu/packages/patches/texinfo-perl-compat.patch b/gnu/packages/patches/texinfo-perl-compat.patch
new file mode 100644
index 0000000000..a7348fde0d
--- /dev/null
+++ b/gnu/packages/patches/texinfo-perl-compat.patch
@@ -0,0 +1,51 @@
+Fix compatibility with newer Perls.
+
+The first patch is taken from upstream:
+https://svn.savannah.gnu.org/viewvc/texinfo?view=revision&revision=8008
+
+The second gets rid of a deprecation warning that breaks some tests.
+Taken from Fedora: <https://bugzilla.redhat.com/show_bug.cgi?id=1590308>.
+
+--- trunk/tp/Texinfo/Convert/XSParagraph/xspara.c	2017/04/30 14:57:26	7765
++++ trunk/tp/Texinfo/Convert/XSParagraph/xspara.c	2018/07/13 15:39:29	8008
+@@ -248,6 +248,11 @@
+ 
+   dTHX;
+ 
++#if PERL_VERSION > 27 || (PERL_VERSION == 27 && PERL_SUBVERSION > 8)
++  /* needed due to thread-safe locale handling in newer perls */
++  switch_to_global_locale();
++#endif
++
+   if (setlocale (LC_CTYPE, "en_US.UTF-8")
+       || setlocale (LC_CTYPE, "en_US.utf8"))
+     goto success;
+@@ -320,6 +325,10 @@
+     {
+ success: ;
+       free (utf8_locale);
++#if PERL_VERSION > 27 || (PERL_VERSION == 27 && PERL_SUBVERSION > 8)
++      /* needed due to thread-safe locale handling in newer perls */
++      sync_locale();
++#endif
+       /*
+       fprintf (stderr, "tried to set LC_CTYPE to UTF-8.\n");
+       fprintf (stderr, "character encoding is: %s\n",
+
+diff -up texinfo-6.5/tp/Texinfo/Parser.pm.orig texinfo-6.5/tp/Texinfo/Parser.pm
+--- texinfo-6.5/tp/Texinfo/Parser.pm.orig	2018-06-12 13:40:29.356030136 +0200
++++ texinfo-6.5/tp/Texinfo/Parser.pm	2018-06-12 13:41:28.357725639 +0200
+@@ -5478,11 +5478,11 @@ sub _parse_special_misc_command($$$$)
+     }
+   } elsif ($command eq 'clickstyle') {
+     # REMACRO
+-    if ($line =~ /^\s+@([[:alnum:]][[:alnum:]\-]*)({})?\s*/) {
++    if ($line =~ /^\s+@([[:alnum:]][[:alnum:]\-]*)(\{})?\s*/) {
+       $args = ['@'.$1];
+       $self->{'clickstyle'} = $1;
+       $remaining = $line;
+-      $remaining =~ s/^\s+@([[:alnum:]][[:alnum:]\-]*)({})?\s*(\@(c|comment)((\@|\s+).*)?)?//;
++      $remaining =~ s/^\s+@([[:alnum:]][[:alnum:]\-]*)(\{})?\s*(\@(c|comment)((\@|\s+).*)?)?//;
+       $has_comment = 1 if (defined($4));
+     } else {
+       $self->line_error (sprintf($self->__(
diff --git a/gnu/packages/patches/tomsfastmath-constness.patch b/gnu/packages/patches/tomsfastmath-constness.patch
new file mode 100644
index 0000000000..7c6ab5bbec
--- /dev/null
+++ b/gnu/packages/patches/tomsfastmath-constness.patch
@@ -0,0 +1,76 @@
+From dac089515901d6bf315cd15a6e744b8d2c02c1cb Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
+Date: Sat, 31 Oct 2015 22:48:07 +0100
+Subject: [PATCH] tfm: make a few functions static
+
+clamav expects them to be static and it does not seem bad to do so.
+
+Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
+---
+ src/bin/fp_read_radix.c        | 2 +-
+ src/bin/fp_read_signed_bin.c   | 2 +-
+ src/bin/fp_read_unsigned_bin.c | 2 +-
+ src/headers/tfm.h              | 6 +++---
+ 4 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/bin/fp_read_radix.c b/src/bin/fp_read_radix.c
+index 0b5e826..431afa0 100644
+--- a/src/bin/fp_read_radix.c
++++ b/src/bin/fp_read_radix.c
+@@ -9,7 +9,7 @@
+  */
+ #include <tfm_private.h>
+ 
+-int fp_read_radix(fp_int *a, char *str, int radix)
++int fp_read_radix(fp_int *a, const char *str, int radix)
+ {
+   int     y, neg;
+   char    ch;
+diff --git a/src/bin/fp_read_signed_bin.c b/src/bin/fp_read_signed_bin.c
+index e2b8003..6467d19 100644
+--- a/src/bin/fp_read_signed_bin.c
++++ b/src/bin/fp_read_signed_bin.c
+@@ -9,7 +9,7 @@
+  */
+ #include <tfm_private.h>
+ 
+-void fp_read_signed_bin(fp_int *a, unsigned char *b, int c)
++void fp_read_signed_bin(fp_int *a, const unsigned char *b, int c)
+ {
+   /* read magnitude */
+   fp_read_unsigned_bin (a, b + 1, c - 1);
+diff --git a/src/bin/fp_read_unsigned_bin.c b/src/bin/fp_read_unsigned_bin.c
+index 3ee64c0..2ee89cb 100644
+--- a/src/bin/fp_read_unsigned_bin.c
++++ b/src/bin/fp_read_unsigned_bin.c
+@@ -9,7 +9,7 @@
+  */
+ #include <tfm_private.h>
+ 
+-void fp_read_unsigned_bin(fp_int *a, unsigned char *b, int c)
++void fp_read_unsigned_bin(fp_int *a, const unsigned char *b, int c)
+ {
+   /* zero the int */
+   fp_zero (a);
+diff --git a/src/headers/tfm.h b/src/headers/tfm.h
+index af87b56..f406388 100644
+--- a/src/headers/tfm.h
++++ b/src/headers/tfm.h
+@@ -467,14 +467,14 @@ int fp_prime_random_ex(fp_int *a, int t, int size, int flags, tfm_prime_callback
+ int fp_count_bits(fp_int *a);
+ 
+ int fp_unsigned_bin_size(fp_int *a);
+-void fp_read_unsigned_bin(fp_int *a, unsigned char *b, int c);
++void fp_read_unsigned_bin(fp_int *a, const unsigned char *b, int c);
+ void fp_to_unsigned_bin(fp_int *a, unsigned char *b);
+ 
+ int fp_signed_bin_size(fp_int *a);
+-void fp_read_signed_bin(fp_int *a, unsigned char *b, int c);
++void fp_read_signed_bin(fp_int *a, const unsigned char *b, int c);
+ void fp_to_signed_bin(fp_int *a, unsigned char *b);
+ 
+-int fp_read_radix(fp_int *a, char *str, int radix);
++int fp_read_radix(fp_int *a, const char *str, int radix);
+ 
+ int fp_radix_size(fp_int *a, int radix, int *size);
+ int fp_toradix(fp_int *a, char *str, int radix);
diff --git a/gnu/packages/patches/tophat-build-with-later-seqan.patch b/gnu/packages/patches/tophat-build-with-later-seqan.patch
deleted file mode 100644
index fc742e2a7d..0000000000
--- a/gnu/packages/patches/tophat-build-with-later-seqan.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-This patch resolves a build failure when building TopHat 2.1.0 with SeqAn 1.4.
-This is the relevant part of a patch originally posted here:
-https://lists.fu-berlin.de/pipermail/seqan-dev/2014-July/msg00001.html
-
---- a/src/segment_juncs.cpp
-+++ b/src/segment_juncs.cpp
-@@ -2050,10 +2050,13 @@ void juncs_from_ref_segs(RefSequenceTabl
-     typedef map<uint32_t, IntronMotifs> MotifMap;
-     
-     MotifMap ims;
--	
--    seqan::DnaStringReverseComplement rev_donor_dinuc(donor_dinuc);
--    seqan::DnaStringReverseComplement rev_acceptor_dinuc(acceptor_dinuc);
--    
-+
-+    typedef seqan::ModifiedString<
-+                    seqan::ModifiedString<seqan::DnaString const, seqan::ModView<seqan::FunctorComplement<seqan::Dna> > >,  
-+                    seqan::ModReverse>   ConstDnaStringReverseComplement;
-+    ConstDnaStringReverseComplement rev_donor_dinuc(donor_dinuc);
-+    ConstDnaStringReverseComplement rev_acceptor_dinuc(acceptor_dinuc);
-+     
-     if (talkative)
-         fprintf(stderr, "Collecting potential splice sites in islands\n");
- 
diff --git a/gnu/packages/patches/u-boot-pinebook-a64-update-dts.patch b/gnu/packages/patches/u-boot-pinebook-a64-update-dts.patch
new file mode 100644
index 0000000000..9d0a08c8bf
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-a64-update-dts.patch
@@ -0,0 +1,1485 @@
+From 1b39a1834ed182bbd8036a5cd74a9ea111fa4691 Mon Sep 17 00:00:00 2001
+From: Andre Przywara <andre.przywara@arm.com>
+Date: Mon, 29 Oct 2018 00:56:47 +0000
+Subject: [PATCH 03/13] sunxi: A64: Update .dts/.dtsi files
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Update the .dts/.dtsi file from the Linux sunxi/dt64-for-4.20 tree:
+commit 679294497be31596e1c9c61507746d72b6b05f26
+Author: Rodrigo Exterckötter Tjäder <rodrigo@tjader.xyz>
+Date:   Wed Sep 26 19:48:24 2018 +0000
+    arm64: dts: allwinner: a64: a64-olinuxino: set the PHY TX delay
+
+Signed-off-by: Andre Przywara <andre.przywara@arm.com>
+Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Reviewed-by: Jagan Teki <jagan@openedev.com>
+---
+ arch/arm/dts/sun50i-a64-amarula-relic.dts    | 168 +++++++++++++-
+ arch/arm/dts/sun50i-a64-bananapi-m64.dts     |  34 ++-
+ arch/arm/dts/sun50i-a64-nanopi-a64.dts       |  89 +++++++-
+ arch/arm/dts/sun50i-a64-olinuxino.dts        | 103 ++++++++-
+ arch/arm/dts/sun50i-a64-orangepi-win.dts     | 179 ++++++++++++++-
+ arch/arm/dts/sun50i-a64-pine64.dts           |  32 ++-
+ arch/arm/dts/sun50i-a64-sopine-baseboard.dts |  32 ++-
+ arch/arm/dts/sun50i-a64-sopine.dtsi          |  15 ++
+ arch/arm/dts/sun50i-a64.dtsi                 | 313 +++++++++++++++++++++++++--
+ 9 files changed, 920 insertions(+), 45 deletions(-)
+
+diff --git a/arch/arm/dts/sun50i-a64-amarula-relic.dts b/arch/arm/dts/sun50i-a64-amarula-relic.dts
+index f3b4e93ece..6cb2b7f0c8 100644
+--- a/arch/arm/dts/sun50i-a64-amarula-relic.dts
++++ b/arch/arm/dts/sun50i-a64-amarula-relic.dts
+@@ -22,11 +22,11 @@
+ 		stdout-path = "serial0:115200n8";
+ 	};
+ 
+-	reg_vcc3v3: vcc3v3 {
+-		compatible = "regulator-fixed";
+-		regulator-name = "vcc3v3";
+-		regulator-min-microvolt = <3300000>;
+-		regulator-max-microvolt = <3300000>;
++	wifi_pwrseq: wifi-pwrseq {
++		compatible = "mmc-pwrseq-simple";
++		clocks = <&rtc 1>;
++		clock-names = "ext_clock";
++		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* WL-PMU-EN: PL2 */
+ 	};
+ };
+ 
+@@ -34,10 +34,34 @@
+ 	status = "okay";
+ };
+ 
++&mmc1 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&mmc1_pins>;
++	vmmc-supply = <&reg_dcdc1>;
++	/*
++	 * Schematic shows both dldo4 and eldo1 connected for vcc-io-wifi, but
++	 * dldo4 connection shows DNP(Do Not Populate) and eldo1 connected with
++	 * 0Ohm register to vcc-io-wifi so eldo1 is used.
++	 */
++	vqmmc-supply = <&reg_eldo1>;
++	mmc-pwrseq = <&wifi_pwrseq>;
++	bus-width = <4>;
++	non-removable;
++	status = "okay";
++
++	brcmf: wifi@1 {
++		reg = <1>;
++		compatible = "brcm,bcm4329-fmac";
++		interrupt-parent = <&r_pio>;
++		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>;	/* WL-WAKE-AP: PL3 */
++		interrupt-names = "host-wake";
++	};
++};
++
+ &mmc2 {
+ 	pinctrl-names = "default";
+ 	pinctrl-0 = <&mmc2_pins>;
+-	vmmc-supply = <&reg_vcc3v3>;
++	vmmc-supply = <&reg_dcdc1>;
+ 	bus-width = <8>;
+ 	non-removable;
+ 	cap-mmc-hw-reset;
+@@ -48,9 +72,138 @@
+ 	status = "okay";
+ };
+ 
++&r_rsb {
++	status = "okay";
++
++	axp803: pmic@3a3 {
++		compatible = "x-powers,axp803";
++		reg = <0x3a3>;
++		interrupt-parent = <&r_intc>;
++		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
++		x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
++	};
++};
++
++#include "axp803.dtsi"
++
++&reg_aldo1 {
++	regulator-always-on;
++	regulator-min-microvolt = <2800000>;
++	regulator-max-microvolt = <2800000>;
++	regulator-name = "avdd-csi";
++};
++
++&reg_aldo2 {
++	regulator-always-on;
++	regulator-min-microvolt = <1800000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-pl";
++};
++
++&reg_aldo3 {
++	regulator-always-on;
++	regulator-min-microvolt = <3000000>;
++	regulator-max-microvolt = <3000000>;
++	regulator-name = "vcc-pll-avcc";
++};
++
++&reg_dcdc1 {
++	regulator-always-on;
++	regulator-min-microvolt = <3300000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-3v3";
++};
++
++&reg_dcdc2 {
++	regulator-always-on;
++	regulator-min-microvolt = <1040000>;
++	regulator-max-microvolt = <1300000>;
++	regulator-name = "vdd-cpux";
++};
++
++/* DCDC3 is polyphased with DCDC2 */
++
++&reg_dcdc5 {
++	regulator-always-on;
++	regulator-min-microvolt = <1500000>;
++	regulator-max-microvolt = <1500000>;
++	regulator-name = "vcc-dram";
++};
++
++&reg_dcdc6 {
++	regulator-always-on;
++	regulator-min-microvolt = <1100000>;
++	regulator-max-microvolt = <1100000>;
++	regulator-name = "vdd-sys";
++};
++
++&reg_dldo1 {
++	regulator-min-microvolt = <3300000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-hdmi-dsi-sensor";
++};
++
++&reg_dldo2 {
++	regulator-min-microvolt = <3300000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-mipi";
++};
++
++&reg_dldo3 {
++	regulator-min-microvolt = <2800000>;
++	regulator-max-microvolt = <2800000>;
++	regulator-name = "dovdd-csi";
++};
++
++&reg_dldo4 {
++	regulator-min-microvolt = <3300000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-wifi-io";
++};
++
++&reg_drivevbus {
++	regulator-name = "usb0-vbus";
++	status = "okay";
++};
++
++&reg_eldo1 {
++	regulator-always-on;
++	regulator-min-microvolt = <1800000>;
++	regulator-max-microvolt = <1800000>;
++	regulator-name = "cpvdd";
++};
++
++&reg_eldo3 {
++	regulator-min-microvolt = <1800000>;
++	regulator-max-microvolt = <1800000>;
++	regulator-name = "dvdd-csi";
++};
++
++&reg_fldo1 {
++	regulator-min-microvolt = <1200000>;
++	regulator-max-microvolt = <1200000>;
++	regulator-name = "vcc-1v2-hsic";
++};
++
++/*
++ * The A64 chip cannot work without this regulator off, although
++ * it seems to be only driving the AR100 core.
++ * Maybe we don't still know well about CPUs domain.
++ */
++&reg_fldo2 {
++	regulator-always-on;
++	regulator-min-microvolt = <1100000>;
++	regulator-max-microvolt = <1100000>;
++	regulator-name = "vdd-cpus";
++};
++
++&reg_rtc_ldo {
++	regulator-name = "vcc-rtc";
++};
++
+ &uart0 {
+ 	pinctrl-names = "default";
+-	pinctrl-0 = <&uart0_pins_a>;
++	pinctrl-0 = <&uart0_pb_pins>;
+ 	status = "okay";
+ };
+ 
+@@ -61,5 +214,6 @@
+ 
+ &usbphy {
+ 	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
++	usb0_vbus-supply = <&reg_drivevbus>;
+ 	status = "okay";
+ };
+diff --git a/arch/arm/dts/sun50i-a64-bananapi-m64.dts b/arch/arm/dts/sun50i-a64-bananapi-m64.dts
+index 0716b14411..ef1c90401b 100644
+--- a/arch/arm/dts/sun50i-a64-bananapi-m64.dts
++++ b/arch/arm/dts/sun50i-a64-bananapi-m64.dts
+@@ -60,6 +60,17 @@
+ 		stdout-path = "serial0:115200n8";
+ 	};
+ 
++	hdmi-connector {
++		compatible = "hdmi-connector";
++		type = "a";
++
++		port {
++			hdmi_con_in: endpoint {
++				remote-endpoint = <&hdmi_out_con>;
++			};
++		};
++	};
++
+ 	leds {
+ 		compatible = "gpio-leds";
+ 
+@@ -86,6 +97,10 @@
+ 	};
+ };
+ 
++&de {
++	status = "okay";
++};
++
+ &ehci0 {
+ 	status = "okay";
+ };
+@@ -103,6 +118,17 @@
+ 	status = "okay";
+ };
+ 
++&hdmi {
++	hvcc-supply = <&reg_dldo1>;
++	status = "okay";
++};
++
++&hdmi_out {
++	hdmi_out_con: endpoint {
++		remote-endpoint = <&hdmi_con_in>;
++	};
++};
++
+ &i2c1 {
+ 	pinctrl-names = "default";
+ 	pinctrl-0 = <&i2c1_pins>;
+@@ -151,7 +177,7 @@
+ 
+ &mmc2 {
+ 	pinctrl-names = "default";
+-	pinctrl-0 = <&mmc2_pins>;
++	pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
+ 	vmmc-supply = <&reg_dcdc1>;
+ 	bus-width = <8>;
+ 	non-removable;
+@@ -296,9 +322,13 @@
+ 	regulator-name = "vcc-rtc";
+ };
+ 
++&simplefb_hdmi {
++	vcc-hdmi-supply = <&reg_dldo1>;
++};
++
+ &uart0 {
+ 	pinctrl-names = "default";
+-	pinctrl-0 = <&uart0_pins_a>;
++	pinctrl-0 = <&uart0_pb_pins>;
+ 	status = "okay";
+ };
+ 
+diff --git a/arch/arm/dts/sun50i-a64-nanopi-a64.dts b/arch/arm/dts/sun50i-a64-nanopi-a64.dts
+index e2dce48fa2..31884dbc88 100644
+--- a/arch/arm/dts/sun50i-a64-nanopi-a64.dts
++++ b/arch/arm/dts/sun50i-a64-nanopi-a64.dts
+@@ -51,12 +51,44 @@
+ 	compatible = "friendlyarm,nanopi-a64", "allwinner,sun50i-a64";
+ 
+ 	aliases {
++		ethernet0 = &emac;
+ 		serial0 = &uart0;
+ 	};
+ 
+ 	chosen {
+ 		stdout-path = "serial0:115200n8";
+ 	};
++
++	hdmi-connector {
++		compatible = "hdmi-connector";
++		type = "a";
++
++		port {
++			hdmi_con_in: endpoint {
++				remote-endpoint = <&hdmi_out_con>;
++			};
++		};
++	};
++
++	leds {
++		compatible = "gpio-leds";
++
++		blue {
++			label = "nanopi-a64:blue:status";
++			gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
++		};
++	};
++
++	wifi_pwrseq: wifi_pwrseq {
++		compatible = "mmc-pwrseq-simple";
++		clocks = <&rtc 1>;
++		clock-names = "ext_clock";
++		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
++	};
++};
++
++&de {
++	status = "okay";
+ };
+ 
+ &ehci0 {
+@@ -67,6 +99,26 @@
+ 	status = "okay";
+ };
+ 
++&emac {
++	pinctrl-names = "default";
++	pinctrl-0 = <&rgmii_pins>;
++	phy-mode = "rgmii";
++	phy-handle = <&ext_rgmii_phy>;
++	phy-supply = <&reg_dcdc1>;
++	status = "okay";
++};
++
++&hdmi {
++	hvcc-supply = <&reg_dldo1>;
++	status = "okay";
++};
++
++&hdmi_out {
++	hdmi_out_con: endpoint {
++		remote-endpoint = <&hdmi_con_in>;
++	};
++};
++
+ /* i2c1 connected with gpio headers like pine64, bananapi */
+ &i2c1 {
+ 	pinctrl-names = "default";
+@@ -78,6 +130,13 @@
+ 	bias-pull-up;
+ };
+ 
++&mdio {
++	ext_rgmii_phy: ethernet-phy@1 {
++		compatible = "ethernet-phy-ieee802.3-c22";
++		reg = <7>;
++	};
++};
++
+ &mmc0 {
+ 	pinctrl-names = "default";
+ 	pinctrl-0 = <&mmc0_pins>;
+@@ -88,6 +147,24 @@
+ 	status = "okay";
+ };
+ 
++&mmc1 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&mmc1_pins>;
++	vmmc-supply = <&reg_dcdc1>;
++	vqmmc-supply = <&reg_dldo4>;
++	mmc-pwrseq = <&wifi_pwrseq>;
++	bus-width = <4>;
++	non-removable;
++	status = "okay";
++
++	rtl8189etv: wifi@1 {
++		reg = <1>;
++		interrupt-parent = <&r_pio>;
++		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
++		interrupt-names = "host-wake";
++	};
++};
++
+ &ohci0 {
+ 	status = "okay";
+ };
+@@ -125,9 +202,9 @@
+ 
+ &reg_dcdc1 {
+ 	regulator-always-on;
+-	regulator-min-microvolt = <3000000>;
+-	regulator-max-microvolt = <3000000>;
+-	regulator-name = "vcc-3v";
++	regulator-min-microvolt = <3300000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-3v3";
+ };
+ 
+ &reg_dcdc2 {
+@@ -195,9 +272,13 @@
+ 	regulator-name = "vcc-rtc";
+ };
+ 
++&simplefb_hdmi {
++	vcc-hdmi-supply = <&reg_dldo1>;
++};
++
+ &uart0 {
+ 	pinctrl-names = "default";
+-	pinctrl-0 = <&uart0_pins_a>;
++	pinctrl-0 = <&uart0_pb_pins>;
+ 	status = "okay";
+ };
+ 
+diff --git a/arch/arm/dts/sun50i-a64-olinuxino.dts b/arch/arm/dts/sun50i-a64-olinuxino.dts
+index 3b3081b10e..f7a4bccaa5 100644
+--- a/arch/arm/dts/sun50i-a64-olinuxino.dts
++++ b/arch/arm/dts/sun50i-a64-olinuxino.dts
+@@ -51,6 +51,7 @@
+ 	compatible = "olimex,a64-olinuxino", "allwinner,sun50i-a64";
+ 
+ 	aliases {
++		ethernet0 = &emac;
+ 		serial0 = &uart0;
+ 	};
+ 
+@@ -58,12 +59,74 @@
+ 		stdout-path = "serial0:115200n8";
+ 	};
+ 
++	hdmi-connector {
++		compatible = "hdmi-connector";
++		type = "a";
++
++		port {
++			hdmi_con_in: endpoint {
++				remote-endpoint = <&hdmi_out_con>;
++			};
++		};
++	};
++
++	reg_usb1_vbus: usb1-vbus {
++		compatible = "regulator-fixed";
++		regulator-name = "usb1-vbus";
++		regulator-min-microvolt = <5000000>;
++		regulator-max-microvolt = <5000000>;
++		regulator-boot-on;
++		enable-active-high;
++		gpio = <&pio 6 9 GPIO_ACTIVE_HIGH>; /* PG9 */
++		status = "okay";
++	};
++
+ 	wifi_pwrseq: wifi_pwrseq {
+ 		compatible = "mmc-pwrseq-simple";
+ 		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
+ 	};
+ };
+ 
++&de {
++	status = "okay";
++};
++
++&ehci0 {
++	status = "okay";
++};
++
++&ehci1 {
++	status = "okay";
++};
++
++&emac {
++	pinctrl-names = "default";
++	pinctrl-0 = <&rgmii_pins>;
++	phy-mode = "rgmii";
++	phy-handle = <&ext_rgmii_phy>;
++	phy-supply = <&reg_dcdc1>;
++	allwinner,tx-delay-ps = <600>;
++	status = "okay";
++};
++
++&hdmi {
++	hvcc-supply = <&reg_dldo1>;
++	status = "okay";
++};
++
++&hdmi_out {
++	hdmi_out_con: endpoint {
++		remote-endpoint = <&hdmi_con_in>;
++	};
++};
++
++&mdio {
++	ext_rgmii_phy: ethernet-phy@1 {
++		compatible = "ethernet-phy-ieee802.3-c22";
++		reg = <1>;
++	};
++};
++
+ &mmc0 {
+ 	pinctrl-names = "default";
+ 	pinctrl-0 = <&mmc0_pins>;
+@@ -92,6 +155,14 @@
+ 	};
+ };
+ 
++&ohci0 {
++	status = "okay";
++};
++
++&ohci1 {
++	status = "okay";
++};
++
+ &r_rsb {
+ 	status = "okay";
+ 
+@@ -100,6 +171,7 @@
+ 		reg = <0x3a3>;
+ 		interrupt-parent = <&r_intc>;
+ 		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
++		x-powers,drive-vbus-en;	/* set N_VBUSEN as output pin */
+ 	};
+ };
+ 
+@@ -142,10 +214,14 @@
+ 
+ /* DCDC3 is polyphased with DCDC2 */
+ 
++/*
++ * The board uses DDR3L DRAM chips. 1.36V is the closest to the nominal
++ * 1.35V that the PMIC can drive.
++ */
+ &reg_dcdc5 {
+ 	regulator-always-on;
+-	regulator-min-microvolt = <1500000>;
+-	regulator-max-microvolt = <1500000>;
++	regulator-min-microvolt = <1360000>;
++	regulator-max-microvolt = <1360000>;
+ 	regulator-name = "vcc-ddr3";
+ };
+ 
+@@ -180,6 +256,11 @@
+ 	regulator-name = "vcc-wifi-io";
+ };
+ 
++&reg_drivevbus {
++	regulator-name = "usb0-vbus";
++	status = "okay";
++};
++
+ &reg_eldo1 {
+ 	regulator-min-microvolt = <1800000>;
+ 	regulator-max-microvolt = <1800000>;
+@@ -214,8 +295,24 @@
+ 	regulator-name = "vcc-rtc";
+ };
+ 
++&simplefb_hdmi {
++	vcc-hdmi-supply = <&reg_dldo1>;
++};
++
+ &uart0 {
+ 	pinctrl-names = "default";
+-	pinctrl-0 = <&uart0_pins_a>;
++	pinctrl-0 = <&uart0_pb_pins>;
++	status = "okay";
++};
++
++&usb_otg {
++	dr_mode = "otg";
++	status = "okay";
++};
++
++&usbphy {
+ 	status = "okay";
++	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
++	usb0_vbus-supply = <&reg_drivevbus>;
++	usb1_vbus-supply = <&reg_usb1_vbus>;
+ };
+diff --git a/arch/arm/dts/sun50i-a64-orangepi-win.dts b/arch/arm/dts/sun50i-a64-orangepi-win.dts
+index bf42690a33..b0c64f7579 100644
+--- a/arch/arm/dts/sun50i-a64-orangepi-win.dts
++++ b/arch/arm/dts/sun50i-a64-orangepi-win.dts
+@@ -1,5 +1,6 @@
+ /*
+  * Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
++ * Copyright (C) 2017-2018 Samuel Holland <samuel@sholland.org>
+  *
+  * This file is dual-licensed: you can use it either under the terms
+  * of the GPL or the X11 license, at your option. Note that this dual
+@@ -51,23 +52,127 @@
+ 	compatible = "xunlong,orangepi-win", "allwinner,sun50i-a64";
+ 
+ 	aliases {
++		ethernet0 = &emac;
+ 		serial0 = &uart0;
++		serial1 = &uart1;
++		serial2 = &uart2;
++		serial3 = &uart3;
++		serial4 = &uart4;
+ 	};
+ 
+ 	chosen {
+ 		stdout-path = "serial0:115200n8";
+ 	};
++
++	hdmi-connector {
++		compatible = "hdmi-connector";
++		type = "a";
++
++		port {
++			hdmi_con_in: endpoint {
++				remote-endpoint = <&hdmi_out_con>;
++			};
++		};
++	};
++
++	leds {
++		compatible = "gpio-leds";
++
++		status {
++			label = "orangepi:green:status";
++			gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
++		};
++	};
++
++	reg_gmac_3v3: gmac-3v3 {
++		compatible = "regulator-fixed";
++		regulator-name = "gmac-3v3";
++		regulator-min-microvolt = <3300000>;
++		regulator-max-microvolt = <3300000>;
++		regulator-boot-on;
++		enable-active-high;
++		gpio = <&pio 3 14 GPIO_ACTIVE_HIGH>; /* PD14 */
++		status = "okay";
++	};
++
++	reg_usb1_vbus: usb1-vbus {
++		compatible = "regulator-fixed";
++		regulator-name = "usb1-vbus";
++		regulator-min-microvolt = <5000000>;
++		regulator-max-microvolt = <5000000>;
++		regulator-boot-on;
++		enable-active-high;
++		gpio = <&pio 3 7 GPIO_ACTIVE_HIGH>; /* PD7 */
++		status = "okay";
++	};
++
++	wifi_pwrseq: wifi_pwrseq {
++		compatible = "mmc-pwrseq-simple";
++		reset-gpios = <&r_pio 0 8 GPIO_ACTIVE_LOW>; /* PL8 */
++	};
++};
++
++&de {
++	status = "okay";
++};
++
++&ehci0 {
++	status = "okay";
+ };
+ 
+ &ehci1 {
+ 	status = "okay";
+ };
+ 
++&emac {
++	pinctrl-names = "default";
++	pinctrl-0 = <&rgmii_pins>;
++	phy-mode = "rgmii";
++	phy-handle = <&ext_rgmii_phy>;
++	phy-supply = <&reg_gmac_3v3>;
++	status = "okay";
++};
++
++&hdmi {
++	hvcc-supply = <&reg_dldo1>;
++	status = "okay";
++};
++
++&hdmi_out {
++	hdmi_out_con: endpoint {
++		remote-endpoint = <&hdmi_con_in>;
++	};
++};
++
++&mdio {
++	ext_rgmii_phy: ethernet-phy@1 {
++		compatible = "ethernet-phy-ieee802.3-c22";
++		reg = <1>;
++	};
++};
++
+ &mmc0 {
+ 	pinctrl-names = "default";
+ 	pinctrl-0 = <&mmc0_pins>;
+ 	vmmc-supply = <&reg_dcdc1>;
+-	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
++	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
++	disable-wp;
++	bus-width = <4>;
++	status = "okay";
++};
++
++&mmc1 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&mmc1_pins>;
++	vmmc-supply = <&reg_dldo2>;
++	vqmmc-supply = <&reg_dldo4>;
++	mmc-pwrseq = <&wifi_pwrseq>;
++	bus-width = <4>;
++	non-removable;
++	status = "okay";
++};
++
++&ohci0 {
+ 	status = "okay";
+ };
+ 
+@@ -89,9 +194,8 @@
+ #include "axp803.dtsi"
+ 
+ &reg_aldo1 {
+-	regulator-always-on;
+-	regulator-min-microvolt = <1800000>;
+-	regulator-max-microvolt = <3300000>;
++	regulator-min-microvolt = <2800000>;
++	regulator-max-microvolt = <2800000>;
+ 	regulator-name = "afvcc-csi";
+ };
+ 
+@@ -163,12 +267,23 @@
+ 	regulator-name = "vcc-wifi-io";
+ };
+ 
++&reg_drivevbus {
++	regulator-name = "usb0-vbus";
++	status = "okay";
++};
++
+ &reg_eldo1 {
+ 	regulator-min-microvolt = <1800000>;
+ 	regulator-max-microvolt = <1800000>;
+ 	regulator-name = "cpvdd";
+ };
+ 
++&reg_eldo3 {
++	regulator-min-microvolt = <1500000>;
++	regulator-max-microvolt = <1800000>;
++	regulator-name = "dvdd-csi";
++};
++
+ &reg_fldo1 {
+ 	regulator-min-microvolt = <1200000>;
+ 	regulator-max-microvolt = <1200000>;
+@@ -191,13 +306,65 @@
+ 	regulator-name = "vcc-rtc";
+ };
+ 
++&simplefb_hdmi {
++	vcc-hdmi-supply = <&reg_dldo1>;
++};
++
++&spi0 {
++	status = "okay";
++
++	spi-flash@0 {
++		compatible = "mxicy,mx25l1606e", "jedec,spi-nor";
++		reg = <0>;
++		spi-max-frequency = <80000000>;
++		m25p,fast-read;
++		status = "okay";
++	};
++};
++
++/* On debug connector */
+ &uart0 {
+ 	pinctrl-names = "default";
+-	pinctrl-0 = <&uart0_pins_a>;
++	pinctrl-0 = <&uart0_pb_pins>;
+ 	status = "okay";
+ };
+ 
+-&usbphy {
++/* Bluetooth */
++&uart1 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
++	status = "okay";
++};
++
++/* On Pi-2 connector, RTS/CTS optional */
++&uart2 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&uart2_pins>;
++	status = "disabled";
++};
++
++/* On Pi-2 connector, RTS/CTS optional */
++&uart3 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&uart3_pins>;
++	status = "disabled";
++};
++
++/* On Pi-2 connector (labeled for SPI1), RTS/CTS optional */
++&uart4 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&uart4_pins>;
++	status = "disabled";
++};
++
++&usb_otg {
++	dr_mode = "otg";
+ 	status = "okay";
+ };
+ 
++&usbphy {
++	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
++	usb0_vbus-supply = <&reg_drivevbus>;
++	usb1_vbus-supply = <&reg_usb1_vbus>;
++	status = "okay";
++};
+diff --git a/arch/arm/dts/sun50i-a64-pine64.dts b/arch/arm/dts/sun50i-a64-pine64.dts
+index a75825798a..c077b6c1f4 100644
+--- a/arch/arm/dts/sun50i-a64-pine64.dts
++++ b/arch/arm/dts/sun50i-a64-pine64.dts
+@@ -62,6 +62,21 @@
+ 	chosen {
+ 		stdout-path = "serial0:115200n8";
+ 	};
++
++	hdmi-connector {
++		compatible = "hdmi-connector";
++		type = "a";
++
++		port {
++			hdmi_con_in: endpoint {
++				remote-endpoint = <&hdmi_out_con>;
++			};
++		};
++	};
++};
++
++&de {
++	status = "okay";
+ };
+ 
+ &ehci0 {
+@@ -82,6 +97,17 @@
+ 
+ };
+ 
++&hdmi {
++	hvcc-supply = <&reg_dldo1>;
++	status = "okay";
++};
++
++&hdmi_out {
++	hdmi_out_con: endpoint {
++		remote-endpoint = <&hdmi_con_in>;
++	};
++};
++
+ &i2c1 {
+ 	pinctrl-names = "default";
+ 	pinctrl-0 = <&i2c1_pins>;
+@@ -229,6 +255,10 @@
+ 	regulator-name = "vcc-rtc";
+ };
+ 
++&simplefb_hdmi {
++	vcc-hdmi-supply = <&reg_dldo1>;
++};
++
+ /* On Euler connector */
+ &spdif {
+ 	status = "disabled";
+@@ -237,7 +267,7 @@
+ /* On Exp and Euler connectors */
+ &uart0 {
+ 	pinctrl-names = "default";
+-	pinctrl-0 = <&uart0_pins_a>;
++	pinctrl-0 = <&uart0_pb_pins>;
+ 	status = "okay";
+ };
+ 
+diff --git a/arch/arm/dts/sun50i-a64-sopine-baseboard.dts b/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
+index abe179de35..53fcc9098d 100644
+--- a/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
++++ b/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
+@@ -61,6 +61,17 @@
+ 		stdout-path = "serial0:115200n8";
+ 	};
+ 
++	hdmi-connector {
++		compatible = "hdmi-connector";
++		type = "a";
++
++		port {
++			hdmi_con_in: endpoint {
++				remote-endpoint = <&hdmi_out_con>;
++			};
++		};
++	};
++
+ 	reg_vcc1v8: vcc1v8 {
+ 		compatible = "regulator-fixed";
+ 		regulator-name = "vcc1v8";
+@@ -69,6 +80,10 @@
+ 	};
+ };
+ 
++&de {
++	status = "okay";
++};
++
+ &ehci0 {
+ 	status = "okay";
+ };
+@@ -86,6 +101,17 @@
+ 	status = "okay";
+ };
+ 
++&hdmi {
++	hvcc-supply = <&reg_dldo1>;
++	status = "okay";
++};
++
++&hdmi_out {
++	hdmi_out_con: endpoint {
++		remote-endpoint = <&hdmi_con_in>;
++	};
++};
++
+ &mdio {
+ 	ext_rgmii_phy: ethernet-phy@1 {
+ 		compatible = "ethernet-phy-ieee802.3-c22";
+@@ -134,9 +160,13 @@
+ 	regulator-name = "vcc-wifi";
+ };
+ 
++&simplefb_hdmi {
++	vcc-hdmi-supply = <&reg_dldo1>;
++};
++
+ &uart0 {
+ 	pinctrl-names = "default";
+-	pinctrl-0 = <&uart0_pins_a>;
++	pinctrl-0 = <&uart0_pb_pins>;
+ 	status = "okay";
+ };
+ 
+diff --git a/arch/arm/dts/sun50i-a64-sopine.dtsi b/arch/arm/dts/sun50i-a64-sopine.dtsi
+index 43418bd881..6723b8695e 100644
+--- a/arch/arm/dts/sun50i-a64-sopine.dtsi
++++ b/arch/arm/dts/sun50i-a64-sopine.dtsi
+@@ -45,6 +45,8 @@
+ 
+ #include "sun50i-a64.dtsi"
+ 
++#include <dt-bindings/gpio/gpio.h>
++
+ &mmc0 {
+ 	pinctrl-names = "default";
+ 	pinctrl-0 = <&mmc0_pins>;
+@@ -52,6 +54,7 @@
+ 	non-removable;
+ 	disable-wp;
+ 	bus-width = <4>;
++	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
+ 	status = "okay";
+ };
+ 
+@@ -66,6 +69,18 @@
+ 	};
+ };
+ 
++&spi0  {
++	status = "okay";
++
++	flash@0 {
++		#address-cells = <1>;
++		#size-cells = <1>;
++		compatible = "jedec,spi-nor";
++		reg = <0>;
++		spi-max-frequency = <40000000>;
++	};
++};
++
+ #include "axp803.dtsi"
+ 
+ &reg_aldo2 {
+diff --git a/arch/arm/dts/sun50i-a64.dtsi b/arch/arm/dts/sun50i-a64.dtsi
+index 7a083637c4..f3a66f8882 100644
+--- a/arch/arm/dts/sun50i-a64.dtsi
++++ b/arch/arm/dts/sun50i-a64.dtsi
+@@ -43,9 +43,12 @@
+  */
+ 
+ #include <dt-bindings/clock/sun50i-a64-ccu.h>
++#include <dt-bindings/clock/sun8i-de2.h>
+ #include <dt-bindings/clock/sun8i-r-ccu.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/reset/sun50i-a64-ccu.h>
++#include <dt-bindings/reset/sun8i-de2.h>
++#include <dt-bindings/reset/sun8i-r-ccu.h>
+ 
+ / {
+ 	interrupt-parent = <&gic>;
+@@ -57,17 +60,21 @@
+ 		#size-cells = <1>;
+ 		ranges;
+ 
+-/*
+- * The pipeline mixer0-lcd0 depends on clock CLK_MIXER0 from DE2 CCU.
+- * However there is no support for this clock on A64 yet, so we depend
+- * on the upstream clocks here to keep them (and thus CLK_MIXER0) up.
+- */
+ 		simplefb_lcd: framebuffer-lcd {
+ 			compatible = "allwinner,simple-framebuffer",
+ 				     "simple-framebuffer";
+ 			allwinner,pipeline = "mixer0-lcd0";
+ 			clocks = <&ccu CLK_TCON0>,
+-				 <&ccu CLK_DE>, <&ccu CLK_BUS_DE>;
++				 <&display_clocks CLK_MIXER0>;
++			status = "disabled";
++		};
++
++		simplefb_hdmi: framebuffer-hdmi {
++			compatible = "allwinner,simple-framebuffer",
++				     "simple-framebuffer";
++			allwinner,pipeline = "mixer1-lcd1-hdmi";
++			clocks = <&display_clocks CLK_MIXER1>,
++				 <&ccu CLK_TCON1>, <&ccu CLK_HDMI>;
+ 			status = "disabled";
+ 		};
+ 	};
+@@ -81,6 +88,7 @@
+ 			device_type = "cpu";
+ 			reg = <0>;
+ 			enable-method = "psci";
++			next-level-cache = <&L2>;
+ 		};
+ 
+ 		cpu1: cpu@1 {
+@@ -88,6 +96,7 @@
+ 			device_type = "cpu";
+ 			reg = <1>;
+ 			enable-method = "psci";
++			next-level-cache = <&L2>;
+ 		};
+ 
+ 		cpu2: cpu@2 {
+@@ -95,6 +104,7 @@
+ 			device_type = "cpu";
+ 			reg = <2>;
+ 			enable-method = "psci";
++			next-level-cache = <&L2>;
+ 		};
+ 
+ 		cpu3: cpu@3 {
+@@ -102,7 +112,20 @@
+ 			device_type = "cpu";
+ 			reg = <3>;
+ 			enable-method = "psci";
++			next-level-cache = <&L2>;
+ 		};
++
++		L2: l2-cache {
++			compatible = "cache";
++			cache-level = <2>;
++		};
++	};
++
++	de: display-engine {
++		compatible = "allwinner,sun50i-a64-display-engine";
++		allwinner,pipelines = <&mixer0>,
++				      <&mixer1>;
++		status = "disabled";
+ 	};
+ 
+ 	osc24M: osc24M_clk {
+@@ -168,10 +191,92 @@
+ 		#size-cells = <1>;
+ 		ranges;
+ 
++		de2@1000000 {
++			compatible = "allwinner,sun50i-a64-de2";
++			reg = <0x1000000 0x400000>;
++			allwinner,sram = <&de2_sram 1>;
++			#address-cells = <1>;
++			#size-cells = <1>;
++			ranges = <0 0x1000000 0x400000>;
++
++			display_clocks: clock@0 {
++				compatible = "allwinner,sun50i-a64-de2-clk";
++				reg = <0x0 0x100000>;
++				clocks = <&ccu CLK_DE>,
++					 <&ccu CLK_BUS_DE>;
++				clock-names = "mod",
++					      "bus";
++				resets = <&ccu RST_BUS_DE>;
++				#clock-cells = <1>;
++				#reset-cells = <1>;
++			};
++
++			mixer0: mixer@100000 {
++				compatible = "allwinner,sun50i-a64-de2-mixer-0";
++				reg = <0x100000 0x100000>;
++				clocks = <&display_clocks CLK_BUS_MIXER0>,
++					 <&display_clocks CLK_MIXER0>;
++				clock-names = "bus",
++					      "mod";
++				resets = <&display_clocks RST_MIXER0>;
++
++				ports {
++					#address-cells = <1>;
++					#size-cells = <0>;
++
++					mixer0_out: port@1 {
++						reg = <1>;
++
++						mixer0_out_tcon0: endpoint {
++							remote-endpoint = <&tcon0_in_mixer0>;
++						};
++					};
++				};
++			};
++
++			mixer1: mixer@200000 {
++				compatible = "allwinner,sun50i-a64-de2-mixer-1";
++				reg = <0x200000 0x100000>;
++				clocks = <&display_clocks CLK_BUS_MIXER1>,
++					 <&display_clocks CLK_MIXER1>;
++				clock-names = "bus",
++					      "mod";
++				resets = <&display_clocks RST_MIXER1>;
++
++				ports {
++					#address-cells = <1>;
++					#size-cells = <0>;
++
++					mixer1_out: port@1 {
++						reg = <1>;
++
++						mixer1_out_tcon1: endpoint {
++							remote-endpoint = <&tcon1_in_mixer1>;
++						};
++					};
++				};
++			};
++		};
++
+ 		syscon: syscon@1c00000 {
+-			compatible = "allwinner,sun50i-a64-system-controller",
+-				"syscon";
++			compatible = "allwinner,sun50i-a64-system-control";
+ 			reg = <0x01c00000 0x1000>;
++			#address-cells = <1>;
++			#size-cells = <1>;
++			ranges;
++
++			sram_c: sram@18000 {
++				compatible = "mmio-sram";
++				reg = <0x00018000 0x28000>;
++				#address-cells = <1>;
++				#size-cells = <1>;
++				ranges = <0 0x00018000 0x28000>;
++
++				de2_sram: sram-section@0 {
++					compatible = "allwinner,sun50i-a64-sram-c";
++					reg = <0x0000 0x28000>;
++				};
++			};
+ 		};
+ 
+ 		dma: dma-controller@1c02000 {
+@@ -185,6 +290,75 @@
+ 			#dma-cells = <1>;
+ 		};
+ 
++		tcon0: lcd-controller@1c0c000 {
++			compatible = "allwinner,sun50i-a64-tcon-lcd",
++				     "allwinner,sun8i-a83t-tcon-lcd";
++			reg = <0x01c0c000 0x1000>;
++			interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
++			clocks = <&ccu CLK_BUS_TCON0>, <&ccu CLK_TCON0>;
++			clock-names = "ahb", "tcon-ch0";
++			clock-output-names = "tcon-pixel-clock";
++			resets = <&ccu RST_BUS_TCON0>, <&ccu RST_BUS_LVDS>;
++			reset-names = "lcd", "lvds";
++
++			ports {
++				#address-cells = <1>;
++				#size-cells = <0>;
++
++				tcon0_in: port@0 {
++					#address-cells = <1>;
++					#size-cells = <0>;
++					reg = <0>;
++
++					tcon0_in_mixer0: endpoint@0 {
++						reg = <0>;
++						remote-endpoint = <&mixer0_out_tcon0>;
++					};
++				};
++
++				tcon0_out: port@1 {
++					#address-cells = <1>;
++					#size-cells = <0>;
++					reg = <1>;
++				};
++			};
++		};
++
++		tcon1: lcd-controller@1c0d000 {
++			compatible = "allwinner,sun50i-a64-tcon-tv",
++				     "allwinner,sun8i-a83t-tcon-tv";
++			reg = <0x01c0d000 0x1000>;
++			interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>;
++			clocks = <&ccu CLK_BUS_TCON1>, <&ccu CLK_TCON1>;
++			clock-names = "ahb", "tcon-ch1";
++			resets = <&ccu RST_BUS_TCON1>;
++			reset-names = "lcd";
++
++			ports {
++				#address-cells = <1>;
++				#size-cells = <0>;
++
++				tcon1_in: port@0 {
++					reg = <0>;
++
++					tcon1_in_mixer1: endpoint {
++						remote-endpoint = <&mixer1_out_tcon1>;
++					};
++				};
++
++				tcon1_out: port@1 {
++					#address-cells = <1>;
++					#size-cells = <0>;
++					reg = <1>;
++
++					tcon1_out_hdmi: endpoint@1 {
++						reg = <1>;
++						remote-endpoint = <&hdmi_in_tcon1>;
++					};
++				};
++			};
++		};
++
+ 		mmc0: mmc@1c0f000 {
+ 			compatible = "allwinner,sun50i-a64-mmc";
+ 			reg = <0x01c0f000 0x1000>;
+@@ -227,6 +401,11 @@
+ 			#size-cells = <0>;
+ 		};
+ 
++		sid: eeprom@1c14000 {
++			compatible = "allwinner,sun50i-a64-sid";
++			reg = <0x1c14000 0x400>;
++		};
++
+ 		usb_otg: usb@1c19000 {
+ 			compatible = "allwinner,sun8i-a33-musb";
+ 			reg = <0x01c19000 0x0400>;
+@@ -356,7 +535,7 @@
+ 			};
+ 
+ 			mmc2_pins: mmc2-pins {
+-				pins = "PC1", "PC5", "PC6", "PC8", "PC9",
++				pins = "PC5", "PC6", "PC8", "PC9",
+ 				       "PC10","PC11", "PC12", "PC13",
+ 				       "PC14", "PC15", "PC16";
+ 				function = "mmc2";
+@@ -364,6 +543,18 @@
+ 				bias-pull-up;
+ 			};
+ 
++			mmc2_ds_pin: mmc2-ds-pin {
++				pins = "PC1";
++				function = "mmc2";
++				drive-strength = <30>;
++				bias-pull-up;
++			};
++
++			pwm_pin: pwm_pin {
++				pins = "PD22";
++				function = "pwm";
++			};
++
+ 			rmii_pins: rmii_pins {
+ 				pins = "PD10", "PD11", "PD13", "PD14", "PD17",
+ 				       "PD18", "PD19", "PD20", "PD22", "PD23";
+@@ -394,7 +585,7 @@
+ 				function = "spi1";
+ 			};
+ 
+-			uart0_pins_a: uart0 {
++			uart0_pb_pins: uart0-pb-pins {
+ 				pins = "PB8", "PB9";
+ 				function = "uart0";
+ 			};
+@@ -474,15 +665,6 @@
+ 			status = "disabled";
+ 		};
+ 
+-		pwm: pwm@1c21400 {
+-			compatible = "allwinner,sun50i-a64-pwm",
+-				     "allwinner,sun5i-a13-pwm";
+-			reg = <0x01c21400 0x8>;
+-			clocks = <&osc24M>;
+-			#pwm-cells = <3>;
+-			status = "disabled";
+-		};
+-
+ 		uart0: serial@1c28000 {
+ 			compatible = "snps,dw-apb-uart";
+ 			reg = <0x01c28000 0x400>;
+@@ -617,8 +799,6 @@
+ 			clocks = <&ccu CLK_BUS_EMAC>;
+ 			clock-names = "stmmaceth";
+ 			status = "disabled";
+-			#address-cells = <1>;
+-			#size-cells = <0>;
+ 
+ 			mdio: mdio {
+ 				compatible = "snps,dwmac-mdio";
+@@ -638,11 +818,69 @@
+ 			#interrupt-cells = <3>;
+ 		};
+ 
++		pwm: pwm@1c21400 {
++			compatible = "allwinner,sun50i-a64-pwm",
++				     "allwinner,sun5i-a13-pwm";
++			reg = <0x01c21400 0x400>;
++			clocks = <&osc24M>;
++			pinctrl-names = "default";
++			pinctrl-0 = <&pwm_pin>;
++			#pwm-cells = <3>;
++			status = "disabled";
++		};
++
++		hdmi: hdmi@1ee0000 {
++			compatible = "allwinner,sun50i-a64-dw-hdmi",
++				     "allwinner,sun8i-a83t-dw-hdmi";
++			reg = <0x01ee0000 0x10000>;
++			reg-io-width = <1>;
++			interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>;
++			clocks = <&ccu CLK_BUS_HDMI>, <&ccu CLK_HDMI_DDC>,
++				 <&ccu CLK_HDMI>;
++			clock-names = "iahb", "isfr", "tmds";
++			resets = <&ccu RST_BUS_HDMI1>;
++			reset-names = "ctrl";
++			phys = <&hdmi_phy>;
++			phy-names = "hdmi-phy";
++			status = "disabled";
++
++			ports {
++				#address-cells = <1>;
++				#size-cells = <0>;
++
++				hdmi_in: port@0 {
++					reg = <0>;
++
++					hdmi_in_tcon1: endpoint {
++						remote-endpoint = <&tcon1_out_hdmi>;
++					};
++				};
++
++				hdmi_out: port@1 {
++					reg = <1>;
++				};
++			};
++		};
++
++		hdmi_phy: hdmi-phy@1ef0000 {
++			compatible = "allwinner,sun50i-a64-hdmi-phy";
++			reg = <0x01ef0000 0x10000>;
++			clocks = <&ccu CLK_BUS_HDMI>, <&ccu CLK_HDMI_DDC>,
++				 <&ccu 7>;
++			clock-names = "bus", "mod", "pll-0";
++			resets = <&ccu RST_BUS_HDMI0>;
++			reset-names = "phy";
++			#phy-cells = <0>;
++		};
++
+ 		rtc: rtc@1f00000 {
+ 			compatible = "allwinner,sun6i-a31-rtc";
+ 			reg = <0x01f00000 0x54>;
+ 			interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
+ 				     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
++			clock-output-names = "rtc-osc32k", "rtc-osc32k-out";
++			clocks = <&osc32k>;
++			#clock-cells = <1>;
+ 		};
+ 
+ 		r_intc: interrupt-controller@1f00c00 {
+@@ -664,6 +902,29 @@
+ 			#reset-cells = <1>;
+ 		};
+ 
++		r_i2c: i2c@1f02400 {
++			compatible = "allwinner,sun50i-a64-i2c",
++				     "allwinner,sun6i-a31-i2c";
++			reg = <0x01f02400 0x400>;
++			interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
++			clocks = <&r_ccu CLK_APB0_I2C>;
++			resets = <&r_ccu RST_APB0_I2C>;
++			status = "disabled";
++			#address-cells = <1>;
++			#size-cells = <0>;
++		};
++
++		r_pwm: pwm@1f03800 {
++			compatible = "allwinner,sun50i-a64-pwm",
++				     "allwinner,sun5i-a13-pwm";
++			reg = <0x01f03800 0x400>;
++			clocks = <&osc24M>;
++			pinctrl-names = "default";
++			pinctrl-0 = <&r_pwm_pin>;
++			#pwm-cells = <3>;
++			status = "disabled";
++		};
++
+ 		r_pio: pinctrl@1f02c00 {
+ 			compatible = "allwinner,sun50i-a64-r-pinctrl";
+ 			reg = <0x01f02c00 0x400>;
+@@ -675,6 +936,16 @@
+ 			interrupt-controller;
+ 			#interrupt-cells = <3>;
+ 
++			r_i2c_pl89_pins: r-i2c-pl89-pins {
++				pins = "PL8", "PL9";
++				function = "s_i2c";
++			};
++
++			r_pwm_pin: pwm {
++				pins = "PL10";
++				function = "s_pwm";
++			};
++
+ 			r_rsb_pins: rsb {
+ 				pins = "PL0", "PL1";
+ 				function = "s_rsb";
+-- 
+2.11.0
+
diff --git a/gnu/packages/patches/u-boot-pinebook-dts.patch b/gnu/packages/patches/u-boot-pinebook-dts.patch
new file mode 100644
index 0000000000..48c004fdfc
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-dts.patch
@@ -0,0 +1,388 @@
+From b972831c3cd24f3c9bb0995ed61db8f8239f3391 Mon Sep 17 00:00:00 2001
+From: Vasily Khoruzhick <anarsoul@gmail.com>
+Date: Mon, 5 Nov 2018 20:24:31 -0800
+Subject: [PATCH 10/13] sunxi: DT: add support for Pinebook
+
+Pinebook is a laptop produced by Pine64, with USB-connected keyboard,
+USB-connected touchpad and an eDP LCD panel connected via a RGB-eDP
+bridge from Analogix.
+
+Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
+Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Cc: Vagrant Cascadian <vagrant@debian.org>
+Reviewed-by: Jagan Teki <jagan@openedev.com>
+---
+ arch/arm/dts/Makefile                        |   1 +
+ arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi |  15 ++
+ arch/arm/dts/sun50i-a64-pinebook.dts         | 294 +++++++++++++++++++++++++++
+ configs/pinebook_defconfig                   |  22 ++
+ 4 files changed, 332 insertions(+)
+ create mode 100644 arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi
+ create mode 100644 arch/arm/dts/sun50i-a64-pinebook.dts
+ create mode 100644 configs/pinebook_defconfig
+
+diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
+index 3093c1185e..eae6b9ee5d 100644
+--- a/arch/arm/dts/Makefile
++++ b/arch/arm/dts/Makefile
+@@ -406,6 +406,7 @@ dtb-$(CONFIG_MACH_SUN50I) += \
+ 	sun50i-a64-orangepi-win.dtb \
+ 	sun50i-a64-pine64-plus.dtb \
+ 	sun50i-a64-pine64.dtb \
++	sun50i-a64-pinebook.dtb \
+ 	sun50i-a64-sopine-baseboard.dtb
+ dtb-$(CONFIG_MACH_SUN9I) += \
+ 	sun9i-a80-optimus.dtb \
+diff --git a/arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi b/arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi
+new file mode 100644
+index 0000000000..a99b7171d0
+--- /dev/null
++++ b/arch/arm/dts/sun50i-a64-pinebook-u-boot.dtsi
+@@ -0,0 +1,15 @@
++// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
++/*
++ * Copyright (C) 2018 Vasily Khoruzhick <anarsoul@gmail.com>
++ *
++ */
++
++/* The ANX6345 eDP-bridge is on r_i2c */
++&r_i2c {
++	anx6345: edp-bridge@38 {
++		compatible = "analogix,anx6345";
++		reg = <0x38>;
++		reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
++		status = "okay";
++	};
++};
+diff --git a/arch/arm/dts/sun50i-a64-pinebook.dts b/arch/arm/dts/sun50i-a64-pinebook.dts
+new file mode 100644
+index 0000000000..ec537c5297
+--- /dev/null
++++ b/arch/arm/dts/sun50i-a64-pinebook.dts
+@@ -0,0 +1,294 @@
++// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
++/*
++ * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
++ * Copyright (C) 2018 Vasily Khoruzhick <anarsoul@gmail.com>
++ *
++ */
++
++/dts-v1/;
++
++#include "sun50i-a64.dtsi"
++
++#include <dt-bindings/gpio/gpio.h>
++#include <dt-bindings/input/input.h>
++#include <dt-bindings/pwm/pwm.h>
++
++/ {
++	model = "Pinebook";
++	compatible = "pine64,pinebook", "allwinner,sun50i-a64";
++
++	aliases {
++		serial0 = &uart0;
++		ethernet0 = &rtl8723cs;
++	};
++
++	vdd_bl: regulator@0 {
++		compatible = "regulator-fixed";
++		regulator-name = "bl-3v3";
++		regulator-min-microvolt = <3300000>;
++		regulator-max-microvolt = <3300000>;
++		gpio = <&pio 7 6 GPIO_ACTIVE_HIGH>; /* PH6 */
++		enable-active-high;
++	};
++
++	backlight: backlight {
++		compatible = "pwm-backlight";
++		pwms = <&pwm 0 50000 0>;
++		brightness-levels = <0 5 10 15 20 30 40 55 70 85 100>;
++		default-brightness-level = <2>;
++		enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
++		power-supply = <&vdd_bl>;
++	};
++
++	chosen {
++		stdout-path = "serial0:115200n8";
++
++		framebuffer-lcd {
++			panel-supply = <&reg_dc1sw>;
++			dvdd25-supply = <&reg_dldo2>;
++			dvdd12-supply = <&reg_fldo1>;
++		};
++	};
++
++	gpio_keys {
++		compatible = "gpio-keys";
++
++		lid_switch {
++			label = "Lid Switch";
++			gpios = <&r_pio 0 12 GPIO_ACTIVE_LOW>; /* PL12 */
++			linux,input-type = <EV_SW>;
++			linux,code = <SW_LID>;
++			linux,can-disable;
++			wakeup-source;
++		};
++	};
++
++	reg_vcc3v3: vcc3v3 {
++		compatible = "regulator-fixed";
++		regulator-name = "vcc3v3";
++		regulator-min-microvolt = <3300000>;
++		regulator-max-microvolt = <3300000>;
++	};
++
++	wifi_pwrseq: wifi_pwrseq {
++		compatible = "mmc-pwrseq-simple";
++		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
++	};
++};
++
++&ehci0 {
++	phys = <&usbphy 0>;
++	phy-names = "usb";
++	status = "okay";
++};
++
++&ehci1 {
++	status = "okay";
++};
++
++&mmc0 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&mmc0_pins>;
++	vmmc-supply = <&reg_dcdc1>;
++	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
++	disable-wp;
++	bus-width = <4>;
++	status = "okay";
++};
++
++&mmc1 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&mmc1_pins>;
++	vmmc-supply = <&reg_dldo4>;
++	vqmmc-supply = <&reg_eldo1>;
++	mmc-pwrseq = <&wifi_pwrseq>;
++	bus-width = <4>;
++	non-removable;
++	status = "okay";
++
++	rtl8723cs: wifi@1 {
++		reg = <1>;
++	};
++};
++
++&mmc2 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
++	vmmc-supply = <&reg_dcdc1>;
++	vqmmc-supply = <&reg_eldo1>;
++	bus-width = <8>;
++	non-removable;
++	cap-mmc-hw-reset;
++	mmc-hs200-1_8v;
++	status = "okay";
++};
++
++&ohci0 {
++	phys = <&usbphy 0>;
++	phy-names = "usb";
++	status = "okay";
++};
++
++&ohci1 {
++	status = "okay";
++};
++
++&pwm {
++	status = "okay";
++};
++
++&r_rsb {
++	status = "okay";
++
++	axp803: pmic@3a3 {
++		compatible = "x-powers,axp803";
++		reg = <0x3a3>;
++		interrupt-parent = <&r_intc>;
++		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
++	};
++};
++
++/* The ANX6345 eDP-bridge is on r_i2c */
++&r_i2c {
++	clock-frequency = <100000>;
++	pinctrl-names = "default";
++	pinctrl-0 = <&r_i2c_pl89_pins>;
++	status = "okay";
++};
++
++#include "axp803.dtsi"
++
++&reg_aldo1 {
++	regulator-min-microvolt = <2800000>;
++	regulator-max-microvolt = <2800000>;
++	regulator-name = "vcc-csi";
++};
++
++&reg_aldo2 {
++	regulator-always-on;
++	regulator-min-microvolt = <1800000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-pl";
++};
++
++&reg_aldo3 {
++	regulator-always-on;
++	regulator-min-microvolt = <2700000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-pll-avcc";
++};
++
++&reg_dc1sw {
++	regulator-name = "vcc-lcd";
++};
++
++&reg_dcdc1 {
++	regulator-always-on;
++	regulator-min-microvolt = <3300000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-3v3";
++};
++
++&reg_dcdc2 {
++	regulator-always-on;
++	regulator-min-microvolt = <1000000>;
++	regulator-max-microvolt = <1300000>;
++	regulator-name = "vdd-cpux";
++};
++
++/* DCDC3 is polyphased with DCDC2 */
++
++&reg_dcdc5 {
++	regulator-always-on;
++	regulator-min-microvolt = <1200000>;
++	regulator-max-microvolt = <1200000>;
++	regulator-name = "vcc-dram";
++};
++
++&reg_dcdc6 {
++	regulator-always-on;
++	regulator-min-microvolt = <1100000>;
++	regulator-max-microvolt = <1100000>;
++	regulator-name = "vdd-sys";
++};
++
++&reg_dldo1 {
++	regulator-min-microvolt = <3300000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-hdmi";
++};
++
++&reg_dldo2 {
++	regulator-min-microvolt = <2500000>;
++	regulator-max-microvolt = <2500000>;
++	regulator-name = "vcc-edp";
++};
++
++&reg_dldo3 {
++	regulator-min-microvolt = <3300000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "avdd-csi";
++};
++
++&reg_dldo4 {
++	regulator-min-microvolt = <3300000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-wifi";
++};
++
++&reg_eldo1 {
++	regulator-always-on;
++	regulator-min-microvolt = <1800000>;
++	regulator-max-microvolt = <1800000>;
++	regulator-name = "cpvdd";
++};
++
++&reg_eldo3 {
++	regulator-min-microvolt = <1800000>;
++	regulator-max-microvolt = <1800000>;
++	regulator-name = "vdd-1v8-csi";
++};
++
++&reg_fldo1 {
++	regulator-min-microvolt = <1200000>;
++	regulator-max-microvolt = <1200000>;
++	regulator-name = "vcc-1v2-hsic";
++};
++
++&reg_fldo2 {
++	regulator-always-on;
++	regulator-min-microvolt = <1100000>;
++	regulator-max-microvolt = <1100000>;
++	regulator-name = "vdd-cpus";
++};
++
++&reg_ldo_io0 {
++	regulator-min-microvolt = <3300000>;
++	regulator-max-microvolt = <3300000>;
++	regulator-name = "vcc-usb";
++	status = "okay";
++};
++
++&reg_rtc_ldo {
++	regulator-name = "vcc-rtc";
++};
++
++&simplefb_hdmi {
++	vcc-hdmi-supply = <&reg_dldo1>;
++};
++
++&uart0 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&uart0_pb_pins>;
++	status = "okay";
++};
++
++&usb_otg {
++	dr_mode = "host";
++};
++
++&usbphy {
++	usb0_vbus-supply = <&reg_ldo_io0>;
++	usb1_vbus-supply = <&reg_ldo_io0>;
++	status = "okay";
++};
+diff --git a/configs/pinebook_defconfig b/configs/pinebook_defconfig
+new file mode 100644
+index 0000000000..5294dbd2eb
+--- /dev/null
++++ b/configs/pinebook_defconfig
+@@ -0,0 +1,22 @@
++CONFIG_ARM=y
++CONFIG_ARCH_SUNXI=y
++CONFIG_SPL=y
++CONFIG_MACH_SUN50I=y
++CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y
++CONFIG_DRAM_CLK=552
++CONFIG_DRAM_ZQ=3881949
++CONFIG_MMC_SUNXI_SLOT_EXTRA=2
++CONFIG_R_I2C_ENABLE=y
++# CONFIG_CMD_FLASH is not set
++# CONFIG_SPL_DOS_PARTITION is not set
++# CONFIG_SPL_EFI_PARTITION is not set
++CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinebook"
++CONFIG_DM_REGULATOR=y
++CONFIG_DM_REGULATOR_FIXED=y
++CONFIG_DM_PWM=y
++CONFIG_PWM_SUNXI=y
++CONFIG_USB_EHCI_HCD=y
++CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
++# CONFIG_USB_GADGET is not set
++CONFIG_VIDEO_BRIDGE=y
++CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345=y
+-- 
+2.11.0
+
diff --git a/gnu/packages/patches/u-boot-pinebook-mmc-calibration.patch b/gnu/packages/patches/u-boot-pinebook-mmc-calibration.patch
new file mode 100644
index 0000000000..118bdf8e0c
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-mmc-calibration.patch
@@ -0,0 +1,98 @@
+From 20940ef2a397446a209350900d3bd618c3fd5b94 Mon Sep 17 00:00:00 2001
+From: Vasily Khoruzhick <anarsoul@gmail.com>
+Date: Mon, 5 Nov 2018 20:24:28 -0800
+Subject: [PATCH 07/13] mmc: sunxi: add support for automatic delay calibration
+
+A64 and H6 support automatic delay calibration and Linux driver uses it
+instead of hardcoded delays. Add support for it to u-boot driver.
+
+Fixes eMMC instability on Pinebook
+
+Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
+Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Reviewed-by: Andre Przywara <andre.przywara@arm.com>
+Cc: Vagrant Cascadian <vagrant@debian.org>
+Reviewed-by: Jagan Teki <jagan@openedev.com>
+---
+ arch/arm/include/asm/arch-sunxi/mmc.h |  6 +++++-
+ drivers/mmc/sunxi_mmc.c               | 21 ++++++++++++++++++++-
+ 2 files changed, 25 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h b/arch/arm/include/asm/arch-sunxi/mmc.h
+index d98c53faaa..f2deafddd2 100644
+--- a/arch/arm/include/asm/arch-sunxi/mmc.h
++++ b/arch/arm/include/asm/arch-sunxi/mmc.h
+@@ -46,7 +46,9 @@ struct sunxi_mmc {
+ 	u32 cbda;		/* 0x94 */
+ 	u32 res2[26];
+ #if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_MACH_SUN50I_H6)
+-	u32 res3[64];
++	u32 res3[17];
++	u32 samp_dl;
++	u32 res4[46];
+ #endif
+ 	u32 fifo;		/* 0x100 / 0x200 FIFO access address */
+ };
+@@ -130,5 +132,7 @@ struct sunxi_mmc {
+ #define SUNXI_MMC_COMMON_CLK_GATE		(1 << 16)
+ #define SUNXI_MMC_COMMON_RESET			(1 << 18)
+ 
++#define SUNXI_MMC_CAL_DL_SW_EN		(0x1 << 7)
++
+ struct mmc *sunxi_mmc_init(int sdc_no);
+ #endif /* _SUNXI_MMC_H */
+diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
+index 39f15eb423..147eb9b4d5 100644
+--- a/drivers/mmc/sunxi_mmc.c
++++ b/drivers/mmc/sunxi_mmc.c
+@@ -99,11 +99,16 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
+ {
+ 	unsigned int pll, pll_hz, div, n, oclk_dly, sclk_dly;
+ 	bool new_mode = false;
++	bool calibrate = false;
+ 	u32 val = 0;
+ 
+ 	if (IS_ENABLED(CONFIG_MMC_SUNXI_HAS_NEW_MODE) && (priv->mmc_no == 2))
+ 		new_mode = true;
+ 
++#if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H6)
++	calibrate = true;
++#endif
++
+ 	/*
+ 	 * The MMC clock has an extra /2 post-divider when operating in the new
+ 	 * mode.
+@@ -174,7 +179,11 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz)
+ 		val = CCM_MMC_CTRL_MODE_SEL_NEW;
+ 		setbits_le32(&priv->reg->ntsr, SUNXI_MMC_NTSR_MODE_SEL_NEW);
+ #endif
+-	} else {
++	} else if (!calibrate) {
++		/*
++		 * Use hardcoded delay values if controller doesn't support
++		 * calibration
++		 */
+ 		val = CCM_MMC_CTRL_OCLK_DLY(oclk_dly) |
+ 			CCM_MMC_CTRL_SCLK_DLY(sclk_dly);
+ 	}
+@@ -228,6 +237,16 @@ static int mmc_config_clock(struct sunxi_mmc_priv *priv, struct mmc *mmc)
+ 	rval &= ~SUNXI_MMC_CLK_DIVIDER_MASK;
+ 	writel(rval, &priv->reg->clkcr);
+ 
++#if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H6)
++	/* A64 supports calibration of delays on MMC controller and we
++	 * have to set delay of zero before starting calibration.
++	 * Allwinner BSP driver sets a delay only in the case of
++	 * using HS400 which is not supported by mainline U-Boot or
++	 * Linux at the moment
++	 */
++	writel(SUNXI_MMC_CAL_DL_SW_EN, &priv->reg->samp_dl);
++#endif
++
+ 	/* Re-enable Clock */
+ 	rval |= SUNXI_MMC_CLK_ENABLE;
+ 	writel(rval, &priv->reg->clkcr);
+-- 
+2.11.0
+
diff --git a/gnu/packages/patches/u-boot-pinebook-r_i2c-controller.patch b/gnu/packages/patches/u-boot-pinebook-r_i2c-controller.patch
new file mode 100644
index 0000000000..824a16b9db
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-r_i2c-controller.patch
@@ -0,0 +1,70 @@
+From 31a4ac4d79d75baeede3edfa95515fd4169ef502 Mon Sep 17 00:00:00 2001
+From: Vasily Khoruzhick <anarsoul@gmail.com>
+Date: Mon, 5 Nov 2018 20:24:30 -0800
+Subject: [PATCH 09/13] sun50i: A64: add support for R_I2C controller
+
+Allwinner A64 has a I2C controller, which is in the R_ MMIO zone and has
+two groups of pinmuxes on PL bank, so it's called R_I2C.
+
+Add support for this I2C controller and the pinmux which doesn't conflict
+with RSB.
+
+Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
+Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Cc: Vagrant Cascadian <vagrant@debian.org>
+Acked-by: Jagan Teki <jagan@openedev.com>
+---
+ arch/arm/include/asm/arch-sunxi/gpio.h | 1 +
+ arch/arm/mach-sunxi/Kconfig            | 1 +
+ board/sunxi/board.c                    | 6 ++++++
+ 3 files changed, 8 insertions(+)
+
+diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
+index 6a5eafc3d3..2daf23f6f5 100644
+--- a/arch/arm/include/asm/arch-sunxi/gpio.h
++++ b/arch/arm/include/asm/arch-sunxi/gpio.h
+@@ -211,6 +211,7 @@ enum sunxi_gpio_number {
+ #define SUN8I_H3_GPL_R_TWI	2
+ #define SUN8I_A23_GPL_R_TWI	3
+ #define SUN8I_GPL_R_UART	2
++#define SUN50I_GPL_R_TWI	2
+ 
+ #define SUN9I_GPN_R_RSB		3
+ 
+diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
+index 6277abc3cc..560dc9b25d 100644
+--- a/arch/arm/mach-sunxi/Kconfig
++++ b/arch/arm/mach-sunxi/Kconfig
+@@ -278,6 +278,7 @@ config MACH_SUN50I
+ 	select ARM64
+ 	select DM_I2C
+ 	select PHY_SUN4I_USB
++	select SUN6I_PRCM
+ 	select SUNXI_DE2
+ 	select SUNXI_GEN_SUN6I
+ 	select SUPPORT_SPL
+diff --git a/board/sunxi/board.c b/board/sunxi/board.c
+index b196d48674..64ccbc7245 100644
+--- a/board/sunxi/board.c
++++ b/board/sunxi/board.c
+@@ -168,10 +168,16 @@ void i2c_init_board(void)
+ #endif
+ 
+ #ifdef CONFIG_R_I2C_ENABLE
++#ifdef CONFIG_MACH_SUN50I
++	clock_twi_onoff(5, 1);
++	sunxi_gpio_set_cfgpin(SUNXI_GPL(8), SUN50I_GPL_R_TWI);
++	sunxi_gpio_set_cfgpin(SUNXI_GPL(9), SUN50I_GPL_R_TWI);
++#else
+ 	clock_twi_onoff(5, 1);
+ 	sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_H3_GPL_R_TWI);
+ 	sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_H3_GPL_R_TWI);
+ #endif
++#endif
+ }
+ 
+ #if defined(CONFIG_ENV_IS_IN_MMC) && defined(CONFIG_ENV_IS_IN_FAT)
+-- 
+2.11.0
+
diff --git a/gnu/packages/patches/u-boot-pinebook-syscon-node.patch b/gnu/packages/patches/u-boot-pinebook-syscon-node.patch
new file mode 100644
index 0000000000..9289645bec
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-syscon-node.patch
@@ -0,0 +1,38 @@
+From ababb5920e8992c9bb7956df3cc85dc68d27dfe8 Mon Sep 17 00:00:00 2001
+From: Andre Przywara <andre.przywara@arm.com>
+Date: Mon, 29 Oct 2018 00:56:48 +0000
+Subject: [PATCH 04/13] sunxi: A64: Re-add syscon to DT node
+
+The sun50i-a64.dtsi changes introduced in Linux v4.19-rc1 changed the
+compatible name for the syscon controller, dropping the generic "syscon"
+fallback. Using this new DT node will make the Ethernet driver in every
+older kernel (or non-Linux kernels) fail to initialise the MAC device.
+
+To allow booting distribution kernels (from installer images via UEFI,
+for instance), re-add the syscon compatible string as a fallback. This
+works with both older and newer kernels.
+
+Signed-off-by: Andre Przywara <andre.przywara@arm.com>
+Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Reviewed-by: Jagan Teki <jagan@openedev.com>
+---
+ arch/arm/dts/sun50i-a64.dtsi | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/arch/arm/dts/sun50i-a64.dtsi b/arch/arm/dts/sun50i-a64.dtsi
+index f3a66f8882..ff41abc96a 100644
+--- a/arch/arm/dts/sun50i-a64.dtsi
++++ b/arch/arm/dts/sun50i-a64.dtsi
+@@ -259,7 +259,8 @@
+ 		};
+ 
+ 		syscon: syscon@1c00000 {
+-			compatible = "allwinner,sun50i-a64-system-control";
++			compatible = "allwinner,sun50i-a64-system-control",
++				"syscon";
+ 			reg = <0x01c00000 0x1000>;
+ 			#address-cells = <1>;
+ 			#size-cells = <1>;
+-- 
+2.11.0
+
diff --git a/gnu/packages/patches/u-boot-pinebook-video-bridge.patch b/gnu/packages/patches/u-boot-pinebook-video-bridge.patch
new file mode 100644
index 0000000000..8c6ca8a992
--- /dev/null
+++ b/gnu/packages/patches/u-boot-pinebook-video-bridge.patch
@@ -0,0 +1,50 @@
+From 8336a43792a103c13d939b3925cb75322911f7fb Mon Sep 17 00:00:00 2001
+From: Vasily Khoruzhick <anarsoul@gmail.com>
+Date: Mon, 5 Nov 2018 20:24:29 -0800
+Subject: [PATCH 08/13] dm: video: bridge: don't fail to activate bridge if
+ reset or sleep GPIO is missing
+
+Both GPIOs are optional, so we shouldn't fail if any is missing.
+Without this fix reset is not deasserted if sleep GPIO is missing.
+
+Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
+Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>
+Reviewed-by: Andre Przywara <andre.przywara@arm.com>
+Cc: Vagrant Cascadian <vagrant@debian.org>
+---
+ drivers/video/bridge/video-bridge-uclass.c | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c
+index cd4959cc71..5fecb4cfd5 100644
+--- a/drivers/video/bridge/video-bridge-uclass.c
++++ b/drivers/video/bridge/video-bridge-uclass.c
+@@ -106,13 +106,19 @@ static int video_bridge_pre_probe(struct udevice *dev)
+ int video_bridge_set_active(struct udevice *dev, bool active)
+ {
+ 	struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev);
+-	int ret;
++	int ret = 0;
+ 
+ 	debug("%s: %d\n", __func__, active);
+-	ret = dm_gpio_set_value(&uc_priv->sleep, !active);
+-	if (ret)
+-		return ret;
+-	if (active) {
++	if (uc_priv->sleep.dev) {
++		ret = dm_gpio_set_value(&uc_priv->sleep, !active);
++		if (ret)
++			return ret;
++	}
++
++	if (!active)
++		return 0;
++
++	if (uc_priv->reset.dev) {
+ 		ret = dm_gpio_set_value(&uc_priv->reset, true);
+ 		if (ret)
+ 			return ret;
+-- 
+2.11.0
+
diff --git a/gnu/packages/patches/vsearch-unbundle-cityhash.patch b/gnu/packages/patches/vsearch-unbundle-cityhash.patch
index b1ecb1f063..2a2ab13a73 100644
--- a/gnu/packages/patches/vsearch-unbundle-cityhash.patch
+++ b/gnu/packages/patches/vsearch-unbundle-cityhash.patch
@@ -6,7 +6,7 @@ index e56a8a2..4adcc48 100644
  if TARGET_PPC
  AM_CXXFLAGS=-Wall -Wsign-compare -O3 -g -mcpu=power8
  else
--AM_CXXFLAGS=-Wall -Wsign-compare -O3 -g
+-AM_CXXFLAGS=-Wall -Wsign-compare -O3 -g -march=x86-64 -mtune=generic
 +AM_CXXFLAGS=-Wall -Wsign-compare -O3 -g -lcityhash
  endif
  
@@ -39,7 +39,7 @@ index e56a8a2..4adcc48 100644
 -
  if TARGET_WIN
  
--libcityhash_a_CXXFLAGS = -Wall -Wno-sign-compare -O3 -g -D_MSC_VER
+-libcityhash_a_CXXFLAGS = $(AM_CXXFLAGS) -Wno-sign-compare -D_MSC_VER
 -__top_builddir__bin_vsearch_LDFLAGS = -static
 -__top_builddir__bin_vsearch_LDADD = libregex.a libcityhash.a libcpu_ssse3.a libcpu_sse2.a
 +__top_builddir__bin_vsearch_LDFLAGS = -static -lcityhash
@@ -47,7 +47,7 @@ index e56a8a2..4adcc48 100644
  
  else
  
--libcityhash_a_CXXFLAGS = -Wall -Wno-sign-compare -O3 -g
+-libcityhash_a_CXXFLAGS = $(AM_CXXFLAGS) -Wno-sign-compare
 -
  if TARGET_PPC
 -__top_builddir__bin_vsearch_LDADD = libcityhash.a libcpu.a
diff --git a/gnu/packages/patches/wxmaxima-do-not-use-old-gnuplot-parameters.patch b/gnu/packages/patches/wxmaxima-do-not-use-old-gnuplot-parameters.patch
deleted file mode 100644
index 345101bd3a..0000000000
--- a/gnu/packages/patches/wxmaxima-do-not-use-old-gnuplot-parameters.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-This fixes the wxplot2d plotting issue found at
-https://github.com/andrejv/wxmaxima/issues/973.
-
-From 5a0693c97ceaa4935b908f1e478126896952f399 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Gunter=20K=C3=B6nigsmann?= <gunter@peterpall.de>
-Date: Mon, 19 Feb 2018 05:37:35 +0100
-Subject: [PATCH] Seems I accidentally made wxMaxima to default to parameters
- for old gnuplots. Resolves #973
-
----
- data/wxmathml.lisp.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/data/wxmathml.lisp.in b/data/wxmathml.lisp.in
-index a32e3fc3..4e19acaf 100644
---- a/data/wxmathml.lisp.in
-+++ b/data/wxmathml.lisp.in
-@@ -43,7 +43,7 @@
- (defvar $wxsubscripts t
-   "Recognize TeX-style subscripts")
- (defvar $wxplot_pngcairo nil "Use gnuplot's pngcairo terminal for new plots?")
--(defmvar $wxplot_old_gnuplot t)
-+(defmvar $wxplot_old_gnuplot nil)
- 
- (defun $wxstatusbar (status)
-   (format t "<statusbar>~a</statusbar>~%" status))
diff --git a/gnu/packages/patches/x265-arm-asm-primitives.patch b/gnu/packages/patches/x265-arm-asm-primitives.patch
deleted file mode 100644
index f49aafe577..0000000000
--- a/gnu/packages/patches/x265-arm-asm-primitives.patch
+++ /dev/null
@@ -1,360 +0,0 @@
-From <https://git.busybox.net/buildroot/tree/package/x265/0003-arm-asm-primitives.patch?id=57d4a27eaf1a9e59d767c321e7b7500c5060a2ac>.
-This fixes build errors like:
-
-  cd /tmp/guix-build-x265-2.8.drv-0/x265_2.8/build/encoder && /gnu/store/cd5q2pni1d95fs3cdabbclyh9hqhw2nq-gcc-5.5.0/bin/c++  -DEXPORT_C_API=1 -DHAVE_ARMV6=1 -DHAVE_INT_TYPES_H=1 -DHAVE_NEON -DHIGH_BIT_DEPTH=0 -DX265_ARCH_ARM=1 -DX265_DEPTH=8 -DX265_NS=x265 -D__STDC_LIMIT_MACROS=1 -I/tmp/guix-build-x265-2.8.drv-0/x265_2.8/source/. -I/tmp/guix-build-x265-2.8.drv-0/x265_2.8/source/common -I/tmp/guix-build-x265-2.8.drv-0/x265_2.8/source/encoder -I/tmp/guix-build-x265-2.8.drv-0/x265_2.8/build  -O2 -g -DNDEBUG   -Wall -Wextra -Wshadow -std=gnu++98 -fPIC -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC -Wno-array-bounds -ffast-math -fno-exceptions -Wno-uninitialized -o CMakeFiles/encoder.dir/search.cpp.o -c /tmp/guix-build-x265-2.8.drv-0/x265_2.8/source/encoder/search.cpp
-  /tmp/guix-build-x265-2.8.drv-0/x265_2.8/source/common/arm/asm-primitives.cpp:437:38: error: incompatible types in assignment of ?void(const pixel*, intptr_t, int16_t*, intptr_t) {aka void(const unsigned char*, int, short int*, int)}? to ?void (* [2])(const pixel*, intptr_t, int16_t*, intptr_t) {aka void (* [2])(const unsigned char*, int, short int*, int)}?
-	   p.pu[LUMA_64x48].convert_p2s = PFX(filterPixelToShort_64x48_neon);
-					^
-
-Downloaded from upstream bug report:
-https://bitbucket.org/multicoreware/x265/issues/406
-
-Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
-
---- ./source/common/arm/asm-primitives.cpp.orig	2018-05-21 02:33:10.000000000 -0600
-+++ ./source/common/arm/asm-primitives.cpp	2018-05-28 20:38:37.302378303 -0600
-@@ -48,77 +48,77 @@ void setupAssemblyPrimitives(EncoderPrim
-         p.ssim_4x4x2_core = PFX(ssim_4x4x2_core_neon);
- 
-         // addAvg
--         p.pu[LUMA_4x4].addAvg   = PFX(addAvg_4x4_neon);
--         p.pu[LUMA_4x8].addAvg   = PFX(addAvg_4x8_neon);
--         p.pu[LUMA_4x16].addAvg  = PFX(addAvg_4x16_neon);
--         p.pu[LUMA_8x4].addAvg   = PFX(addAvg_8x4_neon);
--         p.pu[LUMA_8x8].addAvg   = PFX(addAvg_8x8_neon);
--         p.pu[LUMA_8x16].addAvg  = PFX(addAvg_8x16_neon);
--         p.pu[LUMA_8x32].addAvg  = PFX(addAvg_8x32_neon);
--         p.pu[LUMA_12x16].addAvg = PFX(addAvg_12x16_neon);
--         p.pu[LUMA_16x4].addAvg  = PFX(addAvg_16x4_neon);
--         p.pu[LUMA_16x8].addAvg  = PFX(addAvg_16x8_neon);
--         p.pu[LUMA_16x12].addAvg = PFX(addAvg_16x12_neon);
--         p.pu[LUMA_16x16].addAvg = PFX(addAvg_16x16_neon);
--         p.pu[LUMA_16x32].addAvg = PFX(addAvg_16x32_neon);
--         p.pu[LUMA_16x64].addAvg = PFX(addAvg_16x64_neon);
--         p.pu[LUMA_24x32].addAvg = PFX(addAvg_24x32_neon);
--         p.pu[LUMA_32x8].addAvg  = PFX(addAvg_32x8_neon);
--         p.pu[LUMA_32x16].addAvg = PFX(addAvg_32x16_neon);
--         p.pu[LUMA_32x24].addAvg = PFX(addAvg_32x24_neon);
--         p.pu[LUMA_32x32].addAvg = PFX(addAvg_32x32_neon);
--         p.pu[LUMA_32x64].addAvg = PFX(addAvg_32x64_neon);
--         p.pu[LUMA_48x64].addAvg = PFX(addAvg_48x64_neon);
--         p.pu[LUMA_64x16].addAvg = PFX(addAvg_64x16_neon);
--         p.pu[LUMA_64x32].addAvg = PFX(addAvg_64x32_neon);
--         p.pu[LUMA_64x48].addAvg = PFX(addAvg_64x48_neon);
--         p.pu[LUMA_64x64].addAvg = PFX(addAvg_64x64_neon);
-+         p.pu[LUMA_4x4].addAvg[ALIGNED]   = PFX(addAvg_4x4_neon);
-+         p.pu[LUMA_4x8].addAvg[ALIGNED]   = PFX(addAvg_4x8_neon);
-+         p.pu[LUMA_4x16].addAvg[ALIGNED]  = PFX(addAvg_4x16_neon);
-+         p.pu[LUMA_8x4].addAvg[ALIGNED]   = PFX(addAvg_8x4_neon);
-+         p.pu[LUMA_8x8].addAvg[ALIGNED]   = PFX(addAvg_8x8_neon);
-+         p.pu[LUMA_8x16].addAvg[ALIGNED]  = PFX(addAvg_8x16_neon);
-+         p.pu[LUMA_8x32].addAvg[ALIGNED]  = PFX(addAvg_8x32_neon);
-+         p.pu[LUMA_12x16].addAvg[ALIGNED] = PFX(addAvg_12x16_neon);
-+         p.pu[LUMA_16x4].addAvg[ALIGNED]  = PFX(addAvg_16x4_neon);
-+         p.pu[LUMA_16x8].addAvg[ALIGNED]  = PFX(addAvg_16x8_neon);
-+         p.pu[LUMA_16x12].addAvg[ALIGNED] = PFX(addAvg_16x12_neon);
-+         p.pu[LUMA_16x16].addAvg[ALIGNED] = PFX(addAvg_16x16_neon);
-+         p.pu[LUMA_16x32].addAvg[ALIGNED] = PFX(addAvg_16x32_neon);
-+         p.pu[LUMA_16x64].addAvg[ALIGNED] = PFX(addAvg_16x64_neon);
-+         p.pu[LUMA_24x32].addAvg[ALIGNED] = PFX(addAvg_24x32_neon);
-+         p.pu[LUMA_32x8].addAvg[ALIGNED]  = PFX(addAvg_32x8_neon);
-+         p.pu[LUMA_32x16].addAvg[ALIGNED] = PFX(addAvg_32x16_neon);
-+         p.pu[LUMA_32x24].addAvg[ALIGNED] = PFX(addAvg_32x24_neon);
-+         p.pu[LUMA_32x32].addAvg[ALIGNED] = PFX(addAvg_32x32_neon);
-+         p.pu[LUMA_32x64].addAvg[ALIGNED] = PFX(addAvg_32x64_neon);
-+         p.pu[LUMA_48x64].addAvg[ALIGNED] = PFX(addAvg_48x64_neon);
-+         p.pu[LUMA_64x16].addAvg[ALIGNED] = PFX(addAvg_64x16_neon);
-+         p.pu[LUMA_64x32].addAvg[ALIGNED] = PFX(addAvg_64x32_neon);
-+         p.pu[LUMA_64x48].addAvg[ALIGNED] = PFX(addAvg_64x48_neon);
-+         p.pu[LUMA_64x64].addAvg[ALIGNED] = PFX(addAvg_64x64_neon);
- 
-         // chroma addAvg
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x2].addAvg   = PFX(addAvg_4x2_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x4].addAvg   = PFX(addAvg_4x4_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x8].addAvg   = PFX(addAvg_4x8_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x16].addAvg  = PFX(addAvg_4x16_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_6x8].addAvg   = PFX(addAvg_6x8_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x2].addAvg   = PFX(addAvg_8x2_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x4].addAvg   = PFX(addAvg_8x4_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x6].addAvg   = PFX(addAvg_8x6_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x8].addAvg   = PFX(addAvg_8x8_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x16].addAvg  = PFX(addAvg_8x16_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x32].addAvg  = PFX(addAvg_8x32_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_12x16].addAvg = PFX(addAvg_12x16_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_16x4].addAvg  = PFX(addAvg_16x4_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_16x8].addAvg  = PFX(addAvg_16x8_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_16x12].addAvg = PFX(addAvg_16x12_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_16x16].addAvg = PFX(addAvg_16x16_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_16x32].addAvg = PFX(addAvg_16x32_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_24x32].addAvg = PFX(addAvg_24x32_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_32x8].addAvg  = PFX(addAvg_32x8_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_32x16].addAvg = PFX(addAvg_32x16_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_32x24].addAvg = PFX(addAvg_32x24_neon);
--        p.chroma[X265_CSP_I420].pu[CHROMA_420_32x32].addAvg = PFX(addAvg_32x32_neon);
--
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_4x8].addAvg   = PFX(addAvg_4x8_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_4x16].addAvg  = PFX(addAvg_4x16_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_4x32].addAvg  = PFX(addAvg_4x32_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_6x16].addAvg  = PFX(addAvg_6x16_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x4].addAvg   = PFX(addAvg_8x4_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x8].addAvg   = PFX(addAvg_8x8_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x12].addAvg  = PFX(addAvg_8x12_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x16].addAvg  = PFX(addAvg_8x16_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x32].addAvg  = PFX(addAvg_8x32_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x64].addAvg  = PFX(addAvg_8x64_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_12x32].addAvg = PFX(addAvg_12x32_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_16x8].addAvg  = PFX(addAvg_16x8_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_16x16].addAvg = PFX(addAvg_16x16_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_16x24].addAvg = PFX(addAvg_16x24_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_16x32].addAvg = PFX(addAvg_16x32_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_16x64].addAvg = PFX(addAvg_16x64_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_24x64].addAvg = PFX(addAvg_24x64_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_32x16].addAvg = PFX(addAvg_32x16_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_32x32].addAvg = PFX(addAvg_32x32_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_32x48].addAvg = PFX(addAvg_32x48_neon);
--        p.chroma[X265_CSP_I422].pu[CHROMA_422_32x64].addAvg = PFX(addAvg_32x64_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x2].addAvg[ALIGNED]   = PFX(addAvg_4x2_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x4].addAvg[ALIGNED]   = PFX(addAvg_4x4_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x8].addAvg[ALIGNED]   = PFX(addAvg_4x8_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_4x16].addAvg[ALIGNED]  = PFX(addAvg_4x16_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_6x8].addAvg[ALIGNED]   = PFX(addAvg_6x8_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x2].addAvg[ALIGNED]   = PFX(addAvg_8x2_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x4].addAvg[ALIGNED]   = PFX(addAvg_8x4_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x6].addAvg[ALIGNED]   = PFX(addAvg_8x6_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x8].addAvg[ALIGNED]   = PFX(addAvg_8x8_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x16].addAvg[ALIGNED]  = PFX(addAvg_8x16_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_8x32].addAvg[ALIGNED]  = PFX(addAvg_8x32_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_12x16].addAvg[ALIGNED] = PFX(addAvg_12x16_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_16x4].addAvg[ALIGNED]  = PFX(addAvg_16x4_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_16x8].addAvg[ALIGNED]  = PFX(addAvg_16x8_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_16x12].addAvg[ALIGNED] = PFX(addAvg_16x12_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_16x16].addAvg[ALIGNED] = PFX(addAvg_16x16_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_16x32].addAvg[ALIGNED] = PFX(addAvg_16x32_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_24x32].addAvg[ALIGNED] = PFX(addAvg_24x32_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_32x8].addAvg[ALIGNED]  = PFX(addAvg_32x8_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_32x16].addAvg[ALIGNED] = PFX(addAvg_32x16_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_32x24].addAvg[ALIGNED] = PFX(addAvg_32x24_neon);
-+        p.chroma[X265_CSP_I420].pu[CHROMA_420_32x32].addAvg[ALIGNED] = PFX(addAvg_32x32_neon);
-+
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_4x8].addAvg[ALIGNED]   = PFX(addAvg_4x8_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_4x16].addAvg[ALIGNED]  = PFX(addAvg_4x16_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_4x32].addAvg[ALIGNED]  = PFX(addAvg_4x32_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_6x16].addAvg[ALIGNED]  = PFX(addAvg_6x16_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x4].addAvg[ALIGNED]   = PFX(addAvg_8x4_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x8].addAvg[ALIGNED]   = PFX(addAvg_8x8_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x12].addAvg[ALIGNED]  = PFX(addAvg_8x12_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x16].addAvg[ALIGNED]  = PFX(addAvg_8x16_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x32].addAvg[ALIGNED]  = PFX(addAvg_8x32_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_8x64].addAvg[ALIGNED]  = PFX(addAvg_8x64_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_12x32].addAvg[ALIGNED] = PFX(addAvg_12x32_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_16x8].addAvg[ALIGNED]  = PFX(addAvg_16x8_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_16x16].addAvg[ALIGNED] = PFX(addAvg_16x16_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_16x24].addAvg[ALIGNED] = PFX(addAvg_16x24_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_16x32].addAvg[ALIGNED] = PFX(addAvg_16x32_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_16x64].addAvg[ALIGNED] = PFX(addAvg_16x64_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_24x64].addAvg[ALIGNED] = PFX(addAvg_24x64_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_32x16].addAvg[ALIGNED] = PFX(addAvg_32x16_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_32x32].addAvg[ALIGNED] = PFX(addAvg_32x32_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_32x48].addAvg[ALIGNED] = PFX(addAvg_32x48_neon);
-+        p.chroma[X265_CSP_I422].pu[CHROMA_422_32x64].addAvg[ALIGNED] = PFX(addAvg_32x64_neon);
- 
-         // quant
-          p.quant = PFX(quant_neon);
-@@ -402,7 +402,7 @@ void setupAssemblyPrimitives(EncoderPrim
-         p.scale2D_64to32  = PFX(scale2D_64to32_neon);
- 
-         // scale1D_128to64
--        p.scale1D_128to64 = PFX(scale1D_128to64_neon);
-+        p.scale1D_128to64[ALIGNED] = PFX(scale1D_128to64_neon);
- 
-         // copy_count
-         p.cu[BLOCK_4x4].copy_cnt     = PFX(copy_cnt_4_neon);
-@@ -411,37 +411,37 @@ void setupAssemblyPrimitives(EncoderPrim
-         p.cu[BLOCK_32x32].copy_cnt   = PFX(copy_cnt_32_neon);
- 
-         // filterPixelToShort
--        p.pu[LUMA_4x4].convert_p2s   = PFX(filterPixelToShort_4x4_neon);
--        p.pu[LUMA_4x8].convert_p2s   = PFX(filterPixelToShort_4x8_neon);
--        p.pu[LUMA_4x16].convert_p2s  = PFX(filterPixelToShort_4x16_neon);
--        p.pu[LUMA_8x4].convert_p2s   = PFX(filterPixelToShort_8x4_neon);
--        p.pu[LUMA_8x8].convert_p2s   = PFX(filterPixelToShort_8x8_neon);
--        p.pu[LUMA_8x16].convert_p2s  = PFX(filterPixelToShort_8x16_neon);
--        p.pu[LUMA_8x32].convert_p2s  = PFX(filterPixelToShort_8x32_neon);
--        p.pu[LUMA_12x16].convert_p2s = PFX(filterPixelToShort_12x16_neon);
--        p.pu[LUMA_16x4].convert_p2s  = PFX(filterPixelToShort_16x4_neon);
--        p.pu[LUMA_16x8].convert_p2s  = PFX(filterPixelToShort_16x8_neon);
--        p.pu[LUMA_16x12].convert_p2s = PFX(filterPixelToShort_16x12_neon);
--        p.pu[LUMA_16x16].convert_p2s = PFX(filterPixelToShort_16x16_neon);
--        p.pu[LUMA_16x32].convert_p2s = PFX(filterPixelToShort_16x32_neon);
--        p.pu[LUMA_16x64].convert_p2s = PFX(filterPixelToShort_16x64_neon);
--        p.pu[LUMA_24x32].convert_p2s = PFX(filterPixelToShort_24x32_neon);
--        p.pu[LUMA_32x8].convert_p2s  = PFX(filterPixelToShort_32x8_neon);
--        p.pu[LUMA_32x16].convert_p2s = PFX(filterPixelToShort_32x16_neon);
--        p.pu[LUMA_32x24].convert_p2s = PFX(filterPixelToShort_32x24_neon);
--        p.pu[LUMA_32x32].convert_p2s = PFX(filterPixelToShort_32x32_neon);
--        p.pu[LUMA_32x64].convert_p2s = PFX(filterPixelToShort_32x64_neon);
--        p.pu[LUMA_48x64].convert_p2s = PFX(filterPixelToShort_48x64_neon);
--        p.pu[LUMA_64x16].convert_p2s = PFX(filterPixelToShort_64x16_neon);
--        p.pu[LUMA_64x32].convert_p2s = PFX(filterPixelToShort_64x32_neon);
--        p.pu[LUMA_64x48].convert_p2s = PFX(filterPixelToShort_64x48_neon);
--        p.pu[LUMA_64x64].convert_p2s = PFX(filterPixelToShort_64x64_neon);
-+        p.pu[LUMA_4x4].convert_p2s[ALIGNED]   = PFX(filterPixelToShort_4x4_neon);
-+        p.pu[LUMA_4x8].convert_p2s[ALIGNED]   = PFX(filterPixelToShort_4x8_neon);
-+        p.pu[LUMA_4x16].convert_p2s[ALIGNED]  = PFX(filterPixelToShort_4x16_neon);
-+        p.pu[LUMA_8x4].convert_p2s[ALIGNED]   = PFX(filterPixelToShort_8x4_neon);
-+        p.pu[LUMA_8x8].convert_p2s[ALIGNED]   = PFX(filterPixelToShort_8x8_neon);
-+        p.pu[LUMA_8x16].convert_p2s[ALIGNED]  = PFX(filterPixelToShort_8x16_neon);
-+        p.pu[LUMA_8x32].convert_p2s[ALIGNED]  = PFX(filterPixelToShort_8x32_neon);
-+        p.pu[LUMA_12x16].convert_p2s[ALIGNED] = PFX(filterPixelToShort_12x16_neon);
-+        p.pu[LUMA_16x4].convert_p2s[ALIGNED]  = PFX(filterPixelToShort_16x4_neon);
-+        p.pu[LUMA_16x8].convert_p2s[ALIGNED]  = PFX(filterPixelToShort_16x8_neon);
-+        p.pu[LUMA_16x12].convert_p2s[ALIGNED] = PFX(filterPixelToShort_16x12_neon);
-+        p.pu[LUMA_16x16].convert_p2s[ALIGNED] = PFX(filterPixelToShort_16x16_neon);
-+        p.pu[LUMA_16x32].convert_p2s[ALIGNED] = PFX(filterPixelToShort_16x32_neon);
-+        p.pu[LUMA_16x64].convert_p2s[ALIGNED] = PFX(filterPixelToShort_16x64_neon);
-+        p.pu[LUMA_24x32].convert_p2s[ALIGNED] = PFX(filterPixelToShort_24x32_neon);
-+        p.pu[LUMA_32x8].convert_p2s[ALIGNED]  = PFX(filterPixelToShort_32x8_neon);
-+        p.pu[LUMA_32x16].convert_p2s[ALIGNED] = PFX(filterPixelToShort_32x16_neon);
-+        p.pu[LUMA_32x24].convert_p2s[ALIGNED] = PFX(filterPixelToShort_32x24_neon);
-+        p.pu[LUMA_32x32].convert_p2s[ALIGNED] = PFX(filterPixelToShort_32x32_neon);
-+        p.pu[LUMA_32x64].convert_p2s[ALIGNED] = PFX(filterPixelToShort_32x64_neon);
-+        p.pu[LUMA_48x64].convert_p2s[ALIGNED] = PFX(filterPixelToShort_48x64_neon);
-+        p.pu[LUMA_64x16].convert_p2s[ALIGNED] = PFX(filterPixelToShort_64x16_neon);
-+        p.pu[LUMA_64x32].convert_p2s[ALIGNED] = PFX(filterPixelToShort_64x32_neon);
-+        p.pu[LUMA_64x48].convert_p2s[ALIGNED] = PFX(filterPixelToShort_64x48_neon);
-+        p.pu[LUMA_64x64].convert_p2s[ALIGNED] = PFX(filterPixelToShort_64x64_neon);
- 
-         // Block_fill
--        p.cu[BLOCK_4x4].blockfill_s   = PFX(blockfill_s_4x4_neon);
--        p.cu[BLOCK_8x8].blockfill_s   = PFX(blockfill_s_8x8_neon);
--        p.cu[BLOCK_16x16].blockfill_s = PFX(blockfill_s_16x16_neon);
--        p.cu[BLOCK_32x32].blockfill_s = PFX(blockfill_s_32x32_neon);
-+        p.cu[BLOCK_4x4].blockfill_s[ALIGNED]   = PFX(blockfill_s_4x4_neon);
-+        p.cu[BLOCK_8x8].blockfill_s[ALIGNED]   = PFX(blockfill_s_8x8_neon);
-+        p.cu[BLOCK_16x16].blockfill_s[ALIGNED] = PFX(blockfill_s_16x16_neon);
-+        p.cu[BLOCK_32x32].blockfill_s[ALIGNED] = PFX(blockfill_s_32x32_neon);
- 
-         // Blockcopy_ss
-         p.cu[BLOCK_4x4].copy_ss   = PFX(blockcopy_ss_4x4_neon);
-@@ -495,21 +495,21 @@ void setupAssemblyPrimitives(EncoderPrim
-         p.chroma[X265_CSP_I422].cu[BLOCK_422_32x64].copy_sp = PFX(blockcopy_sp_32x64_neon);
- 
-         // pixel_add_ps
--        p.cu[BLOCK_4x4].add_ps   = PFX(pixel_add_ps_4x4_neon);
--        p.cu[BLOCK_8x8].add_ps   = PFX(pixel_add_ps_8x8_neon);
--        p.cu[BLOCK_16x16].add_ps = PFX(pixel_add_ps_16x16_neon);
--        p.cu[BLOCK_32x32].add_ps = PFX(pixel_add_ps_32x32_neon);
--        p.cu[BLOCK_64x64].add_ps = PFX(pixel_add_ps_64x64_neon);
-+        p.cu[BLOCK_4x4].add_ps[ALIGNED]   = PFX(pixel_add_ps_4x4_neon);
-+        p.cu[BLOCK_8x8].add_ps[ALIGNED]   = PFX(pixel_add_ps_8x8_neon);
-+        p.cu[BLOCK_16x16].add_ps[ALIGNED] = PFX(pixel_add_ps_16x16_neon);
-+        p.cu[BLOCK_32x32].add_ps[ALIGNED] = PFX(pixel_add_ps_32x32_neon);
-+        p.cu[BLOCK_64x64].add_ps[ALIGNED] = PFX(pixel_add_ps_64x64_neon);
- 
-         // chroma add_ps
--        p.chroma[X265_CSP_I420].cu[BLOCK_420_4x4].add_ps   = PFX(pixel_add_ps_4x4_neon);
--        p.chroma[X265_CSP_I420].cu[BLOCK_420_8x8].add_ps   = PFX(pixel_add_ps_8x8_neon);
--        p.chroma[X265_CSP_I420].cu[BLOCK_420_16x16].add_ps = PFX(pixel_add_ps_16x16_neon);
--        p.chroma[X265_CSP_I420].cu[BLOCK_420_32x32].add_ps = PFX(pixel_add_ps_32x32_neon);
--        p.chroma[X265_CSP_I422].cu[BLOCK_422_4x8].add_ps   = PFX(pixel_add_ps_4x8_neon);
--        p.chroma[X265_CSP_I422].cu[BLOCK_422_8x16].add_ps  = PFX(pixel_add_ps_8x16_neon);
--        p.chroma[X265_CSP_I422].cu[BLOCK_422_16x32].add_ps = PFX(pixel_add_ps_16x32_neon);
--        p.chroma[X265_CSP_I422].cu[BLOCK_422_32x64].add_ps = PFX(pixel_add_ps_32x64_neon);
-+        p.chroma[X265_CSP_I420].cu[BLOCK_420_4x4].add_ps[ALIGNED]   = PFX(pixel_add_ps_4x4_neon);
-+        p.chroma[X265_CSP_I420].cu[BLOCK_420_8x8].add_ps[ALIGNED]   = PFX(pixel_add_ps_8x8_neon);
-+        p.chroma[X265_CSP_I420].cu[BLOCK_420_16x16].add_ps[ALIGNED] = PFX(pixel_add_ps_16x16_neon);
-+        p.chroma[X265_CSP_I420].cu[BLOCK_420_32x32].add_ps[ALIGNED] = PFX(pixel_add_ps_32x32_neon);
-+        p.chroma[X265_CSP_I422].cu[BLOCK_422_4x8].add_ps[ALIGNED]   = PFX(pixel_add_ps_4x8_neon);
-+        p.chroma[X265_CSP_I422].cu[BLOCK_422_8x16].add_ps[ALIGNED]  = PFX(pixel_add_ps_8x16_neon);
-+        p.chroma[X265_CSP_I422].cu[BLOCK_422_16x32].add_ps[ALIGNED] = PFX(pixel_add_ps_16x32_neon);
-+        p.chroma[X265_CSP_I422].cu[BLOCK_422_32x64].add_ps[ALIGNED] = PFX(pixel_add_ps_32x64_neon);
- 
-         // cpy2Dto1D_shr
-         p.cu[BLOCK_4x4].cpy2Dto1D_shr   = PFX(cpy2Dto1D_shr_4x4_neon);
-@@ -518,10 +518,10 @@ void setupAssemblyPrimitives(EncoderPrim
-         p.cu[BLOCK_32x32].cpy2Dto1D_shr = PFX(cpy2Dto1D_shr_32x32_neon);
- 
-         // ssd_s
--        p.cu[BLOCK_4x4].ssd_s   = PFX(pixel_ssd_s_4x4_neon);
--        p.cu[BLOCK_8x8].ssd_s   = PFX(pixel_ssd_s_8x8_neon);
--        p.cu[BLOCK_16x16].ssd_s = PFX(pixel_ssd_s_16x16_neon);
--        p.cu[BLOCK_32x32].ssd_s = PFX(pixel_ssd_s_32x32_neon);
-+        p.cu[BLOCK_4x4].ssd_s[ALIGNED]   = PFX(pixel_ssd_s_4x4_neon);
-+        p.cu[BLOCK_8x8].ssd_s[ALIGNED]   = PFX(pixel_ssd_s_8x8_neon);
-+        p.cu[BLOCK_16x16].ssd_s[ALIGNED] = PFX(pixel_ssd_s_16x16_neon);
-+        p.cu[BLOCK_32x32].ssd_s[ALIGNED] = PFX(pixel_ssd_s_32x32_neon);
- 
-         // sse_ss
-         p.cu[BLOCK_4x4].sse_ss   = PFX(pixel_sse_ss_4x4_neon);
-@@ -548,10 +548,10 @@ void setupAssemblyPrimitives(EncoderPrim
-         p.chroma[X265_CSP_I422].cu[BLOCK_422_32x64].sub_ps = PFX(pixel_sub_ps_32x64_neon);
- 
-         // calc_Residual
--        p.cu[BLOCK_4x4].calcresidual   = PFX(getResidual4_neon);
--        p.cu[BLOCK_8x8].calcresidual   = PFX(getResidual8_neon);
--        p.cu[BLOCK_16x16].calcresidual = PFX(getResidual16_neon);
--        p.cu[BLOCK_32x32].calcresidual = PFX(getResidual32_neon);
-+        p.cu[BLOCK_4x4].calcresidual[ALIGNED]   = PFX(getResidual4_neon);
-+        p.cu[BLOCK_8x8].calcresidual[ALIGNED]   = PFX(getResidual8_neon);
-+        p.cu[BLOCK_16x16].calcresidual[ALIGNED] = PFX(getResidual16_neon);
-+        p.cu[BLOCK_32x32].calcresidual[ALIGNED] = PFX(getResidual32_neon);
- 
-         // sse_pp
-         p.cu[BLOCK_4x4].sse_pp   = PFX(pixel_sse_pp_4x4_neon);
-@@ -722,31 +722,31 @@ void setupAssemblyPrimitives(EncoderPrim
-         p.pu[LUMA_64x64].sad_x4 = PFX(sad_x4_64x64_neon);
- 
-         // pixel_avg_pp
--        p.pu[LUMA_4x4].pixelavg_pp   = PFX(pixel_avg_pp_4x4_neon);
--        p.pu[LUMA_4x8].pixelavg_pp   = PFX(pixel_avg_pp_4x8_neon);
--        p.pu[LUMA_4x16].pixelavg_pp  = PFX(pixel_avg_pp_4x16_neon);
--        p.pu[LUMA_8x4].pixelavg_pp   = PFX(pixel_avg_pp_8x4_neon);
--        p.pu[LUMA_8x8].pixelavg_pp   = PFX(pixel_avg_pp_8x8_neon);
--        p.pu[LUMA_8x16].pixelavg_pp  = PFX(pixel_avg_pp_8x16_neon);
--        p.pu[LUMA_8x32].pixelavg_pp  = PFX(pixel_avg_pp_8x32_neon);
--        p.pu[LUMA_12x16].pixelavg_pp = PFX(pixel_avg_pp_12x16_neon);
--        p.pu[LUMA_16x4].pixelavg_pp  = PFX(pixel_avg_pp_16x4_neon);
--        p.pu[LUMA_16x8].pixelavg_pp  = PFX(pixel_avg_pp_16x8_neon);
--        p.pu[LUMA_16x12].pixelavg_pp = PFX(pixel_avg_pp_16x12_neon);
--        p.pu[LUMA_16x16].pixelavg_pp = PFX(pixel_avg_pp_16x16_neon);
--        p.pu[LUMA_16x32].pixelavg_pp = PFX(pixel_avg_pp_16x32_neon);
--        p.pu[LUMA_16x64].pixelavg_pp = PFX(pixel_avg_pp_16x64_neon);
--        p.pu[LUMA_24x32].pixelavg_pp = PFX(pixel_avg_pp_24x32_neon);
--        p.pu[LUMA_32x8].pixelavg_pp  = PFX(pixel_avg_pp_32x8_neon);
--        p.pu[LUMA_32x16].pixelavg_pp = PFX(pixel_avg_pp_32x16_neon);
--        p.pu[LUMA_32x24].pixelavg_pp = PFX(pixel_avg_pp_32x24_neon);
--        p.pu[LUMA_32x32].pixelavg_pp = PFX(pixel_avg_pp_32x32_neon);
--        p.pu[LUMA_32x64].pixelavg_pp = PFX(pixel_avg_pp_32x64_neon);
--        p.pu[LUMA_48x64].pixelavg_pp = PFX(pixel_avg_pp_48x64_neon);
--        p.pu[LUMA_64x16].pixelavg_pp = PFX(pixel_avg_pp_64x16_neon);
--        p.pu[LUMA_64x32].pixelavg_pp = PFX(pixel_avg_pp_64x32_neon);
--        p.pu[LUMA_64x48].pixelavg_pp = PFX(pixel_avg_pp_64x48_neon);
--        p.pu[LUMA_64x64].pixelavg_pp = PFX(pixel_avg_pp_64x64_neon);
-+        p.pu[LUMA_4x4].pixelavg_pp[ALIGNED]   = PFX(pixel_avg_pp_4x4_neon);
-+        p.pu[LUMA_4x8].pixelavg_pp[ALIGNED]   = PFX(pixel_avg_pp_4x8_neon);
-+        p.pu[LUMA_4x16].pixelavg_pp[ALIGNED]  = PFX(pixel_avg_pp_4x16_neon);
-+        p.pu[LUMA_8x4].pixelavg_pp[ALIGNED]   = PFX(pixel_avg_pp_8x4_neon);
-+        p.pu[LUMA_8x8].pixelavg_pp[ALIGNED]   = PFX(pixel_avg_pp_8x8_neon);
-+        p.pu[LUMA_8x16].pixelavg_pp[ALIGNED]  = PFX(pixel_avg_pp_8x16_neon);
-+        p.pu[LUMA_8x32].pixelavg_pp[ALIGNED]  = PFX(pixel_avg_pp_8x32_neon);
-+        p.pu[LUMA_12x16].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_12x16_neon);
-+        p.pu[LUMA_16x4].pixelavg_pp[ALIGNED]  = PFX(pixel_avg_pp_16x4_neon);
-+        p.pu[LUMA_16x8].pixelavg_pp[ALIGNED]  = PFX(pixel_avg_pp_16x8_neon);
-+        p.pu[LUMA_16x12].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_16x12_neon);
-+        p.pu[LUMA_16x16].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_16x16_neon);
-+        p.pu[LUMA_16x32].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_16x32_neon);
-+        p.pu[LUMA_16x64].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_16x64_neon);
-+        p.pu[LUMA_24x32].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_24x32_neon);
-+        p.pu[LUMA_32x8].pixelavg_pp[ALIGNED]  = PFX(pixel_avg_pp_32x8_neon);
-+        p.pu[LUMA_32x16].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_32x16_neon);
-+        p.pu[LUMA_32x24].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_32x24_neon);
-+        p.pu[LUMA_32x32].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_32x32_neon);
-+        p.pu[LUMA_32x64].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_32x64_neon);
-+        p.pu[LUMA_48x64].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_48x64_neon);
-+        p.pu[LUMA_64x16].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_64x16_neon);
-+        p.pu[LUMA_64x32].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_64x32_neon);
-+        p.pu[LUMA_64x48].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_64x48_neon);
-+        p.pu[LUMA_64x64].pixelavg_pp[ALIGNED] = PFX(pixel_avg_pp_64x64_neon);
- 
-         // planecopy
-         p.planecopy_cp = PFX(pixel_planecopy_cp_neon);
diff --git a/gnu/packages/patches/x265-arm-flags.patch b/gnu/packages/patches/x265-arm-flags.patch
new file mode 100644
index 0000000000..f17e26f6f1
--- /dev/null
+++ b/gnu/packages/patches/x265-arm-flags.patch
@@ -0,0 +1,36 @@
+https://sources.debian.org/src/x265/2.9-3/debian/patches/0001-Fix-arm-flags.patch/
+
+From: Sebastian Ramacher <sramacher@debian.org>
+Date: Wed, 26 Apr 2017 22:05:06 +0200
+Subject: Fix arm* flags
+
+---
+ source/CMakeLists.txt | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
+index 33b6523..25aecbb 100644
+--- a/source/CMakeLists.txt
++++ b/source/CMakeLists.txt
+@@ -72,7 +72,7 @@ elseif(ARMMATCH GREATER "-1")
+     endif()
+     message(STATUS "Detected ARM target processor")
+     set(ARM 1)
+-    add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1)
++    # add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1)
+ else()
+     message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown")
+     message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
+@@ -230,12 +230,8 @@ if(GCC)
+     if(ARM AND CROSS_COMPILE_ARM)
+         set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC)
+     elseif(ARM)
+-        find_package(Neon)
+         if(CPU_HAS_NEON)
+-            set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC)
+             add_definitions(-DHAVE_NEON)
+-        else()
+-            set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm)
+         endif()
+     endif()
+     add_definitions(${ARM_ARGS})
diff --git a/gnu/packages/patches/x265-detect512-all-arches.patch b/gnu/packages/patches/x265-detect512-all-arches.patch
new file mode 100644
index 0000000000..4d39d868fd
--- /dev/null
+++ b/gnu/packages/patches/x265-detect512-all-arches.patch
@@ -0,0 +1,37 @@
+https://sources.debian.org/data/main/x/x265/2.9-3/debian/patches/0003-detect512-is-needed-on-all-architectures.patch
+
+From: Adam Sampson <unknown@bitbucket>
+Date: Sun, 14 Oct 2018 14:04:18 +0200
+Subject: detect512 is needed on all architectures
+
+---
+ source/common/cpu.cpp | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/source/common/cpu.cpp b/source/common/cpu.cpp
+index 0681ff5..fa687da 100644
+--- a/source/common/cpu.cpp
++++ b/source/common/cpu.cpp
+@@ -110,6 +110,11 @@ const cpu_name_t cpu_names[] =
+     { "", 0 },
+ };
+ 
++bool detect512()
++{
++    return(enable512);
++}
++
+ #if X265_ARCH_X86
+ 
+ extern "C" {
+@@ -123,10 +128,6 @@ uint64_t PFX(cpu_xgetbv)(int xcr);
+ #pragma warning(disable: 4309) // truncation of constant value
+ #endif
+ 
+-bool detect512()
+-{
+-    return(enable512);
+-}
+ uint32_t cpu_detect(bool benableavx512 )
+ {
+ 
diff --git a/gnu/packages/patches/x265-fix-ppc64le-build.patch b/gnu/packages/patches/x265-fix-ppc64le-build.patch
deleted file mode 100644
index f71d2436ab..0000000000
--- a/gnu/packages/patches/x265-fix-ppc64le-build.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-https://sources.debian.org/data/main/x/x265/2.8-3/debian/patches/0003-Fix-build-error-on-on-ppc64le.patch
-
-This patch also fixes building on armhf-linux and aarch64-linux
-
-From: Jayashree <jayashree.c@multicorewareinc.com>
-Date: Fri, 25 May 2018 10:26:05 +0530
-Subject: Fix build error on on ppc64le
-
----
- source/common/param.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/source/common/param.cpp b/source/common/param.cpp
-index 31bcbc7..4a6d0c8 100644
---- a/source/common/param.cpp
-+++ b/source/common/param.cpp
-@@ -633,7 +633,7 @@ int x265_param_parse(x265_param* p, const char* name, const char* value)
-         if (bValueWasNull)
-             p->cpuid = atobool(value);
-         else
--            p->cpuid = parseCpuName(value, bError);
-+            p->cpuid = parseCpuName(value, bError, false);
- #endif
-     }
-     OPT("fps")
diff --git a/gnu/packages/patches/xapian-revert-5489fb2f8.patch b/gnu/packages/patches/xapian-revert-5489fb2f8.patch
deleted file mode 100644
index 7b78e2abb5..0000000000
--- a/gnu/packages/patches/xapian-revert-5489fb2f8.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Revert this upstream commit which breaks a test case in "notmuch":
-
-https://git.xapian.org/?p=xapian;a=commitdiff;h=5489fb2f838c0f0b0a593b4c17df282a93a1fe5a
-
-See the notmuch FAQ entry:
-
-https://notmuchmail.org/faq/#index12h2
-
-This should be fixed for later releases.
-
-diff --git a/backends/glass/glass_postlist.cc b/xapian-core/backends/glass/glass_postlist.cc
-index 80e578b85..a47f14a68 100644
---- a/backends/glass/glass_postlist.cc
-+++ b/backends/glass/glass_postlist.cc
-@@ -759,7 +759,7 @@ GlassPostList::open_nearby_postlist(const std::string & term_,
-     (void)need_pos;
-     if (term_.empty())
- 	RETURN(NULL);
--    if (!this_db.get() || this_db->postlist_table.is_modified())
-+    if (!this_db.get() || this_db->postlist_table.is_writable())
- 	RETURN(NULL);
-     RETURN(new GlassPostList(this_db, term_, cursor->clone()));
- }
diff --git a/gnu/packages/patches/xf86-video-ast-remove-mibstore.patch b/gnu/packages/patches/xf86-video-ast-remove-mibstore.patch
deleted file mode 100644
index 58a44ae260..0000000000
--- a/gnu/packages/patches/xf86-video-ast-remove-mibstore.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-Removes references to mibstore.h and miInitializeBackingStore, which
-have been removed from xorg-server.  Zack Rusin <zackr@vmware.com>
-wrote: "It was a noop for at least 5 years and it has been removed."
-See: http://patches.openembedded.org/patch/46133/
-
-diff -ru xf86-video-ast-0.93.10.orig/src/ast_2dtool.c xf86-video-ast-0.93.10/src/ast_2dtool.c
---- xf86-video-ast-0.93.10.orig/src/ast_2dtool.c	2012-03-23 21:40:56.000000000 -0400
-+++ xf86-video-ast-0.93.10/src/ast_2dtool.c	2014-12-19 02:42:32.422383728 -0500
-@@ -27,7 +27,6 @@
- #include "xf86_OSproc.h"
- #include "xf86cmap.h"
- #include "compiler.h"
--#include "mibstore.h"
- #include "vgaHW.h"
- #include "mipointer.h"
- #include "micmap.h"
-diff -ru xf86-video-ast-0.93.10.orig/src/ast_accel.c xf86-video-ast-0.93.10/src/ast_accel.c
---- xf86-video-ast-0.93.10.orig/src/ast_accel.c	2012-03-23 21:40:56.000000000 -0400
-+++ xf86-video-ast-0.93.10/src/ast_accel.c	2014-12-19 02:41:55.534200809 -0500
-@@ -27,7 +27,6 @@
- #include "xf86_OSproc.h"
- #include "xf86cmap.h"
- #include "compiler.h"
--#include "mibstore.h"
- #include "vgaHW.h"
- #include "mipointer.h"
- #include "micmap.h"
-diff -ru xf86-video-ast-0.93.10.orig/src/ast_cursor.c xf86-video-ast-0.93.10/src/ast_cursor.c
---- xf86-video-ast-0.93.10.orig/src/ast_cursor.c	2012-03-23 21:40:56.000000000 -0400
-+++ xf86-video-ast-0.93.10/src/ast_cursor.c	2014-12-19 02:42:37.258407708 -0500
-@@ -27,7 +27,6 @@
- #include "xf86_OSproc.h"
- #include "xf86cmap.h"
- #include "compiler.h"
--#include "mibstore.h"
- #include "vgaHW.h"
- #include "mipointer.h"
- #include "micmap.h"
-diff -ru xf86-video-ast-0.93.10.orig/src/ast_driver.c xf86-video-ast-0.93.10/src/ast_driver.c
---- xf86-video-ast-0.93.10.orig/src/ast_driver.c	2012-03-23 21:40:56.000000000 -0400
-+++ xf86-video-ast-0.93.10/src/ast_driver.c	2014-12-19 02:42:50.710474414 -0500
-@@ -31,7 +31,6 @@
- #endif
- #include "xf86cmap.h"
- #include "compiler.h"
--#include "mibstore.h"
- #include "vgaHW.h"
- #include "mipointer.h"
- #include "micmap.h"
-@@ -865,7 +864,6 @@
-    }
- #endif /* end of Accel_2D */
-      
--   miInitializeBackingStore(pScreen);
-    xf86SetBackingStore(pScreen);
-    xf86SetSilkenMouse(pScreen);
- 
-diff -ru xf86-video-ast-0.93.10.orig/src/ast_mode.c xf86-video-ast-0.93.10/src/ast_mode.c
---- xf86-video-ast-0.93.10.orig/src/ast_mode.c	2012-03-23 21:40:56.000000000 -0400
-+++ xf86-video-ast-0.93.10/src/ast_mode.c	2014-12-19 02:42:24.894346398 -0500
-@@ -27,7 +27,6 @@
- #include "xf86_OSproc.h"
- #include "xf86cmap.h"
- #include "compiler.h"
--#include "mibstore.h"
- #include "vgaHW.h"
- #include "mipointer.h"
- #include "micmap.h"
-diff -ru xf86-video-ast-0.93.10.orig/src/ast_tool.c xf86-video-ast-0.93.10/src/ast_tool.c
---- xf86-video-ast-0.93.10.orig/src/ast_tool.c	2012-03-23 21:40:56.000000000 -0400
-+++ xf86-video-ast-0.93.10/src/ast_tool.c	2014-12-19 02:42:03.930242443 -0500
-@@ -27,7 +27,6 @@
- #include "xf86_OSproc.h"
- #include "xf86cmap.h"
- #include "compiler.h"
--#include "mibstore.h"
- #include "vgaHW.h"
- #include "mipointer.h"
- #include "micmap.h"
-diff -ru xf86-video-ast-0.93.10.orig/src/ast_vgatool.c xf86-video-ast-0.93.10/src/ast_vgatool.c
---- xf86-video-ast-0.93.10.orig/src/ast_vgatool.c	2012-03-23 21:40:56.000000000 -0400
-+++ xf86-video-ast-0.93.10/src/ast_vgatool.c	2014-12-19 02:42:18.406314226 -0500
-@@ -27,7 +27,6 @@
- #include "xf86_OSproc.h"
- #include "xf86cmap.h"
- #include "compiler.h"
--#include "mibstore.h"
- #include "vgaHW.h"
- #include "mipointer.h"
- #include "micmap.h"
diff --git a/gnu/packages/patches/zathura-pdf-mupdf-link-to-jpeg-libraries.patch b/gnu/packages/patches/zathura-pdf-mupdf-link-to-jpeg-libraries.patch
deleted file mode 100644
index 63e058bbef..0000000000
--- a/gnu/packages/patches/zathura-pdf-mupdf-link-to-jpeg-libraries.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From: Tobias Geerinckx-Rice <me@tobias.gr>
-Date: Mon, 18 Jun 2018 02:37:41 +0200
-Subject: zathura-pdf-mupdf: Link to JPEG libraries.
-
-As of version 0.3.3, zathura-pdf-mupdf no longer links to some required
-JPEG libraries, leading to such errors as:
-
-  $ zathura foo.pdf
-  error: Could not load plugin '/gnu/store/...-profile/lib/zathura/libpdf-mupdf.so' (/gnu/store/...-profile/lib/zathura/libpdf-mupdf.so: undefined symbol: jpeg_resync_to_restart).
-
-The patch below, copied verbatim from Arch[0], fixes that.
-Its description happens to match our reality, too.
-
-[0]: https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/zathura-pdf-mupdf
----
-From 3fb0ff750373d45d4f5172ce1d41b74183cd07e8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= <johannes@kyriasis.com>
-Date: Sat, 24 Mar 2018 14:31:18 +0100
-Subject: [PATCH] Explicitly link against jbig2dec, openjp2, and jpeg
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Normally these are statically linked into libmupdfthird, but we delete
-those to make mupdf use the system libraries.  Previously
-zathura-pdf-mupdf explicitly linked against them, but this is
-technically incorrect since they are supposed to be in libmupdfthird so
-that was removed.  This commit essentially reverts that in the new build
-system.
-
-Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
----
- meson.build | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/meson.build b/meson.build
-index 3b0d7b7..ae2fc9c 100644
---- a/meson.build
-+++ b/meson.build
-@@ -22,7 +22,11 @@ cairo = dependency('cairo')
- mupdf = cc.find_library('mupdf')
- mupdfthird = cc.find_library('mupdfthird')
- 
--build_dependencies = [zathura, girara, glib, cairo, mupdf, mupdfthird]
-+jbig2dec = cc.find_library('jbig2dec')
-+openjp2 = cc.find_library('openjp2')
-+jpeg = cc.find_library('jpeg')
-+
-+build_dependencies = [zathura, girara, glib, cairo, mupdf, mupdfthird, jbig2dec, openjp2, jpeg]
- 
- # defines
- defines = [
--- 
-2.16.3
-
diff --git a/gnu/packages/patches/zstd-fix-stdin-list-test.patch b/gnu/packages/patches/zstd-fix-stdin-list-test.patch
deleted file mode 100644
index a10355448c..0000000000
--- a/gnu/packages/patches/zstd-fix-stdin-list-test.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 8e7bdc18d62632adcee029b2f8f5013d11549dd7 Mon Sep 17 00:00:00 2001
-From: "W. Felix Handte" <w@felixhandte.com>
-Date: Fri, 29 Jun 2018 16:31:22 -0400
-Subject: [PATCH] Fix Tests of `--list` Behavior with `stdin`
-
----
- tests/playTests.sh | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/tests/playTests.sh b/tests/playTests.sh
-index 09a7377f2..aa5535d59 100755
---- a/tests/playTests.sh
-+++ b/tests/playTests.sh
-@@ -731,8 +731,14 @@ $ECHO "\n===>  zstd --list/-l error detection tests "
- ! $ZSTD -lv tmp1*
- ! $ZSTD --list -v tmp2 tmp12.zst
- 
--$ECHO "\n===>  zstd --list/-l exits 1 when stdin is piped in"
--! echo "piped STDIN" | $ZSTD --list
-+$ECHO "\n===>  zstd --list/-l errors when presented with stdin / no files"
-+! $ZSTD -l
-+! $ZSTD -l -
-+! $ZSTD -l < tmp1.zst
-+! $ZSTD -l - < tmp1.zst
-+! $ZSTD -l - tmp1.zst
-+! $ZSTD -l - tmp1.zst < tmp1.zst
-+$ZSTD -l tmp1.zst < tmp1.zst # but doesn't error just because stdin is not a tty
- 
- $ECHO "\n===>  zstd --list/-l test with null files "
- ./datagen -g0 > tmp5
diff --git a/gnu/packages/patches/zstd-fix-stdin-list-without-tty.patch b/gnu/packages/patches/zstd-fix-stdin-list-without-tty.patch
deleted file mode 100644
index 47fa3e59a7..0000000000
--- a/gnu/packages/patches/zstd-fix-stdin-list-without-tty.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 712a9fd9721c314f4b0238577d803b012845f6d2 Mon Sep 17 00:00:00 2001
-From: "W. Felix Handte" <w@felixhandte.com>
-Date: Fri, 29 Jun 2018 15:33:44 -0400
-Subject: [PATCH] Allow Invoking `zstd --list` When `stdin` is not a `tty`
-
-Also now returns an error when no inputs are given.
-
-New proposed behavior:
-
-```
-felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l; echo $?
-No files given
-1
-felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l Makefile.zst; echo $?
-Frames  Skips  Compressed  Uncompressed  Ratio  Check  Filename
-     1      0     3.08 KB      10.92 KB  3.544  XXH64  Makefile.zst
-0
-felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l <Makefile.zst; echo $?
-zstd: --list does not support reading from standard input
-No files given
-1
-felix@odin:~/prog/zstd (list-stdin-check)$ ./zstd -l Makefile.zst <Makefile.zst; echo $?
-Frames  Skips  Compressed  Uncompressed  Ratio  Check  Filename
-     1      0     3.08 KB      10.92 KB  3.544  XXH64  Makefile.zst
-0
-felix@odin:~/prog/zstd (list-stdin-check)$
-```
----
- programs/fileio.c | 16 ++++++++++------
- 1 file changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/programs/fileio.c b/programs/fileio.c
-index 0175b3163..b4eed28d1 100644
---- a/programs/fileio.c
-+++ b/programs/fileio.c
-@@ -2017,21 +2017,25 @@ static int FIO_listFile(fileInfo_t* total, const char* inFileName, int displayLe
- }
- 
- int FIO_listMultipleFiles(unsigned numFiles, const char** filenameTable, int displayLevel){
--
--    if (!IS_CONSOLE(stdin)) {
--        DISPLAYOUT("zstd: --list does not support reading from standard input\n");
--        return 1;
-+    unsigned u;
-+    for (u=0; u<numFiles;u++) {
-+        if (!strcmp (filenameTable[u], stdinmark)) {
-+            DISPLAYOUT("zstd: --list does not support reading from standard input\n");
-+            return 1;
-+        }
-     }
- 
-     if (numFiles == 0) {
-+        if (!IS_CONSOLE(stdin)) {
-+            DISPLAYOUT("zstd: --list does not support reading from standard input\n");
-+        }
-         DISPLAYOUT("No files given\n");
--        return 0;
-+        return 1;
-     }
-     if (displayLevel <= 2) {
-         DISPLAYOUT("Frames  Skips  Compressed  Uncompressed  Ratio  Check  Filename\n");
-     }
-     {   int error = 0;
--        unsigned u;
-         fileInfo_t total;
-         memset(&total, 0, sizeof(total));
-         total.usesCheck = 1;