debian swirl logo

Back to the packages list libsvm

#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
#include /usr/share/cdbs/1/class/makefile.mk
#include /usr/share/python/python.mk

# install examples
DEB_INSTALL_EXAMPLES_libsvm-dev = svm-train.c svm-predict.c
DEB_INSTALL_EXAMPLES_libsvm-tools = heart_scale
#DEB_INSTALL_EXAMPLES_python-libsvm = python/svm_test.py python/cross_validation.py python/test_cross_validation.py

# install documents
DEB_INSTALL_DOCS_libsvm-dev = FAQ.html README
DEB_INSTALL_DOCS_libsvm-tools = FAQ.html
DEB_INSTALL_DOCS_python-libsvm = python/README

# install manpages
DEB_INSTALL_MANPAGES_libsvm-tools = debian/doc/svm-train.1 debian/doc/svm-predict.1 debian/doc/svm-scale.1 debian/doc/svm-grid.1 debian/doc/svm-subset.1 debian/doc/svm-checkdata.1 debian/doc/svm-easy.1

# use pysupport to install files of python-libsvm
#PYVERS=$(shell pyversions -vs)
LVER= 3
LSUBVER= 12
SOVER= $(LVER).$(LSUBVER)
LIBFILE= libsvm.so.$(SOVER)
CXX ?= g++
CFLAGS = -Wall -Wconversion -O3
LIBFLAGS = -fPIC

build: build-arch build-indep
build-arch: svm-train svm-predict svm-scale $(LIBFILE) chname
build-indep: .javastuff

.javastuff:
		$(MAKE) -C java

$(LIBFILE): svm.o
		$(CXX) -shared -Wl,-soname,libsvm.so.$(LVER) -o $(LIBFILE) svm.o -lm && \
		ln -s $(LIBFILE) libsvm.so.$(LVER) && \
		ln -s libsvm.so.$(LVER) libsvm.so

svm-predict: svm-predict.c svm.o
		$(CXX) $(CFLAGS) svm-predict.c svm.o -o svm-predict -lm
svm-train: svm-train.c svm.o
		$(CXX) $(CFLAGS) svm-train.c svm.o -o svm-train -lm
svm-scale: svm-scale.c
		$(CXX) $(CFLAGS) svm-scale.c -o svm-scale
svm.o: svm.cpp svm.h
		$(CXX) $(LIBFLAGS) $(CFLAGS) -c svm.cpp

#	touch $@
#build-python%:
#	cd python && \
#	python$* setup.py build
#	touch $@

chname: 
		cp tools/checkdata.py tools/svm-checkdata
		cp tools/easy.py tools/svm-easy
		cp tools/grid.py tools/svm-grid
		cp tools/subset.py tools/svm-subset
		sed -i 's/..\/svm-train/\/usr\/bin\/svm-train/g' tools/svm-*
		sed -i 's/..\/svm-predict/\/usr\/bin\/svm-predict/g' tools/svm-*
		sed -i 's/..\/svm-scale/\/usr\/bin\/svm-scale/g' tools/svm-*
		sed -i 's/.\/grid.py/\/usr\/bin\/svm-grid/g' tools/svm-easy
		sed -i 's/"get no rate"/RuntimeError("get no rate")/g' tools/svm-grid

#install: $(PYVERS:%=install-python%)
#install-python%:
#	cd python && \
#	install -o root -g root -m 644 \
#	svm.py svmutil.py \
#	python-libsvm
#	python$* setup.py install --no-compile \
#	--install-layout=deb \
#	--root=../debian/python-libsvm 

binary-install/libsvm3-java:: 
		cp java/libsvm.jar $(CURDIR)/debian/libsvm3-java/usr/share/java/libsvm3.jar

binary-install/python-libsvm:: 
		dh_pysupport -ppython-libsvm
binary-install/libsvm-tools::
		dh_pysupport -plibsvm-tools

clean::
		$(MAKE) clean
		find . -name "*.class" | xargs -r rm
		find . -name "*.jar" | xargs -r rm
		rm -f libsvm.so libsvm.so.$(LVER) libsvm.so.$(LVER).$(LSUBVER) tools/svm-*

Builds:

libsvm3-java
java api to support vector machine library (libsvm3.jar)
libsvm3
library implementing support vector machines
libsvm-dev
libsvm header files
libsvm-java
java api to support vector machine library (libsvm.jar)
libsvm-tools
libsvm binary tools
python-libsvm
python interface for support vector machine library