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

Name:          scim-bridge-el
Version:       0.7.4
Release:       1%{?_dist_release}
Source0:       http://www11.atwiki.jp/s-irie/pub/emacs/scim-bridge/scim-bridge.el-%{version}.tar.gz
Source1:       %{name}-install.sh
Source2:       %{name}-remove.sh
Source3:       %{name}-init.el
Source4:       vine-default-%{name}.el

## http://www11.atwiki.jp/s-irie/pages/12.html をテキスト選択して保存したもの
Source10:      12.txt

License:       GPLv2+
URL:           http://www11.atwiki.jp/s-irie/pages/12.html
Group:         Applications/Editors/Emacs
BuildRoot:     %{_tmppath}/%{name}-%{version}-root
Summary:       SCIM-Bridge client for GNU Emacs
Summary(ja):   GNU EmacsのSCIM-Bridgeクライアント
BuildArch:     noarch

PreReq:        emacsen
%prereq_ge     emacsen-common
BuildRequires: emacsen-common

Distribution:  Vine Linux
Vendor:        Project Vine
Packager:      munepi

%description
The Smart Common Input Method platform (SCIM) is an input
method (IM) platform containing support for more than thirty
languages (CJK and many European languages) for POSIX-style
operating systems including Linux and BSD.

This program is SCIM-Bridge client for GNU Emacs. It is, however,
not part of official SCIM-Bridge.


%description -l ja
The Smart Common Input Method platform (SCIM) は、
Linux や BSD を含むPOSIX-styleオペレーティングシステムに対する
30より多くの言語（CJK や多くのヨーロッパ系言語）をサポートしている
インプットメソッド（IM）プラットフォームです。

このプログラムは、GNU Emacs の SCIM-Bridge クライアントです。
しかしながら、公式な SCIM-Bridge の一部ではありません。


%prep
%setup -q -n scim-bridge.el-%{version}
%__cp %{SOURCE10} .

%build


%install

[ "${RPM_BUILD_ROOT}" != "/" ] && %__rm -rf ${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


#
# install el files
#

%__cp -a scim-bridge.el ${RPM_BUILD_ROOT}/%{_datadir}/emacs/site-lisp/%{name}
%__cp -ra localization ${RPM_BUILD_ROOT}/%{_datadir}/emacs/site-lisp/%{name}
%__cp -a %{SOURCE3} %{SOURCE4} \
    ${RPM_BUILD_ROOT}/%{_datadir}/emacs/site-lisp/%{name}/

# remove unpackaged files
%__rm -rf ${RPM_BUILD_ROOT}/%{_datadir}/emacs/site-lisp/%{name}/l10n-dev


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

%_installemacsenscript %{name} %{SOURCE1}

%_removeemacsenscript  %{name} %{SOURCE2}


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


%post
#
# bytecompile and install
#

if [ "$1" = 2 ] ; then

%_emacsenPackageRemove %{name}

fi

%_addemacsenlist %{name}

%_emacsenPackageInstall %{name}


%preun

if [ "$1" = 0 ]; then

%_emacsenPackageRemove %{name}

%_removeemacsenlist %{name}

fi


%files
%defattr(-,root,root)
%doc 12.txt
%{_datadir}/emacs/site-lisp/%{name}/
%{emacsen_pkgdir}/install/%{name}
%{emacsen_pkgdir}/remove/%{name}


%changelog 
* Fri Jan 08 2010 Munehiro Yamamoto <munepi@vinelinux.org> 0.7.4-1
- initial build
