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