Subject: Re: [bug#38670] [PATCH] Fix audio/video in icecat

From: Mark H Weaver <[email-masked]>
Date: Sat, 21 Dec 2019 23:52:08 -0500

Hi Julien,

Thanks very much for investigating and producing a working fix for this
issue!  It is a great relief to remove this item from my TODO list :)

I have a few minor nits, and am currently testing a slight variant of
your proposed patch, attached below.  I made the following changes:

* I added a new phase instead of augmenting the existing
  'link-libxul-with-libraries' phase, since the name of the existing
  phase doesn't match what's being done here.

* I leave the numeric suffixes (version number) of the shared library
  names unchanged, instead of stripping them as you did.

* I used "\\." in the regexp to strictly match that character.

* I moved the rationale comment from the commit log into the code.

What do you think?

   Thanks again!
       Mark

>From eed217b25cea8926680308c8e21522417fe13cf4 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <[email-masked]>
Date: Thu, 19 Dec 2019 13:02:07 +0100
Subject: [PATCH] gnu: icecat: Fix linking with ffmpeg.

* gnu/packages/gnuzilla.scm (icecat)[arguments]: Add
'fix-ffmpeg-runtime-linker' phase.

Co-authored-by: Mark H Weaver <[email-masked]>.
---
 gnu/packages/gnuzilla.scm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index 8bfa6c2a55..46fc7928a0 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -968,6 +968,13 @@ from forcing GEXP-PROMISE."
     'avcodec', 'avutil', 'pulse' ]\n\n"
                                all)))
              #t))
+         (add-after 'link-libxul-with-libraries 'fix-ffmpeg-runtime-linker
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Arrange to load libavcodec.so by its absolute file name.
+             (substitute* "dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp"
+               (("libavcodec\\.so")
+                (string-append (assoc-ref inputs "ffmpeg") "/lib/libavcodec.so")))
+             #t))
          (replace 'bootstrap
            (lambda _
              (invoke "sh" "-c" "autoconf old-configure.in > old-configure")
-- 
2.24.1