~peter-pearse/ubuntu/oneiric/bogofilter/prop001

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# $Id: bogofilter.spec.in 6431 2006-01-22 03:28:21Z relson $

# This .spec file will not build the static package by default.
# To do this, run either of the next rpm[build] commands:
#
# rpmbuild --define 'bogostatic 1' --sign -bb bogofilter.spec
#
# To build with SQLite3, use:
#
# rpmbuild --define 'with_sqlite 1' --sign -bb bogofilter.spec

# To build -debuginfo RPMs on systems with RPM 4.2 or newer and recent
# elfutils, add
#
# --define 'debugrpm 1'
#
# or place   %debugrpm 1   into your ~/.rpmmacros file.

%define	Name		bogofilter
%define	Version		1.2.2
%define	Release		1

%{?bogostatic:  %define bogostatic 1}
%{!?bogostatic: %define bogostatic 0}

%{?with_db42:   %define with_db42 1}
%{!?with_db42:  %define with_db42 0}

%{?with_sqlite:  %define with_sqlite 1}
%{!?with_sqlite: %define with_sqlite 0}

%if %{with_db42}
%define DBFlag 1
%define DBName -db42
%endif

%if %{with_sqlite}
%define DBFlag 1
%define DBName -sqlite3
%endif

%{!?DBFlag: %define DBFlag 0}
%{!?bf_nameext: %define bf_nameext %{nil}}

Summary:	Fast anti-spam filtering by Bayesian statistical analysis
%if ! %{DBFlag}
Name:		%{Name}%{bf_nameext}
%else
Name:		%{Name}%{DBName}%{bf_nameext}
%endif
Version:	%{Version}
Release:	%{Release}
License:	GPL
Group:		Networking/Mail
URL:		http://bogofilter.sourceforge.net
Source0:	%{Name}-%{Version}.tar.gz

%define _requires_exceptions perl

Buildroot:	%{_tmppath}/%{Name}-%{Version}-root
Conflicts:	%{Name}%{DBName}-static

%description
Bogofilter is a Bayesian spam filter.  In its normal mode of
operation, it takes an email message or other text on standard input,
does a statistical check against lists of "good" and "bad" words, and
returns a status code indicating whether or not the message is spam.
Bogofilter is designed with fast algorithms (including Berkeley DB system),
coded directly in C, and tuned for speed, so it can be used for production
by sites that process a lot of mail.

%if %{with_sqlite}
This version was built with SQLite3 support.
%else
This version was built with Berkeley DB support.
%endif

%package static
Summary:	Statically linked
Group:		Networking/Mail
Conflicts:	%{Name}%{DBName}

%description static
Statically linked bogofilter, bogolexer, bogoutil, and bogotune.

# use the debug_package macro if applicable:
%{?debugrpm:%debug_package}

%prep
%setup -q -n %{Name}-%{Version}
CFLAGS="$RPM_OPT_FLAGS" \
./configure \
  --prefix=%{_prefix} \
  --mandir=%{_mandir} \
  --sysconfdir=%{_sysconfdir} \
%if %{?bogostatic}
  --enable-static \
%endif
%if %{?with_db42}
  --with-database=db \
%endif
%if %{?with_sqlite}
  --with-database=sqlite3 \
%endif
  --with-included-gsl

%build
make
make DESTDIR="%{buildroot}" check

%clean
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}

%install
[ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot}
make DESTDIR=%{buildroot} install

cp %{buildroot}%{_sysconfdir}/bogofilter.cf.example \
   %{buildroot}%{_sysconfdir}/bogofilter.cf

for n in xml html ; do
  install -d .inst/$n
  install -m644 doc/*.$n .inst/$n
done

for n in `find %{buildroot}%{_datadir}/%{name} -type d` ; do
  chmod o-w $n
done

for d in contrib ; do
  install -d %{buildroot}%{_datadir}/%{name}/$d
  files=$(find "$d" -maxdepth 1 -type f -print)
  for f in $files ; do
    case $f in
      *.c|*.o|*.obj|*/Makefile*) continue ;;
      *.1)
	cp -p $f %{buildroot}%{_mandir}/man1 ;;
      *)
	cp -p $f %{buildroot}%{_datadir}/%{name}/$d ;;
    esac
  done
done

mv bogogrep* contrib

%if %{bogostatic}
(
cd %{buildroot}%{_datadir}/%{name}
cp -p -r contrib contrib-static
rm contrib/bogogrep_static
rm contrib-static/bogogrep
strip contrib-static/bogogrep_static
)
%endif

%post

%post static
for file in bogofilter bogolexer bogoutil bogotune ; do
    if [ $1 -lt 2 ] ; then
        ln -s %{_bindir}/${file}_static %{_bindir}/${file} 
    fi
done

%postun static
for file in bogofilter bogolexer bogoutil bogotune ; do
    if [ $1 -eq 0 ] ; then
        rm -f %{_bindir}/${file}
        echo rm -f %{_bindir}/${file}
    fi
done

%files
%defattr(-,root,root)

%doc AUTHORS COPYING INSTALL
%doc GETTING.STARTED
%doc NEWS README* RELEASE.NOTES TODO
%doc doc/bogofilter-tuning.HOWTO.html
%doc doc/bogofilter-SA-2002-01
%doc doc/integrating*
%doc doc/programmer
%doc doc/README.*db doc/rpm.notes.BerkeleyDB
%doc .inst/html .inst/xml

%{_sysconfdir}/bogofilter.cf.example
%config(noreplace) %{_sysconfdir}/bogofilter.cf

%{_bindir}/bogofilter
%{_bindir}/bogolexer
%{_bindir}/bogotune
%{_bindir}/bogoutil
%{_bindir}/bogoupgrade
%{_bindir}/bf_copy
%{_bindir}/bf_compact
%{_bindir}/bf_tar

%{_mandir}/man1/bogofilter.1*
%{_mandir}/man1/bogolexer.1*
%{_mandir}/man1/bogotune.1*
%{_mandir}/man1/bogoutil.1*
%{_mandir}/man1/bogoupgrade.1*
%{_mandir}/man1/bf_compact.1*
%{_mandir}/man1/bf_copy.1*
%{_mandir}/man1/bf_tar.1*

%{_datadir}/%{name}/contrib/*

%if %{bogostatic}
%files static
%defattr(-,root,root)

%doc AUTHORS COPYING INSTALL
%doc GETTING.STARTED
%doc NEWS README* RELEASE.NOTES TODO
%doc doc/bogofilter-tuning.HOWTO.html
%doc doc/bogofilter-SA-2002-01
%doc doc/integrating*
%doc doc/programmer
%doc doc/README.*db doc/rpm.notes.BerkeleyDB
%doc .inst/html .inst/xml

%{_sysconfdir}/bogofilter.cf.example
%config(noreplace) %{_sysconfdir}/bogofilter.cf

%{_bindir}/bogofilter_static
%{_bindir}/bogolexer_static
%{_bindir}/bogotune_static
%{_bindir}/bogoutil_static
%{_bindir}/bogoupgrade
%{_bindir}/bf_copy
%{_bindir}/bf_compact
%{_bindir}/bf_tar

%{_mandir}/man1/bogofilter.1*
%{_mandir}/man1/bogolexer.1*
%{_mandir}/man1/bogotune.1*
%{_mandir}/man1/bogoutil.1*
%{_mandir}/man1/bogoupgrade.1*
%{_mandir}/man1/bf_compact.1*
%{_mandir}/man1/bf_copy.1*
%{_mandir}/man1/bf_tar.1*

%{_datadir}/%{name}/contrib-static/*
%endif

%changelog