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

%define		origver		0.85
%define		release		1%{?_dist_release}
%define		emacs		emacs
%define		origname	Mule-UCS

Summary:	MULE-UCS is a coding system and character code translator system.
Name:		%{origname}
Version:	%{origver}
Release:	%{release}
License:	distributable
Group:		Applications/Editors/Emacs
#Source:		ftp://ftp.m17n.org/pub/mule/Mule-UCS/%{origname}-%{version}.tar.gz
Source:		ftp://ftp.m17n.org/pub/mule/Mule-UCS/test/%{origname}-current.tar.gz
Source1:	%{origname}-install.sh
Source2:	%{origname}-remove.sh
Patch1:		x0213-cdef.diff
Patch100:	Mule-UCS-0.84-emacs21.2-un-define.diff
BuildArch:	noarch
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Conflicts:     Mule-UCS-emacs, Mule-UCS-el
PreReq:        emacsen, gzip
%prereq_ge     emacsen-common
BuildRequires: emacsen-common

Packager:      Satoshi MACHINO <machino@vinelinux.org>
Distribution:  Vine Linux
Vendor:        Project Vine


%description
MULE-UCS is a character code translator.  This has an universal ability to
translate from any character sets to any, and constract new coding systems
easily.
And MULE-UCS have a package to translate between MULE INTERNAL CODE and
ISO-10646, So you can handle ISO-10646 based coding systems on
Emacs/Mule(But can't work on 20.2, this version have no extended CCL), Mule
3.0 and Meadow.

%description -l ja
MULE-UCS は文字コードの変換ツールで、容易に文字コードを万国的に変換できます。
MULE-UCS はさらに、MULE 内部コード(MULE INTERNAL CODE)と ISO-10646 間の変換
が出来ます。
Emacs/Mule(20.2 はextended CCL がないので動きません)や Mule 3.0 や Meadow 上で
ISO-10646 を扱うことができます。

Emacs(20, 21) では、~/.emacs.el に
     (require 'un-define)
     (require 'jisx0213)
などを追加してから Emacs を起動してください。 


XEmacs-21.4 で UTF-8 を使うには、~/.xemacs/init.el に
     (require 'un-define)
     (set-coding-priority-list '(utf-8))
     (set-coding-category-system 'utf-8 'utf-8)
などを追加してから XEmacs-21.4 を起動して下さい。

注1) XEmacs-21.4 では 現在 (require 'jisx0213)は使用できません。
注2) XEmacs-21.1.14 では Mule-UCS(当パッケージ)は使用できません。

%prep
#%setup -n %{origname}-%{version}
%setup -n %{origname}-current
#%patch1 -p1
#%patch100 -p1

%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/%{_libdir}/emacsen-common/packages/install
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/emacsen-common/packages/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* doc lisp

%{_datadir}/emacs/site-lisp/%{origname}
%{_libdir}/emacsen-common/packages/install/%{origname}
%{_libdir}/emacsen-common/packages/remove/%{origname}


%changelog
* Sat Aug 16 2008 Shu KONNO <owa@bg.wakwak.com> 0.85-1vl5
- applied new versioning policy, spec in utf-8
- added %%define _libdir %%{_prefix}/lib

* Mon Sep 11 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.85-0vl2
- changed Group to Appliations/Editors/Emacs <BTS:VineLinux:163>
- s/Copyright/License/

* Sat Apr 12 2003 IWAI Masaharu <iwai@alib.jp> 0.85-0vl1
- update Mule-UCS-install.sh ( fix [VineSeed:07674] )

* Wed Mar 26 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 0.85-0vl0
- update to Mule-UCS-0.85rc

* Sun Nov 17 2002 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 0.84-0vl10
- Modified %Patch100([vine-users:055763])

* Fri Nov 15 2002 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 0.84-0vl9
- Add %PreReq gzip
- Modified %description -l ja ([vine-users:055680])
- Add %Patch100(Thanks Toshiyasu KOJIMA <t_kojima@ps.ksky.ne.jp>)
   (http://tsukuba.m17n.org/mule-archive/2002-3/msg00000.html + [vine-users:055729])

* Sun Nov  3 2002 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 0.84-0vl8
- not support xemacs-21.1.14
- Modified Mule-UCS-install.sh for xemacs-21.4.*

* Tue Aug 27 2002 IWAI Masaharu <iwai@alib.jp> 0.84-0vl7
- modified Mule-UCS-install.sh
    deleting .elc files after byte compile in ELDIR

* Mon Aug 26 2002 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 0.84-0vl6
- Modified Mule-UCS-install.sh for xemacs21.4-21.4.9

* Sun Jul 28 2002 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 0.84-0vl5
- Modified Mule-UCS-install.sh for xemacs21.4-21.4.8-0vl1

* Sat Jan 26 2002 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 0.84-0vl4
- Modified Mule-UCS-install.sh for xemacs21.4-21.4.6-0vl1

* Sun Dec 30 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.84-0vl3
- Mule-UCS-el -> Mule-UCS again

* Sat Dec 08 2001 Satoshi MACHINO <machino@vinelinux.org> 0.84-0vl2
- fixed install/remove scripts

* Fri Dec 07 2001 Satoshi MACHINO <machino@vinelinux.org> 0.84-0vl1
- emacsenize 
- changed Package Name

* Tue Oct 23 2001 Satoshi MACHINO <machino@vinelinux.org> 0.84-0vl0.4
- updated emacs-beta(emacs-21.0)

* Wed Sep 12 2001 Satoshi MACHINO <machino@vinelinux.org> 0.84-0vl0.3
- updated emacs-beta(emacs-21.0.104)

* Sun May 20 2001 Satoshi MACHINO <machino@vinelinux.org> 0.84-0vl0.2
- updated emacs-beta(emacs-21.0.103)

* Fri Apr 20 2001 Satoshi MACHINO <machino@vinelinux.org> 0.84-0vl0.1
- updated Mule-USC-0.84

* Mon Jan 22 2001 Satoshi MACHINO <machino@vinelinux.org> 0.83-0vl2.1
- updated emacs-21.0.95.2

* Tue Dec 19 2000 Satoshi MACHINO <machino@vinelinux.org> 0.83-0vl2
- updated emacs-21.0.93.2

* Fri Dec 15 2000 Satoshi MACHINO <machino@vinelinux.org> 0.83-0vl1
- updates
- used rpmmacro

* Mon Jul 03 2000 MACHINO, Satoshi <mac@netfort.gr.jp>
- 0.81-0vl1
- updated Mule-UCS-0.81

* Mon Jun 19 2000 MACHINO, Satoshi <mac@netfort.gr.jp>
- 0.80-0vl2
- added elisp files (jisx0213 big5conv)

* Thu Jun 15 2000 MACHINO, Satoshi <mac@netfort.gr.jp>
- 0.80-0vl1

* Tue Apr 25 2000 MACHINO, Satoshi <mac@netfort.gr.jp>
- 0.74-1vl3
- for emacs-20.6

* Thu Apr 06 2000 MACHINO, Satoshi <mac@netfort.gr.jp>
- 0.74-1vl2
- changed mucs-comp.el (mule-usc.vine.patch)

* Mon Apr 03 2000 MACHINO, Satoshi <mac@netfort.gr.jp>
- 0.74-1vl1

* Mon Feb 28 2000 MACHINO, Satoshi <mac@netfort.gr.jp>
- 0.72-1vl1
- added %description -l ja

* Tue Feb 15 2000 MACHINO, Satoshi <mac@netfort.gr.jp>
- 0.63-1vl1
- rebuild for Vine Linux

* Thu Dec 30 1999 SAKA Toshihide <saka@yugen.org>
- First release.
