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/ghc-haddock-library-unbundle.patch86
-rw-r--r--gnu/packages/patches/icecat-avoid-bundled-libraries.patch14
-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/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
9 files changed, 851 insertions, 527 deletions
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/icecat-avoid-bundled-libraries.patch b/gnu/packages/patches/icecat-avoid-bundled-libraries.patch
index b5e9fb887e..33203b1a33 100644
--- a/gnu/packages/patches/icecat-avoid-bundled-libraries.patch
+++ b/gnu/packages/patches/icecat-avoid-bundled-libraries.patch
@@ -33,3 +33,17 @@ Fixes needed when avoiding bundled libraries.
      '/dom/base',
      '/dom/storage',
      '/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-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/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
+