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

Summary:      IRC Client for emacsen
Summary(ja):  emacsen 用のIRCクライアント

Name:         irchat-pj
Version:      2.4.24.20
Release:      0vl2
Source0:      http://irc.fan.gr.jp/pj/%{name}-%{version}.tar.bz2
Source1:      %{name}-install.sh
Source2:      %{name}-remove.sh

Copyright:    GPL
Group:        Applications/Internet
BuildRoot:    %{_tmppath}/%{name}-%{version}-root

PreReq:       emacsen
BuildPreReq:  emacsen-common
%prereq_ge    emacsen-common
Obsoletes:    irchat
Obsoletes:    irchat-pj-xemacs

Vendor:       Project Vine
Distribution: Vine Linux
Packager:     MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>


%description
irchat-pj package includes Japanse IRC Client.

%description -l ja
irchat-pj パッケージは、より完璧に日本を扱うために, 
irchat-jp を改造した IRC クライアント irchat-pj を含みます。


%prep
%setup


%build

make dcc


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

mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/%{name}
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/emacsen-common/packages/install
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/emacsen-common/packages/remove

#
# install dcc binary
#

make EMACS=emacs \
   DCCDIR=${RPM_BUILD_ROOT}%{_bindir} install-dcc

#
# install el files
#

cp -a Makefile *.el contrib ${RPM_BUILD_ROOT}%{_datadir}/emacs/site-lisp/%{name}


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

%_installemacsenscript %{name} %{SOURCE1}

%_removeemacsenscript  %{name} %{SOURCE2}


%post

#
# byte-compile and install
#

if [ "$1" = 2 ] ; then

%_emacsenPackageRemove %{name}

fi

%_addemacsenlist %{name}

%_emacsenPackageInstall %{name}


%preun

if [ "$1" = 0 ] ; then

%_emacsenPackageRemove %{name}

%_removeemacsenlist %{name}

fi


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


%files
%defattr(-,root,root)
%doc doc contrib
%{_bindir}/dcc
%{_datadir}/emacs/site-lisp/%{name}
%{_libdir}/emacsen-common/packages/install/%{name}
%{_libdir}/emacsen-common/packages/remove/%{name}


%changelog
* Mon Dec 31 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.4.24.20-0vl2
- added missing BuildPreReqs/PreReqs

* Sat Dec 29 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.4.24.20-0vl1
- updated to newest 2.4.24.20 stable release
- now emacsen-common aware

* Thu Jan 24 2001 Tomoya TAKA <tomoya@olive.plala.or.jp> 2.4.24.07-4
- a small fix in the spec file

* Sun Jan  9 2000 Jun Nishii <jun@vinelinux.org>
[2.4.24.07-3]
- added %defattr
- change release to 0vl1

* Fri Jan  7 2000 Jun Nishii <jun@vinelinux.org>
[2.4.24.07-2]
- change group
- strip bin

* Tue Sep 7 1999 Norihito Ohmori <ohmori@flatout.org>
- modified irchat-pj-2.4.24.7 for emacs

* Mon Aug 31 1999 Yasushi karino <kari-p@bk.iij4u.or.jp>
 - irchat-pj-xemacs-2.4.24.8-3
 - It changed to XEmacs21.1.6 correspondence.

* Tue Aug 10 1999 Yasushi Karino <kari-p@bk.iij4u.or.jp>
 - ircaht-pj-2.4.24.08pl1-xemacs-2
 - Changed DCCDIR from /usr/local/bin to /usr/bin
 - Added '%changelog' tag.

* Sun Aug 8 1999 Yasushi Karino <kari-p@bk.iij4u.or.jp>
 - ircaht-pj-2.4.24.08pl1-xemacs-1
 - Applied patch 'irchat-pj-2.4.24.08pl1.diff.gz'
 - first Release
