%define tkver 2.04
%define perl_vendorarch    %(eval "`perl -V:installvendorarch`"; echo $installvendorarch)

Summary: Filter to convert Kanji to Hiragana, Katakana or Romaji
Summary(ja): 漢字かなまじり文をひらがな文やローマ字文に変換するフィルタ
Name: kakasi
Version: 2.3.6
Release: 1%{?_dist_release}
Group: Applications/Text
License: GPLv2+
URL: http://kakasi.namazu.org/

Source: ftp://kakasi.namazu.org/pub/kakasi/kakasi-%{version}.tar.xz
Source1: http://search.cpan.org/CPAN/authors/id/D/DA/DANKOGAI/Text-Kakasi-%{tkver}.tar.gz

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: perl >= 1:5.10.0

Provides: perl-Text-Kakasi = %{tkver}

Distribution: Vine Linux
Vendor: Project Vine
Packager: daisuke


%description
KAKASI is the language processing filter to convert Kanji characters 
to Hiragana, Katakana or Romaji(1) and may be helpful to read Japanese 
documents. perl module for kakasi is also involved.

%description -l ja
KAKASI は漢字かなまじり文をひらがな文やローマ字文に変換することを
目的として作成したプログラムと辞書の総称です。
このパッケージには、kakasi を perlで用いるモジュール Text-Kakasi-%{tkver}
も含んでいます。 


%package devel
Summary: Libraries and include files of KAKASI
Group: Development/Libraries
Summary(ja): KAKASIのライブラリとヘッダファイル

%description devel
Libraries and include files of KAKASI

%description devel -l ja
KAKASI のライブラリとヘッダファイルです

%prep
%setup -q -a 1
find . -type d -name CVS | xargs -r rm -frv

%build
%configure --disable-static
make

# build Text-Kakasi
cd Text-Kakasi-%{tkver}

CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL INSTALLDIRS="vendor"
make INC=-I../lib/ LDFLAGS=-L../lib/

%install
rm -rf %{buildroot}
%makeinstall

# install manual page
mkdir -p %{buildroot}%{_mandir}/ja/man1
install -p -m 644 man/kakasi.1.ja %{buildroot}%{_mandir}/ja/man1/kakasi.1

# install Text-Kakasi
cd Text-Kakasi-%{tkver}
make DESTDIR=$RPM_BUILD_ROOT install
find $RPM_BUILD_ROOT -type f -a \( -name perllocal.pod -o -name .packlist \
  -o \( -name '*.bs' -a -empty \) \) -exec rm -f {} ';'

rm -rf ../Text-Kakasi
mkdir -p ../Text-Kakasi
cp -a README* COPYING* MANIFEST ../Text-Kakasi
cd -

# removed unpackaed files
rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.{a,la}

%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc doc Text-Kakasi
%doc README* AUTHORS COPYING ChangeLog TODO NEWS
%{_bindir}/*
%exclude %{_bindir}/kakasi-config
%{_libdir}/libkakasi.so.*
%dir %{_datadir}/kakasi
%{_datadir}/kakasi/*
%{perl_vendorarch}/Text/Kakasi.pm
%{perl_vendorarch}/Text/Kakasi/JP.pod
%{perl_vendorarch}/auto/Text/Kakasi
%{_mandir}/man3/*
%{_mandir}/man1/kakasi.1*
%{_mandir}/ja/man1/kakasi.1*

%files devel
%defattr(-,root,root)
%{_bindir}/kakasi-config
%{_includedir}/*
%{_libdir}/libkakasi.so
%{_mandir}/man1/kakasi-config.1*


%changelog
* Fri Jun 06 2014 Daisuke SUZUKI <daisuke@vinelinux.org> 2.3.6-1
- update to 2.3.6

* Mon Apr 13 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.3.4-2
- spec in utf-8
- remove static library

* Mon Apr 28 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.3.4-1vl5
- rebuilt with perl 5.10.0
- applied new versioning policy
- removed lib*.la from devel package
- fixed %%doc section
- fixed %%changelog typo

* Wed Mar 15 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 2.3.4-0vl7
- add strdup.patch (patch0) to avoid segmentation fault

* Wed Feb 15 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.3.4-0vl6
- rebuilt with new toolchains and perl-5.8.6
- updated Text-Kakasi source and its URL
- added Provides: perl-Text-Kakasi

* Sat Dec 13 2003 Satoshi MACHINO <machino@vinelinux.org> 2.3.4-0vl5
- rebuilt on perl-5.8.2

* Thu Nov 06 2003 Satoshi MACHINO <machino@vinelinux.org> 2.3.4-0vl4
- rebuilt on perl-5.8.1

* Thu Apr 24 2003 IWAI Masaharu <iwai@alib.jp> 2.3.4-0vl3
- rebuild with perl-5.8.0

* Mon Jan 28 2002 Toru Sagami <sagami@vinelinux.org> 2.3.4-0vl2
- make sure thet libkakasi.{a,la,so} are splitted into devel subpackage

* Fri Sep  7 2001 Jun Nishii <jun@vinelinux.org> - 2.3.4-0vl1
- ver.up
- ver.up Text-Kakasi

* Sat Jun 16 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 2.3.3-0vl4
- rebuilt with perl-5.6.1

* Wed Jun 13 2001 Jun Nishii <jun@vinelinux.org> 2.3.3-0vl3
- modify perl version dependency

* Fri May 11 2001 Hiroaki Irokawa <irorin@terra.dti.ne.jp>
- 2.3.3-0vl2
- TextKakasi VersionDown(1.05 -> 1.04)

* Mon May  7 2001 Hiroaki Irokawa <irorin@terra.dti.ne.jp>
- 2.3.3-0vl1
- update to 2.3.3(TextKakasi 1.04 -> 1.05)

* Sat Jan 13 2001 Toru Sagami <czs14350@mb.infoweb.ne.jp>
- 2.3.2-0vl3
- use better macros, _mandir
- dont pack CVS directory

* Fri Sep 08 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 2.3.2-0vl2
- modified %files section to handle compressed man page(s)

* Sat May 27 2000 Jun Nishii <jun@vinelinux.org>
- 2.3.2-0vl1
- merge Text Kakasi

* Fri Jan  7 2000 Jun Nishii <jun@vinelinux.org>
- change group
- strip bins

* Fri Oct 29 1999 Jun Nishii <jun@flatout.org>
- updated to 2.3.1

* Thu Oct 28 1999 Jun Nishii <jun@flatout.org>
- updated to 2.3.0
- separate devel

* Mon Sep 20 1999 Jun Nishii <jun@flatout.org>
- added %defattr

* Wed Jul 28 1999 Jun Nishii <jun@flatout.org>
- rebuild for Vine-1.9
