[alpine-aports] [PATCH] community/cmus: fix build on mips{el} (-latomic)

alpine-mips-patches
Details
Message ID
<20181128072017.B9D034B9E4@mx7.valuehost.ru>
Sender timestamp
1543388480
DKIM signature
missing
Download raw message
Patch: +63 -3
This adds generic -latomic check so likely covers all architectures
without 64-bit atomic built-ins (e.g. armel too).
---
 community/cmus/APKBUILD                |  9 ++--
 community/cmus/c11-atomics-check.patch | 57 ++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 3 deletions(-)
 create mode 100644 community/cmus/c11-atomics-check.patch

diff --git a/community/cmus/APKBUILD b/community/cmus/APKBUILD
index 03c927ee01..e52ce290d5 100644
--- a/community/cmus/APKBUILD
+++ b/community/cmus/APKBUILD
@@ -4,7 +4,7 @@
 pkgname=cmus
 pkgver=2.8.0_rc0
 _pkgver=${pkgver/_rc/-rc}
-pkgrel=0
+pkgrel=1
 pkgdesc="A very feature-rich ncurses-based music player"
 url="https://cmus.github.io/"
 arch="all"
@@ -15,7 +15,9 @@ makedepends="alsa-lib-dev faad2-dev flac-dev libmad-dev opusfile-dev
 	linux-headers"
 subpackages="$pkgname-doc $pkgname-zsh-completion:zshcomp:noarch
 	$pkgname-bash-completion:bashcomp:noarch"
-source="$pkgname-$_pkgver.tar.gz::https://github.com/cmus/cmus/archive/v$_pkgver.tar.gz"
+source="$pkgname-$_pkgver.tar.gz::https://github.com/cmus/cmus/archive/v$_pkgver.tar.gz
+	c11-atomics-check.patch
+	"
 builddir="$srcdir"/$pkgname-$_pkgver
 
 build() {
@@ -51,4 +53,5 @@ zshcomp() {
 		"$subpkgdir"/usr/share/zsh/site-functions/_$pkgname
 }
 
-sha512sums="0379f18497d6510fad35a2d905c932d12f2726a5694d3ab272ce139e9ea4520cb4dd1cf3fafe890f6ada8a64285f8c04ef7571647a66c2d44df17e2dca80f869  cmus-2.8.0-rc0.tar.gz"
+sha512sums="0379f18497d6510fad35a2d905c932d12f2726a5694d3ab272ce139e9ea4520cb4dd1cf3fafe890f6ada8a64285f8c04ef7571647a66c2d44df17e2dca80f869  cmus-2.8.0-rc0.tar.gz
+97cb5e7340a9baf1d662cd965a169bf63aca28ae165bc0ca1ed81cabfd44b3d3215abbd8e8c42ecdeeaede5ca03271eccb722048d61a894b55f3c7d353e4044e  c11-atomics-check.patch"
diff --git a/community/cmus/c11-atomics-check.patch b/community/cmus/c11-atomics-check.patch
new file mode 100644
index 0000000000..b5c22e9be8
--- /dev/null
+++ b/community/cmus/c11-atomics-check.patch
@@ -0,0 +1,57 @@
+--- a/Makefile
+@@ -21,7 +21,7 @@
+ FFMPEG_CFLAGS += $(shell pkg-config --cflags libswresample)
+ FFMPEG_LIBS += $(shell pkg-config --libs libswresample)
+ 
+-CMUS_LIBS = $(PTHREAD_LIBS) $(NCURSES_LIBS) $(ICONV_LIBS) $(DL_LIBS) $(DISCID_LIBS) \
++CMUS_LIBS = $(ATOMIC_LIBS) $(PTHREAD_LIBS) $(NCURSES_LIBS) $(ICONV_LIBS) $(DL_LIBS) $(DISCID_LIBS) \
+ 			-lm $(COMPAT_LIBS) $(LIBSYSTEMD_LIBS)
+ 
+ input.o main.o ui_curses.o op/pulse.lo: .version
+--- a/configure
+@@ -39,7 +39,35 @@
+ 	return 1
+ }
+ 
++readonly atomic_code="
++#include <stdatomic.h>
+ 
++int main(int argc, char *argv[])
++{
++	static atomic_llong x = ATOMIC_VAR_INIT(1);
++	return atomic_fetch_add_explicit(&x, argc, memory_order_relaxed) == 2;
++}
++"
++
++check_atomic()
++{
++	msg_checking "if -latomic is needed for C11 atomics"
++	if try_compile_link "$atomic_code"
++	then
++		msg_result "no"
++		ATOMIC_LIBS=
++	elif try_compile_link "$atomic_code" -latomic
++	then
++		msg_result "yes"
++		ATOMIC_LIBS=-latomic
++	else
++		msg_result "no C11 atomics?!"
++		return 1
++	fi
++	makefile_vars ATOMIC_LIBS
++	return 0
++}
++
+ check_compat()
+ {
+ 	COMPAT_LIBS=
+@@ -517,6 +545,7 @@
+ check check_cflags
+ check check_cc_depgen
+ check check_endianness
++check check_atomic
+ check check_compat
+ check check_dl
+ check check_pthread
-- 
2.19.1




---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---