commit:     c3f25a35664cfe0d06ff946157e2302fed763710
Author:     David Seifert <soap <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 12 21:17:21 2016 +0000
Commit:     David Seifert <soap <AT> gentoo <DOT> org>
CommitDate: Fri Feb 12 21:17:35 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3f25a35

media-sound/linuxsampler: Fix undefined behaviour in NPTL test

Gentoo-Bug: 537516
* EAPI=6
* Replace PTHREAD_CANCEL_ASYNCHRONOUS, which is undefined behaviour
  when used for a non-pure function

Package-Manager: portage-2.2.27

 .../files/linuxsampler-2.0.0-nptl-hardened.patch   | 15 ++++++
 .../linuxsampler/linuxsampler-2.0.0-r1.ebuild      | 58 ++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git 
a/media-sound/linuxsampler/files/linuxsampler-2.0.0-nptl-hardened.patch 
b/media-sound/linuxsampler/files/linuxsampler-2.0.0-nptl-hardened.patch
new file mode 100644
index 0000000..0c61f09
--- /dev/null
+++ b/media-sound/linuxsampler/files/linuxsampler-2.0.0-nptl-hardened.patch
@@ -0,0 +1,15 @@
+Fix breakage caused by undefined behaviour. Using PTHREAD_CANCEL_ASYNCHRONOUS
+is only allowed in pure functions.
+See also: https://bugs.gentoo.org/show_bug.cgi?id=537516
+
+--- linuxsampler-2.0.0/m4/nptl_bug.m4
++++ linuxsampler-2.0.0/m4/nptl_bug.m4
+@@ -47,7 +47,7 @@
+ void* __pthread_launcher(void* p) {
+     // let the thread be killable under any circumstances
+     // (without this function call, this test always succeeds !)
+-    pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
++    pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
+ 
+     // this will block this 2nd thread, since we already
+     // locked this mutex by the main thread

diff --git a/media-sound/linuxsampler/linuxsampler-2.0.0-r1.ebuild 
b/media-sound/linuxsampler/linuxsampler-2.0.0-r1.ebuild
new file mode 100644
index 0000000..4806c00
--- /dev/null
+++ b/media-sound/linuxsampler/linuxsampler-2.0.0-r1.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools eutils
+
+DESCRIPTION="LinuxSampler is a software audio sampler engine with professional 
grade features"
+HOMEPAGE="http://www.linuxsampler.org/";
+SRC_URI="http://download.linuxsampler.org/packages/${P}.tar.bz2";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc jack sqlite static-libs"
+
+RDEPEND="sqlite? ( >=dev-db/sqlite-3.3 )
+       >=media-libs/libgig-4.0.0
+       media-libs/alsa-lib
+       jack? ( media-sound/jack-audio-connection-kit )"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig
+       doc? ( app-doc/doxygen )"
+PATCHES=(
+       "${FILESDIR}/${P}-nptl-hardened.patch"
+)
+
+src_prepare() {
+       default
+       # Force regeneration of the file to let it build with all bison
+       # versions, bug #556204
+       rm src/network/lscpparser.cpp || die
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               --enable-alsa-driver \
+               --disable-arts-driver \
+               $(use_enable jack jack-driver) \
+               $(use_enable sqlite instruments-db) \
+               $(use_enable static-libs static)
+}
+
+src_compile() {
+       default
+       use doc && emake docs
+}
+
+src_install() {
+       default
+
+       docinto html
+       use doc && dodoc -r doc/html/*
+
+       prune_libtool_files
+}

Reply via email to