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