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