Summary: a Japanese input method with T-Code on Emacsen
Name: tc-el
Version: 2.3.1
Release: 2%{?_dist_release}
License: GPLv2+
Group: Applications/Editors/Emacs
Source0: http://openlab.jp/tcode/resources/soft/tc-%{version}.tar.gz
Source1: %{name}-install.sh
Source2: %{name}-remove.sh
Source3: vine-default-%{name}.el
Source4: %{name}-init.el
Patch0: tc-2.3.1-shebang.patch
Patch1: tc-2.3.1-datadir.patch
URL: http://openlab.jp/tcode/tc2/index.html
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildPreReq: autoconf, libtool, emacs
PreReq: emacsen, emacsen-common >= 0.1
Requires: bash

%description
T-Code is Japanese input method that doesn't use Kana-to-Kanji convertion.
You can input Kanji characters directly in the same way of inputting
Hiragana.  This packages also provides TUT-Code input method (the
alternative of T-Code).

%prep

%setup -q -c
cd tc-%{version}
%patch0 -p0
%patch1 -p0
cd ..

%build
cd tc-%{version}

%configure --with-lispdir=%{_datadir}/emacs/site-lisp/%{name}
make -C bushu-util
make -C doc
make -C etc
make -C kinput2
make -C mazegaki
make -C skkinput3

cd ..

%install
cd tc-%{version}

[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
[ "${RPM_BUILD_ROOT}" != "/" ] && mkdir -p ${RPM_BUILD_ROOT}

mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/%{name}
mkdir -p ${RPM_BUILD_ROOT}%{emacsen_pkgdir}/install
mkdir -p ${RPM_BUILD_ROOT}%{emacsen_pkgdir}/remove

make -C bushu-util DESTDIR=${RPM_BUILD_ROOT} install
make -C doc        DESTDIR=${RPM_BUILD_ROOT} install
make -C etc        DESTDIR=${RPM_BUILD_ROOT} install
make -C kinput2    DESTDIR=${RPM_BUILD_ROOT} install
make -C mazegaki   DESTDIR=${RPM_BUILD_ROOT} install
make -C skkinput3  DESTDIR=${RPM_BUILD_ROOT} install

(cd lisp && \
 install -m 644 *.el ${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/%{name})

cp -p %{SOURCE3} %{SOURCE4} %{buildroot}%{_datadir}/emacs/site-lisp/%{name}

rm -f $RPM_BUILD_ROOT%{_bindir}/tcinput

%_installemacsenscript %{name} %{SOURCE1} 

%_removeemacsenscript  %{name} %{SOURCE2}

cd ..

%post
/sbin/install-info %{_infodir}/tc.info.gz %{_infodir}/dir \
  --section="T-Code Driver for Emacsen"

if [ "$1" = 2 ]; then
  %_emacsenPackageRemove tc-el

fi

%_addemacsenlist tc-el

%_emacsenPackageInstall tc-el

%preun
/sbin/install-info --delete %{_infodir}/tc.info.gz %{_infodir}/dir \
  --section="T-Code Driver for Emacsen"

if [ "$1" = 0 ]; then
  %_emacsenPackageRemove tc-el

  %_removeemacsenlist tc-el

fi

%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-, root, root)
%{_datadir}/tc
%{_infodir}/*.info*
%{emacsen_pkgdir}/install/%{name}
%{emacsen_pkgdir}/remove/%{name}
%{_datadir}/emacs/site-lisp/%{name}/
%doc tc-%{version}/AUTHORS
%doc tc-%{version}/COPYING
%doc tc-%{version}/ChangeLog*
%doc tc-%{version}/NEWS
%doc tc-%{version}/README
%doc tc-%{version}/skkinput3/tcinput

%changelog
* Sat Aug 28 2010 IWAI, Masaharu <iwai@alib.jp> 2.3.1-2
- apply vine-default
 - add vine-default-tc-el.el (Source3)
 - add tc-el-init.el (Source4)
 - update tc-el-{install,remove}.sh
- sync upstream: byte compiling target el files
- update Summary and License
- using emacsen_pkgdir rpm macro

* Mon Aug 18 2008 Shu KONNO <owa@bg.wakwak.com> 2.3.1-1vl5
- applied new versioning policy
- fixed path of emacsen-common

* Tue Sep 12 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.3.1-0vl2
- changed Group to Appliations/Editors/Emacs 
- s/Copyright/License/

* Wed Dec  3 2003 akira yamada <akira@vinelinux.org> 2.3.1-0vl1
- new upstream version.
- BuildPreReq: emacs-beta -> emacs

* Tue Feb 12 2002 akira yamada <akira@vinelinux.org> 2.2-0vl4
- rewrote summary field.
- .tc-bitmap-8x16 is in %{_datadir}/tc, fixed tc-el-install.sh.

* Mon Feb 11 2002 akira yamada <akira@vinelinux.org> 2.2-0vl3
- install .tc-bitmap-8x16 to datadir.

* Wed Feb 06 2002 akira yamada <akira@vinelinux.org> 2.2-0vl2
- BuildArch is not noarch. /usr/lib/tc/{reduce,combine} are elf-binary.

* Mon Feb 04 2002 akira yamada <akira@vinelinux.org> 2.2-0vl1
- new upstream release.
- added autoconf, libtool and emacs-beta to BuildPreReq.
- emacsen-common is in PreReq, not in Requires.
- BuildArch is now noarch.

* Fri Dec 14 2001 akira yamada <akira@vinelinux.org> 2.1+2.2pre2-0vl1
- Initial packaging.
