summary refs log tree commit diff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/bastet-change-source-of-unordered_set.patch40
-rw-r--r--gnu/packages/patches/borg-respect-storage-quota.patch32
-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/emacs-exwm-fix-fullscreen-issue.patch27
-rw-r--r--gnu/packages/patches/ghc-haddock-library-unbundle.patch86
-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-check-error-efibootmgr.patch23
-rw-r--r--gnu/packages/patches/hmmer-remove-cpu-specificity.patch22
-rw-r--r--gnu/packages/patches/icecat-CVE-2018-12383.patch103
-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/libgxps-CVE-2017-11590.patch48
-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/python-CVE-2018-14647.patch61
-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/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/rsem-makefile.patch682
-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/x265-arm-asm-primitives.patch360
-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/zstd-fix-stdin-list-test.patch30
-rw-r--r--gnu/packages/patches/zstd-fix-stdin-list-without-tty.patch67
37 files changed, 1619 insertions, 2955 deletions
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/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/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/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/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/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-check-error-efibootmgr.patch b/gnu/packages/patches/grub-check-error-efibootmgr.patch
index b2fd160c9a..efeb20f213 100644
--- a/gnu/packages/patches/grub-check-error-efibootmgr.patch
+++ b/gnu/packages/patches/grub-check-error-efibootmgr.patch
@@ -160,7 +160,7 @@ index 5e4cdfd..690f180 100644
  
  	  /* Try to make this image bootable using the EFI Boot Manager, if available.  */
  	  if (!efi_distributor || efi_distributor[0] == '\0')
-@@ -1887,8 +1892,11 @@ main (int argc, char *argv[])
+@@ -1887,7 +1892,10 @@ main (int argc, char *argv[])
  			  efidir_grub_dev->disk->name,
  			  (part ? ",": ""), (part ? : ""));
  	  grub_free (part);
@@ -173,4 +173,25 @@ index 5e4cdfd..690f180 100644
 +			     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/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/icecat-CVE-2018-12383.patch b/gnu/packages/patches/icecat-CVE-2018-12383.patch
new file mode 100644
index 0000000000..17ca0f3773
--- /dev/null
+++ b/gnu/packages/patches/icecat-CVE-2018-12383.patch
@@ -0,0 +1,103 @@
+Based on upstream changeset:
+  https://hg.mozilla.org/releases/mozilla-esr60/rev/300efdbc9fe1
+but with the git binary patch and related test changes omitted,
+and adapted to apply cleanly to GNU IceCat.
+
+# HG changeset patch
+# User David Keeler <dkeeler@mozilla.com>
+# Date 1531860660 25200
+# Node ID 300efdbc9fe1f9165428c7934861033935b5abfa
+# Parent  80a4a7ef281374dbb2afda8edac54665b14b9ef8
+Bug 1475775 - Clean up old NSS DB file after upgrade if necessary. r=franziskus, r=mattn, a=RyanVM
+
+Reviewers: franziskus, mattn
+
+Bug #: 1475775
+
+Differential Revision: https://phabricator.services.mozilla.com/D2202
+
+diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp
+--- a/security/manager/ssl/nsNSSComponent.cpp
++++ b/security/manager/ssl/nsNSSComponent.cpp
+@@ -1935,16 +1935,61 @@ AttemptToRenameBothPKCS11ModuleDBVersion
+   NS_NAMED_LITERAL_CSTRING(sqlModuleDBFilename, "pkcs11.txt");
+   nsresult rv = AttemptToRenamePKCS11ModuleDB(profilePath,
+                                               legacyModuleDBFilename);
+   if (NS_FAILED(rv)) {
+     return rv;
+   }
+   return AttemptToRenamePKCS11ModuleDB(profilePath, sqlModuleDBFilename);
+ }
++
++// When we changed from the old dbm database format to the newer sqlite
++// implementation, the upgrade process left behind the existing files. Suppose a
++// user had not set a password for the old key3.db (which is about 99% of
++// users). After upgrading, both the old database and the new database are
++// unprotected. If the user then sets a password for the new database, the old
++// one will not be protected. In this scenario, we should probably just remove
++// the old database (it would only be relevant if the user downgraded to a
++// version of IceCat before 58, but we have to trade this off against the
++// user's old private keys being unexpectedly unprotected after setting a
++// password).
++// This was never an issue on Android because we always used the new
++// implementation.
++static void
++MaybeCleanUpOldNSSFiles(const nsACString& profilePath)
++{
++  UniquePK11SlotInfo slot(PK11_GetInternalKeySlot());
++  if (!slot) {
++    return;
++  }
++  // Unfortunately we can't now tell the difference between "there already was a
++  // password when the upgrade happened" and "there was not a password but then
++  // the user added one after upgrading".
++  bool hasPassword = PK11_NeedLogin(slot.get()) &&
++                     !PK11_NeedUserInit(slot.get());
++  if (!hasPassword) {
++    return;
++  }
++  nsCOMPtr<nsIFile> dbFile = do_CreateInstance("@mozilla.org/file/local;1");
++  if (!dbFile) {
++    return;
++  }
++  nsresult rv = dbFile->InitWithNativePath(profilePath);
++  if (NS_FAILED(rv)) {
++    return;
++  }
++  NS_NAMED_LITERAL_CSTRING(keyDBFilename, "key3.db");
++  rv = dbFile->AppendNative(keyDBFilename);
++  if (NS_FAILED(rv)) {
++    return;
++  }
++  // Since this isn't a directory, the `recursive` argument to `Remove` is
++  // irrelevant.
++  Unused << dbFile->Remove(false);
++}
+ #endif // ifndef ANDROID
+ 
+ // Given a profile directory, attempt to initialize NSS. If nocertdb is true,
+ // (or if we don't have a profile directory) simply initialize NSS in no DB mode
+ // and return. Otherwise, first attempt to initialize in read/write mode, and
+ // then read-only mode if that fails. If both attempts fail, we may be failing
+ // to initialize an NSS DB collection that has FIPS mode enabled. Attempt to
+ // ascertain if this is the case, and if so, rename the offending PKCS#11 module
+@@ -1966,16 +2011,19 @@ InitializeNSSWithFallbacks(const nsACStr
+ 
+   // Try read/write mode. If we're in safeMode, we won't load PKCS#11 modules.
+ #ifndef ANDROID
+   PRErrorCode savedPRErrorCode1;
+ #endif // ifndef ANDROID
+   SECStatus srv = ::mozilla::psm::InitializeNSS(profilePath, false, !safeMode);
+   if (srv == SECSuccess) {
+     MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("initialized NSS in r/w mode"));
++#ifndef ANDROID
++    MaybeCleanUpOldNSSFiles(profilePath);
++#endif // ifndef ANDROID
+     return NS_OK;
+   }
+ #ifndef ANDROID
+   savedPRErrorCode1 = PR_GetError();
+   PRErrorCode savedPRErrorCode2;
+ #endif // ifndef ANDROID
+   // That failed. Try read-only mode.
+   srv = ::mozilla::psm::InitializeNSS(profilePath, true, !safeMode);
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/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/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/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-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/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/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/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/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-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/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;