dev-libs/zthread: fix building with clang
authorAustin English <wizardedit@gentoo.org>
Thu, 2 Jun 2016 06:41:15 +0000 (01:41 -0500)
committerAustin English <wizardedit@gentoo.org>
Thu, 2 Jun 2016 21:42:15 +0000 (16:42 -0500)
Gentoo-Bug: https://bugs.gentoo.org/506934

Reviewed-By: David Seifert <soap@gentoo.org>
Package-Manager: portage-2.2.26

dev-libs/zthread/files/zthread-2.3.2-clang.patch [new file with mode: 0644]
dev-libs/zthread/files/zthread-2.3.2-no-fpermissive-r1.diff [new file with mode: 0644]
dev-libs/zthread/zthread-2.3.2-r4.ebuild [new file with mode: 0644]

diff --git a/dev-libs/zthread/files/zthread-2.3.2-clang.patch b/dev-libs/zthread/files/zthread-2.3.2-clang.patch
new file mode 100644 (file)
index 0000000..13dd91e
--- /dev/null
@@ -0,0 +1,16 @@
+fix compile when using clang as $CC:
+
+Based on patch from https://bugs.launchpad.net/hugin/+bug/1213585 (rebased)
+
+diff -r 2a43e83684d5 src/foreign/zthread/include/zthread/Guard.h
+--- a/include/zthread/Guard.h  Sat Aug 10 11:31:46 2013 +0200
++++ b/include/zthread/Guard.h  Sun Aug 18 09:46:43 2013 +0200
+@@ -108,7 +108,7 @@
+   }
+   template <class LockType>
+-  static void createScope(LockHolder<LockType>& l, unsigned long ms) {
++  static bool createScope(LockHolder<LockType>& l, unsigned long ms) {
+     if(Scope1::createScope(l, ms))
+       if(!Scope2::createScope(l, ms)) {
diff --git a/dev-libs/zthread/files/zthread-2.3.2-no-fpermissive-r1.diff b/dev-libs/zthread/files/zthread-2.3.2-no-fpermissive-r1.diff
new file mode 100644 (file)
index 0000000..94b42ee
--- /dev/null
@@ -0,0 +1,94 @@
+--- a/include/zthread/Guard.h  2008-07-22 14:46:28.000000000 +0200
++++ b/include/zthread/Guard.h  2008-07-22 14:51:41.000000000 +0200
+@@ -491,7 +491,7 @@
+     
+   try {
+     
+-    if(!isDisabled())
++    if(!LockHolder<LockType>::isDisabled())
+       LockingPolicy::destroyScope(*this);
+     
+   } catch (...) { /* ignore */ }  
+--- a/src/MutexImpl.h  2008-07-22 14:54:40.000000000 +0200
++++ b/src/MutexImpl.h  2008-07-22 15:03:30.000000000 +0200
+@@ -153,7 +153,7 @@
+       _owner = self;
+-      ownerAcquired(self);
++      MutexImpl<List,Behavior>::ownerAcquired(self);
+       
+     }
+@@ -164,7 +164,7 @@
+       _waiters.insert(self);
+       m.acquire();
+-      waiterArrived(self);
++      MutexImpl<List, Behavior>::waiterArrived(self);
+       {        
+       
+@@ -173,7 +173,7 @@
+       
+       }
+-      waiterDeparted(self);
++      MutexImpl<List, Behavior>::waiterDeparted(self);
+       m.release();
+         
+@@ -192,7 +192,7 @@
+           assert(_owner == 0);
+           _owner = self;    
+-          ownerAcquired(self);
++          MutexImpl<List, Behavior>::ownerAcquired(self);
+           break;
+         
+@@ -236,7 +236,7 @@
+       _owner = self;
+-      ownerAcquired(self);
++      MutexImpl<List, Behavior>::ownerAcquired(self);
+       
+     }
+@@ -253,7 +253,7 @@
+       
+         m.acquire();
+-        waiterArrived(self);
++        MutexImpl<List, Behavior>:: waiterArrived(self);
+       
+         {
+         
+@@ -262,7 +262,7 @@
+         
+         }
+-        waiterDeparted(self);
++      MutexImpl<List, Behavior>::waiterDeparted(self);
+       
+         m.release();
+         
+@@ -284,7 +284,7 @@
+           assert(0 == _owner);
+           _owner = self;
+-          ownerAcquired(self);
++      MutexImpl<List, Behavior>::ownerAcquired(self);
+         
+           break;
+         
+@@ -326,7 +326,7 @@
+     _owner = 0;
+-    ownerReleased(impl);
++    MutexImpl<List, Behavior>::ownerReleased(impl);
+   
+     // Try to find a waiter with a backoff & retry scheme
+     for(;;) {
diff --git a/dev-libs/zthread/zthread-2.3.2-r4.ebuild b/dev-libs/zthread/zthread-2.3.2-r4.ebuild
new file mode 100644 (file)
index 0000000..154f895
--- /dev/null
@@ -0,0 +1,67 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools eutils
+
+MY_P="ZThread-${PV}"
+
+DESCRIPTION="platform-independent multi-threading and synchronization library for C++"
+HOMEPAGE="http://zthread.sourceforge.net/"
+SRC_URI="mirror://sourceforge/zthread/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~sparc ~x86"
+IUSE="debug doc kernel_linux static-libs"
+
+DEPEND="doc? ( app-doc/doxygen )"
+RDEPEND=""
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+    "${FILESDIR}"/${P}-no-fpermissive-r1.diff
+    "${FILESDIR}"/${P}-m4-quote.patch
+    "${FILESDIR}"/${P}-automake-r2.patch
+    "${FILESDIR}"/${P}-gcc47.patch
+    "${FILESDIR}"/${P}-clang.patch
+)
+
+src_prepare() {
+       default
+
+       rm -f include/zthread/{.Barrier.h.swp,Barrier.h.orig} || die
+
+       sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:' configure.ac || die #467778
+
+       AT_M4DIR="share" eautoreconf
+}
+
+src_configure() {
+       econf \
+               $(use_enable debug) \
+               $(use_enable kernel_linux atomic-linux) \
+               $(use_enable static-libs static)
+}
+
+src_compile() {
+       default
+
+       if use doc; then
+               doxygen doc/zthread.doxygen || die
+               sed -i -e 's|href="html/|href="|' doc/documentation.html || die
+               cp doc/documentation.html doc/html/index.html || die
+               cp doc/{zthread.css,bugs.js} doc/html/ || die
+       fi
+}
+
+src_install() {
+       default
+
+       use doc && dodoc -r doc/html
+
+       prune_libtool_files
+}