%define	srcdate	20110227
%define	srcname	cmigemo-default-src

Summary:	C implementation of migemo
Summary(ja): 	Migemo の C 言語による実装
Name:		cmigemo
Version:	1.3e
Release: 	1%{?_dist_release}
Source0:	http://cmigemo.googlecode.com/files/%{srcname}-%{srcdate}.zip
# include dict file and diasble downloading at complie time.
Source1:	http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.L.gz
Patch0:		cmigemo-include-fix.patch
Patch1:		cmigemo-utf8-dict.patch
License:	MIT/distributable (see README files for detail)
Group:		System Environment/Libraries
URL:		http://www.kaoriya.net/software/cmigemo

#Requires:	
BuildRequires:	ctags
BuildRequires:	unzip
BuildRequires:	nkf
#BuildRequires:	curl
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Vendor:		Project Vine
Distribution:	Vine Linux

Packager:	kazutaka

%description
C/Migemo is a C implementation of Migemo(Ruby/Migemo).
With this library, It is possible to implement incremantal search
function for japanese using roman letter input.

%description -l ja
C/MigemoはMigemo(Ruby/Migemo)をC言語で実装したものです。C/Migemo
ライブラリを利用するソフトウェアは「ローマ字のまま日本語を(インク
リメンタルに)検索する」機能を持つことが可能になります。


%prep
%setup -q -n %{srcname}
%patch0 -p1 -b .include
%patch1 -p1 -b .utf8-dict

# fix execution bit for configure
%{__chmod} +x ./configure

# locate SKK-JISYO.L
%{__cp} %{SOURCE1} dict/

%build
%configure --prefix=$RPM_BUILD_ROOT/%{_prefix}
%{__make} gcc
%{__make} gcc-dict


%install
%{__rm} -rf $RPM_BUILD_ROOT
%{__make} gcc-install DESTDIR=$RPM_BUILD_ROOT

# fix library install location for x86_64
%ifarch x86_64
%{__mv} $RPM_BUILD_ROOT/%{_prefix}/lib/ $RPM_BUILD_ROOT/%{_prefix}/lib64
%endif

# remove unnecessary files
%{__rm} -rf $RPM_BUILD_ROOT/%{_datadir}/migemo/cp932/
%{__rm} -rf $RPM_BUILD_ROOT/%{_datadir}/migemo/euc-jp/
%{__rm} -rf $RPM_BUILD_ROOT/%{_prefix}/doc/migemo/README_j.txt


%post -p /sbin/ldconfig


%postun -p /sbin/ldconfig


%clean
%{__rm} -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root)
%doc README.txt doc/
%{_bindir}/%{name}
%{_includedir}/migemo.h
%{_libdir}/libmigemo*
%{_datadir}/migemo/


%changelog
* Mon Jun 20 2011 Kazutaka HARADA <kazutaka@vinelinux.org> 1.3e-1
- initial build for Vine Linux
