From bcd94e192a8459107ba43f03694fc82a35af6447 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Sun, 3 Nov 2013 18:28:03 -0500
Subject: [PATCH] gnu: alsa-lib: fix atomic op declarations for MIPS.

* gnu/packages/patches/alsa-lib-mips-atomic-fix.patch: New file.
* gnu/packages/linux.scm (alsa-lib): Add patch.
* gnu-system.am (dist_patch_DATA): Add patch.
---
 gnu-system.am                                 |  1 +
 gnu/packages/linux.scm                        |  3 +-
 .../patches/alsa-lib-mips-atomic-fix.patch    | 42 +++++++++++++++++++
 3 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/alsa-lib-mips-atomic-fix.patch

diff --git a/gnu-system.am b/gnu-system.am
index 548f076c4c1..6f2b4d12ce5 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -202,6 +202,7 @@ GNU_SYSTEM_MODULES =				\
 
 patchdir = $(guilemoduledir)/gnu/packages/patches
 dist_patch_DATA =						\
+  gnu/packages/patches/alsa-lib-mips-atomic-fix.patch		\
   gnu/packages/patches/apr-skip-getservbyname-test.patch	\
   gnu/packages/patches/automake-skip-amhello-tests.patch	\
   gnu/packages/patches/avahi-localstatedir.patch		\
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index cd1c921626d..eab42803244 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -473,7 +473,8 @@ (define-public alsa-lib
                    version ".tar.bz2"))
              (sha256
               (base32
-               "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))))
+               "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))
+             (patches (list (search-patch "alsa-lib-mips-atomic-fix.patch")))))
     (build-system gnu-build-system)
     (home-page "http://www.alsa-project.org/")
     (synopsis "The Advanced Linux Sound Architecture libraries")
diff --git a/gnu/packages/patches/alsa-lib-mips-atomic-fix.patch b/gnu/packages/patches/alsa-lib-mips-atomic-fix.patch
new file mode 100644
index 00000000000..8c37bd3ac42
--- /dev/null
+++ b/gnu/packages/patches/alsa-lib-mips-atomic-fix.patch
@@ -0,0 +1,42 @@
+Fix the declarations of inlined atomic ops for mips.
+
+This patch was copied from Debian.
+
+--- alsa-lib/include/iatomic.h.orig	2013-05-21 04:48:28.000000000 -0400
++++ alsa-lib/include/iatomic.h	2013-10-29 13:01:37.055995968 -0400
+@@ -720,7 +720,7 @@
+  * Atomically adds @i to @v.  Note that the guaranteed useful range
+  * of an atomic_t is only 24 bits.
+  */
+-extern __inline__ void atomic_add(int i, atomic_t * v)
++static __inline__ void atomic_add(int i, atomic_t * v)
+ {
+ 	unsigned long temp;
+ 
+@@ -744,7 +744,7 @@
+  * Atomically subtracts @i from @v.  Note that the guaranteed
+  * useful range of an atomic_t is only 24 bits.
+  */
+-extern __inline__ void atomic_sub(int i, atomic_t * v)
++static __inline__ void atomic_sub(int i, atomic_t * v)
+ {
+ 	unsigned long temp;
+ 
+@@ -763,7 +763,7 @@
+ /*
+  * Same as above, but return the result value
+  */
+-extern __inline__ int atomic_add_return(int i, atomic_t * v)
++static __inline__ int atomic_add_return(int i, atomic_t * v)
+ {
+ 	unsigned long temp, result;
+ 
+@@ -784,7 +784,7 @@
+ 	return result;
+ }
+ 
+-extern __inline__ int atomic_sub_return(int i, atomic_t * v)
++static __inline__ int atomic_sub_return(int i, atomic_t * v)
+ {
+ 	unsigned long temp, result;
+ 
-- 
GitLab