summaryrefslogtreecommitdiff
path: root/sci-libs/libsvm
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sci-libs/libsvm
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.xz
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sci-libs/libsvm')
-rw-r--r--sci-libs/libsvm/Manifest1
-rw-r--r--sci-libs/libsvm/files/3.11-openmp.patch34
-rw-r--r--sci-libs/libsvm/files/3.14-makefile.patch51
-rw-r--r--sci-libs/libsvm/libsvm-3.17-r1.ebuild92
-rw-r--r--sci-libs/libsvm/metadata.xml15
5 files changed, 193 insertions, 0 deletions
diff --git a/sci-libs/libsvm/Manifest b/sci-libs/libsvm/Manifest
new file mode 100644
index 00000000000..1fe5b856d07
--- /dev/null
+++ b/sci-libs/libsvm/Manifest
@@ -0,0 +1 @@
+DIST libsvm-3.17.tar.gz 607892 SHA256 46a4750d3506e6ccd8adf7e3e1f482d86ce9c5368f9c78e19c7923edf0067a12 SHA512 43f3e7cbee37b583cd65041465ef620ab7b3a24ad3f0e70cc2f41efea847e8c1c7319a92b53262bc5f721a46c0cfb4d51102d2e29c93b6ccae03ecf006e53d2d WHIRLPOOL 9518e2aeb5d2f0ac0945fa193edfaf7ba022729cc9ea91e5a773fed638fdcaef4d4bea0f284f1698571b570f5543afc8987ec81a54637d537c709b09474f6fbc
diff --git a/sci-libs/libsvm/files/3.11-openmp.patch b/sci-libs/libsvm/files/3.11-openmp.patch
new file mode 100644
index 00000000000..6ddb6f0831f
--- /dev/null
+++ b/sci-libs/libsvm/files/3.11-openmp.patch
@@ -0,0 +1,34 @@
+--- svm.cpp.orig 2011-05-27 04:32:19.000000000 +0100
++++ svm.cpp 2011-12-29 19:17:07.000000000 +0000
+@@ -1281,6 +1281,9 @@
+ int start, j;
+ if((start = cache->get_data(i,&data,len)) < len)
+ {
++#ifdef OPENMP
++#pragma omp parallel for private(j)
++#endif
+ for(j=start;j<len;j++)
+ data[j] = (Qfloat)(y[i]*y[j]*(this->*kernel_function)(i,j));
+ }
+@@ -2463,7 +2466,10 @@
+ model->param.svm_type == NU_SVR)
+ {
+ double *sv_coef = model->sv_coef[0];
+- double sum = 0;
++ double sum = 0; int i;
++#ifdef OPENMP
++#pragma omp parallel for private(i) reduction(+:sum)
++#endif
+ for(i=0;i<model->l;i++)
+ sum += sv_coef[i] * Kernel::k_function(x,model->SV[i],model->param);
+ sum -= model->rho[0];
+@@ -2480,6 +2486,9 @@
+ int l = model->l;
+
+ double *kvalue = Malloc(double,l);
++#ifdef OPENMP
++#pragma omp parallel for private(i)
++#endif
+ for(i=0;i<l;i++)
+ kvalue[i] = Kernel::k_function(x,model->SV[i],model->param);
+
diff --git a/sci-libs/libsvm/files/3.14-makefile.patch b/sci-libs/libsvm/files/3.14-makefile.patch
new file mode 100644
index 00000000000..56e8bd2e091
--- /dev/null
+++ b/sci-libs/libsvm/files/3.14-makefile.patch
@@ -0,0 +1,51 @@
+* respect CFLAGS and CXXFLAGS from user
+* compile with CC for C and CXX for C++ files
+* propagate and respect user's LDFLAGS
+* PIC only used for the library
+* link the shared version library
+nov 2012 - bicatali@gentoo.org
+
+--- Makefile.orig 2012-11-29 10:39:07.149421728 -0800
++++ Makefile 2012-11-29 10:57:19.727766521 -0800
+@@ -1,9 +1,12 @@
+ CXX ?= g++
+-CFLAGS = -Wall -Wconversion -O3 -fPIC
++CC ?= gcc
++CFLAGS ?= -Wall -Wconversion -O3
++CXXFLAGS ?= $(CFLAGS)
+ SHVER = 2
+ OS = $(shell uname)
++PICFLAGS ?= -fPIC
+
+-all: svm-train svm-predict svm-scale
++all: svm-train svm-predict svm-scale lib
+
+ lib: svm.o
+ if [ "$(OS)" = "Darwin" ]; then \
+@@ -11,15 +14,20 @@
+ else \
+ SHARED_LIB_FLAG="-shared -Wl,-soname,libsvm.so.$(SHVER)"; \
+ fi; \
+- $(CXX) $${SHARED_LIB_FLAG} svm.o -o libsvm.so.$(SHVER)
++ $(CXX) $(LDFLAGS) $${SHARED_LIB_FLAG} svm.o -o libsvm.so.$(SHVER) ; \
++ ln -s libsvm.so.$(SHVER) libsvm.so
+
+ svm-predict: svm-predict.c svm.o
+- $(CXX) $(CFLAGS) svm-predict.c svm.o -o svm-predict -lm
++ $(CC) $(CFLAGS) -c $@.c -o $@.o
++ $(CXX) $(LDFLAGS) $@.o svm.o -lm -o $@
+ svm-train: svm-train.c svm.o
+- $(CXX) $(CFLAGS) svm-train.c svm.o -o svm-train -lm
++ $(CC) $(CFLAGS) -c $@.c -o $@.o
++ $(CXX) $(LDFLAGS) $@.o svm.o -lm -o $@
+ svm-scale: svm-scale.c
+- $(CXX) $(CFLAGS) svm-scale.c -o svm-scale
++ $(CC) $(CFLAGS) -c $@.c -o $@.o
++ $(CXX) $(LDFLAGS) $@.o -o $@
++
+ svm.o: svm.cpp svm.h
+- $(CXX) $(CFLAGS) -c svm.cpp
++ $(CXX) $(CXXFLAGS) $(PICFLAGS) -c svm.cpp -o $@
+ clean:
+- rm -f *~ svm.o svm-train svm-predict svm-scale libsvm.so.$(SHVER)
++ rm -f *~ svm.o svm-train svm-predict svm-scale libsvm.so.$(SHVER) libsvm.so
diff --git a/sci-libs/libsvm/libsvm-3.17-r1.ebuild b/sci-libs/libsvm/libsvm-3.17-r1.ebuild
new file mode 100644
index 00000000000..32187ab1db1
--- /dev/null
+++ b/sci-libs/libsvm/libsvm-3.17-r1.ebuild
@@ -0,0 +1,92 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit eutils java-pkg-opt-2 python-r1 flag-o-matic toolchain-funcs
+
+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/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="amd64 ppc ppc64 x86 ~amd64-linux ~x86-linux"
+IUSE="java openmp python tools"
+
+DEPEND="java? ( >=virtual/jdk-1.4 )"
+RDEPEND="
+ java? ( >=virtual/jre-1.4 )
+ tools? ( sci-visualization/gnuplot )"
+
+pkg_setup() {
+ if use openmp; then
+ if [[ $(tc-getCC)$ == *gcc* ]] && ! tc-has-openmp; then
+ ewarn "You are using gcc but without OpenMP capabilities"
+ die "Need an OpenMP capable compiler"
+ else
+ append-ldflags -fopenmp
+ append-flags -fopenmp
+ fi
+ append-flags -DOPENMP
+ fi
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/3.11-openmp.patch \
+ "${FILESDIR}"/3.14-makefile.patch
+ sed -i -e "s@\.\./@${EPREFIX}/usr/bin/@g" tools/*.py \
+ || die "Failed to fix paths in python files"
+
+ if use java; then
+ local JAVAC_FLAGS="$(java-pkg_javac-args)"
+ sed -i \
+ -e "s/JAVAC_FLAGS =/JAVAC_FLAGS=${JAVAC_FLAGS}/g" \
+ java/Makefile || die "Failed to fix java makefile"
+ fi
+ tc-export CXX CC
+}
+
+src_compile() {
+ default
+ use java && emake -C java
+}
+
+src_install() {
+ dobin svm-train svm-predict svm-scale
+ dolib.so *.so*
+ insinto /usr/include
+ doins svm.h
+ dohtml FAQ.html
+ dodoc README
+
+ if use tools; then
+ local t
+ for t in tools/*.py; do
+ newbin ${t} svm-$(basename ${t} .py)
+ done
+ newdoc tools/README README.tools
+ insinto /usr/share/doc/${PF}
+ doins heart_scale
+ doins -r svm-toy
+ fi
+
+ if use python ; then
+ installation() {
+ touch python/__init__.py || die
+ python_moduleinto libsvm
+ python_domodule python/*.py
+ }
+ python_foreach_impl installation
+ newdoc python/README README.python
+ fi
+
+ if use java; then
+ java-pkg_dojar java/libsvm.jar
+ dohtml java/test_applet.html
+ fi
+}
diff --git a/sci-libs/libsvm/metadata.xml b/sci-libs/libsvm/metadata.xml
new file mode 100644
index 00000000000..3c124a8104e
--- /dev/null
+++ b/sci-libs/libsvm/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci</herd>
+ <longdescription lang="en">
+ The LIBSVM library is used to calculate Support Vector Machine
+ optimizations with a great variety of options. It includes
+ one-class, two-class, multiclass, regression-mode, and probablistic
+ output functionality. It is primarily of interest to machine-learning
+ researchers and artificial intelligence application developers.
+</longdescription>
+ <use>
+ <flag name="tools">Install python based tool scripts</flag>
+ </use>
+</pkgmetadata>