]> git.pld-linux.org Git - packages/dspam.git/blobdiff - dspam.spec
- bcond works (mysql40)
[packages/dspam.git] / dspam.spec
index d1caef89b975a6623bd208d76cb8a9894ee94049..13b7b59846209b28303dac9415a0622ce18a7eac 100644 (file)
@@ -1,30 +1,40 @@
-# TODO: everything
+#
+# TODO:
+# - support for libdclassify
+# - oracle driver
+# - messages from default install of cron with mysql driver
+# Memory fault
 #
 # Conditional build:
-%bcond_with    mysql   # enable MySQL storage driver (disable sqlite driver)
-%bcond_with    pgsql   # enable PostgreSQL storage driver (disable sqlite driver)
+%bcond_without mysql   # disable MySQL storage driver
+%bcond_without pgsql   # disable PostgreSQL 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.2.8
-Release:       0.1
+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: e2cf80ef0a10ff8c123cb4fda5f2411d
-Patch0:                %{name}-Makefile.patch
+# Source0-md5: db1aedb9677e6bf5c7a47a72d4f130e5
+Source1:       %{name}.init
 URL:           http://www.nuclearelephant.com/projects/dspam/
-%if %{with mysql}
-BuildRequires: mysql-devel
-%else 
-%if %{with pgsql}
-BuildRequires: postgresql-devel
-%else
-BuildRequires: sqlite-devel
-%endif
-%endif
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: libtool
+BuildRequires: clamav-devel
+%{?with_db:BuildRequires:      db-devel}
+%{?with_mysql:BuildRequires:   mysql-devel}
+BuildRequires: openldap-devel
+%{?with_pgsql:BuildRequires:   postgresql-devel}
 BuildRequires: sed >= 4.0
+%{?with_sqlite:BuildRequires:  sqlite3-devel}
+BuildRequires: zlib-devel
 Buildroot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -65,10 +75,25 @@ DSPAM dzia
 z ka¿dym innym MTA obs³uguj±cym zewnêtrznego agenta MDA (postfiksem,
 qmailem itd.).
 
+%package client
+Summary:       dspam client
+Summary(pl):   Klient dspam
+Group:         Applications/Mail
+# to get the same dspam.conf when both installed
+Conflicts:     dspam > %{version}-%{release}
+Conflicts:     dspam < %{version}-%{release}
+
+%description client
+dspam client.
+
+%description client -l pl
+Klient dspam.
+
 %package libs
 Summary:       A library for Bayesian spam filtering
 Summary(pl):   Biblioteka do bayesowskiego filtrowania spamu
 Group:         Libraries
+Requires:      %{name}-driver = %{version}-%{release}
 
 %description libs
 DSPAM (as in De-Spam) is an open-source project to create a new kind
@@ -119,46 +144,132 @@ Static DSPAM library.
 %description static -l pl
 Statyczna biblioteka DSPAM.
 
+%package driver-hash
+Summary:       HASH driver for DSPAM
+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
+HASH driver for DSPAM.
+
+%description driver-hash -l pl
+Sterownik HASH dla DSPAM-a.
+
+%package driver-db
+Summary:       DB driver for DSPAM
+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
+DB driver for DSPAM.
+
+%description driver-db -l pl
+Sterownik DB dla DSPAM-a.
+
+%package driver-mysql
+Summary:       MySQL driver for DSPAM
+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
+MySQL driver for DSPAM.
+
+%description driver-mysql -l pl
+Sterownik MySQL dla DSPAM-a.
+
+%package driver-pgsql
+Summary:       PostgreSQL driver for DSPAM
+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
+PostgreSQL driver for DSPAM.
+
+%description driver-pgsql -l pl
+Sterownik PostgreSQL dla DSPAM-a.
+
+%package driver-sqlite
+Summary:       SQLite driver for DSPAM
+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
+SQLite driver for DSPAM.
+
+%description driver-sqlite -l pl
+Sterownik SQLite dla DSPAM-a.
+
 %prep
 %setup -q
-%patch0 -p1
-sed -i -e 's#-static##g' tools/Makefile*
+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-bayesian-dobly \
-       --enable-chained-tokens \
-       --enable-experimental \
        --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-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 \
        --disable-dependency-tracking \
-%if %{with mysql}
+       --enable-ldap \
+       --enable-clamav \
+       --enable-preferences-extension \
+       --enable-long-usernames \
+       --enable-neural-networking \
        --enable-virtual-users \
-       --with-storage-driver=mysql_drv \
+       --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
+%if %{with mysql}
        --with-mysql-includes=%{_includedir}/mysql \
-       --with-mysql-libraries=%{_libdir}
-%else
+       --with-mysql-libraries=%{_libdir} \
+%endif
 %if %{with pgsql}
-       --enable-virtual-users \
-       --with-storage-driver=pgsql_drv \
        --with-pgsql-includes=%{_includedir}/postgresql \
-       --with-pgsql-libraries=%{_libdir}
-%else
-       --with-storage-driver=sqlite_drv \
-       --with-sqlite-includes=%{_includedir} \
-       --with-sqlite-libraries=%{_libdir}
+       --with-pgsql-libraries=%{_libdir} \
 %endif
+%if %{with sqlite}
+       --with-sqlite3-includes=%{_includedir} \
+       --with-sqlite3-libraries=%{_libdir} \
 %endif
+       --enable-daemon
+
+# --enable-dclassify-extension needs libdclassify
+
 %{__make}
 
 %install
@@ -167,12 +278,12 @@ rm -rf $RPM_BUILD_ROOT
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
 
+install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
+
 # 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/etc/cron.daily
@@ -187,14 +298,12 @@ chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
 
 # fix prefix
 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
+sed -i -e "s|%{_prefix}/local|%{_prefix}|g" webui/cgi-bin/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
@@ -213,8 +322,6 @@ 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
@@ -232,36 +339,63 @@ DATABASE
 EOF
 %endif
 
+%post
+/sbin/chkconfig --add dspam
+if [ -f /var/lock/subsys/dspam ]; then
+       /etc/rc.d/init.d/dspam restart 1>&2
+else
+       echo "Run \"/etc/rc.d/init.d/dspam start\" to start dspam daemon."
+fi
+
+%preun
+if [ "$1" = "0" ]; then
+       if [ -f /var/lock/subsys/dspam ]; then
+               /etc/rc.d/init.d/dspam stop 1>&2
+       fi
+       /sbin/chkconfig --del dspam
+fi
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %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 README.courier README.pop3filter README.qmail README.exim README.postfix README.sendmail
-%doc cgi/base.css cgi/dspam.cgi
-%if %{with mysql}
-%doc README.mysql
-%doc tools.mysql_drv/mysql_objects-space.sql
-%doc tools.mysql_drv/mysql_objects-speed.sql
-%doc tools.mysql_drv/purge.sql
-%doc tools.mysql_drv/virtual_users.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
-%endif
-%config(noreplace) %verify(not size mtime md5) /etc/dspam.conf
-%dir %attr(0750,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}
+%doc README CHANGELOG RELEASE.NOTES UPGRADING
+%doc webui/*/*.{cgi,prefs,txt} webui/*/*.txt webui/*/templates/*.html
+%doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
+%dir %attr(750,root,mail) /var/lib/%{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}_logrotate
 %attr(755,root,root) %{_bindir}/%{name}_clean
 %attr(755,root,root) %{_bindir}/%{name}_corpus
 %attr(755,root,root) %{_bindir}/%{name}_crc
@@ -270,21 +404,67 @@ rm -rf $RPM_BUILD_ROOT
 %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
+%{_mandir}/man?/%{name}*
+
+%if %{with daemon}
+%attr(754,root,root) /etc/rc.d/init.d/dspam
+%files client
+%defattr(644,root,root,755)
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
+%endif
+%attr(755,root,mail) %{_bindir}/%{name}c
 
 %files libs
 %defattr(644,root,root,755)
 %doc README CHANGELOG
 %attr(755,root,root) %{_libdir}/lib*.so.*.*.*
+%attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
 
 %files devel
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/lib*.so
+%attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
 %{_libdir}/lib*.la
 %{_includedir}/%{name}
+%{_mandir}/man3/libdspam*
 %{_pkgconfigdir}/*.pc
 
 %files static
 %defattr(644,root,root,755)
 %{_libdir}/lib*.a
+
+%files driver-hash
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/css*
+%attr(755,root,root) %{_libdir}/libhash_drv*.so*
+
+%if %{with db}
+%files driver-db
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libdb4_drv*.so*
+%endif
+
+%if %{with mysql}
+%files driver-mysql
+%defattr(644,root,root,755)
+%doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
+%attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
+%attr(755,root,root) %{_libdir}/libmysql_drv*.so*
+%endif
+
+%if %{with pgsql}
+%files driver-pgsql
+%defattr(644,root,root,755)
+%doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
+%attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
+%attr(755,root,root) %{_bindir}/%{name}_pg2int8
+%attr(755,root,root) %{_libdir}/libpgsql_drv*.so*
+%endif
+
+%if %{with sqlite}
+%files driver-sqlite
+%defattr(644,root,root,755)
+%doc doc/sqlite_drv.txt
+%attr(755,root,root) %{_libdir}/libsqlite_drv*.so*
+%endif
This page took 0.07089 seconds and 4 git commands to generate.