summaryrefslogtreecommitdiff
path: root/nongnu/packages/mozilla.scm
diff options
context:
space:
mode:
Diffstat (limited to 'nongnu/packages/mozilla.scm')
-rw-r--r--nongnu/packages/mozilla.scm266
1 files changed, 190 insertions, 76 deletions
diff --git a/nongnu/packages/mozilla.scm b/nongnu/packages/mozilla.scm
index 455482c..0588ad6 100644
--- a/nongnu/packages/mozilla.scm
+++ b/nongnu/packages/mozilla.scm
@@ -1,7 +1,7 @@
-;;; GNU Guix --- Functional package management for GNU
+;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver <mhw@netris.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 Alex Griffin <a@ajgrf.com>
@@ -14,27 +14,13 @@
;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; Copyright © 2019, 2020 Adrian Malacoda <malacoda@monarch-pass.net>
-;;; Copyright © 2020-2022 Jonathan Brielmaier <jonathan.brielmaier@web.de>
+;;; Copyright © 2020-2023 Jonathan Brielmaier <jonathan.brielmaier@web.de>
;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
-;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2021, 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2022 Pierre Langlois <pierre.langlois@gmx.com>
-;;;
-;;; This file is not part of GNU Guix.
-;;;
-;;; GNU Guix is free software; you can redistribute it and/or modify it
-;;; under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 3 of the License, or (at
-;;; your option) any later version.
-;;;
-;;; GNU Guix is distributed in the hope that it will be useful, but
-;;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+;;; Copyright © 2023 Tomas Volf <wolf@wolfsden.cz>
(define-module (nongnu packages mozilla)
#:use-module (guix build-system gnu)
@@ -45,6 +31,7 @@
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix utils)
+ #:use-module ((guix build utils) #:select (alist-replace))
#:use-module (gnu packages)
#:use-module (gnu packages assembly)
@@ -59,6 +46,7 @@
#:use-module (gnu packages glib)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gtk)
+ #:use-module (gnu packages hunspell)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages image)
#:use-module (gnu packages jemalloc)
@@ -66,7 +54,6 @@
#:use-module (gnu packages libcanberra)
#:use-module (gnu packages libevent)
#:use-module (gnu packages libffi)
- #:use-module (gnu packages libreoffice) ;for hunspell
#:use-module (gnu packages linux)
#:use-module (gnu packages llvm)
#:use-module (gnu packages m4)
@@ -78,27 +65,51 @@
#:use-module (gnu packages python)
#:use-module (gnu packages rust)
#:use-module (gnu packages rust-apps)
+ #:use-module (gnu packages speech)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages video)
#:use-module (nongnu packages wasm)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages xorg))
-;; Update this id with every firefox update to it's release date.
-;; It's used for cache validation and therefor can lead to strange bugs.
-(define %firefox-build-id "20220520000000")
+;; Define the versions of rust needed to build firefox, trying to match
+;; upstream. See the file taskcluster/ci/toolchain/rust.yml at
+;; https://searchfox.org under the particular firefox release, like
+;; mozilla-esr102.
+(define-public rust-firefox-esr rust) ; 1.60 is the default in Guix
+(define-public rust-firefox rust) ; 1.65 is the minimum
-(define-public firefox
+(define icu4c-73
(package
- (name "firefox")
- (version "100.0.2")
+ (inherit icu4c)
+ (version "73.1")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/unicode-org/icu/releases/download/release-"
+ (string-map (lambda (x) (if (char=? x #\.) #\- x)) version)
+ "/icu4c-"
+ (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
+ "-src.tgz"))
+ (sha256
+ (base32
+ "0iccpdvc0kvpww5a31k9gjkqigyz016i7v80r9zamd34w4fl6mx4"))))))
+
+;; Update this id with every firefox update to its release date.
+;; It's used for cache validation and therefore can lead to strange bugs.
+(define %firefox-esr-build-id "20240415130026")
+
+(define-public firefox-esr
+ (package
+ (name "firefox-esr")
+ (version "115.10.0esr")
(source
(origin
(method url-fetch)
(uri (string-append "https://archive.mozilla.org/pub/firefox/releases/"
version "/source/firefox-" version ".source.tar.xz"))
(sha256
- (base32 "05w499jjsi8n04zwwr5vskriddafd6dghyhlizykhsag41hrh46w"))))
+ (base32 "1wpf4vcrvnvhnfzqavbkzqbn51bds1l9f6ld4mzh9xwm7mrkrz8a"))))
(build-system gnu-build-system)
(arguments
(list
@@ -117,7 +128,7 @@
"--enable-jemalloc"
;; see https://bugs.gnu.org/32833
- ;; "--with-system-nspr"
+ "--with-system-nspr"
;; "--with-system-nss"
,(string-append "--with-clang-path="
@@ -145,8 +156,14 @@
"--disable-elf-hack"))
#:imported-modules %cargo-utils-modules
#:modules `((ice-9 regex)
+ (ice-9 string-fun)
(ice-9 ftw)
+ (srfi srfi-1)
(srfi srfi-26)
+ (rnrs bytevectors)
+ (rnrs io ports)
+ (guix elf)
+ (guix build gremlin)
,@%gnu-build-system-modules)
#:phases
#~(modify-phases %standard-phases
@@ -175,7 +192,6 @@
(substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
(("libavcodec\\.so")
libavcodec)))))
-
(add-after 'patch-source-shebangs 'patch-cargo-checksums
(lambda _
(use-modules (guix build cargo-utils))
@@ -217,13 +233,40 @@
(substitute* "build/RunCbindgen.py"
(("\"--frozen\",") ""))))
(delete 'bootstrap)
+ (add-before 'configure 'patch-SpeechDispatcherService.cpp
+ (lambda _
+ (let* ((lib "libspeechd.so.2")
+ (file "dom/media/webspeech/synth/speechd/SpeechDispatcherService.cpp")
+ (old-content (call-with-input-file file get-string-all)))
+ (substitute
+ file
+ `((,(format #f "~s" lib)
+ . ,(lambda (line _)
+ (string-replace-substring
+ line
+ lib
+ (string-append #$speech-dispatcher "/lib/" lib))))))
+ (if (string=? old-content
+ (call-with-input-file file get-string-all))
+ (error "substitute did nothing, phase requires an update")))))
+ (add-before 'configure 'set-build-id
+ ;; Firefox will write the timestamp to output, which is harmful
+ ;; for reproducibility, so change it to a fixed date. Use a
+ ;; separate phase for easier modification with inherit.
+ (lambda _
+ (setenv "MOZ_BUILD_DATE" #$%firefox-esr-build-id)))
(replace 'configure
(lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
(setenv "AUTOCONF" (string-append (assoc-ref inputs "autoconf")
"/bin/autoconf"))
(setenv "SHELL" (which "bash"))
(setenv "CONFIG_SHELL" (which "bash"))
- (setenv "MACH_USE_SYSTEM_PYTHON" "1")
+ (setenv "MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE" "system")
+ ;; This should use the host info probably (does firefox build on
+ ;; non-x86_64 though?)
+ (setenv "GUIX_PYTHONPATH"
+ (string-append (getcwd)
+ "/obj-x86_64-pc-linux-gnu/_virtualenvs/build"))
;; Use Clang, Clang is 2x faster than GCC
(setenv "AR" "llvm-ar")
@@ -240,9 +283,6 @@
"/bin/clang++"))
(setenv "MOZ_NOSPAM" "1")
- ;; Firefox will write the timestamp to output, which is harmful for
- ;; reproducibility, so change it to a fixed date.
- (setenv "MOZ_BUILD_DATE" #$%firefox-build-id)
(setenv "MOZBUILD_STATE_PATH" (getcwd))
@@ -299,6 +339,19 @@
(lambda _ (invoke "./mach" "install")))
(add-after 'install 'wrap-program
(lambda* (#:key inputs outputs #:allow-other-keys)
+ ;; The following two functions are from Guix's icecat package in
+ ;; (gnu packages gnuzilla). See commit
+ ;; b7a0935420ee630a29b7e5ac73a32ba1eb24f00b.
+ (define (runpath-of lib)
+ (call-with-input-file lib
+ (compose elf-dynamic-info-runpath
+ elf-dynamic-info
+ parse-elf
+ get-bytevector-all)))
+ (define (runpaths-of-input label)
+ (let* ((dir (string-append (assoc-ref inputs label) "/lib"))
+ (libs (find-files dir "\\.so$")))
+ (append-map runpath-of libs)))
(let* ((out (assoc-ref outputs "out"))
(lib (string-append out "/lib"))
;; TODO: make me a loop again
@@ -309,6 +362,20 @@
;; For hardware video acceleration via VA-API
(libva-lib (string-append (assoc-ref inputs "libva")
"/lib"))
+ ;; VA-API is run in the RDD (Remote Data Decoder) sandbox
+ ;; and must be explicitly given access to files it needs.
+ ;; Rather than adding the whole store (as Nix had
+ ;; upstream do, see
+ ;; <https://github.com/NixOS/nixpkgs/pull/165964> and
+ ;; linked upstream patches), we can just follow the
+ ;; runpaths of the needed libraries to add everything to
+ ;; LD_LIBRARY_PATH. These will then be accessible in the
+ ;; RDD sandbox.
+ (rdd-whitelist
+ (map (cut string-append <> "/")
+ (delete-duplicates
+ (append-map runpaths-of-input
+ '("mesa" "ffmpeg")))))
(pulseaudio-lib (string-append (assoc-ref inputs "pulseaudio")
"/lib"))
;; For U2F and WebAuthn
@@ -317,7 +384,7 @@
"/share")))
(wrap-program (car (find-files lib "^firefox$"))
`("LD_LIBRARY_PATH" prefix (,mesa-lib ,libnotify-lib ,libva-lib
- ,pulseaudio-lib ,eudev-lib))
+ ,pulseaudio-lib ,eudev-lib ,@rdd-whitelist))
`("XDG_DATA_DIRS" prefix (,gtk-share))
`("MOZ_LEGACY_PROFILES" = ("1"))
`("MOZ_ALLOW_DOWNGRADE" = ("1"))))))
@@ -370,7 +437,7 @@
gtk+
gtk+-2
hunspell
- icu4c-70
+ icu4c-73
jemalloc
libcanberra
libevent
@@ -388,13 +455,15 @@
libxt
mesa
mit-krb5
- ;; nspr
+ nspr-4.32
;; nss
pango
+ pipewire
pixman
pulseaudio
- startup-notification
+ speech-dispatcher
sqlite
+ startup-notification
eudev
unzip
zip
@@ -403,59 +472,104 @@
(list
alsa-lib
autoconf-2.13
- `(,rust "cargo")
- clang-12
- llvm-12
+ `(,rust-firefox-esr "cargo")
+ clang
+ llvm
wasm32-wasi-clang-toolchain
m4
nasm
- node
+ node-lts
perl
pkg-config
python
- rust
- rust-cbindgen-0.19
+ rust-firefox-esr
+ rust-cbindgen-0.24
which
yasm))
(home-page "https://mozilla.org/firefox/")
(synopsis "Trademarkless version of Firefox")
(description
"Full-featured browser client built from Firefox source tree, without
-the official icon and the name \"firefox\".")
+the official icon and the name \"firefox\". This is the Extended Support
+Release (ESR) version.")
(license license:mpl2.0)))
- (define-public firefox/wayland
- (package
- (inherit firefox)
- (name "firefox-wayland")
- (native-inputs '())
- (inputs
- `(("bash" ,bash-minimal)
- ("firefox" ,firefox)))
- (build-system trivial-build-system)
- (arguments
- '(#:modules ((guix build utils))
- #:builder
- (begin
- (use-modules (guix build utils))
- (let* ((bash (assoc-ref %build-inputs "bash"))
- (firefox (assoc-ref %build-inputs "firefox"))
- (out (assoc-ref %outputs "out"))
- (exe (string-append out "/bin/firefox")))
- (mkdir-p (dirname exe))
+(define-public firefox-esr/wayland
+ (package
+ (inherit firefox-esr)
+ (name "firefox-esr-wayland")
+ (native-inputs '())
+ (inputs
+ `(("bash" ,bash-minimal)
+ ("firefox-esr" ,firefox-esr)))
+ (build-system trivial-build-system)
+ (arguments
+ '(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let* ((bash (assoc-ref %build-inputs "bash"))
+ (firefox (assoc-ref %build-inputs "firefox-esr"))
+ (out (assoc-ref %outputs "out"))
+ (exe (string-append out "/bin/firefox")))
+ (mkdir-p (dirname exe))
- (call-with-output-file exe
- (lambda (port)
- (format port "#!~a
+ (call-with-output-file exe
+ (lambda (port)
+ (format port "#!~a
MOZ_ENABLE_WAYLAND=1 exec ~a $@\n"
- (string-append bash "/bin/bash")
- (string-append firefox "/bin/firefox"))))
- (chmod exe #o555)
+ (string-append bash "/bin/bash")
+ (string-append firefox "/bin/firefox"))))
+ (chmod exe #o555)
+
+ ;; Provide the manual and .desktop file.
+ (copy-recursively (string-append firefox "/share")
+ (string-append out "/share"))
+ (substitute* (string-append
+ out "/share/applications/firefox.desktop")
+ ((firefox) out))
+ #t))))))
+
+;; Update this id with every firefox update to its release date.
+;; It's used for cache validation and therefore can lead to strange bugs.
+(define %firefox-build-id "20240429124342")
+
+(define-public firefox
+ (package
+ (inherit firefox-esr)
+ (name "firefox")
+ (version "125.0.3")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://archive.mozilla.org/pub/firefox/releases/"
+ version "/source/firefox-" version ".source.tar.xz"))
+ (sha256
+ (base32 "05jnpnc0qym08f7rlapjm36g729445k3nba2rvf4a0sabsw6c726"))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments firefox-esr)
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (replace 'set-build-id
+ (lambda _
+ (setenv "MOZ_BUILD_DATE" #$%firefox-build-id)))
+ (replace 'remove-cargo-frozen-flag
+ (lambda _
+ ;; Remove --frozen flag from cargo invokation, otherwise it'll
+ ;; complain that it's not able to change Cargo.lock.
+ ;; https://bugzilla.mozilla.org/show_bug.cgi?id=1726373
+ (substitute* "build/RunCbindgen.py"
+ (("args.append\\(\"--frozen\"\\)") "pass"))))))))
+ (native-inputs
+ (modify-inputs (package-native-inputs firefox-esr)
+ (replace "rust" rust-firefox)
+ (replace "rust:cargo" `(,rust-firefox "cargo"))
+ (replace "rust-cbindgen" rust-cbindgen-0.26)))
+ (description
+ "Full-featured browser client built from Firefox source tree, without
+the official icon and the name \"firefox\".")))
- ;; Provide the manual and .desktop file.
- (copy-recursively (string-append firefox "/share")
- (string-append out "/share"))
- (substitute* (string-append
- out "/share/applications/firefox.desktop")
- ((firefox) out))
- #t))))))
+;; As of Firefox 121.0, Firefox uses Wayland by default. This means we no
+;; longer need a seperate package for Firefox on Wayland.
+(define-public firefox-wayland
+ (deprecated-package "firefox-wayland" firefox))