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