Skip to content

Commit

Permalink
dev-libs/zthread: fix building with clang
Browse files Browse the repository at this point in the history
Gentoo-Bug: https://bugs.gentoo.org/506934

Reviewed-By: David Seifert <soap@gentoo.org>

Package-Manager: portage-2.2.26
  • Loading branch information
austin987 committed Jun 2, 2016
1 parent 35ced2f commit 5f3562b
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dev-libs/zthread/files/zthread-2.3.2-clang.patch
@@ -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)) {
94 changes: 94 additions & 0 deletions dev-libs/zthread/files/zthread-2.3.2-no-fpermissive-r1.diff
@@ -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(;;) {
67 changes: 67 additions & 0 deletions dev-libs/zthread/zthread-2.3.2-r4.ebuild
@@ -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
}

0 comments on commit 5f3562b

Please sign in to comment.