%define pkg_name    skkdic
%define pkg_version 20160424
%define pkg_release 1%{?_dist_release}

Summary:   SKK Dictionaries
Name:      %{pkg_name}
Version:   %{pkg_version}
Release:   %{pkg_release}
BuildArch: noarch

License: Distrubutable
Group:   Applications/Text
URL:     http://openlab.ring.gr.jp/skk/

Source0: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.L.gz
Source1: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.JIS2.gz
Source2: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.JIS3_4.gz
Source3: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.pubdic+.gz
Source4: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.edict.tar.gz
Source5: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.assoc.gz
Source6: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.china_taiwan.gz
#Source7: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.fukugo.gz
Source8: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.geo.gz
Source9: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.itaiji.gz
Source10: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.law.gz
Source11: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.mazegaki.gz
Source12: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.okinawa.gz
Source13: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.jinmei.gz
Source14: http://openlab.ring.gr.jp/skk/dic/zipcode.tar.gz
Source15: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.fullname.gz
Source16: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.itaiji.JIS3_4.gz
Source17: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.JIS2004.gz
Source18: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.L.unannotated.gz
Source19: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.lisp.gz
Source20: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.propernoun.gz
Source21: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.requested.gz
Source22: http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.station.gz
Source100: dot-dic.skk
Source200: skktocdbm.sh

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

Vendor: Project Vine
Distribution: Vine Linux
Packager: ara_t


%description
SKK dictionaries

%description -l ja
SKK 辞書パッケージです。
/usr/share/doc/skkdic-%{version}/dot-dic.skk
を ~/.skk としてコピーして使用してください。


%package cdb
Summary:     standard dictionary file for SKK in cdb format for faster access
Summary(ja): より高速なアクセスが可能な cdb フォーマットの SKK 標準辞書ファイル
Group:       Applications/Text

%description cdb
This package provides the standard dictionary file for
SKK Japanese input systems, converted to constant database (cdb)
for faster access.

%description -l ja cdb
このパッケージはSKK日本語入力システムの標準辞書ファイルを
constant database (cdb) に変換し、より高速なアクセスを可能とした
ファイルを提供します。


%prep
%setup -n %{name} -c -T -a 4 -a 14

%build
%{__cp} \
 %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE5} %{SOURCE6} \
 %{SOURCE8} %{SOURCE9} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \
 %{SOURCE15} %{SOURCE16} %{SOURCE17} %{SOURCE18} %{SOURCE19} %{SOURCE20} \
 %{SOURCE21} %{SOURCE22} .
gzip -d *.gz

%{__cp} %{SOURCE100} .

%{__mkdir_p} DOCS/zipcode
%{__cp} \
 zipcode/configure zipcode/configure.ac zipcode/Makefile.in zipcode/README.ja \
 zipcode/ZIPCODE-MK zipcode/words.zipcode \
 DOCS/zipcode/

for JISYO in SKK-JISYO.*
do
  LJISYO=`basename $JISYO`
  %{SOURCE200} < ${JISYO} > ${LJISYO}.cdb
done

%install
%{__mkdir_p} ${RPM_BUILD_ROOT}%{_datadir}/skk
%{__install} -m 644 SKK-JISYO.* ${RPM_BUILD_ROOT}%{_datadir}/skk
%{__install} -m 644 zipcode/SKK-JISYO.* ${RPM_BUILD_ROOT}%{_datadir}/skk

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,root)
%doc DOCS/* dot-dic.skk edict_doc.txt
%{_datadir}/skk/SKK-JISYO.*[^{cdb}]
%{_datadir}/skk/SKK-JISYO.L.unannotated
%{_datadir}/skk/SKK-JISYO.assoc
%{_datadir}/skk/SKK-JISYO.requested

%files cdb
%defattr(-, root, root)
%{_datadir}/skk/SKK-JISYO.*.cdb


%changelog
* Fri Apr 29 2016 Toshiaki Ara <ara_t@384.jp> 20160410-1
- update to 20160424
- make subpackage skkdic-cdb

* Sun Apr 10 2016 Toshiaki Ara <ara_t@384.jp> 20160410-1
- update to 20160410
- correct SPEC file

* Sat Mar 12 2016 Toshiaki Ara <ara_t@384.jp> 20160306-1
- update to 20160306

* Mon Dec 28 2015 Toshiaki Ara <ara_t@384.jp> 20151227-1
- update to 20151227

* Tue Nov 17 2015 Toshiaki Ara <ara_t@384.jp> 20151115-1
- update to 20151115

* Wed Sep 23 2015 Toshiaki Ara <ara_t@384.jp> 20150920-1
- update to 20150920

* Thu Jul 09 2015 Toshiaki Ara <ara_t@384.jp> 20150705-2
- rebuild

* Thu Jul 09 2015 Toshiaki Ara <ara_t@384.jp> 20150705-1
- update to 20150705
- update dot-dic.skk (Source100):
-   modify by http://openlab.ring.gr.jp/skk/skk/main/etc/dot.skk
- add new dictionary file (Sources from 15 to 22)

* Sat Jun 30 2012 Munehiro Yamamoto <munepi@vinelinux.org> 20100126-2
- rebuild

* Sun Aug 29 2010 IWAI, Masaharu <iwai@alib.jp> 20100126-1
- update to 20100126
- drop SKK-JISYO.fukugo.gz (Source7): upstream removed 2003-04-05
- update dot-dic.skk (Source100): drop SKK-JISYO.fukugo
- s/BuildArchitectures/BuildArch/

* Sat Oct 11 2008 Shu KONNO <owa@bg.wakwak.com> 20030520-1vl5
- applied new versioning policy, spec in utf-8

* Sat May 24 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org>
- 20030520-0vl2
- added dot-dic.skk

* Tue May 20 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org>
- 20030520-0vl1

* Tue Mar  7 2001 Uechi Yasumasa <uh@u.dhis.portside.net>
- 20010306-0vl1
- 1st release
