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