]> git.pld-linux.org Git - packages/dspam.git/blob - dspam.spec
- use pidfile not to kill wrong processes
[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.20
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 # needs dspam binary
230 Requires:       %{name} = %{version}-%{release}
231
232 %description webui
233 The Web UI (CGI client) can be run from any executable location on a
234 web server, and detects its user's identity from the REMOTE_USER
235 environment variable. This means you'll need to use HTTP password
236 authentication to access the CGI (Any type of authentication will
237 work, so long as Apache supports the module). This is also convenient
238 in that you can set up authentication using almost any existing system
239 you have. The only catch is that you'll need the usernames to match
240 the actual DSPAM usernames used the system. A copy of the shadow
241 password file will suffice for most common installs.
242
243 %prep
244 %setup -q
245 %patch0 -p1
246 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
247 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
248
249 %build
250 %{__libtoolize}
251 %{__aclocal} -I m4
252 %{__autoconf}
253 %{__automake}
254
255 DRIVERS="
256 hash_drv
257 %{?with_db:libdb4_drv}
258 %{?with_mysql:mysql_drv}
259 %{?with_pgsql:pgsql_drv}
260 %{?with_sqlite:sqlite_drv}
261 "
262 %configure \
263         --disable-dependency-tracking \
264         %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
265         --enable-trusted-user-security \
266         --enable-bias \
267         --enable-large-scale \
268         --with-userdir=/var/lib/%{name} \
269         --with-userdir-owner=none \
270         --with-userdir-group=none \
271         --with-dspam-home=/var/lib/%{name} \
272         --with-dspam-home-owner=none \
273         --with-dspam-home-group=none \
274         --with-dspam-owner=none \
275         --with-dspam-group=none \
276         --with-signature-life=14 \
277         --enable-ldap \
278         --enable-clamav \
279         --enable-preferences-extension \
280         --enable-long-usernames \
281         --enable-neural-networking \
282         --enable-virtual-users \
283         --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
284 %if %{with mysql}
285         --with-mysql-includes=%{_includedir}/mysql \
286         --with-mysql-libraries=%{_libdir} \
287 %endif
288 %if %{with pgsql}
289         --with-pgsql-includes=%{_includedir}/postgresql \
290         --with-pgsql-libraries=%{_libdir} \
291 %endif
292 %if %{with sqlite}
293         --with-sqlite3-includes=%{_includedir} \
294         --with-sqlite3-libraries=%{_libdir} \
295 %endif
296         --enable-daemon
297
298 # --enable-dclassify-extension needs libdclassify
299
300 %{__make}
301
302 %install
303 rm -rf $RPM_BUILD_ROOT
304
305 %{__make} install \
306         DESTDIR=$RPM_BUILD_ROOT
307
308 install -d $RPM_BUILD_ROOT/{var/run/dspam,/etc/{rc.d/init.d,sysconfig}}
309 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
310
311 #
312 ln -s /var/log/dspam $RPM_BUILD_ROOT/var/lib/%{name}/log
313
314 # install devel files
315 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
316 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
317
318 # provide maintenance scripts
319 install -d $RPM_BUILD_ROOT/etc/cron.daily
320 install -d $RPM_BUILD_ROOT/etc/cron.weekly
321
322 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
323 #!/bin/sh
324 exec %{_bindir}/%{name}_clean -s -p
325 EOF
326
327 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
328
329 # fix prefix
330 sed -i -e "s|%{_prefix}/local|%{_prefix}|g" $RPM_BUILD_ROOT%{_bindir}/%{name}_corpus
331
332 # fix purge stuff
333 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
334
335 %if %{with mysql}
336 # fix missing file
337 install -d $RPM_BUILD_ROOT/var/lib/%{name}
338 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
339 _UNCONFIGURED_
340
341 Note!
342
343 This file can only contain 5 lines with the following values:
344
345 HOSTNAME
346 PORT
347 USERNAME
348 PASSWORD
349 DATABASE
350 EOF
351 %endif
352
353 %if %{with pgsql}
354 # fix missing file
355 install -d $RPM_BUILD_ROOT/var/lib/%{name}
356 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
357 _UNCONFIGURED_
358
359 Note!
360
361 This file can only contain 5 lines with the following values:
362
363 HOSTNAME
364 PORT
365 USERNAME
366 PASSWORD
367 DATABASE
368 EOF
369 %endif
370
371 install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
372 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
373 install %{SOURCE2} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
374 touch $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/htpasswd
375
376 %post
377 /sbin/chkconfig --add dspam
378 %service dspam restart "dspam daemon"
379
380 %preun
381 if [ "$1" = "0" ]; then
382         %service dspam stop
383         /sbin/chkconfig --del dspam
384 fi
385
386 %clean
387 rm -rf $RPM_BUILD_ROOT
388
389 %post   libs -p /sbin/ldconfig
390 %postun libs -p /sbin/ldconfig
391
392 %post driver-db
393 if [ "$1" = "1" ]; then
394         sed -i -e '/^StorageDriver/s,/.*.so,%{_libdir}/libdb4_drv.so,' /etc/dspam.conf
395 fi
396
397 %post driver-hash
398 if [ "$1" = "1" ]; then
399         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
400 fi
401
402 %post driver-mysql
403 if [ "$1" = "1" ]; then
404         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
405 fi
406
407 %post driver-pgsql
408 if [ "$1" = "1" ]; then
409         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
410 fi
411
412 %post driver-sqlite
413 if [ "$1" = "1" ]; then
414         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite_drv.so,' /etc/dspam.conf
415 fi
416
417 %triggerin webui -- apache1
418 %webapp_register apache %{_webapp}
419
420 %triggerun webui -- apache1
421 %webapp_unregister apache %{_webapp}
422
423 %triggerin webui -- apache < 2.2.0, apache-base
424 %webapp_register httpd %{_webapp}
425
426 %triggerun webui -- apache < 2.2.0, apache-base
427 %webapp_unregister httpd %{_webapp}
428
429 %files
430 %defattr(644,root,root,755)
431 %doc README CHANGELOG RELEASE.NOTES UPGRADING
432 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
433 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
434 %dir %attr(750,root,mail) /var/lib/%{name}
435 %dir %attr(770,root,mail) /var/log/dspam
436 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
437 %attr(755,root,root) %{_bindir}/%{name}
438 %attr(755,root,root) %{_bindir}/%{name}_logrotate
439 %attr(755,root,root) %{_bindir}/%{name}_clean
440 %attr(755,root,root) %{_bindir}/%{name}_corpus
441 %attr(755,root,root) %{_bindir}/%{name}_crc
442 %attr(755,root,root) %{_bindir}/%{name}_dump
443 %attr(755,root,root) %{_bindir}/%{name}_genaliases
444 %attr(755,root,root) %{_bindir}/%{name}_stats
445 %attr(755,root,root) %{_bindir}/%{name}_merge
446 %attr(755,root,root) %{_bindir}/%{name}_2sql
447 %attr(755,root,root) %{_bindir}/%{name}_admin
448 %attr(755,root,root) %{_bindir}/%{name}_train
449 %{_mandir}/man?/%{name}*
450
451 %if %{with daemon}
452 %attr(754,root,root) /etc/rc.d/init.d/dspam
453 %files client
454 %defattr(644,root,root,755)
455 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
456 %attr(770,root,mail) /var/run/dspam
457 %endif
458 %attr(755,root,root) %{_bindir}/%{name}c
459
460 %files libs
461 %defattr(644,root,root,755)
462 %doc README CHANGELOG
463 %attr(755,root,root) %{_libdir}/lib*.so.*.*.*
464 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
465
466 %files devel
467 %defattr(644,root,root,755)
468 %attr(755,root,root) %{_libdir}/lib*.so
469 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
470 %{_libdir}/lib*.la
471 %{_includedir}/%{name}
472 %{_mandir}/man3/libdspam*
473 %{_pkgconfigdir}/*.pc
474
475 %files static
476 %defattr(644,root,root,755)
477 %{_libdir}/lib*.a
478
479 %files driver-hash
480 %defattr(644,root,root,755)
481 %attr(755,root,root) %{_bindir}/css*
482 %attr(755,root,root) %{_libdir}/libhash_drv*.so*
483
484 %if %{with db}
485 %files driver-db
486 %defattr(644,root,root,755)
487 %attr(755,root,root) %{_libdir}/libdb4_drv*.so*
488 %endif
489
490 %if %{with mysql}
491 %files driver-mysql
492 %defattr(644,root,root,755)
493 %doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
494 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
495 %attr(755,root,root) %{_libdir}/libmysql_drv*.so*
496 %endif
497
498 %if %{with pgsql}
499 %files driver-pgsql
500 %defattr(644,root,root,755)
501 %doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
502 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
503 %attr(755,root,root) %{_bindir}/%{name}_pg2int8
504 %attr(755,root,root) %{_libdir}/libpgsql_drv*.so*
505 %endif
506
507 %if %{with sqlite}
508 %files driver-sqlite
509 %defattr(644,root,root,755)
510 %doc doc/sqlite_drv.txt
511 %attr(755,root,root) %{_libdir}/libsqlite_drv*.so*
512 %endif
513
514 %files webui
515 %defattr(644,root,root,755)
516 %dir %attr(750,root,http) %{_webapps}/%{_webapp}
517 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
518 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
519 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/htpasswd
520 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/admins
521 %attr(660,root,http) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/default.prefs
522 %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/configure.pl
523
524 %dir %{_datadir}/dspam
525 %dir %{_datadir}/dspam/cgi
526 %attr(755,root,root) %{_datadir}/dspam/cgi/*.cgi
527 %{_datadir}/dspam/cgi/templates
528 %{_datadir}/dspam/htdocs
This page took 0.09643 seconds and 3 git commands to generate.