]> git.pld-linux.org Git - packages/dspam.git/blob - dspam.spec
- more fixes
[packages/dspam.git] / dspam.spec
1 # TODO:
2 # - support for libdclassify
3 # - oracle driver
4 # - messages from default install of cron with mysql driver Memory fault
5 #
6 # Conditional build:
7 %bcond_without  mysql   # disable MySQL storage driver
8 %bcond_without  pgsql   # disable PostgreSQL storage driver
9 %bcond_without  sqlite  # disable SQLite3 storage driver
10 %bcond_without  db      # disable BerkeleyDB storage driver
11 %bcond_without  daemon  # disable daemon mode
12 %bcond_with     mysql40 # use with mysql 4.0
13 #
14 %include        /usr/lib/rpm/macros.perl
15 Summary:        A library and Mail Delivery Agent for Bayesian spam filtering
16 Summary(pl):    Biblioteka i MDA do bayesowskiego filtrowania spamu
17 Name:           dspam
18 Version:        3.6.5
19 Release:        0.14
20 License:        GPL
21 Group:          Applications/Mail
22 Source0:        http://www.nuclearelephant.com/projects/dspam/sources/%{name}-%{version}.tar.gz
23 # Source0-md5:  da4f0e00633bff49d71fde418caaf14b
24 Patch0:         %{name}-webui.patch
25 Source1:        %{name}.init
26 Source2:        %{name}-apache.conf
27 URL:            http://www.nuclearelephant.com/projects/dspam/
28 BuildRequires:  autoconf
29 BuildRequires:  automake
30 BuildRequires:  clamav-devel
31 %{?with_db:BuildRequires:       db-devel}
32 BuildRequires:  libtool
33 %{?with_mysql:BuildRequires:    mysql-devel}
34 BuildRequires:  openldap-devel
35 %{?with_pgsql:BuildRequires:    postgresql-devel}
36 BuildRequires:  rpm-perlprov >= 4.1-13
37 BuildRequires:  rpmbuild(macros) >= 1.268
38 BuildRequires:  sed >= 4.0
39 %{?with_sqlite:BuildRequires:   sqlite3-devel}
40 BuildRequires:  zlib-devel
41 Requires(post,preun):   /sbin/chkconfig
42 Requires:       rc-scripts
43 Buildroot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
44
45 %define         _webapps        /etc/webapps
46 %define         _webapp         %{name}
47
48 %description
49 DSPAM (as in De-Spam) is an open-source project to create a new kind
50 of anti-spam mechanism, and is currently effective as both a
51 server-side agent for UNIX email servers and a developer's library for
52 mail clients, other anti-spam tools, and similar projects requiring
53 drop-in spam filtering.
54
55 The DSPAM agent masquerades as the email server's local delivery agent
56 and filters/learns spams using an advanced Bayesian statistical
57 approach (based on Bayes's theorem of combined probabilities) which
58 provides an administratively maintenance-free, easy-learning Anti-Spam
59 service custom tailored to each individual user's behavior. Advanced
60 because on top of standard Bayesian filtering is also incorporated the
61 use of Chained Tokens, de-obfuscation, and other enhancements. DSPAM
62 works great with Sendmail and Exim, and should work well with any
63 other MTA that supports an external local delivery agent (postfix,
64 qmail, etc.)
65
66 %description -l pl
67 DSPAM (czyli De-Spam) to projekt o otwartych ¼ród³ach maj±cy na celu
68 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
69 efektywny zarówno jako dzia³aj±cy po stronie serwera agent dla
70 uniksowych serwerów pocztowych jak i biblioteka dla programistów
71 klientów pocztowych, innych narzêdzi antyspamowych i innych projektów
72 wymagaj±cych filtrowania spamu w locie.
73
74 Agent DSPAM zachowuje siê jak lokalny agent dostarczania poczty (MDA)
75 i filtruje/uczy siê spamu przy u¿yciu zaawansowanego bayesowskiego
76 przybli¿enia statystycznego (opartego na twierdzeniu Bayesa o
77 po³±czonych prawdopodobieñstwach), daj±c nie wymagaj±c± obs³ugi
78 administracyjnej, ³atwo ucz±c± siê us³ugê antyspamow± dostosowan± do
79 zachowania ka¿dego u¿ytkownika. Metoda jest zaawansowana poniewa¿ na
80 podstawie standardowego filtrowania bayesowskiego wprowadzono u¿ycie
81 tokenów ³añcuchowych, eliminowanie ukrywanie i inne rozszerzenia.
82 DSPAM dzia³a wspaniale z Sendmailem i Eximem, powinien dzia³aæ dobrze
83 z ka¿dym innym MTA obs³uguj±cym zewnêtrznego agenta MDA (postfiksem,
84 qmailem itd.).
85
86 %package client
87 Summary:        dspam client
88 Summary(pl):    Klient dspam
89 Group:          Applications/Mail
90 # to get the same dspam.conf when both installed
91 Conflicts:      dspam < %{version}-%{release}
92 Conflicts:      dspam > %{version}-%{release}
93
94 %description client
95 dspam client.
96
97 %description client -l pl
98 Klient dspam.
99
100 %package libs
101 Summary:        A library for Bayesian spam filtering
102 Summary(pl):    Biblioteka do bayesowskiego filtrowania spamu
103 Group:          Libraries
104 Requires:       %{name}-driver = %{version}-%{release}
105
106 %description libs
107 DSPAM (as in De-Spam) is an open-source project to create a new kind
108 of anti-spam mechanism, and is currently effective as both a
109 server-side agent for UNIX email servers and a developer's library for
110 mail clients, other anti-spam tools, and similar projects requiring
111 drop-in spam filtering.
112
113 This package contains the library.
114
115 %description libs -l pl
116 DSPAM (czyli De-Spam) to projekt o otwartych ¼ród³ach maj±cy na celu
117 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
118 efektywny zarówno jako dzia³aj±cy po stronie serwera agent dla
119 uniksowych serwerów pocztowych jak i biblioteka dla programistów
120 klientów pocztowych, innych narzêdzi antyspamowych i innych projektów
121 wymagaj±cych filtrowania spamu w locie.
122
123 Ten pakiet zawiera wspomnian± bibliotekê.
124
125 %package devel
126 Summary:        Header files for the DSPAM library
127 Summary(pl):    Pliki nag³ówkowe biblioteki DSPAM
128 Group:          Development/Libraries
129 Requires:       %{name}-libs = %{version}-%{release}
130
131 %description devel
132 DSPAM has had its core engine moved into a separate library, libdspam.
133 This library can be used by developers to provide 'drop-in' spam
134 filtering for their mail client applications, other anti-spam tools,
135 or similar projects.
136
137 %description devel -l pl
138 G³ówny silnik DSPAM zosta³ przeniesiony do oddzielnej biblioteki
139 libdspam, która mo¿e byæ u¿ywana przez programistów do zapewnienia
140 filtrowania spamu w locie dla aplikacji klientów pocztowych, innych
141 narzêdzi antyspamowych i podobnych projektów.
142
143 %package static
144 Summary:        Static DSPAM library
145 Summary(pl):    Statyczna biblioteka DSPAM
146 Group:          Development/Libraries
147 Requires:       %{name}-devel = %{version}-%{release}
148
149 %description static
150 Static DSPAM library.
151
152 %description static -l pl
153 Statyczna biblioteka DSPAM.
154
155 %package driver-hash
156 Summary:        HASH driver for DSPAM
157 Summary(pl):    Sterownik HASH dla DSPAM-a
158 Group:          Libraries
159 Requires(post): sed >= 4.0
160 Requires:       %{name}-libs = %{version}-%{release}
161 Provides:       %{name}-driver = %{version}-%{release}
162
163 %description driver-hash
164 HASH driver for DSPAM.
165
166 %description driver-hash -l pl
167 Sterownik HASH dla DSPAM-a.
168
169 %package driver-db
170 Summary:        DB driver for DSPAM
171 Summary(pl):    Sterownik DB dla DSPAM-a
172 Group:          Libraries
173 Requires(post): sed >= 4.0
174 Requires:       %{name}-libs = %{version}-%{release}
175 Provides:       %{name}-driver = %{version}-%{release}
176
177 %description driver-db
178 DB driver for DSPAM.
179
180 %description driver-db -l pl
181 Sterownik DB dla DSPAM-a.
182
183 %package driver-mysql
184 Summary:        MySQL driver for DSPAM
185 Summary(pl):    Sterownik MySQL dla DSPAM-a
186 Group:          Libraries
187 Requires(post): sed >= 4.0
188 Requires:       %{name}-libs = %{version}-%{release}
189 Provides:       %{name}-driver = %{version}-%{release}
190
191 %description driver-mysql
192 MySQL driver for DSPAM.
193
194 %description driver-mysql -l pl
195 Sterownik MySQL dla DSPAM-a.
196
197 %package driver-pgsql
198 Summary:        PostgreSQL driver for DSPAM
199 Summary(pl):    Sterownik PostgreSQL dla DSPAM-a
200 Group:          Libraries
201 Requires(post): sed >= 4.0
202 Requires:       %{name}-libs = %{version}-%{release}
203 Provides:       %{name}-driver = %{version}-%{release}
204
205 %description driver-pgsql
206 PostgreSQL driver for DSPAM.
207
208 %description driver-pgsql -l pl
209 Sterownik PostgreSQL dla DSPAM-a.
210
211 %package driver-sqlite
212 Summary:        SQLite driver for DSPAM
213 Summary(pl):    Sterownik SQLite dla DSPAM-a
214 Group:          Libraries
215 Requires(post): sed >= 4.0
216 Requires:       %{name}-libs = %{version}-%{release}
217 Provides:       %{name}-driver = %{version}-%{release}
218
219 %description driver-sqlite
220 SQLite driver for DSPAM.
221
222 %description driver-sqlite -l pl
223 Sterownik SQLite dla DSPAM-a.
224
225 %package webui
226 Summary:        Dspam Web UI
227 Group:          Applications/WWW
228 Requires:       webapps
229
230 %description webui
231 The Web UI (CGI client) can be run from any executable location on a
232 web server, and detects its user's identity from the REMOTE_USER
233 environment variable. This means you'll need to use HTTP password
234 authentication to access the CGI (Any type of authentication will
235 work, so long as Apache supports the module). This is also convenient
236 in that you can set up authentication using almost any existing system
237 you have. The only catch is that you'll need the usernames to match
238 the actual DSPAM usernames used the system. A copy of the shadow
239 password file will suffice for most common installs.
240
241 %prep
242 %setup -q
243 %patch0 -p1
244 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
245 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
246
247 %build
248 %{__libtoolize}
249 %{__aclocal} -I m4
250 %{__autoconf}
251 %{__automake}
252
253 DRIVERS="
254 hash_drv
255 %{?with_db:libdb4_drv}
256 %{?with_mysql:mysql_drv}
257 %{?with_pgsql:pgsql_drv}
258 %{?with_sqlite:sqlite_drv}
259 "
260 %configure \
261         %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
262         --enable-trusted-user-security \
263         --enable-bias \
264         --enable-large-scale \
265         --with-userdir=/var/lib/%{name} \
266         --with-userdir-owner=none \
267         --with-userdir-group=none \
268         --with-dspam-home=/var/lib/%{name} \
269         --with-dspam-home-owner=none \
270         --with-dspam-home-group=none \
271         --with-dspam-owner=none \
272         --with-dspam-group=none \
273         --with-signature-life=14 \
274         --disable-dependency-tracking \
275         --enable-ldap \
276         --enable-clamav \
277         --enable-preferences-extension \
278         --enable-long-usernames \
279         --enable-neural-networking \
280         --enable-virtual-users \
281         --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
282 %if %{with mysql}
283         --with-mysql-includes=%{_includedir}/mysql \
284         --with-mysql-libraries=%{_libdir} \
285 %endif
286 %if %{with pgsql}
287         --with-pgsql-includes=%{_includedir}/postgresql \
288         --with-pgsql-libraries=%{_libdir} \
289 %endif
290 %if %{with sqlite}
291         --with-sqlite3-includes=%{_includedir} \
292         --with-sqlite3-libraries=%{_libdir} \
293 %endif
294         --enable-daemon
295
296 # --enable-dclassify-extension needs libdclassify
297
298 %{__make}
299
300 %install
301 rm -rf $RPM_BUILD_ROOT
302
303 %{__make} install \
304         DESTDIR=$RPM_BUILD_ROOT
305
306 install -d $RPM_BUILD_ROOT/{var/run/dspam,/etc/{rc.d/init.d,sysconfig}}
307 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
308
309 #
310 ln -s /var/log/dspam $RPM_BUILD_ROOT/var/lib/%{name}/log
311
312 # install devel files
313 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
314 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
315
316 # provide maintenance scripts
317 install -d $RPM_BUILD_ROOT/etc/cron.daily
318 install -d $RPM_BUILD_ROOT/etc/cron.weekly
319
320 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
321 #!/bin/sh
322 exec %{_bindir}/%{name}_clean -s -p
323 EOF
324
325 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
326
327 # fix prefix
328 sed -i -e "s|%{_prefix}/local|%{_prefix}|g" $RPM_BUILD_ROOT%{_bindir}/%{name}_corpus
329
330 # fix purge stuff
331 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
332
333 %if %{with mysql}
334 # fix missing file
335 install -d $RPM_BUILD_ROOT/var/lib/%{name}
336 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
337 _UNCONFIGURED_
338
339 Note!
340
341 This file can only contain 5 lines with the following values:
342
343 HOSTNAME
344 PORT
345 USERNAME
346 PASSWORD
347 DATABASE
348 EOF
349 %endif
350
351 %if %{with pgsql}
352 # fix missing file
353 install -d $RPM_BUILD_ROOT/var/lib/%{name}
354 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
355 _UNCONFIGURED_
356
357 Note!
358
359 This file can only contain 5 lines with the following values:
360
361 HOSTNAME
362 PORT
363 USERNAME
364 PASSWORD
365 DATABASE
366 EOF
367 %endif
368
369 install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
370 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
371 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
372 touch $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/htpasswd
373
374 %post
375 /sbin/chkconfig --add dspam
376 %service dspam restart "dspam daemon"
377
378 %preun
379 if [ "$1" = "0" ]; then
380         %service dspam stop
381         /sbin/chkconfig --del dspam
382 fi
383
384 %clean
385 rm -rf $RPM_BUILD_ROOT
386
387 %post   libs -p /sbin/ldconfig
388 %postun libs -p /sbin/ldconfig
389
390 %post driver-db
391 if [ "$1" = "1" ]; then
392         sed -i -e '/^StorageDriver/s,/.*.so,%{_libdir}/libdb4_drv.so,' /etc/dspam.conf
393 fi
394
395 %post driver-hash
396 if [ "$1" = "1" ]; then
397         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
398 fi
399
400 %post driver-mysql
401 if [ "$1" = "1" ]; then
402         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
403 fi
404
405 %post driver-pgsql
406 if [ "$1" = "1" ]; then
407         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
408 fi
409
410 %post driver-sqlite
411 if [ "$1" = "1" ]; then
412         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite_drv.so,' /etc/dspam.conf
413 fi
414
415 %triggerin webui -- apache1
416 %webapp_register apache %{_webapp}
417
418 %triggerun webui -- apache1
419 %webapp_unregister apache %{_webapp}
420
421 %triggerin webui -- apache < 2.2.0, apache-base
422 %webapp_register httpd %{_webapp}
423
424 %triggerun webui -- apache < 2.2.0, apache-base
425 %webapp_unregister httpd %{_webapp}
426
427 %files
428 %defattr(644,root,root,755)
429 %doc README CHANGELOG RELEASE.NOTES UPGRADING
430 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
431 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
432 %dir %attr(750,root,mail) /var/lib/%{name}
433 %dir %attr(770,root,mail) /var/log/dspam
434 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
435 %attr(755,root,root) %{_bindir}/%{name}
436 %attr(755,root,root) %{_bindir}/%{name}_logrotate
437 %attr(755,root,root) %{_bindir}/%{name}_clean
438 %attr(755,root,root) %{_bindir}/%{name}_corpus
439 %attr(755,root,root) %{_bindir}/%{name}_crc
440 %attr(755,root,root) %{_bindir}/%{name}_dump
441 %attr(755,root,root) %{_bindir}/%{name}_genaliases
442 %attr(755,root,root) %{_bindir}/%{name}_stats
443 %attr(755,root,root) %{_bindir}/%{name}_merge
444 %attr(755,root,root) %{_bindir}/%{name}_2sql
445 %attr(755,root,root) %{_bindir}/%{name}_admin
446 %attr(755,root,root) %{_bindir}/%{name}_train
447 %{_mandir}/man?/%{name}*
448
449 %if %{with daemon}
450 %attr(754,root,root) /etc/rc.d/init.d/dspam
451 %files client
452 %defattr(644,root,root,755)
453 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
454 %attr(770,root,mail) /var/run/dspam
455 %endif
456 %attr(755,root,root) %{_bindir}/%{name}c
457
458 %files libs
459 %defattr(644,root,root,755)
460 %doc README CHANGELOG
461 %attr(755,root,root) %{_libdir}/lib*.so.*.*.*
462 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
463
464 %files devel
465 %defattr(644,root,root,755)
466 %attr(755,root,root) %{_libdir}/lib*.so
467 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
468 %{_libdir}/lib*.la
469 %{_includedir}/%{name}
470 %{_mandir}/man3/libdspam*
471 %{_pkgconfigdir}/*.pc
472
473 %files static
474 %defattr(644,root,root,755)
475 %{_libdir}/lib*.a
476
477 %files driver-hash
478 %defattr(644,root,root,755)
479 %attr(755,root,root) %{_bindir}/css*
480 %attr(755,root,root) %{_libdir}/libhash_drv*.so*
481
482 %if %{with db}
483 %files driver-db
484 %defattr(644,root,root,755)
485 %attr(755,root,root) %{_libdir}/libdb4_drv*.so*
486 %endif
487
488 %if %{with mysql}
489 %files driver-mysql
490 %defattr(644,root,root,755)
491 %doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
492 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
493 %attr(755,root,root) %{_libdir}/libmysql_drv*.so*
494 %endif
495
496 %if %{with pgsql}
497 %files driver-pgsql
498 %defattr(644,root,root,755)
499 %doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
500 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
501 %attr(755,root,root) %{_bindir}/%{name}_pg2int8
502 %attr(755,root,root) %{_libdir}/libpgsql_drv*.so*
503 %endif
504
505 %if %{with sqlite}
506 %files driver-sqlite
507 %defattr(644,root,root,755)
508 %doc doc/sqlite_drv.txt
509 %attr(755,root,root) %{_libdir}/libsqlite_drv*.so*
510 %endif
511
512 %files webui
513 %defattr(644,root,root,755)
514 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
515 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
516 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
517 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/htpasswd
518 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/admins
519 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/configure.pl
520 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/default.prefs
521
522 %dir %{_datadir}/dspam
523 %dir %{_datadir}/dspam/cgi
524 %attr(755,root,root) %{_datadir}/dspam/cgi/*.cgi
525 %{_datadir}/dspam/cgi/templates
526 %{_datadir}/dspam/htdocs
This page took 0.095249 seconds and 3 git commands to generate.