%define _noVersionedDependencies        1
%define emacsen_pkgdir /usr/lib/emacsen-common/packages


%define       origver       1.14.9
%define       origname      flim

Summary:      Library to provide basic features about message for Emacsen
Summary(ja):  Emacsen 用の message に関する表現形式や符号化のためのライブラリです。
Name:         %{origname}
Version:      %{origver}
Release:      5%{?_dist_release}

License:      1993-1999 Free Software Foundation, Inc., Dan Rich, Morioka Tomohiko, Kobayashi Shuhei
Group:        Applications/Editors/Emacs
URL:	      http://git.chise.org/elisp/flim/

Source0:      http://git.chise.org/elisp/dist/flim/flim-1.14/%{name}-%{version}.tar.gz

Source1:      %{origname}-install.sh
Source2:      %{origname}-remove.sh
Source3:      %{origname}-init.el
Patch0:       FLIM-CFG.emacs.patch

BuildRoot:    %{_tmppath}/%{name}-%{version}-root
BuildArch:    noarch

Requires(post,preun): emacsen emacsen-common
Requires(post): apel
Requires:     apel
Obsoletes:    flim-el
Conflicts:    semi <= 1.14.5-0vl2

Vendor:       Project Vine
Distribution: Vine Linux
Packager:     shaolin


%description
FLIM is a library to provide basic features about message
representation or encoding.

Note: in order to rebuild this SRPM package, you need
emacsen, emacsen-common and apel installed.


%description -l ja
FLIM は Internet message に関する様々な表現形式や符号化に関する
基礎的な機能を提供するための汎用部品です.

注意:この SRPM パッケージを rebuild するには、emacsen と emacsen-common
及び apel がインストールされている必要があります.


%prep

rm -rf ${RPM_BUILD_DIR}/%{origname}-%{origver}

%setup  -q -n %{origname}-%{origver}

%patch0 -p1

iconv -f iso8859-1 -t utf8 -o ChangeLog.new ChangeLog
iconv -f iso2022jp -t utf8 -o README.ja.new README.ja
mv ChangeLog.new ChangeLog
mv README.ja.new README.ja


%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

#
# remove unnecessary file
#
## upstream is dropped in FLIM-ELS: see ChangeLog file 2002-11-15
%{__rm} -f mailcap.el

#
# install el files
# 

cp Makefile FLIM-* *.el %{SOURCE3} \
   ${RPM_BUILD_ROOT}/usr/share/emacs/site-lisp/%{origname}

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

%_installemacsenscript %{origname} %{SOURCE1} 

%_removeemacsenscript  %{origname} %{SOURCE2}

#
# install info file
# 

mkdir -p ${RPM_BUILD_ROOT}/usr/info


%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


%triggerpostun -- flim-el

%_emacsenPackageInstall %{origname}


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

rm -rf ${RPM_BUILD_DIR}/apel-%{apelver}


%files
%defattr(-,root,root)
%doc ChangeLog NEWS README* VERSION
/usr/share/emacs/site-lisp/%{origname}/
%{emacsen_pkgdir}/install/%{origname}
%{emacsen_pkgdir}/remove/%{origname}

 
%changelog
* Wed Apr 15 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.14.9-5
- rebuilt on current VineSeed
- added URL tag
- updated Source0

* Fri Apr 22 2011 IWAI, Masaharu <iwai@alib.jp> 1.14.9-4
- add Requires: apel
- add Requires(preun): emacsen emacsen-common: fix 1.14.9-3

* Thu Apr 21 2011 IWAI, Masaharu <iwai@alib.jp> 1.14.9-3
- drop defining prereq_ge macro
 - using Requires(post) tag

* Thu Mar  4 2010 IWAI, Masaharu <iwai@alib.jp> 1.14.9-2
- remove mailcap.el: <BTS:VineLinux:935>
- update Packager's syntax
- update description-{en,ja}

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

* Fri Dec  7 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.14.9-0vl1
- updated to 1.14.9

* Wed Jan 10 2007 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 1.14.8-0vl1
- updated in sync with 1.14.8 release

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

* Mon Dec 13 2004 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 1.14.7-0vl1
- updated in sync with 1.14.7 release

* Wed Dec 24 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.14.6-0vl1
- updated in sync with 1.14.6 release

* Mon Jun 09 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.14.5-0vl2
- increased release number for the new apel release

* Wed May 21 2003 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 1.14.5-0vl1
- updated in sync with 1.14.5 release

* Mon Jun 03 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.14.4-0vl1
- updated in sync with 1.14.4 release

* Fri Jan 11 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.14.3-0vl9
- Obsoletes: flim-el now, instead of Conflicts:
- added %%triggerpostun -- flim-el

* Fri Dec 28 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.14.3-0vl8
- package name changed flim-el -> flim again
- added Source3 for forthcoming site-start mechanism

* Sun Dec 23 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.14.3-0vl7
- modified Source1 to remove mel-b-ccl.el* if the flavor is xemacs-21.1.x
  (see http://lists.airs.net/wl/archive/200101/msg00077.html)

* Fri Nov  9 2001 Kazuhisa TAKEI <takei@vinelinux.org>
- change Patch0( fixed load-path)

* Mon Jul 23 2001 Kazuhisa TAKEI <takei@vinelinux.org>
- requires: emacsen-common -> prereq 

* Wed Jul 18 2001 Kazuhisa TAKEI <takei@vinelinux.org>
- emacsenize 

* Wed Jul 11 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 1.14.3-0vl2
- back to Requires: emacs = 20.7 -> emacs >= 20.7 (for emacs-beta)

* Wed Jul 11 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 1.14.3-0vl1
- updated to apel-10.3, flim-1.14.3, semi-1.14.3, emh-1.14.1

* Fri Aug 25 2000 MATSUBAYASHI 'Shaolin' Kohji
- 1.13.7-8
- added %define _noVersionedDependencies 1

* Fri Aug 25 2000 MATSUBAYASHI 'Shaolin' Kohji
- 1.13.7-7
- modified %files section to handle compressed man page(s)

* Wed May 10 2000 MATSUBAYASHI 'Shaolin' Kohji
- 1.13.7-6
- apel updated to 10.2

* Mon Jan 24 2000 MATSUBAYASHI 'Shaolin' Kohji
- 1.13.7-5
- added patch (see emacs-mime-ja: 00303) to format texinfo correctly

* Thu Dec 24 1999 MATSUBAYASHI 'Shaolin' Kohji
- 1.13.7-4
- updated in sync with apel-10.0 / clime-1.13.6 release

* Wed Dec  1 1999 MATSUBAYASHI 'Shaolin' Kohji
- 1.13.7-3
- change Group to Applications/Editors/EmacsLisp

* Mon Nov 29 1999 MATSUBAYASHI 'Shaolin' Kohji
- 1.13.7-2
- added patches (see emacs-mime-ja:00183, emacs-mime-ja:00184)
- now emh-1.10.1 and rmail-mime-1.13.0 are also included
- documentation files are properly stored under /usr/doc directory

* Wed Nov  3 1999 MATSUBAYASHI 'Shaolin' Kohji
- 1.13.7-1
- updated to apel-9.23 / clime-1.13.5 / semi-1.13.7 release
- added Japanese / English info files to be installed