Merge branch 'master' into core-updates-frozen
[jackhill/guix/guix.git] / gnu / packages / gnuzilla.scm
index e657dbd..58ea1f7 100644 (file)
@@ -1,9 +1,9 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
-;;; Copyright © 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2017, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017, 2018 Nikita <nikita@n0.is>
@@ -14,6 +14,8 @@
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;; Copyright © 2019, 2020 Adrian Malacoda <malacoda@monarch-pass.net>
 ;;; Copyright © 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
+;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -336,8 +338,7 @@ in C/C++.")
                (let ((out (assoc-ref outputs "out")))
                  (setenv "SHELL" (which "sh"))
                  (setenv "CONFIG_SHELL" (which "sh"))
-                 (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
-                                                   "/bin/autoconf"))
+                 (setenv "AUTOCONF" (which "autoconf"))
                  (apply invoke "./configure"
                         (cons (string-append "--prefix=" out)
                               configure-flags))))))))
@@ -353,7 +354,7 @@ in C/C++.")
   ;; we take the Debian version instead, because it is easier to work with.
   (package
     (inherit mozjs-38)
-    (version "60.2.3-2")
+    (version "60.2.3-4")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -362,7 +363,7 @@ in C/C++.")
               (file-name (git-file-name "mozjs" version))
               (sha256
                (base32
-                "091w050rwzrdcbgyi934k2viyccmlqxrp13sm2mql71mabb5dai6"))))
+                "1xl6avsj9gkgma71p56jzs7nasc767k3n1frnmri5pad4rj94bij"))))
     (arguments
      `(#:tests? #f ; FIXME: all tests pass, but then the check phase fails anyway.
        #:test-target "check-jstests"
@@ -393,8 +394,7 @@ in C/C++.")
                (chdir "run-configure-from-here")
                (setenv "SHELL" (which "sh"))
                (setenv "CONFIG_SHELL" (which "sh"))
-               (setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
-                                                 "/bin/autoconf"))
+               (setenv "AUTOCONF" (which "autoconf"))
                (apply invoke "../js/src/configure"
                       (cons (string-append "--prefix=" out)
                             configure-flags))
@@ -413,6 +413,148 @@ in C/C++.")
        ("pkg-config" ,pkg-config)
        ("python" ,python-2)))))
 
+(define-public mozjs-78
+  (package
+    (inherit mozjs-60)
+    (version "78.10.1")
+    (source (origin
+              (method url-fetch)
+              ;; TODO: Switch to IceCat source once available on ftp.gnu.org.
+              (uri (string-append "https://archive.mozilla.org/pub/firefox"
+                                  "/releases/" version "esr/source/firefox-"
+                                  version "esr.source.tar.xz"))
+              (sha256
+               (base32
+                "0gyg2p6i1wmmfghwg13pp6fj8j8xz6c14f6bbnf4pf0f5c3la7y4"))))
+    (arguments
+     `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
+       #:modules ((guix build cargo-utils)
+                  ,@%gnu-build-system-modules)
+       #:test-target "check-jstests"
+       #:configure-flags
+       '(;; Disable debugging symbols to save space.
+         "--disable-debug"
+         "--disable-debug-symbols"
+         ;; This is important because without it gjs will segfault during the
+         ;; configure phase.  With jemalloc only the standalone mozjs console
+         ;; will work.
+         "--disable-jemalloc"
+         "--enable-tests"
+         "--enable-hardening"
+         "--enable-optimize"
+         "--enable-release"
+         "--enable-rust-simd"
+         "--enable-readline"
+         "--enable-shared-js"
+         "--with-system-icu"
+         "--with-system-nspr"
+         "--with-system-zlib"
+         "--with-intl-api")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-source-shebangs 'patch-cargo-checksums
+           (lambda _
+             (let ((null-hash
+                    "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"))
+               (for-each (lambda (file)
+                           (format #t "patching checksums in ~a~%" file)
+                           (substitute* file
+                             (("^checksum = \".*\"")
+                              (string-append "checksum = \"" null-hash "\""))))
+                         (find-files "." "Cargo\\.lock$"))
+               (for-each generate-all-checksums
+                         '("js" "third_party/rust"))
+               #t)))
+         (replace 'configure
+           (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
+             ;; The configure script does not accept environment variables as
+             ;; arguments.  It also must be run from a different directory,
+             ;; but not the root directory either.
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir "run-configure-from-here")
+               (chdir "run-configure-from-here")
+               (setenv "SHELL" (which "sh"))
+               (setenv "CONFIG_SHELL" (which "sh"))
+               (setenv "AUTOCONF" (which "autoconf"))
+               (apply invoke "../js/src/configure"
+                      (cons (string-append "--prefix=" out)
+                            configure-flags))
+               #t)))
+         (add-after 'unpack 'adjust-for-icu-68
+           (lambda _
+             (with-directory-excursion "js/src/tests"
+               ;; The test suite expects a lightly patched ICU 67.  Since
+               ;; Guix is about to switch to ICU 68, massage the tests to
+               ;; work with that instead of patching ICU.  Try removing this
+               ;; phase for newer versions of mozjs.
+
+               ;; These tests look up locale names and expects to get
+               ;; "GB" instead of "UK".
+               (substitute* "non262/Intl/DisplayNames/language.js"
+                 (("Traditionell, GB")
+                  "Traditionell, UK"))
+               (substitute* "non262/Intl/DisplayNames/region.js"
+                 (("\"GB\": \"GB\"")
+                  "\"GB\": \"UK\""))
+
+               ;; XXX: Some localized time formats have changed, and
+               ;; substitution fails for accented characters, even though
+               ;; it works in the REPL(?).  Just delete these for now.
+               (delete-file "non262/Intl/Date/toLocaleString_timeZone.js")
+               (delete-file "non262/Intl/Date/toLocaleDateString_timeZone.js")
+
+               ;; Similarly, these get an unexpected "A" suffix when looking
+               ;; up a time in the "ar-MA-u-ca-islamicc" locale, which is
+               ;; tricky to substitute.
+               (delete-file "non262/Intl/DateTimeFormat/format_timeZone.js")
+               (delete-file "non262/Intl/DateTimeFormat/format.js")
+
+               ;; This file compares a generated list of ICU locale names
+               ;; with actual lookups.  Some have changed slightly, i.e.
+               ;; daf-Latn-ZZ -> daf-Latn-CI, so drop it for simplicity.
+               (delete-file "non262/Intl/Locale/likely-subtags-generated.js"))
+
+             #t))
+         (add-before 'check 'pre-check
+           (lambda _
+             (with-directory-excursion "../js/src/tests"
+               (substitute* "shell/os.js"
+                 ;; FIXME: Why does the killed process have an exit status?
+                 ((".*killed process should not have exitStatus.*")
+                  ""))
+
+               ;; XXX: Delete all tests that test time zone functionality,
+               ;; because the test suite uses /etc/localtime to figure out
+               ;; the offset from the hardware clock, which does not work
+               ;; in the build container.  See <tests/non262/Date/shell.js>.
+               (delete-file-recursively "non262/Date")
+               (delete-file "non262/Intl/DateTimeFormat/tz-environment-variable.js")
+
+               (setenv "JSTESTS_EXTRA_ARGS"
+                       (string-join
+                        (list
+                         ;; Do not run tests marked as "random".
+                         "--exclude-random"
+                         ;; Exclude web platform tests.
+                         "--wpt=disabled"
+                         ;; Respect the daemons configured number of jobs.
+                         (string-append "--worker-count="
+                                        (number->string (parallel-job-count)))))))
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf-2.13)
+       ("automake" ,automake)
+       ("llvm" ,llvm)                   ;for llvm-objdump
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-3)
+       ("rust" ,rust-1.41)
+       ("cargo" ,rust-1.41 "cargo")))
+    (inputs
+     `(("icu4c" ,icu4c)
+       ("readline" ,readline)
+       ("zlib" ,zlib)))))
+
 (define mozilla-compare-locales
   (origin
     (method hg-fetch)
@@ -550,8 +692,8 @@ from forcing GEXP-PROMISE."
                       #:system system
                       #:guile-for-build guile)))
 
-(define %icecat-version "78.5.0-guix0-preview1")
-(define %icecat-build-id "20201117000000") ;must be of the form YYYYMMDDhhmmss
+(define %icecat-version "78.14.0-guix0-preview1")
+(define %icecat-build-id "20210907000000") ;must be of the form YYYYMMDDhhmmss
 
 ;; 'icecat-source' is a "computed" origin that generates an IceCat tarball
 ;; from the corresponding upstream Firefox ESR tarball, using the 'makeicecat'
@@ -573,11 +715,11 @@ from forcing GEXP-PROMISE."
                   "firefox-" upstream-firefox-version ".source.tar.xz"))
             (sha256
              (base32
-              "1442yjmwz69hkfcvh8kkb60jf4c9ms0pac04nc3xw2da13v4zxai"))))
+              "1ymjlg6p23c510m764pqr4sldrvk0c7g490a29js2cqc2nj2h3ma"))))
 
-         (upstream-icecat-base-version "78.5.0") ; maybe older than base-version
+         (upstream-icecat-base-version "78.7.0") ; maybe older than base-version
          ;;(gnuzilla-commit (string-append "v" upstream-icecat-base-version))
-         (gnuzilla-commit "bcfe407570cae32d00dd33a268de0e0593166f7b")
+         (gnuzilla-commit "abfe5eebaca3c2787f1a9505669393674493c177")
          (gnuzilla-source
           (origin
             (method git-fetch)
@@ -589,7 +731,7 @@ from forcing GEXP-PROMISE."
                                       (string-take gnuzilla-commit 8)))
             (sha256
              (base32
-              "1pg8fjjg91qyrv7za585ds1xrdvmybbkf2jmkff107fh5y23lxrg"))))
+              "00ws3540x5whpicc5fx4k949ff73cqvajz6jp13ahn49wqdads47"))))
 
          ;; 'search-patch' returns either a valid file name or #f, so wrap it
          ;; in 'assume-valid-file-name' to avoid 'local-file' warnings.
@@ -766,6 +908,7 @@ from forcing GEXP-PROMISE."
        ;; UNBUNDLE-ME! ("nss" ,nss)
        ("shared-mime-info" ,shared-mime-info)
        ;; UNBUNDLE-ME! ("sqlite" ,sqlite)
+       ("eudev" ,eudev)
        ("unzip" ,unzip)
        ("zip" ,zip)
        ;; UNBUNDLE-ME! ("zlib" ,zlib)
@@ -785,13 +928,13 @@ from forcing GEXP-PROMISE."
 
        ("patch" ,(canonical-package patch))
 
-       ("rust" ,rust-1.41)
-       ("cargo" ,rust-1.41 "cargo")
+       ("rust" ,rust)
+       ("cargo" ,rust "cargo")
        ("rust-cbindgen" ,rust-cbindgen-0.14)
        ("llvm" ,llvm)
        ("clang" ,clang)
        ("perl" ,perl)
-       ("node" ,node-10.22)
+       ("node" ,node)
        ("python" ,python)
        ("python-2" ,python-2)
        ("python2-pysqlite" ,python2-pysqlite)
@@ -804,12 +947,6 @@ from forcing GEXP-PROMISE."
      `(#:tests? #f          ; no check target
        #:out-of-source? #t  ; must be built outside of the source directory
 
-       ;; XXX: There are RUNPATH issues such as
-       ;; $prefix/lib/icecat-31.6.0/plugin-container NEEDing libmozalloc.so,
-       ;; which is not in its RUNPATH, but they appear to be harmless in
-       ;; practice somehow.  See <http://hydra.gnu.org/build/378133>.
-       #:validate-runpath? #f
-
        #:configure-flags `("--enable-default-toolkit=cairo-gtk3-wayland"
 
                            "--with-distribution-id=org.gnu"
@@ -1057,6 +1194,9 @@ from forcing GEXP-PROMISE."
                (setenv "AUTOCONF" (which "autoconf")) ; must be autoconf-2.13
                (setenv "CC" "gcc")  ; apparently needed when Stylo is enabled
                (setenv "MOZ_BUILD_DATE" ,%icecat-build-id) ; avoid timestamp
+               (setenv "LDFLAGS" (string-append "-Wl,-rpath="
+                                                (assoc-ref outputs "out")
+                                                "/lib/icecat"))
                (mkdir "../build")
                (chdir "../build")
                (format #t "build directory: ~s~%" (getcwd))
@@ -1130,19 +1270,21 @@ from forcing GEXP-PROMISE."
                     (lib (string-append out "/lib"))
                     (gtk (assoc-ref inputs "gtk+"))
                     (gtk-share (string-append gtk "/share"))
-                    (mesa (assoc-ref inputs "mesa"))
-                    (mesa-lib (string-append mesa "/lib"))
-                    (pulseaudio (assoc-ref inputs "pulseaudio"))
-                    (pulseaudio-lib (string-append pulseaudio "/lib"))
-                    (libxscrnsaver (assoc-ref inputs "libxscrnsaver"))
-                    (libxscrnsaver-lib (string-append libxscrnsaver "/lib")))
+                    (ld-libs (map (lambda (lib)
+                                    (string-append (assoc-ref inputs lib)
+                                                   "/lib"))
+                              '("libxscrnsaver"
+                                "mesa"
+                                "mit-krb5"
+                                "eudev"
+                                "pulseaudio"))))
                (wrap-program (car (find-files lib "^icecat$"))
                  `("XDG_DATA_DIRS" prefix (,gtk-share))
                  ;; The following line is commented out because the icecat
                  ;; package on guix has been observed to be unstable when
                  ;; using wayland, and the bundled extensions stop working.
                  ;;   `("MOZ_ENABLE_WAYLAND" = ("1"))
-                 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib ,mesa-lib ,libxscrnsaver-lib)))
+                 `("LD_LIBRARY_PATH" prefix ,ld-libs))
                #t))))))
     (home-page "https://www.gnu.org/software/gnuzilla/")
     (synopsis "Entirely free browser derived from Mozilla Firefox")
@@ -1161,11 +1303,11 @@ standards of the IceCat project.")
        (cpe-version . ,(first (string-split version #\-)))))))
 
 ;; Update this together with icecat!
-(define %icedove-build-id "20201111000000") ;must be of the form YYYYMMDDhhmmss
+(define %icedove-build-id "20210810000000") ;must be of the form YYYYMMDDhhmmss
 (define-public icedove
   (package
     (name "icedove")
-    (version "78.4.3")
+    (version "78.13.0")
     (source icecat-source)
     (properties
      `((cpe-name . "thunderbird_esr")))
@@ -1314,8 +1456,7 @@ standards of the IceCat project.")
                (setenv "CC" "gcc")
                (setenv "MOZ_NOSPAM" "1")
                (setenv "PYTHON"
-                       (string-append (assoc-ref inputs "python2")
-                                      "/bin/python"))
+                       (search-input-file inputs "/bin/python"))
                (setenv "MOZ_BUILD_DATE" ,%icedove-build-id) ; avoid timestamp
                (setenv "LDFLAGS" (string-append "-Wl,-rpath="
                                                 (assoc-ref outputs "out")
@@ -1355,7 +1496,9 @@ standards of the IceCat project.")
                      "ac_add_options --with-system-nspr\n"
                      "ac_add_options --with-system-nss\n"
                      "ac_add_options --with-system-zlib\n"
-                     "ac_add_options --with-user-appdir=\\.icedove\n"))))
+                     "ac_add_options --with-user-appdir=\\.icedove\n"
+                     "mk_add_options MOZ_MAKE_FLAGS=-j"
+                     (number->string (parallel-job-count)) "\n"))))
                (display (getcwd))
                (newline)
                (display "mach configure")
@@ -1397,10 +1540,12 @@ standards of the IceCat project.")
                     (gtk (assoc-ref inputs "gtk+"))
                     (gtk-share (string-append gtk "/share"))
                     (pulseaudio (assoc-ref inputs "pulseaudio"))
-                    (pulseaudio-lib (string-append pulseaudio "/lib")))
+                    (pulseaudio-lib (string-append pulseaudio "/lib"))
+                    (eudev (assoc-ref inputs "eudev"))
+                    (eudev-lib (string-append eudev "/lib")))
                (wrap-program (car (find-files lib "^icedove$"))
                  `("XDG_DATA_DIRS" prefix (,gtk-share))
-                 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib)))
+                 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib ,eudev-lib)))
                #t))))))
     (inputs
      `(("bzip2" ,bzip2)
@@ -1436,6 +1581,7 @@ standards of the IceCat project.")
        ("pulseaudio" ,pulseaudio)
        ("sqlite" ,sqlite)
        ("startup-notification" ,startup-notification)
+       ("eudev" ,eudev)
        ("unzip" ,unzip)
        ("zip" ,zip)
        ("zlib" ,zlib)))
@@ -1445,7 +1591,7 @@ standards of the IceCat project.")
         ;; in the Thunderbird release tarball.  We don't use the release
         ;; tarball because it duplicates the Icecat sources and only adds the
         ;; "comm" directory, which is provided by this repository.
-        ,(let ((changeset "6ee1d79f9e77c90f0f165b9315b5b437a220b665"))
+        ,(let ((changeset "adcfedf831da719455116546865f9a5faea848a6"))
            (origin
              (method hg-fetch)
              (uri (hg-reference
@@ -1454,18 +1600,18 @@ standards of the IceCat project.")
              (file-name (string-append "thunderbird-" version "-checkout"))
              (sha256
               (base32
-               "0m6isazpirmviv14kjav8jn3w3gm3mls0qwyf1n87hj00bj6z6jc")))))
+               "1dahf3y8bm3kh7amf341wnmh82a2r0ksqihc6dwiakh6x86a94cm")))))
        ("autoconf" ,autoconf-2.13)
-       ("cargo" ,rust-1.41 "cargo")
+       ("cargo" ,rust "cargo")
        ("clang" ,clang)
        ("llvm" ,llvm)
        ("nasm" ,nasm)
-       ("node" ,node-10.22)
+       ("node" ,node)
        ("perl" ,perl)
        ("pkg-config" ,pkg-config)
        ("python" ,python)
        ("python2" ,python-2.7)
-       ("rust" ,rust-1.41)
+       ("rust" ,rust)
        ("rust-cbindgen" ,rust-cbindgen-0.14)
        ("which" ,which)
        ("yasm" ,yasm)))
@@ -1477,25 +1623,40 @@ Thunderbird.  It supports email, news feeds, chat, calendar and contacts.")
     (license license:mpl2.0)))
 
 (define-public icedove/wayland
-  (package/inherit icedove
+  (package
+    (inherit icedove)
     (name "icedove-wayland")
+    (native-inputs '())
+    (inputs
+     `(("bash" ,bash-minimal)
+       ("icedove" ,icedove)))
+    (build-system trivial-build-system)
     (arguments
-     (substitute-keyword-arguments (package-arguments icedove)
-       ((#:phases phases)
-        `(modify-phases ,phases
-          (replace '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"))
-                    (pulseaudio (assoc-ref inputs "pulseaudio"))
-                    (pulseaudio-lib (string-append pulseaudio "/lib")))
-               (wrap-program (car (find-files lib "^icedove$"))
-                 `("MOZ_ENABLE_WAYLAND" = ("1"))
-                 `("XDG_DATA_DIRS" prefix (,gtk-share))
-                 `("LD_LIBRARY_PATH" prefix (,pulseaudio-lib)))
-               #t)))))))))
+      '(#:modules ((guix build utils))
+        #:builder
+        (begin
+          (use-modules (guix build utils))
+          (let* ((bash    (assoc-ref %build-inputs "bash"))
+                 (icedove (assoc-ref %build-inputs "icedove"))
+                 (out     (assoc-ref %outputs "out"))
+                 (exe     (string-append out "/bin/icedove")))
+            (mkdir-p (dirname exe))
+
+            (call-with-output-file exe
+              (lambda (port)
+                (format port "#!~a
+ MOZ_ENABLE_WAYLAND=1 exec ~a $@"
+                        (string-append bash "/bin/bash")
+                        (string-append icedove "/bin/icedove"))))
+            (chmod exe #o555)
+
+            ;; Provide the manual and .desktop file.
+            (copy-recursively (string-append icedove "/share")
+                              (string-append out "/share"))
+            (substitute* (string-append
+                          out "/share/applications/icedove.desktop")
+              ((icedove) out))
+            #t))))))
 
 (define-public firefox-decrypt
   (package