]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- fix tmp files cleaning
[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
13 %ifarch x32
14 %undefine with_llvm
15 %endif
16
17 %bcond_with     system_llvm
18
19 Summary:        An anti-virus utility for Unix
20 Summary(pl.UTF-8):      Narzędzie antywirusowe dla Uniksów
21 Name:           clamav
22 Version:        0.99.3
23 Release:        1
24 License:        GPL v2+
25 Group:          Daemons
26 Source0:        http://www.clamav.net/downloads/production/%{name}-%{version}.tar.gz
27 # Source0-md5:  5272f127312e987b3e10c155cf1d84df
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:         clamav-0.99.2-temp-cleanup.patch
49 URL:            http://www.clamav.net/
50 BuildRequires:  autoconf
51 BuildRequires:  automake
52 BuildRequires:  bzip2-devel
53 BuildRequires:  check-devel
54 BuildRequires:  curl-devel
55 BuildRequires:  gmp-devel
56 BuildRequires:  libltdl-devel
57 %{?with_milter:BuildRequires:   libmilter-devel}
58 BuildRequires:  libstdc++-devel >= 5:3.4
59 BuildRequires:  libtool
60 %{?with_milter:BuildRequires:   libwrap-devel}
61 %{?with_llvm:%{?with_system_llvm:BuildRequires: llvm-devel < 3.7}}
62 BuildRequires:  ncurses-devel
63 BuildRequires:  openssl-devel
64 BuildRequires:  pkgconfig
65 BuildRequires:  rpm >= 4.4.9-56
66 BuildRequires:  rpmbuild(macros) >= 1.647
67 BuildRequires:  zlib-devel
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(triggerpostun):        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.
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 jest potężnym skanerem antywirusowym dla systemów
118 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
119 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
120 Baza wirusów zawiera ponad 90000 sygnatur. Skaner jest wielowątkowy,
121 napisany w C i zgodny z POSIXem.
122
123 %package libs
124 Summary:        Shared libraries for clamav
125 Summary(pl.UTF-8):      Biblioteki dzielone clamav
126 Group:          Libraries
127
128 %description libs
129 Shared libraries for clamav.
130
131 %description libs -l pl.UTF-8
132 Biblioteki dzielone clamav.
133
134 %package milter
135 Summary:        ClamAV filter using milter interface
136 Summary(pl.UTF-8):      Filtr ClamAV korzystający z interfejsu milter
137 Group:          Daemons
138 Requires:       %{name} = %{epoch}:%{version}-%{release}
139 Requires:       postfix
140 #Requires:      sendmail >= 8.11
141 Requires:       tcp_wrappers
142
143 %description milter
144 ClamAV sendmail filter using MILTER interface.
145
146 %description milter -l pl.UTF-8
147 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
148
149 %package devel
150 Summary:        clamav - Development header files and libraries
151 Summary(pl.UTF-8):      clamav - Pliki nagłówkowe i biblioteki dla programistów
152 Group:          Development/Libraries
153 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
154 Requires:       bzip2-devel
155 Requires:       curl-devel
156 Requires:       gmp-devel
157 Requires:       openssl-devel
158 Requires:       zlib-devel
159
160 %description devel
161 This package contains the development header files and libraries
162 necessary to develop clamav client applications.
163
164 %description devel -l pl.UTF-8
165 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
166 klienckich clamav.
167
168 %package static
169 Summary:        clamav static libraries
170 Summary(pl.UTF-8):      Biblioteki statyczne clamav
171 Group:          Development/Libraries
172 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
173
174 %description static
175 clamav static libraries.
176
177 %description static -l pl.UTF-8
178 Biblioteki statyczne clamav.
179
180 %prep
181 %setup -q
182 %patch0 -p1
183 %patch1 -p1
184 %if "%{pld_release}" == "ac"
185 %patch2 -p1
186 %endif
187 %if "%{pld_release}" != "ac"
188 %patch3 -p1
189 %endif
190 #%patch4 -p1
191 %patch5 -p1
192 %patch6 -p1
193 %patch7 -p1
194
195 %build
196 export CFLAGS="%{rpmcflags} -Wall -W -Wmissing-prototypes -Wmissing-declarations -std=gnu99"
197 export CXXFLAGS="%{rpmcxxflags} -std=gnu++98"
198 %{__libtoolize}
199 %{__aclocal} -I m4
200 %{__autoconf}
201 %{__autoheader}
202 %{__automake}
203 %configure \
204         --disable-zlib-vcheck \
205         --disable-silent-rules \
206         --disable-clamav \
207         --enable-clamdtop \
208         %{?with_llvm:--enable-llvm %{?with_system_llvm:--with-system-llvm}} \
209         %{?with_milter:--enable-milter} \
210         --with-dbdir=/var/lib/%{name} \
211         --with-no-cache \
212         --with-ltdl-include=%{_includedir} \
213         --with-ltdl-lib=%{_libdir}
214
215 %{__make} \
216         LIBTOOL=%{_bindir}/libtool
217
218 %install
219 rm -rf $RPM_BUILD_ROOT
220 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
221         $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
222         $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
223         $RPM_BUILD_ROOT%{systemdunitdir}
224
225 %{__make} install \
226         LIBTOOL=%{_bindir}/libtool \
227         DESTDIR=$RPM_BUILD_ROOT
228 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
229
230 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
231 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
232 EOF
233
234 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
235 %if %{with milter}
236 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
237 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
238 %endif
239 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
240 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
241 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
242         mv $i ${i%%.sample}
243 done
244 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
245
246 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
247
248 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
249
250 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
251 cp -p %{SOURCE12} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.timer
252 sed -e's#@sbindir@#%{_sbindir}#' <  %{SOURCE13} > $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.service
253
254 # NOTE: clamd uses sane rights to it's clamd.pid file
255 # So better keep it dir
256 # If it is fixed use of dir will be unecesary
257 install -d $RPM_BUILD_ROOT/var/run/%{name}
258
259 :> $RPM_BUILD_ROOT/var/log/freshclam.log
260
261 %clean
262 rm -rf $RPM_BUILD_ROOT
263
264 %triggerin -- amavis-ng
265 %addusertogroup -q clamav amavis
266
267 %triggerin -- amavisd-new
268 %addusertogroup -q clamav amavis
269
270 %triggerin -- amavisd
271 %addusertogroup -q clamav amavis
272
273 %pre
274 %groupadd -g 43 clamav
275 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
276
277 %post
278 /sbin/chkconfig --add clamd
279 %service clamd restart "Clam Antivirus daemon"
280 touch /var/log/freshclam.log
281 chown clamav:root /var/log/freshclam.log
282 chmod 640 /var/log/freshclam.log
283 %systemd_post clamd.service cronjob-clamav.timer
284
285 %preun
286 if [ "$1" = "0" ]; then
287         %service clamd stop
288         /sbin/chkconfig --del clamd
289 fi
290 %systemd_preun clamd.service cronjob-clamav.timer
291
292 %postun
293 if [ "$1" = "0" ]; then
294         %userremove clamav
295         %groupremove clamav
296 fi
297 %systemd_reload
298
299 %triggerpostun -- %{name} < 0.80
300 if [ -f /etc/clamav.conf.rpmsave ]; then
301         echo "Renaming config to new name /etc/clamd.conf"
302         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
303         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
304         echo "Changing config location in freshclam config"
305         %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
306 fi
307
308 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
309 %{__cp} -f /etc/clamd.conf{,.rpmsave}
310 %{__sed} -i -e '
311                 s,^LogSyslog$,& yes,
312                 s,^FixStaleSocket$,& yes,
313                 s,^AllowSupplementaryGroups$,& yes,
314                 s,^ClamukoScanOnOpen$,& yes,
315                 s,^ClamukoScanOnClose$,& yes,
316                 s,^ClamukoScanOnExec$,& yes,
317                 s,^LogTime$,& yes,
318                 s,^ScanPE$,& yes,
319 ' /etc/clamd.conf
320 %banner -e %{name}-0.90 <<EOF
321 ClamAV config was automatically upgraded to 0.90 format. You should review it
322 that it's still valid.
323 EOF
324 #'
325 # unfortunately clamd has no configcheck option so we just have to start it
326 # once again after config was broken after upgrade
327 touch /var/lock/subsys/clamd
328 %service -q clamd restart
329
330 %triggerpostun -- %{name} < 0.97.7-4
331 %systemd_trigger clamd.service
332
333 %triggerpostun -- %{name} < 0.99.2-2
334 %systemd_service_enable cronjob-clamav.timer
335
336 %post milter
337 /sbin/chkconfig --add clamav-milter
338 %service clamav-milter restart "Clam Antivirus daemon"
339
340 %preun milter
341 if [ "$1" = "0" ]; then
342         %service clamav-milter stop
343         /sbin/chkconfig --del clamav-milter
344 fi
345
346 %post   libs -p /sbin/ldconfig
347 %postun libs -p /sbin/ldconfig
348
349 %files
350 %defattr(644,root,root,755)
351 %doc AUTHORS ChangeLog FAQ NEWS README docs/*.pdf
352 %attr(755,root,root) %{_bindir}/clambc
353 %attr(755,root,root) %{_bindir}/clamdscan
354 %attr(755,root,root) %{_bindir}/clamdtop
355 %attr(755,root,root) %{_bindir}/clamscan
356 %attr(755,root,root) %{_bindir}/clamsubmit
357 %attr(755,root,root) %{_bindir}/freshclam
358 %attr(755,root,root) %{_bindir}/sigtool
359 %attr(755,root,root) %{_bindir}/clamconf
360 %attr(755,root,root) %{_sbindir}/clamd
361 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
362 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
363 %{systemdtmpfilesdir}/%{name}.conf
364 %{systemdunitdir}/clamd.service
365 %{systemdunitdir}/cronjob-clamav.service
366 %{systemdunitdir}/cronjob-clamav.timer
367 %attr(755,clamav,root) %dir /var/lib/%{name}
368 %attr(640,clamav,root) %ghost /var/log/freshclam.log
369 %attr(750,clamav,clamav) %dir /var/run/%{name}
370
371 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
372 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
373 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
374
375 %attr(754,root,root) /etc/rc.d/init.d/clamd
376 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
377 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
378 %{_mandir}/man1/*
379 %{_mandir}/man5/clamd*
380 %{_mandir}/man5/freshclam*
381 %{_mandir}/man8/clamd*
382
383 %if %{with milter}
384 %files milter
385 %defattr(644,root,root,755)
386 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
387 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
388 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
389 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
390 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
391 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
392 %attr(755,root,root) %{_sbindir}/clamav-milter
393 %{_mandir}/man5/clamav-milter*
394 %{_mandir}/man8/clamav-milter.8*
395 %attr(700,clamav,clamav) /var/spool/clamav
396 %endif
397
398 %files libs
399 %defattr(644,root,root,755)
400 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
401 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.7
402 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
403 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.7
404 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
405 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.7
406
407 %files devel
408 %defattr(644,root,root,755)
409 %attr(755,root,root) %{_bindir}/clamav-config
410 %attr(755,root,root) %{_libdir}/libclamav.so
411 %attr(755,root,root) %{_libdir}/libclamunrar.so
412 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
413 %{_libdir}/libclamav.la
414 %{_libdir}/libclamunrar.la
415 %{_libdir}/libclamunrar_iface.la
416 %{_includedir}/clamav.h
417 %{_pkgconfigdir}/libclamav.pc
418
419 %files static
420 %defattr(644,root,root,755)
421 %{_libdir}/libclamav.a
422 %{_libdir}/libclamunrar.a
423 %{_libdir}/libclamunrar_iface.a
This page took 0.127651 seconds and 4 git commands to generate.