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