summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Beffa <beffa@fbengineering.ch>2014-12-18 21:32:34 +0100
committerFederico Beffa <beffa@fbengineering.ch>2015-01-12 18:00:08 +0100
commitbeb8dc0007f447a0d20e1691b41594fb9d810b83 (patch)
treeed4d6aa241bd32176d82f0a25df519ba15d7cb69
parentb47e1b20bd83191919fd452a6fc8b9a94690c3b7 (diff)
gnu: libcanberra: Add default sounds support.
* gnu/packages/libcanberra.scm (libcanberra): Add input 'sound-theme-freedesktop'. Add "libcanberra-sound-theme-freedesktop.patch" and related phase 'patch-default-sounds-directory to patch the default sounds directory.
-rw-r--r--gnu/packages/libcanberra.scm31
-rw-r--r--gnu/packages/patches/libcanberra-sound-theme-freedesktop.patch22
2 files changed, 51 insertions, 2 deletions
diff --git a/gnu/packages/libcanberra.scm b/gnu/packages/libcanberra.scm
index 764c3272a2..3d43c4f98e 100644
--- a/gnu/packages/libcanberra.scm
+++ b/gnu/packages/libcanberra.scm
@@ -19,6 +19,7 @@
(define-module (gnu packages libcanberra)
#:use-module ((guix licenses) #:select (lgpl2.1+))
+ #:use-module (gnu packages)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
@@ -46,7 +47,21 @@
version ".tar.xz"))
(sha256
(base32
- "0wps39h8rx2b00vyvkia5j40fkak3dpipp1kzilqla0cgvk73dn2"))))
+ "0wps39h8rx2b00vyvkia5j40fkak3dpipp1kzilqla0cgvk73dn2"))
+ ;; "sound-theme-freedesktop" is the default and fall-back sound theme for
+ ;; XDG desktops and should always be present.
+ ;; http://www.freedesktop.org/wiki/Specifications/sound-theme-spec/
+ ;; We make sure libcanberra will find it.
+ ;;
+ ;; We add the default sounds store directory to the code dealing with
+ ;; XDG_DATA_DIRS and not XDG_DATA_HOME. This is because XDG_DATA_HOME
+ ;; can only be a single directory and is inspected first. XDG_DATA_DIRS
+ ;; can list an arbitrary number of directories and is only inspected
+ ;; later. This is designed to allows the user to modify any theme at
+ ;; his pleasure.
+ (patch-flags '("-p0"))
+ (patches
+ (list (search-patch "libcanberra-sound-theme-freedesktop.patch")))))
(build-system gnu-build-system)
(inputs
`(("alsa-lib" ,alsa-lib)
@@ -55,9 +70,21 @@
("libtool" ,libtool)
("libvorbis" ,libvorbis)
("pulseaudio" ,pulseaudio)
- ("udev" ,eudev)))
+ ("udev" ,eudev)
+ ("sound-theme-freedesktop" ,sound-theme-freedesktop)))
(native-inputs
`(("pkg-config" ,pkg-config)))
+ (arguments
+ `(#:phases
+ (alist-cons-before
+ 'build 'patch-default-sounds-directory
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "src/sound-theme-spec.c"
+ (("@SOUND_THEME_DIRECTORY@")
+ (string-append
+ (assoc-ref inputs "sound-theme-freedesktop")
+ "/share"))))
+ %standard-phases)))
(home-page "http://0pointer.de/lennart/projects/libcanberra/")
(synopsis
"Implementation of the XDG Sound Theme and Name Specifications")
diff --git a/gnu/packages/patches/libcanberra-sound-theme-freedesktop.patch b/gnu/packages/patches/libcanberra-sound-theme-freedesktop.patch
new file mode 100644
index 0000000000..ff998cbf76
--- /dev/null
+++ b/gnu/packages/patches/libcanberra-sound-theme-freedesktop.patch
@@ -0,0 +1,22 @@
+# We insert a hook called "@SOUND_THEME_DIRECTORY@" where, at build time, we
+# insert the directory of the package "sound-theme-freedesktop" in the store.
+
+--- src/sound-theme-spec.c.orig 2015-01-11 13:13:29.520527358 +0100
++++ src/sound-theme-spec.c 2015-01-11 14:27:23.035046849 +0100
+@@ -321,9 +321,13 @@
+ const char *g;
+
+ if (!(g = getenv("XDG_DATA_DIRS")) || *g == 0)
+- return "/usr/local/share:/usr/share";
+-
+- return g;
++ return "@SOUND_THEME_DIRECTORY@";
++ else {
++ const char *stp = ":@SOUND_THEME_DIRECTORY@";
++ size_t len = strlen(stp) + strlen(g) + 1;
++ char *g2 = (char*) malloc(len);
++ return strcat(strcpy(g2, g), stp);
++ }
+ }
+
+ static int load_theme_dir(ca_theme_data *t, const char *name) {