%define origver  0.15
%define rel      1
%define svn_rev  8462

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

Summary:      Emacs interface to Hatena::Diary Writer
Summary(ja):  はてなダイアリーライターの Emacs インタフェース
Name:         %{origname}
Version:      %{origver}
Release:      %{rel}.svn%{svn_rev}%{?_dist_release}

Source0:      http://svn.coderepos.org/share/lang/elisp/simple-hatena-mode/trunk/simple-hatena-mode.el
Source1:      %{origname}-install.sh
Source2:      %{origname}-remove.sh
Source3:      vine-default-%{origname}.el
Source4:      %{origname}-init.el
Source5:      http://www.gnu.org/licenses/gpl-2.0.txt

License:      GPLv2+
Group:        Applications/Editors/Emacs
URL:          http://coderepos.org/share/wiki/SimpleHatenaMode
BuildRoot:    %{_tmppath}/%{name}-%{version}-root
BuildArch:    noarch

Requires:     emacsen
PreReq:       emacsen
%prereq_ge    emacsen-common

Requires:     hatena-diary-writer
Requires:     html-helper-mode

Distribution: Vine Linux
Vendor:       Project Vine
Packager:     iwaim

%description
Emacs interface to Hatena::Diary Writer

%description -l ja
はてなダイアリーライターの Emacs インタフェース

%prep

%setup -q -T -c %{origname}-%{origver}
%{__cp} -a %{SOURCE0} %{SOURCE5} .

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
[ "%{buildroot}" != "/" ] && mkdir -p %{buildroot}

mkdir -p %{buildroot}%{_datadir}/emacs/site-lisp/%{origname}/packages
mkdir -p %{buildroot}%{emacsen_pkgdir}/install
mkdir -p %{buildroot}%{emacsen_pkgdir}/remove

#
# install el files
#

%{__cp} -p *.el %{SOURCE3} %{SOURCE4} %{buildroot}%{_datadir}/emacs/site-lisp/%{origname}


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

%_installemacsenscript %{origname} %{SOURCE1}

%_removeemacsenscript  %{origname} %{SOURCE2}


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

%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


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


%changelog
* Wed Apr 07 2010 IWAI, Masaharu <iwai@alib.jp> 0.15-1.svn8462
- first release for Vine Linux
