%define	_noVersionedDependencies	1

%define	origver		1.2.5
%define	origname	rail
%define emacsen_pkgdir /usr/lib/emacsen-common/packages

Name:         %{origname}
Version:      %{origver}
Release:      2%{?_dist_release}
Summary:      rail - Replace Agent-string Internal Library for emacsen
Summary(ja):  rail - emacsen 用 Agent 名変換ライブラリ

Source0:      ftp://ftp.fan.gr.jp/pub/elisp/rail/rail-%{version}.tar.bz2
Source1:      semi-1.14.6-VERSION
Source2:      flim-1.14.9-VERSION
Source10:     %{origname}-install.sh
Source11:     %{origname}-remove.sh
Source12:     %{origname}-init.el

License:      GPL
Group:        Applications/Editors/Emacs
BuildRoot:    %{_tmppath}/%{name}-%{version}-root
BuildArch:    noarch

Requires:     emacsen semi
Requires(post): emacsen emacsen-common semi
Obsoletes:    rail-xemacs
Conflicts:    %{origname}-el

Vendor:       Project Vine
Distribution: Vine Linux
Packager:     shaolin


%description
rail is a nifty elisp, that translates codenames with latin chars
of flim/semi/XEmacs/UTF-2000-Mule/Meadow to Japanese characters.
It also provides a function compatible with genjis.el (a part
of tm, that converts mule-version to Japanese characters).


%description -l ja
rail は，flim/semi/XEmacs/UTF-2000-Mule/Meadow のコードネームを
日本語化し，User-Agent: フィールドに適用するための elsp です．
tm の genjis.el 互換機能 (mule-version の日本語化) も備えています．


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

## install newer codename file for semi
cp %{SOURCE1} contrib/SEMI_VERSION
cp %{SOURCE2} contrib/FLIM_VERSION


%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
mkdir -p ${RPM_BUILD_ROOT}/%{emacsen_pkgdir}/install
mkdir -p ${RPM_BUILD_ROOT}/%{emacsen_pkgdir}/remove


## install el files

cp -a Makefile contrib *.el \
      ${RPM_BUILD_ROOT}/%{_datadir}/emacs/site-lisp/%{origname}

# 2004.12.13 add Irokawa
cp -a %{SOURCE12} \
      ${RPM_BUILD_ROOT}/%{_datadir}/emacs/site-lisp/%{origname}


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

%_installemacsenscript %{origname} %{SOURCE10}

%_removeemacsenscript  %{origname} %{SOURCE11}


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


%post

## bytecompile el and install elc

if [ "$1" = 2 ] ; then

%_emacsenPackageRemove %{origname}

fi

%_addemacsenlist %{origname}

%_emacsenPackageInstall %{origname}


%preun

if [ "$1" = 0 ] ; then

%_emacsenPackageRemove %{origname}

%_removeemacsenlist %{origname}

fi


%files
%defattr(-,root,root)
%doc 00README 00FAQ CHANGELOG contrib
%{_datadir}/emacs/site-lisp/%{origname}
#%{_libdir}/emacsen-common/packages/install/%{origname}
#%{_libdir}/emacsen-common/packages/remove/%{origname}
%{emacsen_pkgdir}/install/%{origname}
%{emacsen_pkgdir}/remove/%{origname}


%changelog
* Thu Apr 21 2011 IWAI, Masaharu <iwai@alib.jp> 1.2.5-2
- drop defining prereq_ge macro: using Requires(post) tag
- add Requires: emacsen semi
- update Packager syntax

* Sat Sep 06 2008 Shu KONNO <owa@bg.wakwak.com> 1.2.5-1vl5
- applied new versioning policy, spec in utf-8
- added macro %%emacsen_pkgdir

* Fri Dec  7 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.2.5-0vl12
- added %%{SOURCE2} for flim-1.14.9

* Wed Jan 10 2007 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 1.2.5-0vl11
- added %%{SOURCE2} for flim-1.14.8

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

* Mon Dec 13 2004 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 1.2.5-0vl9
- added %%{SOURCE2} for flim-1.14.7
- added %%{SOURCE12} for use /etc/$FLAVOR/site-start.d/

* Wed Dec 24 2003 MATSUBAYASHI <shaolin@vinelinux.org> 1.2.5-0vl8
- added %%{SOURCE1} and %%{SOURCE2} for flim-1.14.6 / semi-1.14.6

* Wed May 21 2003 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 1.2.5-0vl7
- Modded %%{SOURCE2} for flim-1.14.5

* Sat Dec 07 2002 MATSUBAYASHI <shaolin@vinelinux.org> 1.2.5-0vl6
- added %%{SOURCE1} for semi-1.14.5

* Mon Jun 03 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.2.5-0vl5
- added Source2 (for flim-1.14.4)

* Fri Dec 28 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.2.5-0vl4
- package name changed rail-el -> rail again

* Thu Dec 06 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.2.5-0vl3
- rail is now rail-el, thus emacsen-common aware :)

* Wed Jul 11 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 1.2.5-0vl2
- added %%{SOURCE1} for semi-1.14.3

* Tue Jan 23 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 1.2.5-0vl1
- updated to 1.2.5 release
- now rail-xemacs is a sub-package
- use better macros (%%{_tmppath})

* Tue Mar 28 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 1.2.4-0vl1
- updated in sync with 1.2.4 release

* Mon Nov 29 1999 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rins.st.ryukoku.ac.jp>
- 1.0.2-2
- Requires: apel, flim removed

* Tue Nov 16 1999 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rins.st.ryukoku.ac.jp>
- 1.0.2-1
- updated in sync wih 1.0.2 release

* Tue Oct 26 1999 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rins.st.ryukoku.ac.jp>
- 0.8-1
- updated in sync wih 0.8 release
- added newer FLIM_VERSION file for newest CLIME release

* Wed Oct 13 1999 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rins.st.ryukoku.ac.jp>
- 0.7-1
- updated in sync wih 0.7 release

* Mon Oct  4 1999 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rins.st.ryukoku.ac.jp>
- 0.6-1
- updated in sync wih 0.6 release

* Fri Oct  1 1999 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rins.st.ryukoku.ac.jp>
- 0.5-2
- added newer FLIM_VERSION file for newest CLIME release

* Wed Sep 29 1999 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rins.st.ryukoku.ac.jp>
- 0.5-1
- first rpm release
