[SCM] mpv/master: Add 04_use-atomic-not-sync.patch to fix FTBFS on mips (powerpc still lacks gcc 4.8)

ghedo at users.alioth.debian.org ghedo at users.alioth.debian.org
Mon Dec 30 13:19:13 UTC 2013


The following commit has been merged in the master branch:
commit a10d2eff313a48f5eb9b92dd40897150a0e8fb17
Author: Alessandro Ghedini <alessandro at ghedini.me>
Date:   Mon Dec 30 14:14:37 2013 +0100

    Add 04_use-atomic-not-sync.patch to fix FTBFS on mips (powerpc still lacks gcc 4.8)

diff --git a/debian/patches/04_use-atomic-not-sync.patch b/debian/patches/04_use-atomic-not-sync.patch
new file mode 100644
index 0000000..f0ee8c3
--- /dev/null
+++ b/debian/patches/04_use-atomic-not-sync.patch
@@ -0,0 +1,49 @@
+Description: Use __atomic* GCC built-ins when available
+ Some platforms (ppc, mips) do not have __sync_add_and_fetch_8 and other atomic
+ built-ins and thus FTBFS. __atomic_add_fetch on the other hand is always
+ available (GCC >= 4.8) and resolves to a function in GCC's libatomic when the
+ equivalent __sync is not available.
+Origin: vendor
+Bug: *** FIXME ***
+Forwarded: *** FIXME ***
+Author: Alessandro Ghedini <ghedo at debian.org>
+Reviewed-by: Alessandro Ghedini <ghedo at debian.org>
+Last-Update: 2013-12-30
+Applied-Upstream: *** FIXME ***
+
+--- a/compat/atomics.h
++++ b/compat/atomics.h
+@@ -19,5 +19,14 @@
+ // At this point both gcc and clang had __sync_synchronize support for some
+ // time. We only support a full memory barrier.
+ 
+-#define mp_memory_barrier()           __sync_synchronize()
+-#define mp_atomic_add_and_fetch(a, b) __sync_add_and_fetch(a, b)
++#if HAVE_ATOMIC_THREAD_FENCE
++# define mp_memory_barrier()           __atomic_thread_fence(__ATOMIC_SEQ_CST)
++#else
++# define mp_memory_barrier()           __sync_synchronize()
++#endif
++
++#if HAVE_ATOMIC_ADD_FETCH
++# define mp_atomic_add_and_fetch(a, b) __atomic_add_fetch(a, b,__ATOMIC_SEQ_CST)
++#else
++# define mp_atomic_add_and_fetch(a, b) __sync_add_and_fetch(a, b)
++#endif
+--- a/wscript
++++ b/wscript
+@@ -99,6 +99,14 @@
+         'req': True,
+         'fmsg': 'Unable to find pthreads support.'
+     }, {
++        'name': 'atomic_thread_fence',
++        'desc': '__atomic_thread_fence',
++        'func': check_statement('stdio.h', '__atomic_thread_fence()')
++    }, {
++        'name': 'atomic_add_fetch',
++        'desc': '__atomic_add_fetch',
++        'func': check_statement('stdio.h', 'long test = 0; test = __atomic_add_fetch(&test, 1, __ATOMIC_SEQ_CST)')
++    }, {
+         'name': 'librt',
+         'desc': 'linking with -lrt',
+         'deps': [ 'pthreads' ],
diff --git a/debian/patches/series b/debian/patches/series
index db00e03..9297b3d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 01_desktop-path.patch
 02_fix-config-path.patch
 03_waf.patch
+04_use-atomic-not-sync.patch

-- 
mpv packaging



More information about the pkg-multimedia-commits mailing list