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