%define ver 0.2.4
%define rel 2

%define srcname marisa

%define enable_python 1

Summary: Matching Algorithm with Recursively Implemented StorAge
Name: marisa-trie
Version: %{ver}
Release: %{rel}%{_dist_release}
License: BSD
Group: System Environment/Libraries
URL: http://code.google.com/p/marisa-trie/
Source0: http://marisa-trie.googlecode.com/files/%{srcname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
%if %{enable_python}
BuildRequires: swig
BuildRequires: python-devel
BuildRequires: marisa-trie-devel
%endif

Vendor: Project Vine
Distribution: Vine Linux
Packager: iwaim

%description
*Matching Algorithm with Recursively Implemented !StorAge (MARISA)* is a static
 and space-efficient trie data structure. And *libmarisa* is a C++ library to p
rovide an implementation of MARISA. Also, the package of *libmarisa* contains a
 set of command line tools for building and operating a MARISA-based dictionary
.

A MARISA-based dictionary supports not only lookup but also reverse lookup, com
mon prefix search and predictive search.

 * Lookup is to check whether or not a given string exists in a dictionary.
 * Reverse lookup is to restore a key from its ID.
 * Common prefix search is to find keys from prefixes of a given string.
 * Predictive search is to find keys starting with a given string.

The biggest advantage of *libmarisa* is that its dictionary size is considerabl
y more compact than others. See below for the dictionary size of other implemen
tations.


%package devel
Summary: Header files and libraries for developing apps which will use marisa-trie
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
The marisa-trie-devel package contains the header files and libraries.

%if %{enable_python}
%package python
Summary: marisa-trie Python binding
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description python
marisa-trie Python binding

%endif

%prep
%setup -q -n %{srcname}-%{version}

%build
%configure --enable-shared
%__make

%if %{enable_python}
pushd bindings
make swig-python
pushd python
python setup.py build
popd
popd
%endif

%install
%__rm -rf $RPM_BUILD_ROOT
%makeinstall

%if %{enable_python}
pushd bindings/python
python setup.py install --root $RPM_BUILD_ROOT
popd
%endif

# remove files
%__rm -f $RPM_BUILD_ROOT%{_libdir}/*.{la,a}

%clean
%__rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc README ChangeLog COPYING AUTHORS NEWS docs
%{_bindir}/marisa-benchmark
%{_bindir}/marisa-build
%{_bindir}/marisa-common-prefix-search
%{_bindir}/marisa-dump
%{_bindir}/marisa-lookup
%{_bindir}/marisa-predictive-search
%{_bindir}/marisa-reverse-lookup
%{_libdir}/libmarisa.so.*

%files devel
%defattr(-,root,root,-)
%doc COPYING AUTHORS
%{_libdir}/pkgconfig/marisa.pc
%dir %{_includedir}/marisa
%{_includedir}/marisa.h
%{_includedir}/marisa/*.h
%{_libdir}/libmarisa.so

%if %{enable_python}
%files python
%defattr(-,root,root,-)
%doc COPYING AUTHORS
%{python_sitearch}/_marisa.so
%{python_sitearch}/marisa-*.egg-info
%{python_sitearch}/marisa.py
%{python_sitearch}/marisa.pyc
%endif

%changelog
* Wed May  6 2015 IWAI, Masaharu <iwaim.sub@gmail.com> 0.2.4-2
- build with current VineSeed

* Tue Jun 18 2013 IWAI, Masaharu <iwaim.sub@gmail.com> 0.2.4-1
- update to 0.2.4

* Sat Mar 16 2013 IWAI, Masaharu <iwai@alib.jp> 0.2.2-1
- update to 0.2.2

* Fri Feb  8 2013 IWAI, Masaharu <iwai@alib.jp> 0.2.1-2
- create python sub package

* Mon Jan 28 2013 IWAI, Masaharu <iwai@alib.jp> 0.2.1-1
- initial build for Vine Linux

