sci-libs/spr: Allow for compiling with GCC 6
authorDavid Seifert <soap@gentoo.org>
Tue, 20 Sep 2016 21:02:22 +0000 (23:02 +0200)
committerDavid Seifert <soap@gentoo.org>
Tue, 20 Sep 2016 21:06:21 +0000 (23:06 +0200)
Gentoo-bug: 594376
* EAPI=6

Package-Manager: portage-2.3.1

sci-libs/spr/files/spr-3.3.2-fix-c++14.patch [new file with mode: 0644]
sci-libs/spr/spr-3.3.2.ebuild

diff --git a/sci-libs/spr/files/spr-3.3.2-fix-c++14.patch b/sci-libs/spr/files/spr-3.3.2-fix-c++14.patch
new file mode 100644 (file)
index 0000000..fc29392
--- /dev/null
@@ -0,0 +1,68 @@
+Fix building with C++14, which errors out due to bool -> T* conversions
+See also: https://bugs.gentoo.org/show_bug.cgi?id=594376
+
+--- a/src/SprBinaryEncoder.cc
++++ b/src/SprBinaryEncoder.cc
+@@ -165,7 +165,7 @@
+   if( found != vars.end() ) {
+     cerr << "Variable " << sclass.c_str() << " is already included " 
+        << "in the input list for SprBinaryEncoder." << endl;
+-    return false;
++    return NULL;
+   }
+   vars.push_back(sclass);
+ 
+--- a/src/SprDecisionTree.cc
++++ b/src/SprDecisionTree.cc
+@@ -362,7 +362,7 @@
+ {
+   // header
+   char s [200];
+-  sprintf(s,"Trained DecisionTree %-6i signal nodes.    Overall FOM=%-10g W0=%-10g W1=%-10g N0=%-10i N1=%-10i    Version=%s",nodes1_.size(),fom_,w0_,w1_,n0_,n1_,SprVersion.c_str());
++  sprintf(s,"Trained DecisionTree %-6lu signal nodes.    Overall FOM=%-10g W0=%-10g W1=%-10g N0=%-10i N1=%-10i    Version=%s",nodes1_.size(),fom_,w0_,w1_,n0_,n1_,SprVersion.c_str());
+   os << s << endl;
+   os << "-------------------------------------------------------" << endl;
+ 
+--- a/src/SprVarTransformerReader.cc
++++ b/src/SprVarTransformerReader.cc
+@@ -50,7 +50,7 @@
+   nLine++;
+   if( !getline(is,line) ) {
+     cerr << "Unable to read VarTransformer from line " << nLine << endl;
+-    return 0;
++    return NULL;
+   }
+   istringstream ist(line);
+   string dummy, transformerName, version;
+@@ -59,9 +59,9 @@
+   // decode name
+   if( transformerName.empty() ) {
+     cerr << "Unable to read VarTransformer name on line " << nLine << endl;
+-    return false;
++    return NULL;
+   }
+-  SprAbsVarTransformer* t = 0;
++  SprAbsVarTransformer* t = NULL;
+   if(      transformerName == "PCA" )
+     t = SprVarTransformerReader::readPCATransformer(is,nLine);
+   else if( transformerName == "InputNormalizer" )
+@@ -72,16 +72,16 @@
+     t = SprVarTransformerReader::readTransformerSequence(is,nLine);
+   else {
+     cerr << "Unknown VarTransformer name specified on line " << nLine << endl;
+-    return 0;
++    return NULL;
+   }
+-  if( t == 0 ) return 0;
++  if( t == NULL ) return NULL;
+   
+   // read vars
+   vector<string> oldVars, newVars;
+   if( !SprVarTransformerReader::readVars(is,nLine,oldVars,newVars) ||
+       oldVars.empty() || newVars.empty() ) {
+     cerr << "Unable to read VarTransformer variables." << endl;
+-    return 0;
++    return NULL;
+   }
+   t->setOldVars(oldVars);
+   t->setNewVars(newVars);
index dad4d53b9e76f0289e9f8ea32a858cb124580016..d63e597993b85482c58dfdf8f2f28c7b95d130d9 100644 (file)
@@ -1,15 +1,14 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-EAPI=4
-inherit eutils autotools
+EAPI=6
 
-MYP=SPR-${PV}
+inherit autotools
 
 DESCRIPTION="Statistical analysis and machine learning library"
 HOMEPAGE="http://statpatrec.sourceforge.net/"
-SRC_URI="mirror://sourceforge/statpatrec/${MYP}.tar.gz"
+SRC_URI="mirror://sourceforge/statpatrec/${P^^}.tar.gz"
 
 LICENSE="GPL-2"
 SLOT="0"
@@ -20,15 +19,18 @@ IUSE="root static-libs"
 DEPEND="root? ( sci-physics/root )"
 RDEPEND="${DEPEND}"
 
-S=${WORKDIR}/${MYP}
+S=${WORKDIR}/${P^^}
+PATCHES=(
+       "${FILESDIR}"/${P}-autotools.patch
+       "${FILESDIR}"/${P}-gcc46.patch
+       "${FILESDIR}"/${P}-fix-c++14.patch
+)
 
 src_prepare() {
-       epatch \
-               "${FILESDIR}"/${P}-autotools.patch \
-               "${FILESDIR}"/${P}-gcc46.patch
+       default
        rm aclocal.m4 || die
        eautoreconf
-       cp data/gauss* src/
+       cp data/gauss* src/ || die
 }
 
 src_configure() {