%define _noVersionedDependencies        1
%define prereq_ge()  %(LC_ALL="C" rpm -q --queryformat 'PreReq:%%{NAME} >= %%{VERSION}' %1| grep -v "is not")

%define		origver		0.75
%define		release		6%{?_dist_release}
%define		emacs		emacs
%define		origname	IIIMECF

Summary:	Internet/Intranet Input Method Emacs Client Framework
Summary(ja):	Emacs クライアント用 Internet/Intranet Input Method フレームワーク
Name:		%{origname}
Version:	%{origver}
Release:	%{release}
License:	GPL
Group:		Applications/Editors/Emacs
URL:		http://www.meadowy.org/~kawabata/iiimecf/
#Source:		ftp://ftp.m17n.org/pub/mule/IIIM/%{origname}-%{version}.tar.gz
Source:		http://www.meadowy.org/~kawabata/iiimecf/%{origname}-%{version}.tar.gz
Source1:	%{origname}-install.sh
Source2:	%{origname}-remove.sh
Source3:	%{origname}-init.el
Source4:	vine-default-%{origname}.el
BuildArch:	noarch
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

PreReq:        emacsen, gzip
%prereq_ge     emacsen-common
BuildRequires: emacsen-common
## 0.7.5: Emacs 21 のみ Mule-UCS が必要です
# PreReq:        Mule-UCS
# Requires:      Mule-UCS

#Packager:      Shoji Matsumoto <shom@vinelinux.org>
Distribution:  Vine Linux
Vendor:        Project Vine


%description
  IIIMECF conforms IIIM Protocol Specification defined by Sun Microsystems,
and consists of a library to create IIIM awared applications and a simple
input method library controlled by IIIM server(s).

If you use IIIMECF on Emacs 21, Mule-UCS is required.

%description -l ja
  IIIMECFは、Sun Microsystems社の定めるIIIM Protocolに基づき、Emacs上で
IIIM対応のapplicationを構築するためのlibraryと、それを用いた、Server sideで
制御されるシンプルなInput Method libraryによって構成されています。

Emacs 21 では Mule-UCS が必要です。

%prep
#% setup -n %{origname}-%{version}
%setup -n iiimecf

%__cp -a %{SOURCE3} %{SOURCE4} .

%install
[ "${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/%{origname}
%__mkdir_p $RPM_BUILD_ROOT%{emacsen_pkgdir}/install
%__mkdir_p $RPM_BUILD_ROOT%{emacsen_pkgdir}/remove

cp -r *.el lisp ${RPM_BUILD_ROOT}/usr/share/emacs/site-lisp/%{origname}

#
# install  script( bytecompile el and install elc , remove )   
#

%_installemacsenscript %{origname} %{SOURCE1} 

%_removeemacsenscript  %{origname} %{SOURCE2}

%post 
#
# bytecompile and install 
#

if [ "$1" = 2 ]; then

%_emacsenPackageRemove %{origname}

fi

%_addemacsenlist %{origname}

%_emacsenPackageInstall %{origname}

%preun

if [ "$1" = 0 ]; then

%_emacsenPackageRemove %{origname}

%_removeemacsenlist %{origname}

fi


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


%files
%defattr(-,root,root)
%doc COPYING*  ChangeLog* README* lisp

%{_datadir}/emacs/site-lisp/%{origname}
%{emacsen_pkgdir}/install/%{origname}
%{emacsen_pkgdir}/remove/%{origname}


%changelog
* Thu Feb 24 2011 Munehiro Yamamoto <munepi@vinelinux.org> 0.75-6
- updated IIIMECF-init.el
  - output "Loading vine-default-IIIMECF ..." to the buffer *Messages*
- fixed some comments of vine-default-IIIMECF.el

* Sat Jul 25 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.75-5
- updated yatex-install.sh
  - *-init.el: changed from hard copy to symbolic link 
    on /etc/emacs-XX.YY/site-start.d

* Thu May 21 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.75-4
- fixed some STDOUT messages in IIIMECF-install.sh

* Sun May 17 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.75-3
- updated vine-default-IIIMECF.el

* Thu Apr 23 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.75-2
- added vine-default-IIIMECF.el, IIIMECF-init.el
- updated wl-install.sh for vine-default-wl.el

* Sun Mar 29 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.75-1
- new upstream relase
- spec in utf8
- applied new versioning policy
- added URL: 
- added some comments about Mule-UCS in %%description
- dropped Requires: Mule-UCS and BuildRequires: Mule-UCS
  - ONLY Emacs 21 needs Mule-UCS

* Tue Sep 12 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.6-0vl5
- changed Group to Appliations/Editors/Emacs <BTS:VineLinux:163>

* Sat Jul 22 2006 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.6-0vl4
- correct Summary <BTS:VineLinux:65>
- add Summary(ja)
- use License tag instead of CopyLight tag
- change License from distibutable to GPL
- rebuild for VineSeed (4.0)

* Thu Nov 14 2002 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 0.6-0vl2
- add Prereq: gzip
- Not Support xemacs-21.1.* in IIIMECF-install.sh 

* Fri Oct 04 2002 Tomoya TAKA <taka@vinelinux.org> 0.6-0vl1
- add Prereq: Mule-UCS

* Tue Aug 13 2002 Shoji Matsumoto <shom@vinelinux.org> 0.6-0vl0
- created