# TODO: everything
#
# Conditional build:
-%bcond_with mysql # enable MySQL storage driver (disable db4 driver)
-%bcond_with pgsql # enable PostgreSQL storage driver (disable db4 driver)
+%bcond_with mysql # enable MySQL storage driver (disable sqlite driver)
+%bcond_with pgsql # enable PostgreSQL storage driver (disable sqlite driver)
+%bcond_with sqlite3 # enable SQLite3 storage driver (disable sqlite2 driver)
#
Summary: A library and Mail Delivery Agent for Bayesian spam filtering
Summary(pl): Biblioteka i MDA do bayesowskiego filtrowania spamu
Name: dspam
-Version: 3.2.6
-Release: 0.1
+Version: 3.4.3
+Release: 0.2
License: GPL
Group: Applications/Mail
Source0: http://www.nuclearelephant.com/projects/dspam/sources/%{name}-%{version}.tar.gz
-# Source0-md5: aad53b4542076840e2a0e1fd43e48ebb
-Patch0: %{name}-Makefile.patch
+# Source0-md5: befcaee35a69efe559471367b2249ea3
URL: http://www.nuclearelephant.com/projects/dspam/
%if %{with mysql}
BuildRequires: mysql-devel
-%else
+%else
%if %{with pgsql}
BuildRequires: postgresql-devel
%else
+%if %{with sqlite3}
+BuildRequires: sqlite3-devel
+%else
BuildRequires: sqlite-devel
+BuildRequires: sqlite-static
+%endif
%endif
%endif
+BuildRequires: sed >= 4.0
Buildroot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
%prep
%setup -q
-%patch0 -p1
-sed -i -e 's#-static##g' tools/Makefile*
+sed -i -e 's#-static##g' src/tools/Makefile*
%build
%configure \
--enable-bias \
--enable-large-scale \
--enable-delivery-to-stdout \
- --enable-virtual-users \
--with-userdir=/var/lib/%{name} \
--with-dspam-home=/var/lib/%{name} \
--with-userdir-owner=none \
--with-storage-driver=pgsql_drv \
--with-pgsql-includes=%{_includedir}/postgresql \
--with-pgsql-libraries=%{_libdir}
+%else
+%if %{with sqlite3}
+ --with-storage-driver=sqlite3_drv \
+ --with-sqlite3-includes=%{_includedir} \
+ --with-sqlite3-libraries=%{_libdir}
%else
--with-storage-driver=sqlite_drv \
--with-sqlite-includes=%{_includedir} \
--with-sqlite-libraries=%{_libdir}
%endif
%endif
+%endif
%{__make}
%install
# install devel files
install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/lib/%{name}}
-install -m0644 libdspam.h $RPM_BUILD_ROOT%{_includedir}/%{name}
-install -m0644 libdspam_objects.h $RPM_BUILD_ROOT%{_includedir}/%{name}
-install -m0644 lht.h $RPM_BUILD_ROOT%{_includedir}/%{name}
-install -m0644 nodetree.h $RPM_BUILD_ROOT%{_includedir}/%{name}
+install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
# provide maintenance scripts
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly
+install -d $RPM_BUILD_ROOT/etc/cron.daily
+install -d $RPM_BUILD_ROOT/etc/cron.weekly
-cat > $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name} <<EOF
+cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
#!/bin/sh
exec %{_bindir}/%{name}_clean -s -p
EOF
chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
# fix prefix
-perl -pi -e "s|%{_prefix}/local|%{_prefix}|g" $RPM_BUILD_ROOT%{_bindir}/%{name}_corpus
-perl -pi -e "s|%{_prefix}/local|%{_prefix}|g" cgi/dspam.cgi
+sed -i -e "s|%{_prefix}/local|%{_prefix}|g" $RPM_BUILD_ROOT%{_bindir}/%{name}_corpus
+sed -i -e "s|%{_prefix}/local|%{_prefix}|g" cgi/dspam.cgi
# fix purge stuff
-#install -m0755 dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
+#install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
%if %{with mysql}
-cp tools.mysql_drv/README README.mysql
-
# fix missing file
install -d $RPM_BUILD_ROOT/var/lib/%{name}
cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
%endif
%if %{with pgsql}
-cp tools.pgsql_drv/README README.pgsql
-
# fix missing file
install -d $RPM_BUILD_ROOT/var/lib/%{name}
cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
%files
%defattr(644,root,root,755)
-%doc README CHANGELOG RELEASE.NOTES
+%doc README CHANGELOG RELEASE.NOTES UPGRADING
%doc cgi/base.css cgi/dspam.cgi
%if %{with mysql}
-%doc README.mysql
-%doc tools.mysql_drv/mysql_objects.sql.space.optimized
-%doc tools.mysql_drv/mysql_objects.sql.speed.optimized
-%doc tools.mysql_drv/purge.sql
-%doc tools.mysql_drv/virtual_users.sql
+%doc doc/mysql_drv.txt
+%doc src/tools.mysql_drv/*.sql
%endif
%if %{with pgsql}
-%doc README.pgsql
-%doc tools.pgsql_drv/virtual_users.sql
-%doc tools.pgsql_drv/pgsql_objects.sql
-%doc tools.pgsql_drv/purge.sql
+%doc doc/pgsql_drv.txt
+%doc src/tools.pgsql_drv/*.sql
+%endif
+%if %{!with mysql} && %{!with pgsql}
+%doc doc/sqlite_drv.txt
%endif
-%config(noreplace) %verify(not size mtime md5) /etc/dspam.conf
-%dir %attr(0750,root,mail) /var/lib/%{name}
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
+%dir %attr(750,root,mail) /var/lib/%{name}
%{?with_mysql:%attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data}
%{?with_pgsql:%attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data}
-%attr(755,root,root) %config(noreplace) %{_sysconfdir}/cron.daily/%{name}
+%attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
%attr(755,root,mail) %{_bindir}/%{name}
-%attr(755,root,root) %{_bindir}/%{name}_admin
+%attr(755,root,mail) %{_bindir}/%{name}c
+%attr(755,root,mail) %{_bindir}/%{name}_logrotate
%attr(755,root,root) %{_bindir}/%{name}_clean
%attr(755,root,root) %{_bindir}/%{name}_corpus
%attr(755,root,root) %{_bindir}/%{name}_crc
%attr(755,root,root) %{_bindir}/%{name}_stats
%attr(755,root,root) %{_bindir}/%{name}_merge
%attr(755,root,root) %{_bindir}/%{name}_2sql
-%attr(755,root,root) %{_bindir}/%{name}_stats
-%{_mandir}/man?/*
+%attr(755,root,root) %{_bindir}/%{name}_admin
+%{?with_pgsql:%attr(755,root,root) %{_bindir}/%{name}_pg2int8}
+%{_mandir}/man?/%{name}*
%files libs
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/lib*.so
%{_libdir}/lib*.la
%{_includedir}/%{name}
+%{_mandir}/man3/libdspam*
%{_pkgconfigdir}/*.pc
%files static