diff options
author | Justin Lecher <jlec@gentoo.org> | 2010-02-11 18:53:56 +0000 |
---|---|---|
committer | Justin Lecher <jlec@gentoo.org> | 2010-02-11 18:53:56 +0000 |
commit | 583fa6bf7aff807585da8fac0fe20ff363685abc (patch) | |
tree | de11d6cec614a878fe529d408b1166187304e803 /sci-libs/libsvm | |
parent | Add initial support for Jython. (diff) | |
download | gentoo-2-583fa6bf7aff807585da8fac0fe20ff363685abc.tar.gz gentoo-2-583fa6bf7aff807585da8fac0fe20ff363685abc.tar.bz2 gentoo-2-583fa6bf7aff807585da8fac0fe20ff363685abc.zip |
Added python3 support, thanks for help Kacper Kowalik
(Portage version: 2.2_rc62/cvs/Linux x86_64)
Diffstat (limited to 'sci-libs/libsvm')
-rw-r--r-- | sci-libs/libsvm/ChangeLog | 8 | ||||
-rw-r--r-- | sci-libs/libsvm/files/2.90-python3.patch | 13 | ||||
-rw-r--r-- | sci-libs/libsvm/libsvm-2.90-r1.ebuild | 104 |
3 files changed, 124 insertions, 1 deletions
diff --git a/sci-libs/libsvm/ChangeLog b/sci-libs/libsvm/ChangeLog index e3151d4eba8e..f2ee5b0dbb70 100644 --- a/sci-libs/libsvm/ChangeLog +++ b/sci-libs/libsvm/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for sci-libs/libsvm # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sci-libs/libsvm/ChangeLog,v 1.16 2010/02/10 21:21:07 jlec Exp $ +# $Header: /var/cvsroot/gentoo-x86/sci-libs/libsvm/ChangeLog,v 1.17 2010/02/11 18:53:55 jlec Exp $ + +*libsvm-2.90-r1 (11 Feb 2010) + + 11 Feb 2010; Justin Lecher (jlec) <jlec@gentoo.org> + +files/2.90-python3.patch, +libsvm-2.90-r1.ebuild: + added python3 support *libsvm-2.90 (10 Feb 2010) diff --git a/sci-libs/libsvm/files/2.90-python3.patch b/sci-libs/libsvm/files/2.90-python3.patch new file mode 100644 index 000000000000..764200498ed1 --- /dev/null +++ b/sci-libs/libsvm/files/2.90-python3.patch @@ -0,0 +1,13 @@ +diff --git a/python/svmc_wrap.c b/python/svmc_wrap.c +index 22ea45d..c4282b1 100644 +--- a/python/svmc_wrap.c ++++ b/python/svmc_wrap.c +@@ -758,7 +758,7 @@ SWIG_Python_str_AsChar(PyObject *str) + #if PY_VERSION_HEX >= 0x03000000 + char *cstr; + char *newstr; +- int len; ++ Py_ssize_t len; + str = PyUnicode_AsUTF8String(str); + PyBytes_AsStringAndSize(str, &cstr, &len); + newstr = (char *) malloc(len+1); diff --git a/sci-libs/libsvm/libsvm-2.90-r1.ebuild b/sci-libs/libsvm/libsvm-2.90-r1.ebuild new file mode 100644 index 000000000000..ad6a98a67c09 --- /dev/null +++ b/sci-libs/libsvm/libsvm-2.90-r1.ebuild @@ -0,0 +1,104 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sci-libs/libsvm/libsvm-2.90-r1.ebuild,v 1.1 2010/02/11 18:53:55 jlec Exp $ + +EAPI="3" +SUPPORT_PYTHON_ABIS="1" + +inherit eutils java-pkg-opt-2 python toolchain-funcs multilib + +MY_P="${PN}-${PV%0}" + +DESCRIPTION="Library for Support Vector Machines" +HOMEPAGE="http://www.csie.ntu.edu.tw/~cjlin/libsvm/" +SRC_URI="http://www.csie.ntu.edu.tw/~cjlin/libsvm/${MY_P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~ppc64 ~x86" +IUSE="java python tools" + +DEPEND="java? ( >=virtual/jdk-1.4 )" +RDEPEND="${DEPEND} + tools? ( sci-visualization/gnuplot )" + +S="${WORKDIR}"/${MY_P} + +src_prepare() { + epatch "${FILESDIR}"/${PV}-fpic.patch + epatch "${FILESDIR}"/${PV}-ldflags.patch + epatch "${FILESDIR}"/${PV}-python3.patch + python_copy_sources --no-link +} + +src_compile() { + emake \ + CXX="$(tc-getCXX)" \ + LDFLAGS="${LDFLAGS}" \ + CFLAGS="${CXXFLAGS}" \ + || die "emake failed" + + sed -i -e 's@\.\./@/usr/bin/@g' tools/*.py \ + || die "Failed to fix paths in python files" + + if use python ; then + compilation () { + pushd python + emake \ + CXX="$(tc-getCXX)" \ + LDFLAGS="${LDFLAGS} -shared" \ + CFLAGS="${CXXFLAGS} -I$(python_get_includedir) -I.." \ + all || die "emake for python modules failed" + popd + } + python_execute_function -s compilation + fi + + if use java ; then + pushd java + local JAVAC_FLAGS="$(java-pkg_javac-args)" + sed -i \ + -e "s/JAVAC_FLAGS =/JAVAC_FLAGS=${JAVAC_FLAGS}/g" \ + Makefile || die "Failed to fix java makefile" + emake || die "emake for java modules failed" + popd + fi +} + +src_install() { + dobin svm-train svm-predict svm-scale \ + || die "Failed to install binaries" + dohtml FAQ.html || die + dodoc README || die + + if use tools; then + pushd tools + insinto /usr/share/${PN}/tools + doins easy.py grid.py subset.py \ + || die "Failed to install python tools" + docinto tools + dodoc README || die + popd + fi + + if use python ; then + installation() { + pushd python + insinto $(python_get_sitedir) + doins svmc.so svm.py \ + || die "Failed to install python scripts" + docinto python + dodoc README || die + popd + } + python_execute_function -s installation + fi + + if use java; then + pushd java + java-pkg_dojar libsvm.jar + docinto java + dohtml test_applet.html || die + popd + fi +} |