Name:		bogofilter
Summary:	fast anti-spam filtering by Bayesian statistical analysis
Summary(ja):	ベイジアン解析による高速アンチスパムフィルタリング
Version:	1.2.4
Release:	1%{?_dist_release}
License:	GPLv2
Group:		Applications/Internet
URL:		http://bogofilter.sourceforge.net/
Source0:	http://prdownloads.sourceforge.net/bogofilter/bogofilter-%{version}.tar.bz2
Source999:	filter-requires-bogofilter.sh
Patch10:	http://www.c-wind.com/bogofilter/bogofilter-%{version}+mecab-0.1.patch.gz

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	libdb-devel
BuildRequires:  mecab-devel
BuildRequires:  gsl-devel
BuildRequires:  flex
BuildRequires:  xmlto

%define __find_requires %{SOURCE999}

%description
Bogofilter is a Bayesian spam filter.  In its normal mode of
operation, it takes an email message or other text on standard input,
does a statistical check against lists of "good" and "bad" words, and
returns a status code indicating whether or not the message is spam.
Bogofilter is designed with fast algorithms (including Berkeley DB system),
coded directly in C, and tuned for speed, so it can be used for production
by sites that process a lot of mail.

%prep
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}

%setup -q
%patch10 -p1 -b .mecab

%build
export CFLAGS="$RPM_OPT_FLAGS -DWAKATI"
export LIBS="`mecab-config --libs`"
%configure --program-prefix=
%__make

%install
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}
make install DESTDIR=$RPM_BUILD_ROOT

%__cp -p %{buildroot}%{_sysconfdir}/bogofilter.cf.example \
	%{buildroot}%{_sysconfdir}/bogofilter.cf

for n in xml html ; do
	%__install -d -m755 .inst/$n
	%__install -p -m644 doc/*.$n .inst/$n
done

#for d in contrib ; do
#	%__install -d -m755 %{buildroot}%{_datadir}/%{name}/$d
#	for f in $(%{_bindir}/find $d -maxdepth 1 -type f) ; do
#		case $f in
#			*.c|*.o|*.obj|*/Makefile*)
#				continue
#				;;
#			*.1)
#				%__cp -p $f %{buildroot}%{_mandir}/man1
#				;;
#			*)
#				%__cp -p $f %{buildroot}%{_datadir}/%{name}/$d
#				;;
#		esac
#	done
#done
%{__chmod} -x contrib/*

for README in contrib randomtrain ; do
	%__ln_s ../../%{name}/contrib/README.$README doc/README.$README
done

# drop executable bit from contrib/* to avoid unneeded dependencies
#%{_bindir}/find %{buildroot}%{_datadir}/%{name}/contrib -type f \
#	-exec %__chmod -x '{}' \;

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

%files
%defattr(-,root,root)
%doc AUTHORS COPYING INSTALL NEWS
%doc README* RELEASE.NOTES* TODO GETTING.STARTED
%doc doc/README* doc/bogofilter-SA* doc/integrating* doc/rpm.notes.BerkeleyDB
%doc doc/programmer
%doc .inst/html .inst/xml
%doc contrib

%{_sysconfdir}/bogofilter.cf.example
%config(noreplace) %{_sysconfdir}/bogofilter.cf

%{_bindir}/bogofilter
%{_bindir}/bogolexer
%{_bindir}/bogotune
%{_bindir}/bogoutil
%{_bindir}/bogoupgrade
%{_bindir}/bf_compact
%{_bindir}/bf_copy
%{_bindir}/bf_tar
%{_mandir}/man1/bogofilter.1*
%{_mandir}/man1/bogolexer.1*
%{_mandir}/man1/bogotune.1*
%{_mandir}/man1/bogoutil.1*
%{_mandir}/man1/bogoupgrade.1*
%{_mandir}/man1/bf_compact.1*
%{_mandir}/man1/bf_copy.1*
%{_mandir}/man1/bf_tar.1*

%changelog
* Thu Feb  5 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.2.4-1
- update to 1.2.4
- built with libdb 5.3.28
- BR: xmlto

* Thu Nov 29 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 1.2.3-1
- update to 1.2.3
- use mecab instead of kakasi
- BR: mecab-devel

* Thu May 05 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2.2-2
- rebuild with current VineSeed environment
- fix perl requirements

* Thu Dec 30 2010 Kazutaka HARADA <kazutaka@vinelinux.org> 1.2.2-1
- new upstream release
- update Patch10
- add Requires: kakasi (<BTS:VineLinux:852>)
- updates Source999: add filtering string

* Fri Sep 12 2008 Shu KONNO <owa@bg.wakwak.com> 1.0.2-1vl5
- applied new versioning policy, spec in utf-8

* Sun Aug  5 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.2-0vl5
- rebuild with gsl-1.9

* Thu May 10 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.2-0vl4
- rebuild with db4-4.3

* Wed Mar 15 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0.2-0vl3
- add filter-requires-bogofilter.sh (source999)

* Wed Mar 15 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0.2-0vl2
- rebuild

* Wed Mar 15 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0.2-0vl1
- new upstream release
- modified kakasi patch

* Mon Feb 27 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0.1-0vl2
- rebuild

* Mon Feb 27 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 1.0.1-0vl1
- new upstream release
- update kakasi patch
- remove unneeded macro %%mydocdir
- fix symlink
- add Japanese summary
- drop executable bit from contrib/*

* Tue Oct 11 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 0.96.2-0vl2
- rebuild

* Tue Oct 11 2005 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 0.96.2-0vl1
- new upstream release
- update and modify kakasi patch
- fix dependencies
  - add BuildRequires: kakasi-devel, gsl-devel, flex
  - add Requires: gsl
- update %%files
  - update %%doc
  - add %%{_bindir}/bf_{compact,copy,tar} and corresponding man pages

* Sun Nov  7 2004 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.92.6-0vl2
- rebuilt with db4-4.2.52

* Tue Sep 21 2004 Tomohiro 'Tomo-p' KATO <tomop@teamgedoh.net> 0.92.6-0vl1
- new upstream release.
- update kakasi patch.

* Sun May  2 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 0.17.5-0vl1
- new upstream release
- add kakasi patch (http://www.ono.org/software/bogofilter/)

* Sun Jun 15 2003 IWAI Masaharu <iwai@alib.jp> 0.13.6.2-0vl1
- upstream release
- using --program-prefix option with configure script
- update %%files section

* Fri May 16 2003 IWAI Masaharu <iwai@alib.jp> 0.12.3-0vl1
- first release for Vine Linux

