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

%define pkgname wl
%define cvsdate 20111201

Summary:      IMAP-capable mail/news reader for emacsen (development version)
Summary(ja):  Emacsen 用 IMAP に対応したメール/ニュースリーダ（開発版）
Name:         wl-beta
Version:      2.15.9
Release:      4%{?cvsdate:.cvs%cvsdate}%{?_dist_release}
License:      GPLv2
Group:        Applications/Editors/Emacs
Source0:      %{pkgname}-%{version}%{?cvsdate:.cvs%cvsdate}.tar.xz
Source1:      %{name}-install.sh
Source2:      %{name}-remove.sh
Source3:      %{name}-init.el
Source4:      vine-default-%{name}.el
# Script used to create the %{pkgname}-%{version}.cvs%{cvsdate}.tar.xz 
# archive from Wanderlust CVS
Source10:     wl-snapshot.sh

Patch1:       wl-2.14.0-wl-news.patch

#Patch10:      wl-2.8.1-texi-ja.diff
Patch11:      wl-2.8.1-install-utils.diff

Patch50:      wl-2.15.9-wl-beta.patch

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

Requires(post): emacsen
%prereq_ge     emacsen-common
%prereq_ge     semi
%prereq_ge     w3m-el
BuildRequires: emacsen-common, semi, w3m-el

Vendor:       Project Vine
Distribution: Vine Linux
Packager:     munepi


%description
Wanderlust is a mail/news management system with IMAP4rev1 support for Emacs.
Overall impression resembles to Mew, but Wanderlust have nifty
features like IMAP support, threading display, and so on. 

This is a development version of Wanderlust. 

If you install both wl and wl-beta packages on your system, 
you may add the following configure in your emacs init file 
%if %{?_dist_release} == "vl5"
~/.emacs.el: 
%else
~/.emacs.d/emacsXX-vine-default.el (XX: emacs major version): 
%endif

;; I use wl-beta. 
(setq vine-default-wl nil)


%description -l ja
Wanderlust は、elisp のみで実装された IMAPrev1 対応の
メール/ニュースリーダです。
使用感は Mew に近く、加えてスレッド表示や未読管理などにも対応しています。

これは Wanderlust の開発バージョンです。

wl と wl-beta パッケージの両方をインストールする場合、
%if %{?_dist_release} == "vl5"
~/.emacs.el: 
%else
~/.emacs.d/emacsXX-vine-default.el (XX: emacs のメジャーバージョン)
%endif
に以下の設定を追加するとよいでしょう。

;; wl-beta を使う
(setq vine-default-wl nil)


%prep
%__rm -rf ${RPM_BUILD_DIR}/%{pkgname}-%{version}

%setup -q -n %{pkgname}-%{version}

%patch1 -p1

#%patch10 -p1
%patch11 -p1

%patch50 -p1 -b .vine

touch doc/*.texi


%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/%{name}/etc
%__mkdir_p ${RPM_BUILD_ROOT}%{emacsen_pkgdir}/install
%__mkdir_p ${RPM_BUILD_ROOT}%{emacsen_pkgdir}/remove
%__mkdir_p ${RPM_BUILD_ROOT}%{_infodir}


#
# install el files
# 

%__cp -a WL-* Makefile wl %{SOURCE3} %{SOURCE4} \
	${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/%{name}
%__cp -a utils elmo \
	${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/%{name}
%__cp -a etc/icons \
	${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/%{name}/etc/.
%__cp -a NEWS* \
	${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/%{name}


#
# build & install info
#

# %__make EMACS=emacs info
# %__make EMACS=emacs INFODIR=${RPM_BUILD_ROOT}%{_infodir} install-info


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

%_installemacsenscript %{name} %{SOURCE1} 

%_removeemacsenscript  %{name} %{SOURCE2}



%post 

#
# bytecompile and install 
#

if [ "$1" = 2 ]; then

%_emacsenPackageRemove %{name}

fi

%_addemacsenlist %{name}

%_emacsenPackageInstall %{name}


# /sbin/install-info %{_infodir}/wl-ja.info.gz %{_infodir}/dir \
# 	--section="Message User Agent"
# /sbin/install-info %{_infodir}/wl.info.gz %{_infodir}/dir \
# 	--section="Message User Agent"


%preun

if [ "$1" = 0 ]; then

%_emacsenPackageRemove %{name}

%_removeemacsenlist %{name}

# /sbin/install-info --delete %{_infodir}/wl-ja.info.gz %{_infodir}/dir \
# 	--section="Message User Agent"
# /sbin/install-info --delete %{_infodir}/wl.info.gz %{_infodir}/dir \
# 	--section="Message User Agent"
fi




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


%files
%defattr(-,root,root)
%doc BUGS* COPYING* ChangeLog*
%doc INSTALL* NEWS* README*
%doc doc etc samples tests
%{_datadir}/emacs/site-lisp/%{name}/
%{emacsen_pkgdir}/install/%{name}
%{emacsen_pkgdir}/remove/%{name}
#%{_infodir}/wl*.info*

 

%changelog
* Thu Dec  1 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2.15.9-3.cvs20111201
- source snapshot 20111201

* Tue May 24 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2.15.9-3.cvs20110524
- source snapshot 20110524

* Thu Apr 14 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2.15.9-2.cvs20110414
- source snapshot 20110414

* Sun Feb 20 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2.15.9-1.cvs20110220
- initial build based on wl-2.14.0-3vl6
