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