SUMMARY="Library for Support Vector Machines"
DESCRIPTION="
Libsvm is a simple, easy-to-use, and efficient software for SVM \
classification and regression. It solves C-SVM classification, nu-SVM \
classification, one-class-SVM, epsilon-SVM regression, and nu-SVM \
regression. It also provides an automatic model selection tool for \
C-SVM classification."
HOMEPAGE="http://www.csie.ntu.edu.tw/~cjlin/libsvm/"
SOURCE_URI="git+https://github.com/cjlin1/libsvm#8f3d96e"
REVISION="1"
LICENSE="BSD (3-clause)"
COPYRIGHT="2000-2014 Chih-Chung Chang and Chih-Jen Lin"

ARCHITECTURES="x86_gcc2 x86 x86_64"

PROVIDES="
	libsvm = $portVersion
	lib:libsvm
	"

REQUIRES="
	haiku
	lib:libstdc++
	"

BUILD_PREREQUIRES="
	haiku
	cmd:make
	cmd:gcc
	cmd:g++
	cmd:sed
	"

BUILD_REQUIRES="
	haiku_devel
	"

PATCH()
{
	sed -e 's/-lm//g' -i Makefile
}

BUILD()
{
	make lib $jobArgs
	make $jobArgs
}

INSTALL()
{
	mkdir -p $binDir
	mkdir -p $libDir
	mkdir -p $includeDir

	cp svm-train			$binDir/svm-train
	cp svm-predict			$binDir/svm-predict
	cp svm-scale			$binDir/svm-scale
	cp tools/checkdata.py	$binDir/svm-checkdata
	cp tools/subset.py		$binDir/svm-subset
	cp tools/easy.py		$binDir/svm-easy
	cp tools/grid.py		$binDir/svm-grid
	packageEntries tools $binDir

	cp libsvm.so.2 $libDir
	cp svm.h $includeDir
	prepareInstalledDevelLibs libsvm
	packageEntries devel $developDir
}

# ----- devel package -------------------------------------------------------

PROVIDES_devel="
	libsvm_devel = $portVersion
	devel:libsvm
	"

REQUIRES_devel="
	libsvm == $portVersion base
	"
# ----- tools package -------------------------------------------------------

PROVIDES_tools="
	libsvm_tools = $portVersion
	cmd:svm_train
	cmd:svm_predict
	cmd:svm_scale
	cmd:svm_checkdata
	cmd:svm_subset
	cmd:svm_easy
	cmd:svm_grid
	"

REQUIRES_tools="
	haiku
	lib:libstdc++
	cmd:python
	"
