%define name libtorch
%define archive Torch3
%define version 3.1
%define release 1%{?_dist_release}
%define major 3
%define minor 0.0

Summary: Machine-learning library
Summary(ja): 機械学習ライブラリ
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{archive}src.tgz
Patch0: torch3_3.1-0.diff
License: BSD
Group: System Environment/Libraries
URL: http://www.torch.ch/

BuildRoot: %{_tmppath}/%{name}-%{version}-root

Vendor: Project Vine
Distribution: Vine Linux

%description
* A lot of things in gradient machines, that is, machines which could be learned
  with a gradient descent. This includes multi-layered perceptrons, radial basis
  functions, mixtures of experts, convolutional networks and even time-delay
  neural networks. In fact a lot of "modules" are available that you can plug as
  you want to get what you need.
* Support vector machines, in classification and regression. As fast as the old
  stand-alone program SVMTorch II, but with the powerful environment of the
  library.
* Ensemble models such as bagging or adaboost.
* Non-parametric models such as K-nearest-neighbors, Parzen regression and
  Parzen density estimator.
* Distributions stuff, like Kmeans, Gaussian mixture models, hidden Markov
  models, input-output hidden Markov models, and Bayes classifier.
* Speech recognition tools (Embedded training and large vocabulary decoding).

%package devel
Summary: Development files for Torch: Machine-learning library
Group: Development/Libraries
Requires: libtorch

%description devel
Development files for Torch: Machine-learning library.

%prep
%setup -q -n %{archive}
%patch0 -p1

%build
%__make depend
%__make

%install
rm -rf ${RPM_BUILD_ROOT}
%__install -D -m 0644 lib/%{name}.a ${RPM_BUILD_ROOT}%{_libdir}/libtorch.a
%__install -m 0644 lib/%{name}.so.%{major}.%{minor} ${RPM_BUILD_ROOT}%{_libdir}
%__install -d ${RPM_BUILD_ROOT}%{_includedir}/torch
%__install -m 0644 */*.h ${RPM_BUILD_ROOT}%{_includedir}/torch
cd ${RPM_BUILD_ROOT}%{_libdir}
%__ln_s %{name}.so.%{major}.%{minor} %{name}.so.%{major}
%__ln_s %{name}.so.%{major}.%{minor} %{name}.so

%clean
rm -rf ${RPM_BUILD_ROOT}

%files 
%defattr(-,root,root)
%doc ChangeLog LICENSE
%{_libdir}/%{name}.so.*

%files devel
%defattr(-,root,root)
%{_libdir}/%{name}.a
%{_libdir}/%{name}.so
%{_includedir}/torch/*.h

%changelog
* Mon Sep 29 2008 Shu KONNO <owa@bg.wakwak.com> 3.1-1vl5
- applied new versioning policy, spec in utf-8
- use macros for library and include path

* Sat Jun 16 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.1-0vl2
- rebuilt with new toolchain

* Sat Mar 11 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 3.1-0vl1
- add Summary(ja)

* Thu Mar 9 2006 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 3.1-0vl0.5
- change package name from torch to libtorch
- add Patch0 (from Debian stable)
- add devel package

* Tue Dec 27 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 3.1-0vl0.4
- integrate devel package into main package

* Sat Dec 24 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 3.1-0vl0.3
- add version dependencies to -devel package

* Sat Dec 24 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 3.1-0vl0.2
- add -devel package

* Sat Dec 24 2005 KANEKO Seiji <giraffe@m2.pbc.ne.jp> 3.1-0vl0.1
- initial build for Vine Linux
