sys-libs/libomp: Backport upstream musl fix by Lei Zhang
authorMichał Górny <mgorny@gentoo.org>
Tue, 18 Oct 2016 16:57:25 +0000 (18:57 +0200)
committerMichał Górny <mgorny@gentoo.org>
Tue, 18 Oct 2016 16:59:38 +0000 (18:59 +0200)
Closes: https://github.com/gentoo/gentoo/pull/2118

sys-libs/libomp/files/libomp-3.9.0-musl-strerror_r.patch [new file with mode: 0644]
sys-libs/libomp/libomp-3.9.0.ebuild

diff --git a/sys-libs/libomp/files/libomp-3.9.0-musl-strerror_r.patch b/sys-libs/libomp/files/libomp-3.9.0-musl-strerror_r.patch
new file mode 100644 (file)
index 0000000..4fbf9f6
--- /dev/null
@@ -0,0 +1,35 @@
+From 4fa7d5e207a4f7ef79b423b7d9658b7625795f5c Mon Sep 17 00:00:00 2001
+From: Michal Gorny <mgorny@gentoo.org>
+Date: Tue, 18 Oct 2016 16:38:44 +0000
+Subject: [PATCH] Fix a compile error on musl-libc due to strerror_r()
+ prototype
+
+Function strerror_r() has different signatures in different
+implementations of libc: glibc's version returns a char*, while BSDs
+and musl return a int. libomp unconditionally assumes glibc on Linux
+and thus fails to compile against musl-libc. This patch addresses this
+issue.
+
+Differential Revision: https://reviews.llvm.org/D25071
+
+git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@284492 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ runtime/src/kmp_i18n.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/runtime/src/kmp_i18n.c b/runtime/src/kmp_i18n.c
+index 546e693..e008d1f 100644
+--- a/runtime/src/kmp_i18n.c
++++ b/runtime/src/kmp_i18n.c
+@@ -809,7 +809,7 @@ sys_error(
+                 int    strerror_r( int, char *, size_t );  // XSI version
+         */
+-        #if KMP_OS_LINUX
++        #if defined(__GLIBC__) && defined(_GNU_SOURCE)
+             // GNU version of strerror_r.
+-- 
+2.10.1
+
index ed972e831f65db3734557ce7b2db2e4acf37f8b0..dad69636c3e524987de34287899c308436e4a14a 100644 (file)
@@ -27,6 +27,8 @@ S="${WORKDIR}/${MY_P}.src"
 PATCHES=(
        # backport of https://reviews.llvm.org/D24563
        "${FILESDIR}"/${PN}-3.9.0-optional-aliases.patch
+       # backport of https://reviews.llvm.org/D25071
+       "${FILESDIR}"/${PN}-3.9.0-musl-strerror_r.patch
 )
 
 multilib_src_configure() {