diff mbox

gnu: Add alsa-plugins.

Message ID 20161029144331.29451-2-ng0@we.make.ritual.n0.is
State New
Headers show

Commit Message

non such Oct. 29, 2016, 2:43 p.m. UTC
* gnu/packages/linux.scm (alsa-plugins): New variable.
---
 gnu/packages/linux.scm | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

Comments

Ricardo Wurmus Oct. 29, 2016, 9:35 p.m. UTC | #1
ng0 <ng0@we.make.ritual.n0.is> writes:

> * gnu/packages/linux.scm (alsa-plugins): New variable.

Thanks!  This patch doesn’t apply to current master here.  Does it need
rebasing?

> +(define-public alsa-plugins
> +  (package
> +    (name "alsa-plugins")
> +    (version "1.1.1")
> +    (source (origin
> +             (method url-fetch)
> +             (uri (string-append "ftp://ftp.alsa-project.org/pub/plugins/"
> +                                 name "-" version ".tar.bz2"))
> +             (sha256
> +              (base32
> +               "1w81z5jlwqhd1l2m7qrq69lc4k9dnrg1wn52jsl2hrf3hbhd394f"))))
> +    (build-system gnu-build-system)
> +    ;; TODO: Split libavcodec and speex if possible. It looks like they can not
> +    ;; be split, there are references to both in files.
> +    (outputs '("out" "pulseaudio"))
> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (add-after 'install 'split
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             ;; Split the binaries to the various outputs.

“Distribute” is probably better than “Split” here.

> +               (rename-file (string-append out "/share/alsa/alsa.conf.d/"
> +                                           "50-pulseaudio.conf")
> +                            (string-append pua "/share/alsa/alsa.conf.d/"
> +                                           "50-pulseaudio.conf"))
> +               (rename-file (string-append out "/share/alsa/alsa.conf.d/"
> +                                           "99-pulseaudio-default.conf.example")
> +                            (string-append pua "/share/alsa/alsa.conf.d/"
> +                                           "99-pulseaudio-default.conf.example"))
> +               (rename-file (string-append out "/lib/alsa-lib/"
> +                                           "libasound_module_conf_pulse.la")
> +                            (string-append pua "/lib/alsa-lib/"
> +                                           "libasound_module_conf_pulse.la"))
> +               (rename-file (string-append out "/lib/alsa-lib/"
> +                                           "libasound_module_conf_pulse.so")
> +                            (string-append pua "/lib/alsa-lib/"
> +                                           "libasound_module_conf_pulse.so"))
> +               (rename-file (string-append out "/lib/alsa-lib/"
> +                                           "libasound_module_ctl_pulse.la")
> +                            (string-append pua "/lib/alsa-lib/"
> +                                           "libasound_module_ctl_pulse.la"))
> +               (rename-file (string-append out "/lib/alsa-lib/"
> +                                           "libasound_module_ctl_pulse.so")
> +                            (string-append pua "/lib/alsa-lib/"
> +                                           "libasound_module_ctl_pulse.so"))
> +               (rename-file (string-append out "/lib/alsa-lib/"
> +                                           "libasound_module_pcm_pulse.la")
> +                            (string-append pua "/lib/alsa-lib/"
> +                                           "libasound_module_pcm_pulse.la"))
> +               (rename-file (string-append out "/lib/alsa-lib/"
> +                                           "libasound_module_pcm_pulse.so")
> +                            (string-append pua "/lib/alsa-lib/"
> +                                           "libasound_module_pcm_pulse.so"))
> +               (delete-file-recursively (string-append out
> "/share"))))))))

That’s a bit crude.  Can’t you use “find-files” with a pattern to find
all files containing “pulse” and then use “for-each” to move all files?

One more thing: could you check with “guix gc --references” to confirm
that the separate outputs do not contain “bad” references?  The “out”
output should not contain a reference to “pulseaudio”, otherwise
distributing binaries to outputs is pointless.

> +    (inputs
> +     `(("alsa-lib" ,alsa-lib)
> +       ("speex" ,speex) ; libspeexdsp resampling plugin
> +       ("libsamplerate" ,libsamplerate) ; libsamplerate resampling plugin
> +       ("ffmpeg" ,ffmpeg) ; libavcodec resampling plugin, a52 plugin
> +       ("pulseaudio" ,pulseaudio))) ; PulseAudio plugin
> +    (native-inputs
> +     `(("pkg-config" ,pkg-config)))
> +    (home-page "http://www.alsa-project.org/")
> +    (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
> +    (description
> +     "The Advanced Linux Sound Architecture (ALSA) provides audio and
> +MIDI functionality to the Linux-based operating system.  This package provides
> +additional plugins.")

“additional plugins” is a bit short.  What do they do (in general), why
would I want them?

> +    (license (list license:gpl2+
> +                   ;; `rate/rate_samplerate.c': LGPL v2.1 or later.
> +                   license:lgpl2.1+))))
> +

Could you please send an updated patch?

~~ Ricardo
non such Oct. 31, 2016, 2:39 p.m. UTC | #2
I tried to debug what's faulty about the two for-each here, but I don't find it.

Help welcome :)
diff mbox

Patch

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 934a67f..2448250 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -15,6 +15,7 @@ 
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
+;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -69,6 +70,8 @@ 
   #:use-module (gnu packages slang)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages video)
+  #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
@@ -867,6 +870,82 @@  MIDI functionality to the Linux-based operating system.")
     ;; GPLv2-only.
     (license license:gpl2)))
 
+(define-public alsa-plugins
+  (package
+    (name "alsa-plugins")
+    (version "1.1.1")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "ftp://ftp.alsa-project.org/pub/plugins/"
+                                 name "-" version ".tar.bz2"))
+             (sha256
+              (base32
+               "1w81z5jlwqhd1l2m7qrq69lc4k9dnrg1wn52jsl2hrf3hbhd394f"))))
+    (build-system gnu-build-system)
+    ;; TODO: Split libavcodec and speex if possible. It looks like they can not
+    ;; be split, there are references to both in files.
+    (outputs '("out" "pulseaudio"))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'split
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Split the binaries to the various outputs.
+             (let* ((out (assoc-ref outputs "out"))
+                    (pua (assoc-ref outputs "pulseaudio")))
+               (mkdir-p (string-append pua "/share/alsa/alsa.conf.d/"))
+               (mkdir-p (string-append pua "/lib/alsa-lib"))
+               (rename-file (string-append out "/share/alsa/alsa.conf.d/"
+                                           "50-pulseaudio.conf")
+                            (string-append pua "/share/alsa/alsa.conf.d/"
+                                           "50-pulseaudio.conf"))
+               (rename-file (string-append out "/share/alsa/alsa.conf.d/"
+                                           "99-pulseaudio-default.conf.example")
+                            (string-append pua "/share/alsa/alsa.conf.d/"
+                                           "99-pulseaudio-default.conf.example"))
+               (rename-file (string-append out "/lib/alsa-lib/"
+                                           "libasound_module_conf_pulse.la")
+                            (string-append pua "/lib/alsa-lib/"
+                                           "libasound_module_conf_pulse.la"))
+               (rename-file (string-append out "/lib/alsa-lib/"
+                                           "libasound_module_conf_pulse.so")
+                            (string-append pua "/lib/alsa-lib/"
+                                           "libasound_module_conf_pulse.so"))
+               (rename-file (string-append out "/lib/alsa-lib/"
+                                           "libasound_module_ctl_pulse.la")
+                            (string-append pua "/lib/alsa-lib/"
+                                           "libasound_module_ctl_pulse.la"))
+               (rename-file (string-append out "/lib/alsa-lib/"
+                                           "libasound_module_ctl_pulse.so")
+                            (string-append pua "/lib/alsa-lib/"
+                                           "libasound_module_ctl_pulse.so"))
+               (rename-file (string-append out "/lib/alsa-lib/"
+                                           "libasound_module_pcm_pulse.la")
+                            (string-append pua "/lib/alsa-lib/"
+                                           "libasound_module_pcm_pulse.la"))
+               (rename-file (string-append out "/lib/alsa-lib/"
+                                           "libasound_module_pcm_pulse.so")
+                            (string-append pua "/lib/alsa-lib/"
+                                           "libasound_module_pcm_pulse.so"))
+               (delete-file-recursively (string-append out "/share"))))))))
+    (inputs
+     `(("alsa-lib" ,alsa-lib)
+       ("speex" ,speex) ; libspeexdsp resampling plugin
+       ("libsamplerate" ,libsamplerate) ; libsamplerate resampling plugin
+       ("ffmpeg" ,ffmpeg) ; libavcodec resampling plugin, a52 plugin
+       ("pulseaudio" ,pulseaudio))) ; PulseAudio plugin
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (home-page "http://www.alsa-project.org/")
+    (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
+    (description
+     "The Advanced Linux Sound Architecture (ALSA) provides audio and
+MIDI functionality to the Linux-based operating system.  This package provides
+additional plugins.")
+    (license (list license:gpl2+
+                   ;; `rate/rate_samplerate.c': LGPL v2.1 or later.
+                   license:lgpl2.1+))))
+
 (define-public iptables
   (package
     (name "iptables")