Subject: Progress (?)

From: Prafulla Giri <[email-masked]>
Date: Sat, 26 Sep 2020 15:36:46 +0545

So, there were a few issues with my union. I've fixed them. Attached is the
diff as it stands right now.
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 0f727a6e9e..9a6a768af2 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -3836,7 +3836,40 @@ programmers to access a standard API to open and decompress media files.")
        ("hunspell" ,hunspell)
        ("mesa" ,mesa)
        ("libass" ,libass)
-       ("alsa-lib" ,alsa-lib)
+       ("alsa-lib-with-pulseaudio-plugin"
+        ,(package
+           (inherit alsa-lib)
+           (name "alsa-lib-with-pulseaudio-plugin")
+           (source #f)
+           (build-system trivial-build-system)
+           (arguments
+            `(#:modules ((guix build union)
+                         (guix build utils))
+              #:builder
+              (begin
+                (use-modules (ice-9 match)
+                             (guix build union)
+                             (guix build utils))
+                (let ((out (assoc-ref %outputs "out"))
+                      (alsa-lib (assoc-ref %build-inputs "alsa-lib")))
+                  (match %build-inputs
+                    (((names . directories) ...)
+                     (union-build out
+                                  directories
+                                  ;; Instead of a symlink union, this is will be a
+                                  ;; copy union, because this won't "Just Work™"
+                                  ;; with mere symlinks. Some of the files that make
+                                  ;; up the union need to tweaked to work properly.
+                                  #:create-all-directories? #t
+                                  #:symlink copy-file)))
+                  ;; Fix alsa-lib pkg-config file to point to the /gnu/store of
+                  ;; this union, rather than that of alsa-lib itself.
+                  (substitute* (string-append out "/lib/pkgconfig/alsa.pc")
+                    ((alsa-lib) out))
+                  #t))))
+           (inputs
+            `(("alsa-lib" ,alsa-lib)
+              ("alsa-plugins:pulseaudio" ,alsa-plugins "pulseaudio")))))
        ("pulseaudio" ,pulseaudio)
        ("libx11" ,libx11)
        ("freetype" ,freetype)