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