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

## To build wl-2.14.0, we use emacs-23.X
%define __emacs %(rpm -q --queryformat "%%{name}-%%{version}" emacs | grep "emacs-23")


%define       origname      wl
%define       origver       2.14.0
# if the package is not prerelease, set %%{prever} to %{nil}
%define       prever        %{nill}
%define       emacsen_pkgdir /usr/lib/emacsen-common/packages

Summary:      IMAP-capable mail/news reader for emacsen
Summary(ja):  (X)Emacs 用IMAP に対応したメール/ニュースリーダ
Name:         %{origname}
Version:      %{origver}
Release:      4%{?_dist_release}

Source0:      ftp://ftp.gohome.org/%{origname}/stable/%{origname}-%{origver}.tar.gz
Source1:      %{origname}-install.sh
Source2:      %{origname}-remove.sh
Source3:      %{origname}-init.el
Source4:      vine-default-%{origname}.el

Patch1:       wl-2.14.0-wl-news.patch

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


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


Obsoletes:     wl-el, Wanderlust, Wanderlust-xemacs
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:     shaolin, munepi


%description
Wanderlust is a mail/news reader supporting IMAP for emacsen.
Overall impression resembles to Mew, but Wanderlust have nifty
features like IMAP support, threading display, and so on.

#(eigo wakannai)
#After installation, you must modify your ~/.emacs file to contain
#at least:
#
#    (load "mime-setup")
#
#    (autoload 'wl "wl" "Wanderlust t)
#    (autoload 'wl-draft "wl" "Write draft with Wanderlust." t)

Other detailed information can be available at:

  http://www.gohome.org/wl/index-e.html
  (sorry, much detailed info is currently available only in Japanese)


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. 
(setq vine-default-wl-beta nil)


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

主な特徴(Wanderlust web ページより抜粋)

  - elisp のみによる実装
  - IMAPrev1, NNTP, POP, MH 形式のサポート
  - Mew っぽい Folder Specification に基づくメッセージへの
    統一的アクセス
  - Mew っぽいキーバインドとマーク処理
  - インタラクティブなスレッド表示
  - 未読管理
  - 購読フォルダの一覧を表示するフォルダモード
  - メッセージキャッシュ、オフライン処理 (IMAP4)
  - MIME 対応 (by SEMI or tm)

#インストール後、~/.emacs に最低でも以下の記述を追加して下さい:
#
#    (load "mime-setup")
#
#    (autoload 'wl "wl" "Wanderlust t)
#    (autoload 'wl-draft "wl" "Write draft with Wanderlust." t)

# Emacs/XEmacs 起動時に以下の設定ファイルを読み込みます。
# M-x wl で起動します。

# /etc/emacs-??.?/site-start.d/55wl-init.el
# /etc/xemacs-??.?.??/site-start.d/55wl-init.el

アカウント毎の設定は、
%{_defaultdocdir}/%{name}-%{origver}/samples/ja/dot.wl
%{_defaultdocdir}/%{name}-%{origver}/samples/ja/dot.folders
%{_defaultdocdir}/%{name}-%{origver}/samples/ja/dot.addresses
をベースに、
~/.wl
~/.folders
~/.address
を作成下さい。


詳しくは、Wanderlust の web ページ

  http://www.gohome.org/wl/

を見て下さい。


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

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


%prep
## we use emacs-23.X to build wl-2.14.0
[ -z "%__emacs" ] && exit 1

%__rm -rf ${RPM_BUILD_DIR}/%{origname}-%{origver}
%setup -q -n %{origname}-%{origver}

%patch1 -p1

#%patch10 -p1
%patch11 -p1

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/%{origname}/etc
#%__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
%__mkdir_p ${RPM_BUILD_ROOT}%{_infodir}


#
# install el files
# 

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

# 2004.12.13 add Irokawa
%__cp -a NEWS* \
	${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/%{origname}



#
# build & install info
#

yes | %__sed -e "s/y/\n/g" | %__make EMACS=%__emacs info
%__make EMACS=%__emacs INFODIR=${RPM_BUILD_ROOT}%{_infodir} install-info


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

%_installemacsenscript %{origname} %{SOURCE1} 

%_removeemacsenscript  %{origname} %{SOURCE2}



%post 

#
# bytecompile and install 
#

if [ "$1" = 2 ]; then

%_emacsenPackageRemove %{origname}

fi

%_addemacsenlist %{origname}

%_emacsenPackageInstall %{origname}


/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 %{origname}

%_removeemacsenlist %{origname}

/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/%{origname}/
#%{_libdir}/emacsen-common/packages/install/%{origname}
#%{_libdir}/emacsen-common/packages/remove/%{origname}
%{emacsen_pkgdir}/install/%{origname}
%{emacsen_pkgdir}/remove/%{origname}

%{_infodir}/wl*.info*

 

%changelog
* Tue Feb 22 2011 Munehiro Yamamoto <munepi@vinelinux.org> 2.14.0-4
- defined %%__emacs
  - use emacs-23.X to build wl-2.14.0
- updated wl-init.el
  - output "Loading vine-default-wl ..." to the buffer *Messages*
- changed from PreReq: emacsen to Requires(post): emacsen

* Tue Apr 21 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 2.14.0-3
- fixed wl-init.el

* Sat Apr 11 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 2.14.0-2
- added vine-default-wl.el
- updated wl-install.sh for vine-default-wl.el

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

* Fri Dec  7 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.14.0-0vl5
- rebuild

* Wed Jan 10 2007 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 2.14.0-0vl4
- rebuild

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

* Fri Sep 30 2005 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.14.0-0vl2
- added Patch1 (wl-news.elc was not generated with emacs22)

* Fri Apr 15 2005 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.14.0-0vl1
- updated to new upstream release 2.14.0

* Sun Dec 26 2004 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 2.12.0-0vl1
- updated to new upstream release 2.12.1

* Mon Dec 13 2004 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 2.12.0-0vl0.pre
- updated to new release canditate 2.12.0pre

* Wed Dec 24 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.10.1-0vl2
- increased release number for the new flim/semi release

* Tue Jul  8 2003 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 2.10.1-0vl1
- updated to new upstream release 2.10.1

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

* Wed Dec 11 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.10.0-0vl1
- updated to new upstream release 2.10.0

* Sat Dec 07 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.10.0-0vl0.1
- updated to new release canditate 2.10.0pre4

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

* Fri Jan 11 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.8.1-0vl2
- added PreReq: w3m-el, for shimbun-guys will be happy :)

* Fri Dec 28 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.8.1-0vl1
- updated to new upstream release

* Thu Dec 27 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.6.1-0vl5
- modified wl-install.sh to put pixmaps in a proper place even with emacs21

* Sat Dec 15 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.6.1-0vl4
- modified wl-install.sh to put xemacs pixmaps in a proper place (AGAIN)

* Fri Dec 07 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.6.1-0vl3
- spec file cleaned-up too much now

* Thu Dec 06 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.6.1-0vl2
- modified wl-install.sh to put xemacs pixmaps in a proper place

* Thu Dec 06 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.6.1-0vl1
- updated to 2.6.1 stable release
- the changelog was incorrect. now merged from original Wanderlust spec file

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

* Wed Jul 11 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 2.6.0-0vl2
- added patch to fix recursive load problem
  (see wl:07309, wl:07812)

* Wed Jul 11 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 2.6.0-0vl1
- updated to 2.6.0 stable release

* Wed Feb 14 2001 MATSUBAYASHI 'Shaolin' Kohji
- 2.4.1-0vl1
- updated to 2.4.1 stable release
- merge emacs/xemacs package again into one source rpm :-)

* Fri Dec 01 2000 MATSUBAYASHI 'Shaolin' Kohji 
- 2.4.0-0vl1
- updated to 2.4.0 stable release

* Thu Nov 23 2000 MATSUBAYASHI 'Shaolin' Kohji 
- 2.4.0-0.3vl1
- updated to 2.4.0pre3 release canditate

* Wed Nov 15 2000 MATSUBAYASHI 'Shaolin' Kohji 
- 2.4.0-0.2vl1
- updated to 2.4.0pre2 release canditate

* Sun Nov 12 2000 MATSUBAYASHI 'Shaolin' Kohji 
- 2.4.0-0.1vl1
- updated to 2.4.0pre release canditate

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

* Wed May 10 2000 MATSUBAYASHI 'Shaolin' Kohji 
- 1.1.1-0vl2
- included a patch to fix Maildir-related problem
  (Thanks Teranishi-kun!)

* Wed May 10 2000 MATSUBAYASHI 'Shaolin' Kohji 
- 1.1.1-0vl1
- updated to 1.1.1 release

* Mon Mar 27 2000 MATSUBAYASHI 'Shaolin' Kohji 
- 1.1.0-1vl2
- added small patch by Mr. Yuuichi Teranishi himself :-)

* Fri Mar 24 2000 MATSUBAYASHI 'Shaolin' Kohji
- 1.1.0-1vl1
- updated to 1.1.0 release
- added a patch (see wl:04506)

* Thu Mar 09 2000 MATSUBAYASHI 'Shaolin' Kohji
- 1.1.0-0.3vl1
- updated to 1.1.0pre3 release canditate

* Fri Mar 03 2000 MATSUBAYASHI 'Shaolin' Kohji
- 1.1.0-0.1vl1, 1.1.0-0.1vl2
- updated to 1.1.0pre1 release canditate
- added patches (see wl:04218, wl:04281)

* Mon Feb 21 2000 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.18-1
- updated to 2.2.18 beta release

* Wed Jan 12 2000 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.15-1
- updated to 2.2.15 beta release
- included patches (see wl:03792, wl:03793)

* Sat Jan 08 2000 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.14-1
- updated to 2.2.14 beta release
- included patches (see wl:03746, wl:03751)

* Thu Jan 06 2000 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.13-2
- included patches (see wl:03604, wl:03709, wl:03713, wl:03722)
- fixed %install section to get wl be installed in proper directory

* Tue Dec 28 1999 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.13-1
- updated to 2.2.13 beta release
- now utils are also installed
- included a patch (see wl:03684)

* Tue Dec 21 1999 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.12-3
- included patches (see wl:03595, wl:03620, wl:03637, wl:03651)

* Tue Dec  7 1999 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.12-2
- updated to 2.2.12 beta release
- included paches (see wl:03357, wl:03564)

* Mon Dec  6 1999 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.11-1
- updated to 2.2.11 beta release
- included patches (see wl:03526, wl:03528)

* Sat Dec  4 1999 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.10-2
- included patches (see wl:03489, wl:03491)

* Fri Dec  3 1999 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.10-1
- udpated to 2.2.10 beta release
- included patches (see wl:03480, wl:03484)

* Mon Nov 29 1999 MATSUBAYASHI 'Shaolin' Kohji
- 2.2.8-1
- udpated to 2.2.8 beta release for semi-1.13.7
- included patches (see wl:03171, wl:03182)

* Sat Nov 27 1999 MATSUBAYASHI 'Shaolin' Kohji
- 1.0.3-4
- Obsolete: Wanderlust-mule added
- %post and %preun section modified

* Fri Oct 29 1999 MATSUBAYASHI 'Shaolin' Kohji
- 1.0.3-3
- %post and %preun section added for install-info

* Wed Sep 29 1999 MATSUBAYASHI 'Shaolin' Kohji
- 1.0.3-2
- package name changed from Wanderlust-emacs to Wanderlust

* Wed Sep 15 1999 MATSUBAYASHI 'Shaolin' Kohji
- 1.0.3-1
- first release for FSF Emacs 20.4

