]> git.pld-linux.org Git - packages/dspam.git/blob - dspam.spec
- fix chkconfig, rc-scripts deps
[packages/dspam.git] / dspam.spec
1 #
2 # TODO:
3 # - support for libdclassify
4 # - oracle driver
5 # - messages from default install of cron with mysql driver
6 # Memory fault
7 #
8 # Conditional build:
9 %bcond_without  mysql   # disable MySQL storage driver
10 %bcond_without  pgsql   # disable PostgreSQL storage driver
11 %bcond_without  sqlite  # disable SQLite3 storage driver
12 %bcond_without  db      # disable BerkeleyDB storage driver
13 %bcond_without  daemon  # disable daemon mode
14 %bcond_with     mysql40 # use with mysql 4.0
15 #
16 Summary:        A library and Mail Delivery Agent for Bayesian spam filtering
17 Summary(pl):    Biblioteka i MDA do bayesowskiego filtrowania spamu
18 Name:           dspam
19 Version:        3.6.4
20 Release:        0.0.1
21 License:        GPL
22 Group:          Applications/Mail
23 Source0:        http://www.nuclearelephant.com/projects/dspam/sources/%{name}-%{version}.tar.gz
24 # Source0-md5:  e9fdb00a23a99e05c9e4c22aa8aa3655
25 Source1:        %{name}.init
26 URL:            http://www.nuclearelephant.com/projects/dspam/
27 BuildRequires:  autoconf
28 BuildRequires:  automake
29 BuildRequires:  clamav-devel
30 %{?with_db:BuildRequires:       db-devel}
31 BuildRequires:  libtool
32 %{?with_mysql:BuildRequires:    mysql-devel}
33 BuildRequires:  openldap-devel
34 %{?with_pgsql:BuildRequires:    postgresql-devel}
35 BuildRequires:  sed >= 4.0
36 %{?with_sqlite:BuildRequires:   sqlite3-devel}
37 BuildRequires:  zlib-devel
38 Requires(post,preun):   /sbin/chkconfig
39 Requires:       rc-scripts
40 Buildroot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42 %description
43 DSPAM (as in De-Spam) is an open-source project to create a new kind
44 of anti-spam mechanism, and is currently effective as both a
45 server-side agent for UNIX email servers and a developer's library for
46 mail clients, other anti-spam tools, and similar projects requiring
47 drop-in spam filtering.
48
49 The DSPAM agent masquerades as the email server's local delivery agent
50 and filters/learns spams using an advanced Bayesian statistical
51 approach (based on Bayes's theorem of combined probabilities) which
52 provides an administratively maintenance-free, easy-learning Anti-Spam
53 service custom tailored to each individual user's behavior. Advanced
54 because on top of standard Bayesian filtering is also incorporated the
55 use of Chained Tokens, de-obfuscation, and other enhancements. DSPAM
56 works great with Sendmail and Exim, and should work well with any
57 other MTA that supports an external local delivery agent (postfix,
58 qmail, etc.)
59
60 %description -l pl
61 DSPAM (czyli De-Spam) to projekt o otwartych ¼ród³ach maj±cy na celu
62 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
63 efektywny zarówno jako dzia³aj±cy po stronie serwera agent dla
64 uniksowych serwerów pocztowych jak i biblioteka dla programistów
65 klientów pocztowych, innych narzêdzi antyspamowych i innych projektów
66 wymagaj±cych filtrowania spamu w locie.
67
68 Agent DSPAM zachowuje siê jak lokalny agent dostarczania poczty (MDA)
69 i filtruje/uczy siê spamu przy u¿yciu zaawansowanego bayesowskiego
70 przybli¿enia statystycznego (opartego na twierdzeniu Bayesa o
71 po³±czonych prawdopodobieñstwach), daj±c nie wymagaj±c± obs³ugi
72 administracyjnej, ³atwo ucz±c± siê us³ugê antyspamow± dostosowan± do
73 zachowania ka¿dego u¿ytkownika. Metoda jest zaawansowana poniewa¿ na
74 podstawie standardowego filtrowania bayesowskiego wprowadzono u¿ycie
75 tokenów ³añcuchowych, eliminowanie ukrywanie i inne rozszerzenia.
76 DSPAM dzia³a wspaniale z Sendmailem i Eximem, powinien dzia³aæ dobrze
77 z ka¿dym innym MTA obs³uguj±cym zewnêtrznego agenta MDA (postfiksem,
78 qmailem itd.).
79
80 %package client
81 Summary:        dspam client
82 Summary(pl):    Klient dspam
83 Group:          Applications/Mail
84 # to get the same dspam.conf when both installed
85 Conflicts:      dspam < %{version}-%{release}
86 Conflicts:      dspam > %{version}-%{release}
87
88 %description client
89 dspam client.
90
91 %description client -l pl
92 Klient dspam.
93
94 %package libs
95 Summary:        A library for Bayesian spam filtering
96 Summary(pl):    Biblioteka do bayesowskiego filtrowania spamu
97 Group:          Libraries
98 Requires:       %{name}-driver = %{version}-%{release}
99
100 %description libs
101 DSPAM (as in De-Spam) is an open-source project to create a new kind
102 of anti-spam mechanism, and is currently effective as both a
103 server-side agent for UNIX email servers and a developer's library for
104 mail clients, other anti-spam tools, and similar projects requiring
105 drop-in spam filtering.
106
107 This package contains the library.
108
109 %description libs -l pl
110 DSPAM (czyli De-Spam) to projekt o otwartych ¼ród³ach maj±cy na celu
111 stworzenie nowego rodzaju mechanizmu antyspamowego. Aktualnie jest
112 efektywny zarówno jako dzia³aj±cy po stronie serwera agent dla
113 uniksowych serwerów pocztowych jak i biblioteka dla programistów
114 klientów pocztowych, innych narzêdzi antyspamowych i innych projektów
115 wymagaj±cych filtrowania spamu w locie.
116
117 Ten pakiet zawiera wspomnian± bibliotekê.
118
119 %package devel
120 Summary:        Header files for the DSPAM library
121 Summary(pl):    Pliki nag³ówkowe biblioteki DSPAM
122 Group:          Development/Libraries
123 Requires:       %{name}-libs = %{version}-%{release}
124
125 %description devel
126 DSPAM has had its core engine moved into a separate library, libdspam.
127 This library can be used by developers to provide 'drop-in' spam
128 filtering for their mail client applications, other anti-spam tools,
129 or similar projects.
130
131 %description devel -l pl
132 G³ówny silnik DSPAM zosta³ przeniesiony do oddzielnej biblioteki
133 libdspam, która mo¿e byæ u¿ywana przez programistów do zapewnienia
134 filtrowania spamu w locie dla aplikacji klientów pocztowych, innych
135 narzêdzi antyspamowych i podobnych projektów.
136
137 %package static
138 Summary:        Static DSPAM library
139 Summary(pl):    Statyczna biblioteka DSPAM
140 Group:          Development/Libraries
141 Requires:       %{name}-devel = %{version}-%{release}
142
143 %description static
144 Static DSPAM library.
145
146 %description static -l pl
147 Statyczna biblioteka DSPAM.
148
149 %package driver-hash
150 Summary:        HASH driver for DSPAM
151 Summary(pl):    Sterownik HASH dla DSPAM-a
152 Group:          Libraries
153 Requires(post): sed >= 4.0
154 Requires:       %{name}-libs = %{version}-%{release}
155 Provides:       %{name}-driver = %{version}-%{release}
156
157 %description driver-hash
158 HASH driver for DSPAM.
159
160 %description driver-hash -l pl
161 Sterownik HASH dla DSPAM-a.
162
163 %package driver-db
164 Summary:        DB driver for DSPAM
165 Summary(pl):    Sterownik DB dla DSPAM-a
166 Group:          Libraries
167 Requires(post): sed >= 4.0
168 Requires:       %{name}-libs = %{version}-%{release}
169 Provides:       %{name}-driver = %{version}-%{release}
170
171 %description driver-db
172 DB driver for DSPAM.
173
174 %description driver-db -l pl
175 Sterownik DB dla DSPAM-a.
176
177 %package driver-mysql
178 Summary:        MySQL driver for DSPAM
179 Summary(pl):    Sterownik MySQL dla DSPAM-a
180 Group:          Libraries
181 Requires(post): sed >= 4.0
182 Requires:       %{name}-libs = %{version}-%{release}
183 Provides:       %{name}-driver = %{version}-%{release}
184
185 %description driver-mysql
186 MySQL driver for DSPAM.
187
188 %description driver-mysql -l pl
189 Sterownik MySQL dla DSPAM-a.
190
191 %package driver-pgsql
192 Summary:        PostgreSQL driver for DSPAM
193 Summary(pl):    Sterownik PostgreSQL dla DSPAM-a
194 Group:          Libraries
195 Requires(post): sed >= 4.0
196 Requires:       %{name}-libs = %{version}-%{release}
197 Provides:       %{name}-driver = %{version}-%{release}
198
199 %description driver-pgsql
200 PostgreSQL driver for DSPAM.
201
202 %description driver-pgsql -l pl
203 Sterownik PostgreSQL dla DSPAM-a.
204
205 %package driver-sqlite
206 Summary:        SQLite driver for DSPAM
207 Summary(pl):    Sterownik SQLite dla DSPAM-a
208 Group:          Libraries
209 Requires(post): sed >= 4.0
210 Requires:       %{name}-libs = %{version}-%{release}
211 Provides:       %{name}-driver = %{version}-%{release}
212
213 %description driver-sqlite
214 SQLite driver for DSPAM.
215
216 %description driver-sqlite -l pl
217 Sterownik SQLite dla DSPAM-a.
218
219 %prep
220 %setup -q
221 sed -i -e 's#\-static##g' src/Makefile* src/*/Makefile*
222 %{?with_mysql40:sed -i -e 's#40100#99999#g' src/mysql_drv.c}
223
224 %build
225 %{__libtoolize}
226 %{__aclocal} -I m4
227 %{__autoconf}
228 %{__automake}
229
230 DRIVERS="
231 hash_drv
232 %{?with_db:libdb4_drv}
233 %{?with_mysql:mysql_drv}
234 %{?with_pgsql:pgsql_drv}
235 %{?with_sqlite:sqlite_drv}
236 "
237 %configure \
238         %{?debug: --enable-debug --enable-bnr-debug --enable-verbose-debug} \
239         --enable-trusted-user-security \
240         --enable-bias \
241         --enable-large-scale \
242         --with-userdir=/var/lib/%{name} \
243         --with-userdir-owner=none \
244         --with-userdir-group=none \
245         --with-dspam-home=/var/lib/%{name} \
246         --with-dspam-home-owner=none \
247         --with-dspam-home-group=none \
248         --with-dspam-owner=none \
249         --with-dspam-group=none \
250         --with-signature-life=14 \
251         --disable-dependency-tracking \
252         --enable-ldap \
253         --enable-clamav \
254         --enable-preferences-extension \
255         --enable-long-usernames \
256         --enable-neural-networking \
257         --enable-virtual-users \
258         --with-storage-driver=$(echo $DRIVERS | tr ' ' ',') \
259 %if %{with mysql}
260         --with-mysql-includes=%{_includedir}/mysql \
261         --with-mysql-libraries=%{_libdir} \
262 %endif
263 %if %{with pgsql}
264         --with-pgsql-includes=%{_includedir}/postgresql \
265         --with-pgsql-libraries=%{_libdir} \
266 %endif
267 %if %{with sqlite}
268         --with-sqlite3-includes=%{_includedir} \
269         --with-sqlite3-libraries=%{_libdir} \
270 %endif
271         --enable-daemon
272
273 # --enable-dclassify-extension needs libdclassify
274
275 %{__make}
276
277 %install
278 rm -rf $RPM_BUILD_ROOT
279
280 %{__make} install \
281         DESTDIR=$RPM_BUILD_ROOT
282
283 install -d $RPM_BUILD_ROOT/{var/run/dspam,/etc/{rc.d/init.d,sysconfig}}
284 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/dspam
285
286 #
287 ln -s /var/log/dspam $RPM_BUILD_ROOT/var/lib/%{name}/log
288
289 # install devel files
290 install -d $RPM_BUILD_ROOT{%{_includedir}/%{name},/var/{log,lib}/%{name}}
291 install src/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}
292
293 # provide maintenance scripts
294 install -d $RPM_BUILD_ROOT/etc/cron.daily
295 install -d $RPM_BUILD_ROOT/etc/cron.weekly
296
297 cat > $RPM_BUILD_ROOT/etc/cron.daily/%{name} <<EOF
298 #!/bin/sh
299 exec %{_bindir}/%{name}_clean -s -p
300 EOF
301
302 chmod 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.daily/%{name}
303
304 # fix prefix
305 sed -i -e "s|%{_prefix}/local|%{_prefix}|g" $RPM_BUILD_ROOT%{_bindir}/%{name}_corpus
306 sed -i -e "s|%{_prefix}/local|%{_prefix}|g" webui/cgi-bin/dspam.cgi
307
308 # fix purge stuff
309 #install dspam-cron.weekly $RPM_BUILD_ROOT%{_sysconfdir}/cron.weekly/%{name}
310
311 %if %{with mysql}
312 # fix missing file
313 install -d $RPM_BUILD_ROOT/var/lib/%{name}
314 cat > $RPM_BUILD_ROOT/var/lib/%{name}/mysql.data <<EOF
315 _UNCONFIGURED_
316
317 Note!
318
319 This file can only contain 5 lines with the following values:
320
321 HOSTNAME
322 PORT
323 USERNAME
324 PASSWORD
325 DATABASE
326 EOF
327 %endif
328
329 %if %{with pgsql}
330 # fix missing file
331 install -d $RPM_BUILD_ROOT/var/lib/%{name}
332 cat > $RPM_BUILD_ROOT/var/lib/%{name}/pgsql.data <<EOF
333 _UNCONFIGURED_
334
335 Note!
336
337 This file can only contain 5 lines with the following values:
338
339 HOSTNAME
340 PORT
341 USERNAME
342 PASSWORD
343 DATABASE
344 EOF
345 %endif
346
347 %post
348 /sbin/chkconfig --add dspam
349 if [ -f /var/lock/subsys/dspam ]; then
350         /etc/rc.d/init.d/dspam restart 1>&2
351 else
352         echo "Run \"/etc/rc.d/init.d/dspam start\" to start dspam daemon."
353 fi
354
355 %preun
356 if [ "$1" = "0" ]; then
357         if [ -f /var/lock/subsys/dspam ]; then
358                 /etc/rc.d/init.d/dspam stop 1>&2
359         fi
360         /sbin/chkconfig --del dspam
361 fi
362
363 %clean
364 rm -rf $RPM_BUILD_ROOT
365
366 %post   libs -p /sbin/ldconfig
367 %postun libs -p /sbin/ldconfig
368
369 %post driver-db
370 if [ "$1" = "1" ]; then
371         sed -i -e '/^StorageDriver/s,/.*.so,%{_libdir}/libdb4_drv.so,' /etc/dspam.conf
372 fi
373
374 %post driver-hash
375 if [ "$1" = "1" ]; then
376         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libhash_drv.so,' /etc/dspam.conf
377 fi
378
379 %post driver-mysql
380 if [ "$1" = "1" ]; then
381         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libmysql_drv.so,' /etc/dspam.conf
382 fi
383
384 %post driver-pgsql
385 if [ "$1" = "1" ]; then
386         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libpgsql_drv.so,' /etc/dspam.conf
387 fi
388
389 %post driver-sqlite
390 if [ "$1" = "1" ]; then
391         sed -i -e '/^StorageDriver/s,/.*\.so,%{_libdir}/libsqlite_drv.so,' /etc/dspam.conf
392 fi
393
394 %files
395 %defattr(644,root,root,755)
396 %doc README CHANGELOG RELEASE.NOTES UPGRADING
397 %doc webui/*/*.{cgi,prefs,txt} webui/*/*.txt webui/*/templates/*.html
398 %doc doc/{courier,exim,markov,pop3filter,postfix,qmail,relay,sendmail}.txt
399 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
400 %dir %attr(750,root,mail) /var/lib/%{name}
401 %dir %attr(770,root,mail) /var/log/dspam
402 %attr(755,root,root) %config(noreplace) /etc/cron.daily/%{name}
403 %attr(755,root,root) %{_bindir}/%{name}
404 %attr(755,root,root) %{_bindir}/%{name}_logrotate
405 %attr(755,root,root) %{_bindir}/%{name}_clean
406 %attr(755,root,root) %{_bindir}/%{name}_corpus
407 %attr(755,root,root) %{_bindir}/%{name}_crc
408 %attr(755,root,root) %{_bindir}/%{name}_dump
409 %attr(755,root,root) %{_bindir}/%{name}_genaliases
410 %attr(755,root,root) %{_bindir}/%{name}_stats
411 %attr(755,root,root) %{_bindir}/%{name}_merge
412 %attr(755,root,root) %{_bindir}/%{name}_2sql
413 %attr(755,root,root) %{_bindir}/%{name}_admin
414 %{_mandir}/man?/%{name}*
415
416 %if %{with daemon}
417 %attr(754,root,root) /etc/rc.d/init.d/dspam
418 %files client
419 %defattr(644,root,root,755)
420 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/dspam.conf
421 %attr(770,root,mail) /var/run/dspam
422 %endif
423 %attr(755,root,root) %{_bindir}/%{name}c
424
425 %files libs
426 %defattr(644,root,root,755)
427 %doc README CHANGELOG
428 %attr(755,root,root) %{_libdir}/lib*.so.*.*.*
429 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
430
431 %files devel
432 %defattr(644,root,root,755)
433 %attr(755,root,root) %{_libdir}/lib*.so
434 %attr(755,root,root) %exclude %{_libdir}/lib*_drv*.so*
435 %{_libdir}/lib*.la
436 %{_includedir}/%{name}
437 %{_mandir}/man3/libdspam*
438 %{_pkgconfigdir}/*.pc
439
440 %files static
441 %defattr(644,root,root,755)
442 %{_libdir}/lib*.a
443
444 %files driver-hash
445 %defattr(644,root,root,755)
446 %attr(755,root,root) %{_bindir}/css*
447 %attr(755,root,root) %{_libdir}/libhash_drv*.so*
448
449 %if %{with db}
450 %files driver-db
451 %defattr(644,root,root,755)
452 %attr(755,root,root) %{_libdir}/libdb4_drv*.so*
453 %endif
454
455 %if %{with mysql}
456 %files driver-mysql
457 %defattr(644,root,root,755)
458 %doc doc/mysql_drv.txt src/tools.mysql_drv/*.sql
459 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/mysql.data
460 %attr(755,root,root) %{_libdir}/libmysql_drv*.so*
461 %endif
462
463 %if %{with pgsql}
464 %files driver-pgsql
465 %defattr(644,root,root,755)
466 %doc doc/pgsql_drv.txt src/tools.pgsql_drv/*.sql
467 %attr(640,root,mail) %config(noreplace) /var/lib/%{name}/pgsql.data
468 %attr(755,root,root) %{_bindir}/%{name}_pg2int8
469 %attr(755,root,root) %{_libdir}/libpgsql_drv*.so*
470 %endif
471
472 %if %{with sqlite}
473 %files driver-sqlite
474 %defattr(644,root,root,755)
475 %doc doc/sqlite_drv.txt
476 %attr(755,root,root) %{_libdir}/libsqlite_drv*.so*
477 %endif
This page took 0.106093 seconds and 4 git commands to generate.