]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- added workaround for broken OpenSSL detection
[packages/clamav.git] / clamav.spec
1 # TODO:
2 # - Make freshclam package (script and daemon)
3 # - restart amavis in triggers if group membership was modified?
4 #
5 # Conditional build:
6 %bcond_without  milter          # milter interface subpackage
7 %if "%{pld_release}" == "ac"
8 %bcond_with     llvm            # LLVM support
9 %else
10 %bcond_without  llvm            # LLVM support
11 %endif
12
13 Summary:        An anti-virus utility for Unix
14 Summary(pl.UTF-8):      Narzędzie antywirusowe dla Uniksów
15 Name:           clamav
16 Version:        0.98.3
17 Release:        1
18 License:        GPL v2+
19 Group:          Daemons
20 Source0:        http://downloads.sourceforge.net/clamav/%{name}-%{version}.tar.gz
21 # Source0-md5:  b649d35ee85d4d6075a98173dd255c17
22 Source1:        %{name}.init
23 Source2:        %{name}.sysconfig
24 Source3:        %{name}-milter.init
25 Source4:        %{name}-cron-updatedb
26 Source5:        %{name}.logrotate
27 Source8:        %{name}-post-updatedb
28 Source9:        %{name}-milter.sysconfig
29 Source10:       %{name}.tmpfiles
30 Source11:       clamd.service
31 Patch0:         %{name}-pld_config.patch
32 Patch1:         %{name}-nolibs.patch
33 %if "%{pld_release}" == "ac"
34 Patch2:         am-nosilentrules.patch
35 %endif
36 Patch3:         ac2.68.patch
37 Patch4:         %{name}-openssl.patch
38 URL:            http://www.clamav.net/
39 BuildRequires:  autoconf
40 BuildRequires:  automake
41 BuildRequires:  bzip2-devel
42 BuildRequires:  curl-devel
43 BuildRequires:  gmp-devel
44 BuildRequires:  libltdl-devel
45 %{?with_milter:BuildRequires:   libmilter-devel}
46 BuildRequires:  libstdc++-devel
47 BuildRequires:  libtool
48 %{?with_milter:BuildRequires:   libwrap-devel}
49 BuildRequires:  llvm-devel
50 %{?with_llvm:BuildRequires:     llvm-devel}
51 BuildRequires:  ncurses-devel
52 BuildRequires:  openssl-devel
53 BuildRequires:  rpm >= 4.4.9-56
54 BuildRequires:  rpmbuild(macros) >= 1.647
55 BuildRequires:  zlib-devel
56 Requires(post,preun):   /sbin/chkconfig
57 Requires(postun):       /usr/sbin/groupdel
58 Requires(postun):       /usr/sbin/userdel
59 Requires(postun,pre):   /usr/sbin/usermod
60 Requires(pre):  /bin/id
61 Requires(pre):  /usr/bin/getgid
62 Requires(pre):  /usr/sbin/groupadd
63 Requires(pre):  /usr/sbin/useradd
64 Requires(post,preun,postun):    systemd-units >= 38
65 Requires:       systemd-units >= 38
66 Requires(triggerpostun):        sed >= 4.0
67 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
68 Requires:       /usr/sbin/usermod
69 Requires:       rc-scripts >= 0.4.1.23
70 Suggests:       clamav-database
71 Provides:       group(clamav)
72 Provides:       user(clamav)
73 Conflicts:      logrotate < 3.7-4
74 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
75
76 %description
77 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
78 especially for e-mail scanning on mail gateways. It provides a number
79 of utilities including a flexible and scalable multi-threaded daemon,
80 a command line scanner and advanced tool for automatic database
81 updates. The core of the package is an anti-virus engine available in
82 a form of shared library.
83
84 Here is a list of the main features:
85 - command-line scanner
86 - fast, multi-threaded daemon with support for on-access scanning
87 - milter interface for sendmail
88 - advanced database updater with support for scripted updates and
89   digital signatures
90 - virus scanner C library
91 - on-access scanning (Linux® and FreeBSD®)
92 - virus database updated multiple times per day (see home page for
93   total number of signatures)
94 - built-in support for various archive formats, including Zip, RAR,
95   Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
96 - built-in support for almost all mail file formats
97 - built-in support for ELF executables and Portable Executable files
98   compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
99   obfuscated with SUE, Y0da Cryptor and others
100 - built-in support for popular document formats including MS Office
101   and MacOffice files, HTML, RTF and PDF
102
103 %description -l pl.UTF-8
104 Clam Antivirus jest potężnym skanerem antywirusowym dla systemów
105 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
106 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
107 Baza wirusów zawiera ponad 90000 sygnatur. Skaner jest wielowątkowy,
108 napisany w C i zgodny z POSIXem.
109
110 %package libs
111 Summary:        Shared libraries for clamav
112 Summary(pl.UTF-8):      Biblioteki dzielone clamav
113 Group:          Libraries
114
115 %description libs
116 Shared libraries for clamav.
117
118 %description libs -l pl.UTF-8
119 Biblioteki dzielone clamav.
120
121 %package milter
122 Summary:        ClamAV filter using milter interface
123 Summary(pl.UTF-8):      Filtr ClamAV korzystający z interfejsu milter
124 Group:          Daemons
125 Requires:       %{name} = %{epoch}:%{version}-%{release}
126 Requires:       postfix
127 #Requires:      sendmail >= 8.11
128 Requires:       tcp_wrappers
129
130 %description milter
131 ClamAV sendmail filter using MILTER interface.
132
133 %description milter -l pl.UTF-8
134 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
135
136 %package devel
137 Summary:        clamav - Development header files and libraries
138 Summary(pl.UTF-8):      clamav - Pliki nagłówkowe i biblioteki dla programistów
139 Group:          Development/Libraries
140 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
141 Requires:       bzip2-devel
142 Requires:       curl-devel
143 Requires:       gmp-devel
144 Requires:       openssl-devel
145 Requires:       zlib-devel
146
147 %description devel
148 This package contains the development header files and libraries
149 necessary to develop clamav client applications.
150
151 %description devel -l pl.UTF-8
152 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
153 klienckich clamav.
154
155 %package static
156 Summary:        clamav static libraries
157 Summary(pl.UTF-8):      Biblioteki statyczne clamav
158 Group:          Development/Libraries
159 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
160
161 %description static
162 clamav static libraries.
163
164 %description static -l pl.UTF-8
165 Biblioteki statyczne clamav.
166
167 %prep
168 %setup -q
169 %patch0 -p1
170 %patch1 -p1
171 %if "%{pld_release}" == "ac"
172 %patch2 -p1
173 %endif
174 %patch3 -p1
175 %patch4 -p1
176
177 %build
178 %{__libtoolize}
179 %{__aclocal} -I m4
180 %{__autoconf}
181 %{__autoheader}
182 %{__automake}
183 %configure \
184         --disable-silent-rules \
185         --disable-clamav \
186         --enable-clamdtop \
187         %{?with_milter:--enable-milter} \
188         --with-dbdir=/var/lib/%{name} \
189         --with-no-cache \
190         --with-ltdl-include=%{_includedir} \
191         --with-ltdl-lib=%{_libdir}
192
193 %{__make} \
194         LIBTOOL=%{_bindir}/libtool
195
196 %install
197 rm -rf $RPM_BUILD_ROOT
198 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
199         $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
200         $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
201         $RPM_BUILD_ROOT%{systemdunitdir}
202
203 %{__make} install \
204         LIBTOOL=%{_bindir}/libtool \
205         DESTDIR=$RPM_BUILD_ROOT
206 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
207
208 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
209 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
210 EOF
211
212 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
213 %if %{with milter}
214 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
215 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
216 %endif
217 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
218 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
219 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
220         mv $i ${i%%.sample}
221 done
222 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
223
224 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
225
226 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
227
228 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
229
230 # NOTE: clamd uses sane rights to it's clamd.pid file
231 # So better keep it dir
232 # If it is fixed use of dir will be unecesary
233 install -d $RPM_BUILD_ROOT/var/run/%{name}
234
235 :> $RPM_BUILD_ROOT/var/log/freshclam.log
236
237 %clean
238 rm -rf $RPM_BUILD_ROOT
239
240 %triggerin -- amavis-ng
241 %addusertogroup -q clamav amavis
242
243 %triggerin -- amavisd-new
244 %addusertogroup -q clamav amavis
245
246 %triggerin -- amavisd
247 %addusertogroup -q clamav amavis
248
249 %pre
250 %groupadd -g 43 clamav
251 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
252
253 %post
254 /sbin/chkconfig --add clamd
255 %service clamd restart "Clam Antivirus daemon"
256 touch /var/log/freshclam.log
257 chown clamav:root /var/log/freshclam.log
258 chmod 640 /var/log/freshclam.log
259 %systemd_post clamd.service
260
261 %preun
262 if [ "$1" = "0" ]; then
263         %service clamd stop
264         /sbin/chkconfig --del clamd
265 fi
266 %systemd_preun clamd.service
267
268 %postun
269 if [ "$1" = "0" ]; then
270         %userremove clamav
271         %groupremove clamav
272 fi
273 %systemd_reload
274
275 %triggerpostun -- %{name} < 0.80
276 if [ -f /etc/clamav.conf.rpmsave ]; then
277         echo "Renaming config to new name /etc/clamd.conf"
278         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
279         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
280         echo "Changing config location in freshclam config"
281         %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
282 fi
283
284 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
285 %{__cp} -f /etc/clamd.conf{,.rpmsave}
286 %{__sed} -i -e '
287                 s,^LogSyslog$,& yes,
288                 s,^FixStaleSocket$,& yes,
289                 s,^AllowSupplementaryGroups$,& yes,
290                 s,^ClamukoScanOnOpen$,& yes,
291                 s,^ClamukoScanOnClose$,& yes,
292                 s,^ClamukoScanOnExec$,& yes,
293                 s,^LogTime$,& yes,
294                 s,^ScanPE$,& yes,
295 ' /etc/clamd.conf
296 %banner -e %{name}-0.90 <<EOF
297 ClamAV config was automatically upgraded to 0.90 format. You should review it
298 that it's still valid.
299 EOF
300 #'
301 # unfortunately clamd has no configcheck option so we just have to start it
302 # once again after config was broken after upgrade
303 touch /var/lock/subsys/clamd
304 %service -q clamd restart
305
306 %triggerpostun -- %{name} < 0.97.7-4
307 %systemd_trigger clamd.service
308
309 %post milter
310 /sbin/chkconfig --add clamav-milter
311 %service clamav-milter restart "Clam Antivirus daemon"
312
313 %preun milter
314 if [ "$1" = "0" ]; then
315         %service clamav-milter stop
316         /sbin/chkconfig --del clamav-milter
317 fi
318
319 %post   libs -p /sbin/ldconfig
320 %postun libs -p /sbin/ldconfig
321
322 %files
323 %defattr(644,root,root,755)
324 %doc AUTHORS ChangeLog FAQ NEWS README docs/*.pdf
325 %attr(755,root,root) %{_bindir}/clambc
326 %attr(755,root,root) %{_bindir}/clamdscan
327 %attr(755,root,root) %{_bindir}/clamdtop
328 %attr(755,root,root) %{_bindir}/clamscan
329 %attr(755,root,root) %{_bindir}/clamsubmit
330 %attr(755,root,root) %{_bindir}/freshclam
331 %attr(755,root,root) %{_bindir}/sigtool
332 %attr(755,root,root) %{_bindir}/clamconf
333 %attr(755,root,root) %{_sbindir}/clamd
334 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
335 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
336 %{systemdtmpfilesdir}/%{name}.conf
337 %{systemdunitdir}/clamd.service
338 %attr(755,clamav,root) %dir /var/lib/%{name}
339 %attr(640,clamav,root) %ghost /var/log/freshclam.log
340 %attr(750,clamav,clamav) %dir /var/run/%{name}
341
342 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
343 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
344 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
345
346 %attr(754,root,root) /etc/rc.d/init.d/clamd
347 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
348 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
349 %{_mandir}/man[15]/*
350 %{_mandir}/man8/clamd*
351
352 %if %{with milter}
353 %files milter
354 %defattr(644,root,root,755)
355 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
356 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
357 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
358 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
359 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
360 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
361 %attr(755,root,root) %{_sbindir}/clamav-milter
362 %{_mandir}/man8/clamav-milter.8*
363 %attr(700,clamav,clamav) /var/spool/clamav
364 %endif
365
366 %files libs
367 %defattr(644,root,root,755)
368 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
369 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.6
370 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
371 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.6
372 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
373 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.6
374
375 %files devel
376 %defattr(644,root,root,755)
377 %attr(755,root,root) %{_bindir}/clamav-config
378 %attr(755,root,root) %{_libdir}/libclamav.so
379 %attr(755,root,root) %{_libdir}/libclamunrar.so
380 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
381 %{_libdir}/libclamav.la
382 %{_libdir}/libclamunrar.la
383 %{_libdir}/libclamunrar_iface.la
384 %{_includedir}/clamav.h
385 %{_pkgconfigdir}/libclamav.pc
386
387 %files static
388 %defattr(644,root,root,755)
389 %{_libdir}/libclamav.a
390 %{_libdir}/libclamunrar.a
391 %{_libdir}/libclamunrar_iface.a
This page took 0.081154 seconds and 4 git commands to generate.