summaryrefslogtreecommitdiffstats
path: root/bogofilter.spec
blob: d94155a4c25167874edba611d7bd550d0fd0875c (plain) (blame)
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
# 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.5
%define	Release		1

%{?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.xz

%define _requires_exceptions perl

Buildroot:	%{_tmppath}/%{Name}-%{Version}-root

%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

# 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 %{?with_db42}
  --with-database=db \
%endif
%if %{?with_sqlite}
  --with-database=sqlite3 \
%endif
  --with-included-gsl

%build
make %_smp_mflags
make %_smp_mflags 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

find %{buildroot}%{_datadir}/%{name} -name .dirstamp -print -delete

%post

%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 .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/*

%changelog
* Tue Oct 11 2022 Matěj Cepl <mcepl@cepl.eu> 1.2.5-1
- new package built with tito