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