From d08096e25f7e6c77f8d463f64dab40b269215154 Mon Sep 17 00:00:00 2001 From: Tomas Volf Date: Sat, 7 Oct 2023 21:05:59 +0200 Subject: nongnu: firefox-esr: Fix Web Speech API. Firefox loads libspeechd.so.2 during runtime using PR_LoadLibrary and it fails to locate the library in the store. Fix is to add extra phase that patches the file to load the library using an absolute path. * nongnu/packages/mozilla.scm (firefox-esr) [phases]{'patch-SpeechDispatcherService.cpp}: New phase. [inputs]: Add `speech-dispatcher`. Fixes: https://gitlab.com/nonguix/nonguix/-/issues/284 Tested-by: Jonathan Brielmaier --- nongnu/packages/mozilla.scm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/nongnu/packages/mozilla.scm b/nongnu/packages/mozilla.scm index 1e067fc..aa981a7 100644 --- a/nongnu/packages/mozilla.scm +++ b/nongnu/packages/mozilla.scm @@ -20,6 +20,7 @@ ;;; Copyright © 2021 Brice Waegeneire ;;; Copyright © 2021, 2022, 2023 John Kehayias ;;; Copyright © 2022 Pierre Langlois +;;; Copyright © 2023 Tomas Volf (define-module (nongnu packages mozilla) #:use-module (guix build-system gnu) @@ -64,6 +65,7 @@ #: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) @@ -154,6 +156,7 @@ "--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) @@ -230,6 +233,22 @@ (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) + . ,(λ (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 @@ -442,8 +461,9 @@ pipewire pixman pulseaudio - startup-notification + speech-dispatcher sqlite + startup-notification eudev unzip zip -- cgit v1.2.3