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