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