# TODO:
# - support for libdclassify
# - oracle driver
+# - messages from default install of cron with mysql driver
+# Memory fault
#
# Conditional build:
%bcond_without mysql # disable MySQL storage driver
%bcond_without sqlite # disable SQLite3 storage driver
%bcond_without db # disable BerkeleyDB storage driver
%bcond_without daemon # disable daemon mode
+%bcond_with mysql40 # use with mysql 4.0
#
Summary: A library and Mail Delivery Agent for Bayesian spam filtering
Summary(pl): Biblioteka i MDA do bayesowskiego filtrowania spamu
Name: dspam
-Version: 3.6.0
-Release: 0.3
+Version: 3.6.3
+Release: 0.4
License: GPL
Group: Applications/Mail
Source0: http://www.nuclearelephant.com/projects/dspam/sources/%{name}-%{version}.tar.gz
-# Source0-md5: d9ee63a8cf67ea933d711b00851ce916
+# Source0-md5: db1aedb9677e6bf5c7a47a72d4f130e5
Source1: %{name}.init
URL: http://www.nuclearelephant.com/projects/dspam/
BuildRequires: autoconf
%package driver-hash
Summary: HASH driver for DSPAM
-Summary(pl); Sterownik HASH dla DSPAM-a
+Summary(pl): Sterownik HASH dla DSPAM-a
Group: Libraries
Requires: %{name}-libs = %{version}-%{release}
+Requires(post): sed >= 4.0
Provides: %{name}-driver = %{version}-%{release}
%description driver-hash
%package driver-db
Summary: DB driver for DSPAM
-Summary(pl); Sterownik DB dla DSPAM-a
+Summary(pl): Sterownik DB dla DSPAM-a
Group: Libraries
Requires: %{name}-libs = %{version}-%{release}
+Requires(post): sed >= 4.0
Provides: %{name}-driver = %{version}-%{release}
%description driver-db
%package driver-mysql
Summary: MySQL driver for DSPAM
-Summary(pl); Sterownik MySQL dla DSPAM-a
+Summary(pl): Sterownik MySQL dla DSPAM-a
Group: Libraries
Requires: %{name}-libs = %{version}-%{release}
+Requires(post): sed >= 4.0
Provides: %{name}-driver = %{version}-%{release}
%description driver-mysql
%package driver-pgsql
Summary: PostgreSQL driver for DSPAM
-Summary(pl); Sterownik PostgreSQL dla DSPAM-a
+Summary(pl): Sterownik PostgreSQL dla DSPAM-a
Group: Libraries
Requires: %{name}-libs = %{version}-%{release}
+Requires(post): sed >= 4.0
Provides: %{name}-driver = %{version}-%{release}
%description driver-pgsql
%package driver-sqlite
Summary: SQLite driver for DSPAM
-Summary(pl); Sterownik SQLite dla DSPAM-a
+Summary(pl): Sterownik SQLite dla DSPAM-a
Group: Libraries
Requires: %{name}-libs = %{version}-%{release}
+Requires(post): sed >= 4.0
Provides: %{name}-driver = %{version}-%{release}
%description driver-sqlite
%prep
%setup -q
sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
+%{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
%build
%{__libtoolize}
%{__aclocal} -I m4
%{__autoconf}
%{__automake}
+
+DRIVERS="
+hash_drv
+%{?with_db:libdb4_drv}
+%{?with_mysql:mysql_drv}
+%{?with_pgsql:pgsql_drv}
+%{?with_sqlite:sqlite_drv}
+"
%configure \
%{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
--enable-trusted-user-security \
--enable-bias \
--enable-large-scale \
--with-userdir=/var/lib/%{name} \
- --with-dspam-home=/var/lib/%{name} \
--with-userdir-owner=none \
--with-userdir-group=none \
+ --with-dspam-home=/var/lib/%{name} \
+ --with-dspam-home-owner=none \
+ --with-dspam-home-group=none \
--with-dspam-owner=none \
--with-dspam-group=none \
--with-signature-life=14 \
--enable-preferences-extension \
--enable-long-usernames \
--enable-neural-networking \
- --enable-virtual-users \
- --with-storage-driver=hash_drv%{?with_db:,libdb4_drv}%{?with_mysql:,mysql_drv}%{?with_pgsql:,pgsql_drv}%{?with_sqlite:,sqlite_drv} \
+ --enable-virtual-users \
+ --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
%if %{with mysql}
--with-mysql-includes=%{_includedir}/mysql \
--with-mysql-libraries=%{_libdir} \
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
+%post driver-db
+if [ "$1" = "1" ]; then
+ sed -i -e '/^StorageDriver/s,/.*.so,%{_libdir}/libdb4_drv.so,' /etc/dspam.conf
+fi
+
+%post driver-hash
+if [ "$1" = "1" ]; then
+ sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
+fi
+
+%post driver-mysql
+if [ "$1" = "1" ]; then
+ sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
+fi
+
+%post driver-pgsql
+if [ "$1" = "1" ]; then
+ sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
+fi
+
+%post driver-sqlite
+if [ "$1" = "1" ]; then
+ sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite_drv.so,' /etc/dspam.conf
+fi
+
%files
%defattr(644,root,root,755)
%doc README CHANGELOG RELEASE.NOTES UPGRADING