gnu: Add mozjs-38 (Mozilla SpiderMonkey 38).
[jackhill/guix/guix.git] / gnu / packages / gnuzilla.scm
index f7a8c7d..d9901fd 100644 (file)
@@ -1,10 +1,12 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
-;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
+;;; Copyright © 2017 ng0 <ng0@no-reply.pragmatique.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 
 (define-module (gnu packages gnuzilla)
   #:use-module ((srfi srfi-1) #:hide (zip))
+  #:use-module (ice-9 match)
   #:use-module (gnu packages)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix utils)
   #:use-module (guix build-system gnu)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages glib)
-  #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages libcanberra)
   #:use-module (gnu packages cups)
-  #:use-module (gnu packages mit-krb5)
+  #:use-module (gnu packages kerberos)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
@@ -54,7 +58,8 @@
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages video)
   #:use-module (gnu packages xdisorg)
-  #:use-module (gnu packages zip))
+  #:use-module (gnu packages zip)
+  #:use-module (gnu packages readline))
 
 (define-public mozjs
   (package
@@ -68,6 +73,7 @@
              (sha256
               (base32
                "1fig2wf4f10v43mqx67y68z6h77sy900d1w0pz9qarrqx57rc7ij"))
+             (patches (search-patches "mozjs17-aarch64-support.patch"))
              (modules '((guix build utils)))
              (snippet
               ;; Fix incompatibility with Perl 5.22+.
                  (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
     (build-system gnu-build-system)
     (native-inputs
-      `(("perl" ,perl)
-        ("python" ,python-2)))
+     `(("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-2)))
+    (propagated-inputs
+     `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-17.0.pc
+    (inputs
+     `(("zlib" ,zlib)))
     (arguments
-      `(;; XXX: parallel build fails, lacking:
-        ;;   mkdir -p "system_wrapper_js/"
-        #:parallel-build? #f
-        #:phases
-          (alist-cons-before
-           'configure 'chdir
+     `(;; XXX: parallel build fails, lacking:
+       ;;   mkdir -p "system_wrapper_js/"
+       #:parallel-build? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'delete-timedout-test
+           ;; This test times out on slower hardware.
+           (lambda _ (delete-file "js/src/jit-test/tests/basic/bug698584.js")))
+         (add-before 'configure 'chdir
            (lambda _
-             (chdir "js/src"))
-           (alist-replace
-            'configure
-            ;; configure fails if it is followed by SHELL and CONFIG_SHELL
-            (lambda* (#:key outputs #:allow-other-keys)
-              (let ((out (assoc-ref outputs "out")))
-                (setenv "SHELL" (which "sh"))
-                (setenv "CONFIG_SHELL" (which "sh"))
-                (zero? (system*
-                        "./configure" (string-append "--prefix=" out)))))
-            %standard-phases))))
+             (chdir "js/src")
+             #t))
+         (replace 'configure
+           ;; configure fails if it is followed by SHELL and CONFIG_SHELL
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (setenv "SHELL" (which "sh"))
+               (setenv "CONFIG_SHELL" (which "sh"))
+               (zero? (system*
+                       "./configure" (string-append "--prefix=" out)
+                                     ,@(if (string=? "aarch64-linux"
+                                                     (%current-system))
+                                         '("--host=aarch64-unknown-linux-gnu")
+                                         '())))))))))
     (home-page
      "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey")
     (synopsis "Mozilla javascript engine")
@@ -116,43 +133,124 @@ in C/C++.")
                (base32
                 "1n1phk8r3l8icqrrap4czplnylawa0ddc2cc4cgdz46x3lrkybz6"))
               (modules '((guix build utils)))
+              (patches (search-patches "mozjs24-aarch64-support.patch"))
               (snippet
                ;; Fix incompatibility with Perl 5.22+.
                '(substitute* '("js/src/config/milestone.pl")
                   (("defined\\(@TEMPLATE_FILE)") "@TEMPLATE_FILE")))))
     (arguments
-     '(;; XXX: parallel build fails, lacking:
+      (substitute-keyword-arguments (package-arguments mozjs)
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (replace 'configure
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let ((out (assoc-ref outputs "out")))
+                  ;; configure fails if it is followed by SHELL and CONFIG_SHELL
+                  (setenv "SHELL" (which "sh"))
+                  (setenv "CONFIG_SHELL" (which "sh"))
+                  (zero? (system* "./configure"
+                                  (string-append "--prefix=" out)
+                                  "--with-system-nspr"
+                                  "--enable-system-ffi"
+                                  "--enable-threadsafe"
+                                  ,@(if (string=? "aarch64-linux"
+                                                  (%current-system))
+                                      '("--host=aarch64-unknown-linux-gnu")
+                                      '()))))))))))
+    (inputs
+     `(("libffi" ,libffi)
+       ("zlib" ,zlib)))))
+
+(define-public mozjs-38
+  (package
+    (inherit mozjs)
+    (name "mozjs")
+    (version "38.2.1.rc0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://people.mozilla.org/~sstangl/"
+                    name "-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681"))
+              (patches
+               (search-patches
+                ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1269317 for
+                ;; GCC 6 compatibility.
+
+                "mozjs38-version-detection.patch" ; for 0ad
+                "mozjs38-tracelogger.patch"
+
+                ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1339931.
+                "mozjs38-pkg-config-version.patch"
+                "mozjs38-shell-version.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Fix incompatibility with sed 4.4.
+                  (substitute* "js/src/configure"
+                    (("\\^\\[:space:\\]") "^[[:space:]]"))
+
+                  ;; The headers are symlinks to files that are in /tmp, so they
+                  ;; end up broken.  Copy them instead.
+                  (substitute*
+                      "python/mozbuild/mozbuild/backend/recursivemake.py"
+                    (("\\['dist_include'\\].add_symlink")
+                     "['dist_include'].add_copy"))
+
+                  ;; Remove bundled libraries.
+                  (for-each delete-file-recursively
+                            '("intl"
+                              "js/src/ctypes/libffi"
+                              "js/src/ctypes/libffi-patches"
+                              "modules/zlib"))
+                  #t))))
+    (arguments
+     `(;; XXX: parallel build fails, lacking:
        ;;   mkdir -p "system_wrapper_js/"
        #:parallel-build? #f
+       ;; See https://bugzilla.mozilla.org/show_bug.cgi?id=1008470.
+       #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (replace
-          'configure
-          (lambda* (#:key outputs #:allow-other-keys)
-            (let ((out (assoc-ref outputs "out")))
-              (chdir "js/src")
-              ;; configure fails if it is follwed by SHELL and CONFIG_SHELL
-              (setenv "SHELL" (which "sh"))
-              (setenv "CONFIG_SHELL" (which "sh"))
-              (zero? (system* "./configure"
-                              (string-append "--prefix=" out)
-                              "--with-system-nspr"
-                              "--enable-system-ffi"
-                              "--enable-threadsafe"))))))))
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (chdir "js/src")
+               (setenv "SHELL" (which "sh"))
+               (setenv "CONFIG_SHELL" (which "sh"))
+               (zero? (system* "./configure"
+                               (string-append "--prefix=" out)
+                               "--enable-ctypes"
+                               "--enable-gcgenerational"
+                               "--enable-optimize"
+                               "--enable-pie"
+                               "--enable-readline"
+                               "--enable-shared-js"
+                               "--enable-system-ffi"
+                               "--enable-threadsafe"
+                               "--enable-xterm-updates"
+                               "--with-system-icu"
+                               "--with-system-nspr"
+                               "--with-system-zlib"
+
+                               ;; Intl API requires bundled ICU.
+                               "--without-intl-api"))))))))
     (native-inputs
      `(("perl" ,perl)
        ("pkg-config" ,pkg-config)
-       ("python" ,python-2)))
-    (propagated-inputs
-     `(("nspr" ,nspr))) ; in the Requires.private field of mozjs-24.pc
+       ("python-2" ,python-2)))
     (inputs
      `(("libffi" ,libffi)
+       ("readline" ,readline)
+       ("icu4c" ,icu4c)
        ("zlib" ,zlib)))))
 
 (define-public nspr
   (package
     (name "nspr")
-    (version "4.12")
+    (version "4.14")
     (source (origin
              (method url-fetch)
              (uri (string-append
@@ -160,21 +258,19 @@ in C/C++.")
                    version "/src/nspr-" version ".tar.gz"))
              (sha256
               (base32
-               "1pk98bmc5xzbl62q5wf2d6mryf0v95z6rsmxz27nclwiaqg0mcg0"))))
+               "1m8p9l3prabhfxz6zs889fl7gmcka72a62i46a8klh2pca11iz34"))))
     (build-system gnu-build-system)
     (native-inputs
-      `(("perl" ,perl)))
+     `(("perl" ,perl)))
     (arguments
      `(#:tests? #f ; no check target
        #:configure-flags (list "--enable-64bit"
                                (string-append "LDFLAGS=-Wl,-rpath="
                                               (assoc-ref %outputs "out")
                                               "/lib"))
-       #:phases (alist-cons-before
-                 'configure 'chdir
-                 (lambda _
-                   (chdir "nspr"))
-                 %standard-phases)))
+       #:phases (modify-phases %standard-phases
+                  (add-before 'configure 'chdir
+                    (lambda _ (chdir "nspr") #t)))))
     (home-page
      "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR")
     (synopsis "Netscape API for system level and libc-like functions")
@@ -186,7 +282,7 @@ in the Mozilla clients.")
 (define-public nss
   (package
     (name "nss")
-    (version "3.27.1")
+    (version "3.30.2")
     (source (origin
               (method url-fetch)
               (uri (let ((version-with-underscores
@@ -197,13 +293,15 @@ in the Mozilla clients.")
                       "nss-" version ".tar.gz")))
               (sha256
                (base32
-                "0sraxk26swlgl7rl742rkfp5k251v5z3lqw9k8ikin0cjfhkfdpx"))
+                "096frzvyp3z257x84rxknscfgsbavzh2a0gyibx7kvmw4vzpfjhd"))
               ;; Create nss.pc and nss-config.
-              (patches (search-patches "nss-pkgconfig.patch"))))
+              (patches (search-patches "nss-pkgconfig.patch"
+                                       "nss-disable-long-b64-tests.patch"
+                                       "nss-increase-test-timeout.patch"))))
     (build-system gnu-build-system)
     (outputs '("out" "bin"))
     (arguments
-     '(#:parallel-build? #f ; failed
+     `(#:parallel-build? #f ; not supported
        #:make-flags
        (let* ((out (assoc-ref %outputs "out"))
               (nspr (string-append (assoc-ref %build-inputs "nspr")))
@@ -221,55 +319,65 @@ in the Mozilla clients.")
                   (ice-9 match)
                   (srfi srfi-26))
        #:phases
-       (alist-replace
-        'configure
-        (lambda* (#:key system inputs #:allow-other-keys)
-          (setenv "CC" "gcc")
-          ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
-          (when (string-prefix? "x86_64" system)
-            (setenv "USE_64" "1"))
-          #t)
-        (alist-replace
-         'check
-         (lambda _
-           ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
-           ;; The later requires a working DNS or /etc/hosts.
-           (setenv "DOMSUF" "(none)")
-           (setenv "USE_IP" "TRUE")
-           (setenv "IP_ADDRESS" "127.0.0.1")
-           (zero? (system* "./nss/tests/all.sh")))
-         (alist-replace
-          'install
-          (lambda* (#:key outputs #:allow-other-keys)
-            (let* ((out (assoc-ref outputs "out"))
-                   (bin (string-append (assoc-ref outputs "bin") "/bin"))
-                   (inc (string-append out "/include/nss"))
-                   (lib (string-append out "/lib/nss"))
-                   (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
-                          ((obj) (string-append "dist/" obj)))))
-              ;; Install nss-config to $out/bin.
-              (install-file (string-append obj "/bin/nss-config")
-                            (string-append out "/bin"))
-              (delete-file (string-append obj "/bin/nss-config"))
-              ;; Install nss.pc to $out/lib/pkgconfig.
-              (install-file (string-append obj "/lib/pkgconfig/nss.pc")
-                            (string-append out "/lib/pkgconfig"))
-              (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
-              (rmdir (string-append obj "/lib/pkgconfig"))
-              ;; Install other files.
-              (copy-recursively "dist/public/nss" inc)
-              (copy-recursively (string-append obj "/bin") bin)
-              (copy-recursively (string-append obj "/lib") lib)
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda _
+             (setenv "CC" "gcc")
+             ;; Tells NSS to build for the 64-bit ABI if we are 64-bit system.
+             ,@(match (%current-system)
+                 ((or "x86_64-linux" "aarch64-linux")
+                  `((setenv "USE_64" "1")))
+                 (_
+                  '()))
+             ;; The timeout values in "increase-test-timeouts" are still
+             ;; too low, so apply this workaround on armhf for now to avoid
+             ;; rebuilding on all platforms. This should be incorporated in
+             ;; the patch for the next update.
+             ;; https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00472.html
+             ,@(if (string-prefix? "armhf" (or (%current-target-system)
+                                               (%current-system)))
+                   `((substitute* "nss/gtests/ssl_gtest/tls_connect.cc"
+                       (("25000\\);") "300000);")))
+                   '())
+             #t))
+         (replace 'check
+           (lambda _
+             ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
+             ;; The later requires a working DNS or /etc/hosts.
+             (setenv "DOMSUF" "(none)")
+             (setenv "USE_IP" "TRUE")
+             (setenv "IP_ADDRESS" "127.0.0.1")
+             (zero? (system* "./nss/tests/all.sh"))))
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (bin (string-append (assoc-ref outputs "bin") "/bin"))
+                      (inc (string-append out "/include/nss"))
+                      (lib (string-append out "/lib/nss"))
+                      (obj (match (scandir "dist" (cut string-suffix? "OBJ" <>))
+                             ((obj) (string-append "dist/" obj)))))
+                 ;; Install nss-config to $out/bin.
+                 (install-file (string-append obj "/bin/nss-config")
+                               (string-append out "/bin"))
+                 (delete-file (string-append obj "/bin/nss-config"))
+                 ;; Install nss.pc to $out/lib/pkgconfig.
+                 (install-file (string-append obj "/lib/pkgconfig/nss.pc")
+                               (string-append out "/lib/pkgconfig"))
+                 (delete-file (string-append obj "/lib/pkgconfig/nss.pc"))
+                 (rmdir (string-append obj "/lib/pkgconfig"))
+                 ;; Install other files.
+                 (copy-recursively "dist/public/nss" inc)
+                 (copy-recursively (string-append obj "/bin") bin)
+                 (copy-recursively (string-append obj "/lib") lib)
 
-              ;; FIXME: libgtest1.so is installed in the above step, and it's
-              ;; (unnecessarily) linked with several NSS libraries, but
-              ;; without the needed rpaths, causing the 'validate-runpath'
-              ;; phase to fail.  Here we simply delete libgtest1.so, since it
-              ;; seems to be used only during the tests.
-              (delete-file (string-append lib "/libgtest1.so"))
+                 ;; FIXME: libgtest1.so is installed in the above step, and it's
+                 ;; (unnecessarily) linked with several NSS libraries, but
+                 ;; without the needed rpaths, causing the 'validate-runpath'
+                 ;; phase to fail.  Here we simply delete libgtest1.so, since it
+                 ;; seems to be used only during the tests.
+                 (delete-file (string-append lib "/libgtest1.so"))
 
-              #t))
-          %standard-phases)))))
+                 #t))))))
     (inputs
      `(("sqlite" ,sqlite)
        ("zlib" ,zlib)))
@@ -292,10 +400,10 @@ standards.")
     (license license:mpl2.0)))
 
 (define (mozilla-patch file-name changeset hash)
-  "Return an origin for CHANGESET from the mozilla-esr45 repository."
+  "Return an origin for CHANGESET from the mozilla-esr52 repository."
   (origin
     (method url-fetch)
-    (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr45/raw-rev/"
+    (uri (string-append "https://hg.mozilla.org/releases/mozilla-esr52/raw-rev/"
                         changeset))
     (sha256 (base32 hash))
     (file-name file-name)))
@@ -303,71 +411,47 @@ standards.")
 (define-public icecat
   (package
     (name "icecat")
-    (version "45.3.0-gnu1-beta")
+    (version "52.1.0-gnu1")
     (source
      (origin
       (method url-fetch)
-      (uri (list (string-append "mirror://gnu/gnuzilla/" version "/"
-                                name "-" version ".tar.bz2")
-                 ;; XXX Temporary URI for 45.3 beta release.
-                 ;;     Remove when no longer needed.
-                 (string-append "http://jenkins.trisquel.info/icecat/binaries/"
-                                "icecat-45.3.0-gnu1.tar.bz2")))
+      (uri (string-append "mirror://gnu/gnuzilla/"
+                          (first (string-split version #\-))
+                          "/" name "-" version ".tar.bz2"))
       (sha256
        (base32
-        "1hk5lwaqm8nkfm43sq521mzyrx0x3iiwvlcy62m7cq7grz9wixp6"))
+        "1wr4bc5806xzyqpi6m4rjaf61za6ylpx4g0kfk95c6yw9yhg5vqb"))
       (patches
-       `(,(search-patch "icecat-avoid-bundled-libraries.patch")
-         ,(search-patch "icecat-binutils.patch")
-         ,(mozilla-patch "icecat-CVE-2016-5250.patch"     "6711ccb0184e" "1p0s91rw1j7ib6hy9gh5p0l33rja32rfgygh29jw4wq1hxfql8rk")
-         ,(mozilla-patch "icecat-CVE-2016-5257-pt1.patch" "b08f28db372e" "0fmifimavawbff700rzjibsnr16am6902gp965scvi1iy78754ia")
-         ,(mozilla-patch "icecat-CVE-2016-5257-pt2.patch" "a49fd7eb57ba" "1dyh0pjdmf64sjbj1x0mdjwfispacx9yny1kx9nzpf85myryr640")
-         ,(mozilla-patch "icecat-CVE-2016-5257-pt3.patch" "9707c3423a1e" "12nn8av0akza4ml1is9mfy8f7368mrkxsl32ly97r4irzh0iryh1")
-         ,(mozilla-patch "icecat-CVE-2016-5257-pt4.patch" "9d632865560a" "1msp1wqv0c317wqkm82hd9ajbg4a5mcr8pld5j8cx37ccv7f21g3")
-         ,(mozilla-patch "icecat-CVE-2016-5257-pt5.patch" "90697781ec9f" "1h6gcrw5ykf7r59phxqkhpfs7jsgzqn509qm43sj7mbpcvqvk5mg")
-         ,(mozilla-patch "icecat-CVE-2016-5257-pt6.patch" "dd9eb81853b9" "1lyqnn40sayziych8gqd5aj7il3zajf318y8ddj8dzz3c8id5dzc")
-         ,(mozilla-patch "icecat-CVE-2016-5257-pt7.patch" "d91fc76079e0" "022lhixa8dxa6ny9a4bh2di282i0lhyq0glqr9n4q3r8msfmf0ba")
-         ,(mozilla-patch "icecat-CVE-2016-5257-pt8.patch" "3e37ba5e0867" "1w8lncxaayq4xndhyp1hwlv00zggbayljq6rlypb8kdwgzfpi77w")
-         ,(mozilla-patch "icecat-CVE-2016-5257-pt9.patch" "3c4958a98908" "16bc6ai5qddnpm3yw24lry5s7i05xs0ycixzxiir4wmcgwcaayiy")
-         ,(mozilla-patch "icecat-CVE-2016-5261.patch"     "bc2f5467b33d" "0i4b8ydmqg4blx541f56g9qrlm7gp6ih4cs7ixbds724cwk83b9f")
-         ,(mozilla-patch "icecat-CVE-2016-5270.patch"     "7cd50d56bb61" "15nbp5axr59mczxgf37nli37jbw0jdknmxz7z71772pzjd2z07r9")
-         ,(mozilla-patch "icecat-CVE-2016-5272.patch"     "6e43a01fee3c" "025xp1wdnz1gc5l2rsgbrwsh1pbysjiyfgz0g6rvr390r7ag1n74")
-         ,(mozilla-patch "icecat-CVE-2016-5274.patch"     "10c9453407de" "1wqh6hj0dpa7r3hhlyrflcv3r3cg0xq4rb0zvhysi6l7lwb8q51r")
-         ,(mozilla-patch "icecat-CVE-2016-5276.patch"     "fc818ab03f15" "1q64ipl172dcmyy9p8p3l3ljpdh1q1jg48lai0qn2xgknl7sdpks")
-         ,(mozilla-patch "icecat-CVE-2016-5277.patch"     "7b668c5cec92" "1qmchn6qifgjakzac6i4hgnivy062pzgz9p1l11c1m3an1rh0isg")
-         ,(mozilla-patch "icecat-CVE-2016-5278.patch"     "fd5052e343df" "1nzmzlnsz61w9aw4mjvgmlkz88aqv1w858rr0mbv07hwyrljfi84")
-         ,(mozilla-patch "icecat-CVE-2016-5280.patch"     "30673bc9730b" "1qz1684v1rp86ngadcaqd68iqf472flnrnk971ryg4fbsyy8g1za")
-         ,(mozilla-patch "icecat-CVE-2016-5281-pt1.patch" "61405f1fd1df" "1fgmq67arwsl1nrl133fcb5cz6jbbcfjvbv8cd8cadhapin971a7")
-         ,(mozilla-patch "icecat-CVE-2016-5281-pt2.patch" "7776b6ec7b92" "1f7k8f4lk7nyghwajsxf6nb7yvzsaw3jwpa3316znsva12m548mn")
-         ,(mozilla-patch "icecat-CVE-2016-5284-pt1.patch" "55e768767416" "1gg7m12njbkn1jqf2gp2y7zd9ik3xhqkjb7znczna4l438h7ki83")
-         ,(mozilla-patch "icecat-CVE-2016-5284-pt2.patch" "3c42249975a5" "0gnanndkmhsp49rldv4kh0smkdcs7616v46hn567kfw8yfwqvnli")
-         ,(mozilla-patch "icecat-CVE-2016-5284-pt3.patch" "126e5d574811" "13gr08bzqy23adz0ciihb7cy9wdnkcn71i77a3y5b5apm6k54mwi")
-         ,(mozilla-patch "icecat-CVE-2016-5284-pt4.patch" "7b8bd7aae1a8" "0mq5gpq6ni8czfcs1rif4is0igh0054aw41ga0jqkq58g7lavkrf")
-         ,(mozilla-patch "icecat-CVE-2016-5284-pt5.patch" "0799490f4e6f" "1ypv6i48nabbhcqbach8fbgz9bmnhm7q5z9dnfid44z8g54l3f33")
-         ,(mozilla-patch "icecat-CVE-2016-5284-pt6.patch" "fc990e4ae8bc" "1s2cj505ajwwiy4xvn5zlmyzqpgahxmqqvis0a6xm6mjbjh02gm4")
-         ,(mozilla-patch "icecat-bug-1251088.patch"       "5ffa912ed83e" "0v5lpv3c89c2d4y5acn0kyijv096axdnrvaj5ya5yypzfcaqxv24")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt1.patch" "d4b5b8f3e373" "0w8cxn6ryhgxryy8k8i06yw4mknv509ns9ff1avd0hmgxa83mcdp")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt2.patch" "adce603ae36d" "0mgs85cwx61bk17r7npl311l4m8yn4667wyhgjmm2ajiys6nn0yl")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt3.patch" "97268426bb6f" "1z7hg796cgag025gm9pp2szz7w870s7naagdri1dlsilj797v8hr")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt4.patch" "fc055950b6b8" "05iml5k3rzc653jk4imd111sh18625jxfxkcj12kjdihl0gdr4x4")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt5.patch" "6f845c23565b" "01dlbnmpsnwr448fajs276y62gl03r74k1hxnwsg6ihwhnfdvn5a")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt6.patch" "e5d51ca7a3c0" "0hshcz24hc6pkz5pcqxhajm17ibwrlfn1s00frfnpjjy56vacfz0")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt7.patch" "61d1463acd04" "1iig4a79dxmfcr6w82mdhyl88wy7d36g5n4p24632kbabgl9j9sz")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt8.patch" "8e0bab4216de" "1knq8h5ni8crfndi3p78b2pyj5lzchqw67vk0yx061r76mq4wp4r")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt9.patch" "bb10104dc89e" "1flvagckrzfk7hs2xzb5j3s5i0ck57ygyskh5494xmpa2a1nnsqj")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt10.patch" "7006b275b829" "0sqagm247wx94mf51fyhdkn0vf1a1qy9i829shjnhssd79srxmnn")
-         ,(mozilla-patch "icecat-CVE-2016-5290-pt11.patch" "32ce7be98543" "1y2r9i4p1qpqi75mlwmibr51whz5h1vj28c6mh6ik57dxkqxbclb")
-         ,(mozilla-patch "icecat-CVE-2016-5291.patch"     "3ff0c89f3b26" "1prn74aglshaj27jfrpd2s2i4slpljw4rbzjxc1qgwjvkq4m6j6f")
-         ,(mozilla-patch "icecat-CVE-2016-5297.patch"     "46b07bdbf8b2" "1n8y1c5l0ms81dra7jsx8mp633ak5qvx105drvlg9hn3m0fwv1lj")
-         ,(search-patch  "icecat-CVE-2016-9064.patch") ; adapted for icecat based on:
-                                        ;                 "00c2b7baaa0b" "0y02yb7r62656nq9dji9dnwils2lxqasjz5byv62j1xa87r7f9hp"
-         ,(mozilla-patch "icecat-CVE-2016-9066.patch"     "576f1725a57e" "1lic9d3r8r1vcniw1g3ca71390lw3dmwjsw55dp6z96hyjbcq3fd")
-         ,(mozilla-patch "icecat-bug-1212939.patch"       "4a0e851f83e4" "182vx1qxrr7r2175jjf0bcixwwm1khdj4sq0c8wnsyry7p9waq5q")
-         ,(mozilla-patch "icecat-bug-1168743.patch"       "a1e06af61ab3" "07llk1ba6axjasiv30vicz96k55ff4mybxy21vjxk6j0asgyjz23")
-         ,(mozilla-patch "icecat-bug-1287176.patch"       "0569d5dce9db" "1d41sqbq6jc3af73dz9w19win7v7c12kw1mp7j7b1gkadq46c4y7")
-         ,(mozilla-patch "icecat-bug-1263665.patch"       "a79cafee93f4" "0bn7hpm8mh8qmkpz5wiridr792irrs5sjxyvryazy2i0p4pjh62p")
-         ,(mozilla-patch "icecat-bug-1304962.patch"       "f61049d5f373" "04d1na31qqq7yq4jjvhq6vzqq3f23rwac8c6fw4h5fx1pdb3l997")
-         ,(mozilla-patch "icecat-bug-1314574.patch"       "46b2558ca469" "00q8676xg4wb7p371wgi04nl05j7idkb2kna9a0l08k6lks9wdhh")))
+       (list
+        (search-patch "icecat-avoid-bundled-libraries.patch")
+        (mozilla-patch "icecat-bug-1342366.patch"        "fb43f6690a26" "1vnkjpq2bcqwzmjkgyqv8wj0ndrrsyix3qy1rsb5is6pjmi9sbaa")
+        (mozilla-patch "icecat-bug-1343818.patch"        "90f870bbec29" "0mbki955f71n4yr9p0yc7kh5jwq7vs4bs4rhaazdncirbr564hm6")
+        (mozilla-patch "icecat-bug-1348454.patch"        "c1cd8a02669f" "1wf0107763rw45kxkak7478vlax06ay7076cbm7ysxl7vijbr52w")
+        (mozilla-patch "icecat-bug-1297111.patch"        "2553531f83b9" "0ibf59pa8czdyhc25sas6zhh2gf1k8vr8fklis2b1ms3n1qnzrha")
+        (mozilla-patch "icecat-bug-1355873.patch"        "9ee455ddcd68" "0d38hi4556635g9ag805vfyffdgfsp4a8v3d9ldffdp99ypv2ixj")
+        (mozilla-patch "icecat-bug-1348424-pt1.patch"    "6472c7006a73" "1fgydas23fzj49n4g43133bgjn98b2h38bii4knl7z7pm3fs2wws")
+        (mozilla-patch "icecat-bug-1348424-pt2.patch"    "0d5a26b29816" "03mkghl9i83jk1axr8bvw8la6shbggkabf23if8a9vi5jdv8182x")
+        (mozilla-patch "icecat-bug-1357092.patch"        "e78c943af07f" "0r830k6hja8z9rjk2nqjg8zfzr0wjcnic8rddh7jmc1inr1w3crm")
+        (mozilla-patch "icecat-bug-1352093.patch"        "d7c06f2d0d13" "1ahyns5v37w91bilvb3pa8kkdzkkn3fcxmi49jr5bycjlawljrm4")
+        (mozilla-patch "icecat-bug-1349595.patch"        "9071c7d4cc9c" "12128sf8s3zwv2w16kfl5jry9d6ky7hvps2006184rg23p32aj6n")
+        (mozilla-patch "icecat-bug-1336979.patch"        "8bbc7b586d68" "0c13imyp1nq18in3yb1zcyi41b69svh4fn8msyj0c2lhbf8qnqcw")
+        (mozilla-patch "icecat-bug-1352556.patch"        "6d80ca63ff8b" "0s893fn6v0p323lcnl4cbkg1zd7gs1p0bw76ki6cmiapkn63gs13")
+        (mozilla-patch "icecat-bug-1359547.patch"        "43d7b98d8743" "1dhgy1jkvn3c4k27hbv8p16w7l09b8hd4w9zzpk8dpn4h78ncs3h")
+        (mozilla-patch "icecat-CVE-2017-5031.patch"      "bd4fcdee9a06" "0xz1r342023a0bsllhjbzn6v75lpqznwacqyikb7q8i4hxkxh78a")
+        (mozilla-patch "icecat-bug-1346499.patch"        "747fd6c81983" "00iscyn4wr69205ppiaghlnd32845f5lcsl303v0fcdd4d1v04vc")
+        (mozilla-patch "icecat-bug-1334443-pt1.patch"    "16201e8478df" "1k91xaai25vn1svkaldnsd2s8br3fgvnk5l54k3n3lk3m5vj55hv")
+        (mozilla-patch "icecat-bug-1334443-pt2.patch"    "f100e5cf3bcb" "1cgbbbnkrd3ydfw99rhnpqdp5zq65537mg8sa1s9ajxkjjd1dkwj")
+        (mozilla-patch "icecat-bug-1354810.patch"        "e579ef6e8d11" "0cmrh8dl85lzjxpbni08xbs8qq15sljnpg70a7rsl0jdbgih3mdx")
+        (mozilla-patch "icecat-bug-1356755.patch"        "4a3fce67b52d" "126i9nwxsb3sjwb7dvhafacq86glnhx7r7jjv0h9v21s1w0kx4wj")
+        (mozilla-patch "icecat-bug-1273265.patch"        "7902fea300b8" "1jkrl8hdycsi17dd1m1vvl6gm1skhpf10q2m29zwfr8l40fd6a3q")
+        (mozilla-patch "icecat-bug-1353204.patch"        "b5a21502aeff" "13rbrhvr37w95av9d4hkgi913nq0j6k2iijydylvprcn18cwibp0")
+        (mozilla-patch "icecat-bug-1028195.patch"        "69a5ca2bf867" "0q8cgi6837ikpg7gsvywmzhq0i102845apcbrd6mw0205qqsnw5c")
+        (mozilla-patch "icecat-bug-1347835.patch"        "bc635f45af37" "1fny422l6yc80901x6swybr8nk0in1wxfgy97ky4bdkcqlnmzpqv")
+        (mozilla-patch "icecat-bug-1241066.patch"        "b922ca70cce5" "09hcf9rm7ng3vj5y267w0c9h6pqinnz8gjlkwx1337xh43mdvqjv")
+        (mozilla-patch "icecat-bug-1346012.patch"        "1ce6d0652921" "163ji64a86h682frh1jq016w1mjf8g24r8cni0irsdmiihis7zxc")
+        (mozilla-patch "icecat-bug-1324140.patch"        "8886f9cd5dd3" "0byabs9md8r3pc4r67sv2759427n1za0gfayln40nx47n2p52kmg")
+        (mozilla-patch "icecat-bug-1342552.patch"        "ad995e90916b" "02nq9sg675p26z99nr2pykbz51hi2phf0gmrb1bjpq9pjbll7gsa")
+        (mozilla-patch "icecat-bug-1355039.patch"        "4ae71415fecf" "0yfkkdkkimad9a3w734xx85lb7hrl870c8k8an7w78fq3vl3fjnd")))
       (modules '((guix build utils)))
       (snippet
        '(begin
@@ -411,7 +495,7 @@ standards.")
                       "db/sqlite3"))
           ;; Delete .pyc files, typically present in icecat source tarballs
           (for-each delete-file (find-files "." "\\.pyc$"))
-          ;; Delete obj-* directories, found in icecat-45.3.0-gnu1-beta
+          ;; Delete obj-* directories, sometimes present in icecat tarballs
           (for-each delete-file-recursively
                     (scandir "." (lambda (name)
                                    (string-prefix? "obj-" name))))
@@ -425,9 +509,8 @@ standards.")
        ("dbus-glib" ,dbus-glib)
        ("gdk-pixbuf" ,gdk-pixbuf)
        ("glib" ,glib)
-       ("gstreamer" ,gstreamer)
-       ("gst-plugins-base" ,gst-plugins-base)
-       ("gtk+" ,gtk+-2)
+       ("gtk+" ,gtk+)
+       ("gtk+-2" ,gtk+-2)
        ("pango" ,pango)
        ("freetype" ,freetype)
        ("hunspell" ,hunspell)
@@ -435,12 +518,13 @@ standards.")
        ("libgnome" ,libgnome)
        ("libjpeg-turbo" ,libjpeg-turbo)
        ("libxft" ,libxft)
-       ("libevent" ,libevent)
+       ("libevent" ,libevent-2.0)
        ("libxinerama" ,libxinerama)
        ("libxscrnsaver" ,libxscrnsaver)
        ("libxcomposite" ,libxcomposite)
        ("libxt" ,libxt)
        ("libffi" ,libffi)
+       ("ffmpeg" ,ffmpeg)
        ("libvpx" ,libvpx)
        ("icu4c" ,icu4c)
        ("pixman" ,pixman)
@@ -452,19 +536,19 @@ standards.")
        ("sqlite" ,sqlite)
        ("startup-notification" ,startup-notification)
        ("unzip" ,unzip)
-       ("yasm" ,yasm)
        ("zip" ,zip)
        ("zlib" ,zlib)))
     (native-inputs
      `(("perl" ,perl)
        ("python" ,python-2) ; Python 3 not supported
        ("python2-pysqlite" ,python2-pysqlite)
+       ("yasm" ,yasm)
        ("pkg-config" ,pkg-config)
+       ("autoconf" ,autoconf-2.13)
        ("which" ,which)))
     (arguments
      `(#:tests? #f          ; no check target
        #:out-of-source? #t  ; must be built outside of the source directory
-       #:parallel-build? #f
 
        ;; XXX: There are RUNPATH issues such as
        ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
@@ -472,17 +556,11 @@ standards.")
        ;; practice somehow.  See <http://hydra.gnu.org/build/378133>.
        #:validate-runpath? #f
 
-       #:configure-flags '("--enable-default-toolkit=cairo-gtk2"
-                           "--enable-pango"
+       #:configure-flags '("--enable-default-toolkit=cairo-gtk3"
                            "--enable-gio"
-                           "--enable-svg"
-                           "--enable-canvas"
-                           "--enable-mathml"
                            "--enable-startup-notification"
                            "--enable-pulseaudio"
-                           "--enable-gstreamer=1.0"
 
-                           "--disable-gnomevfs"
                            "--disable-gconf"
                            "--disable-gnomeui"
 
@@ -491,9 +569,8 @@ standards.")
                            "--disable-debug"
                            "--disable-debug-symbols"
 
-                           ;; Temporary hack to work around missing
-                           ;; "unofficial" branding in
-                           ;; icecat-45.3.0-gnu1-beta.
+                           ;; Hack to work around missing
+                           ;; "unofficial" branding in icecat.
                            "--enable-official-branding"
 
                            ;; Avoid bundled libraries.
@@ -541,14 +618,17 @@ standards.")
                          #t))
               #t)))
          (add-after
-          'unpack 'remove-h264parse-from-blacklist
+          'unpack 'use-skia-by-default
           (lambda _
-            ;; Remove h264parse from gstreamer format helper blacklist.  It
-            ;; was put there to work around a bug in a pre-1.0 version of
-            ;; gstreamer.  See:
-            ;; https://www.mozilla.org/en-US/security/advisories/mfsa2015-47/
-            (substitute* "dom/media/gstreamer/GStreamerFormatHelper.cpp"
-              (("^  \"h264parse\",\n") ""))
+            ;; Use the bundled Skia library by default, since IceCat appears
+            ;; to be far more stable when using it than when using our system
+            ;; Cairo.
+            (let ((out (open "browser/app/profile/icecat.js"
+                              (logior O_WRONLY O_APPEND))))
+              (format out "~%// Use Skia by default~%")
+              (format out "pref(~s, ~s);~%" "gfx.canvas.azure.backends" "skia")
+              (format out "pref(~s, ~s);~%" "gfx.content.azure.backends" "skia")
+              (close-port out))
             #t))
          (add-after
           'unpack 'arrange-to-link-libxul-with-libraries-it-might-dlopen
@@ -560,10 +640,11 @@ standards.")
             ;; calls to dlopen or PR_LoadLibrary, but that didn't seem to
             ;; work.  More investigation is needed.
             (substitute* "toolkit/library/moz.build"
-              (("^# This needs to be last")
-               "OS_LIBS += [
+              (("^# This library needs to be last" all)
+               (string-append "OS_LIBS += [
     'GL', 'gnome-2', 'canberra', 'Xss', 'cups', 'gssapi_krb5',
-    'gstreamer-1.0', 'gstapp-1.0', 'gstvideo-1.0' ]\n\n"))
+    'avcodec', 'avutil', 'pulse' ]\n\n"
+                              all)))
             #t))
          (replace
           'configure
@@ -580,6 +661,7 @@ standards.")
                             ,@configure-flags)))
               (setenv "SHELL" bash)
               (setenv "CONFIG_SHELL" bash)
+              (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
               (mkdir "../build")
               (chdir "../build")
               (format #t "build directory: ~s~%" (getcwd))
@@ -641,8 +723,17 @@ standards.")
                       (copy-file file (string-append icons "/icecat.png"))))
                   '("default16.png" "default22.png" "default24.png"
                     "default32.png" "default48.png" "content/icon64.png"
-                    "mozicon128.png" "default256.png")))))))))
-    (home-page "http://www.gnu.org/software/gnuzilla/")
+                    "mozicon128.png" "default256.png"))))))
+         ;; This fixes the file chooser crash that happens with GTK 3.
+         (add-after 'install 'wrap-program
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (lib (string-append out "/lib"))
+                    (gtk (assoc-ref inputs "gtk+"))
+                    (gtk-share (string-append gtk "/share")))
+               (wrap-program (car (find-files lib "^icecat$"))
+                 `("XDG_DATA_DIRS" ":" prefix (,gtk-share)))))))))
+    (home-page "https://www.gnu.org/software/gnuzilla/")
     (synopsis "Entirely free browser derived from Mozilla Firefox")
     (description
      "IceCat is the GNU version of the Firefox browser.  It is entirely free