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