From 48b12377601ede984770b15b14a2e5a829a4b1af Mon Sep 17 00:00:00 2001 From: Sebastien Fabbro Date: Mon, 14 Mar 2011 19:48:21 +0000 Subject: Added a couple patches from Debian/Upstream (Portage version: 2.1.9.42/cvs/Linux x86_64) --- sci-mathematics/fann/ChangeLog | 11 ++- sci-mathematics/fann/fann-2.1.0_beta-r1.ebuild | 95 ++++++++++++++++++++++ .../fann/files/fann-2.1.0_beta-pythonlink.patch | 30 +++++++ .../fann/files/fann-2.1.0_beta-sizecheck.patch | 25 ++++++ .../fann/files/fann-2.1.0_beta-valist.patch | 65 +++++++++++++++ 5 files changed, 224 insertions(+), 2 deletions(-) create mode 100644 sci-mathematics/fann/fann-2.1.0_beta-r1.ebuild create mode 100644 sci-mathematics/fann/files/fann-2.1.0_beta-pythonlink.patch create mode 100644 sci-mathematics/fann/files/fann-2.1.0_beta-sizecheck.patch create mode 100644 sci-mathematics/fann/files/fann-2.1.0_beta-valist.patch (limited to 'sci-mathematics/fann') diff --git a/sci-mathematics/fann/ChangeLog b/sci-mathematics/fann/ChangeLog index aa6b725bdc4c..f8c54c121c21 100644 --- a/sci-mathematics/fann/ChangeLog +++ b/sci-mathematics/fann/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sci-mathematics/fann -# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fann/ChangeLog,v 1.15 2010/12/23 08:26:55 jlec Exp $ +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fann/ChangeLog,v 1.16 2011/03/14 19:48:21 bicatali Exp $ + +*fann-2.1.0_beta-r1 (14 Mar 2011) + + 14 Mar 2011; Sébastien Fabbro + +fann-2.1.0_beta-r1.ebuild, +files/fann-2.1.0_beta-pythonlink.patch, + +files/fann-2.1.0_beta-sizecheck.patch, +files/fann-2.1.0_beta-valist.patch: + Added a couple patches from Debian/Upstream 23 Dec 2010; Justin Lecher -files/fann-1.2.0-r1.patch, -files/fann-1.2.0-setup.py, fann-2.0.0.ebuild, fann-2.1.0_beta.ebuild: diff --git a/sci-mathematics/fann/fann-2.1.0_beta-r1.ebuild b/sci-mathematics/fann/fann-2.1.0_beta-r1.ebuild new file mode 100644 index 000000000000..5884592e06c0 --- /dev/null +++ b/sci-mathematics/fann/fann-2.1.0_beta-r1.ebuild @@ -0,0 +1,95 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fann/fann-2.1.0_beta-r1.ebuild,v 1.1 2011/03/14 19:48:21 bicatali Exp $ + +EAPI=2 + +PYTHON_DEPEND="python? 2" +SUPPORT_PYTHON_ABIS="1" +RESTRICT_PYTHON_ABIS="3.*" + +inherit eutils python autotools + +MY_P=${P/_/} + +DESCRIPTION="Fast Artificial Neural Network Library" +HOMEPAGE="http://leenissen.dk/fann/" +SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86" +IUSE="doc python static-libs" + +RDEPEND="" +DEPEND="${RDEPEND} + python? ( dev-lang/swig ) + app-arch/unzip" + +S="${WORKDIR}/${P/_beta/}" + +src_prepare() { + epatch \ + "${FILESDIR}"/${P}-python.patch \ + "${FILESDIR}"/${P}-benchmark.patch \ + "${FILESDIR}"/${P}-examples.patch \ + "${FILESDIR}"/${P}-asneeded.patch \ + "${FILESDIR}"/${P}-valist.patch \ + "${FILESDIR}"/${P}-sizecheck.patch + eautoreconf + use python && python_copy_sources python +} + +src_configure() { + econf $(use_enable static-libs static) +} + +src_compile() { + emake || die "emake failed" + compilation() { + emake PYTHON_VERSION="$(python_get_version)" || die "emake python failed" + } + use python && python_execute_function -s --source-dir python compilation +} + +src_test() { + cd "${S}"/examples + emake CFLAGS="${CFLAGS} -I../src/include -L../src/.libs" \ + || die "emake examples failed" + LD_LIBRARY_PATH="../src/.libs" emake runtest || die "tests failed" + emake clean + testing() { + emake test || die "failed tests for python wrappers" + } + use python && python_execute_function -s --source-dir python testing +} + +src_install() { + emake install DESTDIR="${D}" || die "emake install failed" + dodoc AUTHORS ChangeLog NEWS README TODO || die + + if use doc; then + dodoc doc/*.txt + insinto /usr/share/doc/${PF} + doins doc/fann_en.pdf || die "failed to install reference manual" + doins -r examples || die "failed to install examples" + doins -r benchmarks || die "failed to install benchmarks" + fi + + installation() { + emake install ROOT="${D}" || die "failed to install python wrappers" + if use doc; then + insinto /usr/share/doc/${PF}/examples/python + doins -r examples || die "failed to install python examples" + fi + } + use python && python_execute_function -s --source-dir python installation +} + +pkg_postinst() { + python_mod_optimize py${PN} +} + +pkg_postrm() { + python_mod_cleanup py${PN} +} diff --git a/sci-mathematics/fann/files/fann-2.1.0_beta-pythonlink.patch b/sci-mathematics/fann/files/fann-2.1.0_beta-pythonlink.patch new file mode 100644 index 000000000000..308a21e0bd4a --- /dev/null +++ b/sci-mathematics/fann/files/fann-2.1.0_beta-pythonlink.patch @@ -0,0 +1,30 @@ +From: Christian Kastner +Date: Fri, 4 Jun 2010 23:27:24 +0200 +Subject: [PATCH] Link python-pyfann dynamically instead of statically + +Upstream links the pyfann extension against libfann's static library. This +causes all sorts of troubles on some platforms, most notably amd64, where the +extension FTBFS because the static library isn't compiled with -fPIC. The +Debian-specific solution presented here is to link to the shared library and +let package python-pyfann Depend: on it. + +Forwarded: no +Last-Update: 2010-06-04 +--- + python/setup.py | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/python/setup.py b/python/setup.py +index 67cef7e..6b2a3dc 100755 +--- a/python/setup.py ++++ b/python/setup.py +@@ -42,7 +42,7 @@ setup( + py_modules=['pyfann.libfann'], + ext_modules=[Extension('pyfann._libfann',['pyfann/pyfann_wrap.cxx'], + include_dirs=['../src/include'], +- extra_objects=['../src/doublefann.o'], ++ extra_objects=['../src/.libs/doublefann.o'], + define_macros=[("SWIG_COMPILE",None)] + ), + ] +-- diff --git a/sci-mathematics/fann/files/fann-2.1.0_beta-sizecheck.patch b/sci-mathematics/fann/files/fann-2.1.0_beta-sizecheck.patch new file mode 100644 index 000000000000..885db95b04f6 --- /dev/null +++ b/sci-mathematics/fann/files/fann-2.1.0_beta-sizecheck.patch @@ -0,0 +1,25 @@ +From: Christian Kastner +Date: Sun, 6 Feb 2011 17:09:05 +0100 +Subject: [PATCH] Correct a typo in a size comparison + +Origin: http://leenissen.dk/fann/forum/viewtopic.php?f=1&t=626 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/712290 +Last-Update: 2011-02-06 +--- + python/pyfann/pyfann.i | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/python/pyfann/pyfann.i b/python/pyfann/pyfann.i +index 47b17ba..ec55535 100644 +--- a/python/pyfann/pyfann.i ++++ b/python/pyfann/pyfann.i +@@ -108,7 +108,7 @@ + for (j = 0; j< num; j++) + { + PyObject* o1=PySequence_GetItem($input,j); +- if ((unsigned int)PySequence_Length(o1) == dim) { ++ if ((unsigned int)PySequence_Length(o1) != dim) { + PyErr_SetString(PyExc_ValueError,"Size mismatch. All items must be of the same size"); + SWIG_fail; + } +-- diff --git a/sci-mathematics/fann/files/fann-2.1.0_beta-valist.patch b/sci-mathematics/fann/files/fann-2.1.0_beta-valist.patch new file mode 100644 index 000000000000..23d130f60650 --- /dev/null +++ b/sci-mathematics/fann/files/fann-2.1.0_beta-valist.patch @@ -0,0 +1,65 @@ +From: Christian Kastner +Date: Thu, 1 Jul 2010 01:02:47 +0200 +Subject: [PATCH] Portable handling for va_list + +The current code wrongly assumes va_list is always implemented as an array. va_list +however is an opaque type, and may also be implemented as a struct, for +example. This patch implements handling of va_list in a platform-independent +way, fixing a FTBFS on alpha and armel. + +Forwarded: no +Last-Update: 2010-07-01 +--- + src/include/fann_cpp.h | 21 +++++++++++++++------ + 1 files changed, 15 insertions(+), 6 deletions(-) + +diff --git a/src/include/fann_cpp.h b/src/include/fann_cpp.h +index eb647af..bf6e75b 100644 +--- a/src/include/fann_cpp.h ++++ b/src/include/fann_cpp.h +@@ -916,9 +916,12 @@ public: + bool create_standard(unsigned int num_layers, ...) + { + va_list layers; ++ unsigned int arr[num_layers]; ++ + va_start(layers, num_layers); +- bool status = create_standard_array(num_layers, +- reinterpret_cast(layers)); ++ for (unsigned int ii = 0; ii < num_layers; ii++) ++ arr[ii] = va_arg(layers, unsigned int); ++ bool status = create_standard_array(num_layers, arr); + va_end(layers); + return status; + } +@@ -966,9 +969,12 @@ public: + bool create_sparse(float connection_rate, unsigned int num_layers, ...) + { + va_list layers; ++ unsigned int arr[num_layers]; ++ + va_start(layers, num_layers); +- bool status = create_sparse_array(connection_rate, num_layers, +- reinterpret_cast(layers)); ++ for (unsigned int ii = 0; ii < num_layers; ii++) ++ arr[ii] = va_arg(layers, unsigned int); ++ bool status = create_sparse_array(connection_rate, num_layers, arr); + va_end(layers); + return status; + } +@@ -1013,9 +1019,12 @@ public: + bool create_shortcut(unsigned int num_layers, ...) + { + va_list layers; ++ unsigned int arr[num_layers]; ++ + va_start(layers, num_layers); +- bool status = create_shortcut_array(num_layers, +- reinterpret_cast(layers)); ++ for (unsigned int ii = 0; ii < num_layers; ii++) ++ arr[ii] = va_arg(layers, unsigned int); ++ bool status = create_shortcut_array(num_layers, arr); + va_end(layers); + return status; + } +-- -- cgit v1.2.3-65-gdbad