]> git.pld-linux.org Git - packages/clamav.git/blob - clamav.spec
- undefine llvm for x32 and properly for ac
[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
9 %if "%{pld_release}" == "ac"
10 %undefine with_llvm
11 %endif
12
13 %ifarch x32
14 %undefine with_llvm
15 %endif
16
17 Summary:        An anti-virus utility for Unix
18 Summary(pl.UTF-8):      Narzędzie antywirusowe dla Uniksów
19 Name:           clamav
20 Version:        0.98.7
21 Release:        2
22 License:        GPL v2+
23 Group:          Daemons
24 Source0:        http://downloads.sourceforge.net/clamav/%{name}-%{version}.tar.gz
25 # Source0-md5:  157c601161da1c2d5a0e48ea1b49e067
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 Source10:       %{name}.tmpfiles
34 Source11:       clamd.service
35 Patch0:         %{name}-pld_config.patch
36 Patch1:         %{name}-nolibs.patch
37 %if "%{pld_release}" == "ac"
38 Patch2:         am-nosilentrules.patch
39 %endif
40 Patch3:         ac2.68.patch
41 Patch4:         %{name}-openssl.patch
42 Patch5:         %{name}-major.patch
43 URL:            http://www.clamav.net/
44 BuildRequires:  autoconf
45 BuildRequires:  automake
46 BuildRequires:  bzip2-devel
47 BuildRequires:  curl-devel
48 BuildRequires:  gmp-devel
49 BuildRequires:  libltdl-devel
50 %{?with_milter:BuildRequires:   libmilter-devel}
51 BuildRequires:  libstdc++-devel
52 BuildRequires:  libtool
53 %{?with_milter:BuildRequires:   libwrap-devel}
54 %{?with_llvm:BuildRequires:     llvm-devel}
55 BuildRequires:  ncurses-devel
56 BuildRequires:  openssl-devel
57 BuildRequires:  rpm >= 4.4.9-56
58 BuildRequires:  rpmbuild(macros) >= 1.647
59 BuildRequires:  zlib-devel
60 Requires(post,preun):   /sbin/chkconfig
61 Requires(postun):       /usr/sbin/groupdel
62 Requires(postun):       /usr/sbin/userdel
63 Requires(postun,pre):   /usr/sbin/usermod
64 Requires(pre):  /bin/id
65 Requires(pre):  /usr/bin/getgid
66 Requires(pre):  /usr/sbin/groupadd
67 Requires(pre):  /usr/sbin/useradd
68 Requires(post,preun,postun):    systemd-units >= 38
69 Requires:       systemd-units >= 38
70 Requires(triggerpostun):        sed >= 4.0
71 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
72 Requires:       /usr/sbin/usermod
73 Requires:       rc-scripts >= 0.4.1.23
74 Suggests:       clamav-database
75 Suggests:       crondaemon
76 Provides:       group(clamav)
77 Provides:       user(clamav)
78 Conflicts:      logrotate < 3.7-4
79 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
80
81 %description
82 Clam AntiVirus is an open source anti-virus toolkit for UNIX, designed
83 especially for e-mail scanning on mail gateways. It provides a number
84 of utilities including a flexible and scalable multi-threaded daemon,
85 a command line scanner and advanced tool for automatic database
86 updates. The core of the package is an anti-virus engine available in
87 a form of shared library.
88
89 Here is a list of the main features:
90 - command-line scanner
91 - fast, multi-threaded daemon with support for on-access scanning
92 - milter interface for sendmail
93 - advanced database updater with support for scripted updates and
94   digital signatures
95 - virus scanner C library
96 - on-access scanning (Linux® and FreeBSD®)
97 - virus database updated multiple times per day (see home page for
98   total number of signatures)
99 - built-in support for various archive formats, including Zip, RAR,
100   Tar, Gzip, Bzip2, OLE2, Cabinet, CHM, BinHex, SIS and others
101 - built-in support for almost all mail file formats
102 - built-in support for ELF executables and Portable Executable files
103   compressed with UPX, FSG, Petite, NsPack, wwpack32, MEW, Upack and
104   obfuscated with SUE, Y0da Cryptor and others
105 - built-in support for popular document formats including MS Office
106   and MacOffice files, HTML, RTF and PDF
107
108 %description -l pl.UTF-8
109 Clam Antivirus jest potężnym skanerem antywirusowym dla systemów
110 uniksowych. Wspiera on AMaViSa, skompresowane pliki, skanowanie
111 "on-access" i posiada system bezpiecznej, automatycznej aktualizacji.
112 Baza wirusów zawiera ponad 90000 sygnatur. Skaner jest wielowątkowy,
113 napisany w C i zgodny z POSIXem.
114
115 %package libs
116 Summary:        Shared libraries for clamav
117 Summary(pl.UTF-8):      Biblioteki dzielone clamav
118 Group:          Libraries
119
120 %description libs
121 Shared libraries for clamav.
122
123 %description libs -l pl.UTF-8
124 Biblioteki dzielone clamav.
125
126 %package milter
127 Summary:        ClamAV filter using milter interface
128 Summary(pl.UTF-8):      Filtr ClamAV korzystający z interfejsu milter
129 Group:          Daemons
130 Requires:       %{name} = %{epoch}:%{version}-%{release}
131 Requires:       postfix
132 #Requires:      sendmail >= 8.11
133 Requires:       tcp_wrappers
134
135 %description milter
136 ClamAV sendmail filter using MILTER interface.
137
138 %description milter -l pl.UTF-8
139 Filtr ClamAV dla sendmaila korzystający z interfejsu MILTER.
140
141 %package devel
142 Summary:        clamav - Development header files and libraries
143 Summary(pl.UTF-8):      clamav - Pliki nagłówkowe i biblioteki dla programistów
144 Group:          Development/Libraries
145 Requires:       %{name}-libs = %{epoch}:%{version}-%{release}
146 Requires:       bzip2-devel
147 Requires:       curl-devel
148 Requires:       gmp-devel
149 Requires:       openssl-devel
150 Requires:       zlib-devel
151
152 %description devel
153 This package contains the development header files and libraries
154 necessary to develop clamav client applications.
155
156 %description devel -l pl.UTF-8
157 Pliki nagłówkowe i biblioteki konieczne do kompilacji aplikacji
158 klienckich clamav.
159
160 %package static
161 Summary:        clamav static libraries
162 Summary(pl.UTF-8):      Biblioteki statyczne clamav
163 Group:          Development/Libraries
164 Requires:       %{name}-devel = %{epoch}:%{version}-%{release}
165
166 %description static
167 clamav static libraries.
168
169 %description static -l pl.UTF-8
170 Biblioteki statyczne clamav.
171
172 %prep
173 %setup -q
174 %patch0 -p1
175 %patch1 -p1
176 %if "%{pld_release}" == "ac"
177 %patch2 -p1
178 %endif
179 %if "%{pld_release}" != "ac"
180 %patch3 -p1
181 %endif
182 #%patch4 -p1
183 %patch5 -p1
184
185 %build
186 %{__libtoolize}
187 %{__aclocal} -I m4
188 %{__autoconf}
189 %{__autoheader}
190 %{__automake}
191 %configure \
192         --disable-silent-rules \
193         --disable-clamav \
194         --enable-clamdtop \
195         %{?with_llvm:--enable-llvm --with-system-llvm} \
196         %{?with_milter:--enable-milter} \
197         --with-dbdir=/var/lib/%{name} \
198         --with-no-cache \
199         --with-ltdl-include=%{_includedir} \
200         --with-ltdl-lib=%{_libdir}
201
202 %{__make} \
203         LIBTOOL=%{_bindir}/libtool
204
205 %install
206 rm -rf $RPM_BUILD_ROOT
207 install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,rc.d/init.d,sysconfig} \
208         $RPM_BUILD_ROOT%{_var}/{log,spool/clamav,lib/clamav} \
209         $RPM_BUILD_ROOT%{systemdtmpfilesdir} \
210         $RPM_BUILD_ROOT%{systemdunitdir}
211
212 %{__make} install \
213         LIBTOOL=%{_bindir}/libtool \
214         DESTDIR=$RPM_BUILD_ROOT
215 %{!?with_milter:rm -f $RPM_BUILD_ROOT%{_mandir}/man8/clamav-milter.8*}
216
217 cat <<'EOF' >$RPM_BUILD_ROOT/etc/cron.d/%{name}
218 5 * * * *       root    %{_sbindir}/clamav-cron-updatedb
219 EOF
220
221 install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamd
222 %if %{with milter}
223 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/clamav-milter
224 cp -p %{SOURCE9} $RPM_BUILD_ROOT/etc/sysconfig/clamav-milter
225 %endif
226 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/clamd
227 install -p %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/clamav-cron-updatedb
228 for i in $RPM_BUILD_ROOT%{_sysconfdir}/*.conf.sample; do
229         mv $i ${i%%.sample}
230 done
231 cp -p %{SOURCE5} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
232
233 install -p %{SOURCE8} $RPM_BUILD_ROOT%{_sbindir}
234
235 cp -p %{SOURCE10} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
236
237 cp -p %{SOURCE11} $RPM_BUILD_ROOT%{systemdunitdir}
238
239 # NOTE: clamd uses sane rights to it's clamd.pid file
240 # So better keep it dir
241 # If it is fixed use of dir will be unecesary
242 install -d $RPM_BUILD_ROOT/var/run/%{name}
243
244 :> $RPM_BUILD_ROOT/var/log/freshclam.log
245
246 %clean
247 rm -rf $RPM_BUILD_ROOT
248
249 %triggerin -- amavis-ng
250 %addusertogroup -q clamav amavis
251
252 %triggerin -- amavisd-new
253 %addusertogroup -q clamav amavis
254
255 %triggerin -- amavisd
256 %addusertogroup -q clamav amavis
257
258 %pre
259 %groupadd -g 43 clamav
260 %useradd -u 43 -d /tmp -s /bin/false -c "Clam Anti Virus Checker" -g clamav clamav
261
262 %post
263 /sbin/chkconfig --add clamd
264 %service clamd restart "Clam Antivirus daemon"
265 touch /var/log/freshclam.log
266 chown clamav:root /var/log/freshclam.log
267 chmod 640 /var/log/freshclam.log
268 %systemd_post clamd.service
269
270 %preun
271 if [ "$1" = "0" ]; then
272         %service clamd stop
273         /sbin/chkconfig --del clamd
274 fi
275 %systemd_preun clamd.service
276
277 %postun
278 if [ "$1" = "0" ]; then
279         %userremove clamav
280         %groupremove clamav
281 fi
282 %systemd_reload
283
284 %triggerpostun -- %{name} < 0.80
285 if [ -f /etc/clamav.conf.rpmsave ]; then
286         echo "Renaming config to new name /etc/clamd.conf"
287         mv -f /etc/clamd.conf /etc/clamd.conf.rpmnew
288         mv -f /etc/clamav.conf.rpmsave /etc/clamd.conf
289         echo "Changing config location in freshclam config"
290         %{__sed} -i -e 's/clamav.conf/clamd.conf/' /etc/freshclam.conf
291 fi
292
293 %triggerpostun -- %{name} < 0.90-0.rc2.0.10
294 %{__cp} -f /etc/clamd.conf{,.rpmsave}
295 %{__sed} -i -e '
296                 s,^LogSyslog$,& yes,
297                 s,^FixStaleSocket$,& yes,
298                 s,^AllowSupplementaryGroups$,& yes,
299                 s,^ClamukoScanOnOpen$,& yes,
300                 s,^ClamukoScanOnClose$,& yes,
301                 s,^ClamukoScanOnExec$,& yes,
302                 s,^LogTime$,& yes,
303                 s,^ScanPE$,& yes,
304 ' /etc/clamd.conf
305 %banner -e %{name}-0.90 <<EOF
306 ClamAV config was automatically upgraded to 0.90 format. You should review it
307 that it's still valid.
308 EOF
309 #'
310 # unfortunately clamd has no configcheck option so we just have to start it
311 # once again after config was broken after upgrade
312 touch /var/lock/subsys/clamd
313 %service -q clamd restart
314
315 %triggerpostun -- %{name} < 0.97.7-4
316 %systemd_trigger clamd.service
317
318 %post milter
319 /sbin/chkconfig --add clamav-milter
320 %service clamav-milter restart "Clam Antivirus daemon"
321
322 %preun milter
323 if [ "$1" = "0" ]; then
324         %service clamav-milter stop
325         /sbin/chkconfig --del clamav-milter
326 fi
327
328 %post   libs -p /sbin/ldconfig
329 %postun libs -p /sbin/ldconfig
330
331 %files
332 %defattr(644,root,root,755)
333 %doc AUTHORS ChangeLog FAQ NEWS README docs/*.pdf
334 %attr(755,root,root) %{_bindir}/clambc
335 %attr(755,root,root) %{_bindir}/clamdscan
336 %attr(755,root,root) %{_bindir}/clamdtop
337 %attr(755,root,root) %{_bindir}/clamscan
338 %attr(755,root,root) %{_bindir}/clamsubmit
339 %attr(755,root,root) %{_bindir}/freshclam
340 %attr(755,root,root) %{_bindir}/sigtool
341 %attr(755,root,root) %{_bindir}/clamconf
342 %attr(755,root,root) %{_sbindir}/clamd
343 %attr(755,root,root) %{_sbindir}/clamav-cron-updatedb
344 %attr(755,root,root) %{_sbindir}/clamav-post-updatedb
345 %{systemdtmpfilesdir}/%{name}.conf
346 %{systemdunitdir}/clamd.service
347 %attr(755,clamav,root) %dir /var/lib/%{name}
348 %attr(640,clamav,root) %ghost /var/log/freshclam.log
349 %attr(750,clamav,clamav) %dir /var/run/%{name}
350
351 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
352 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamd.conf
353 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/freshclam.conf
354
355 %attr(754,root,root) /etc/rc.d/init.d/clamd
356 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamd
357 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/clamav
358 %{_mandir}/man[15]/*
359 %{_mandir}/man8/clamd*
360
361 %if %{with milter}
362 %files milter
363 %defattr(644,root,root,755)
364 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clamav-milter
365 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/clamav-milter.conf
366 %attr(754,root,root) /etc/rc.d/init.d/clamav-milter
367 #%attr(755,root,root) %{_sysconfdir}/cron.daily/clamav-milter
368 #%attr(755,root,root) %{_sysconfdir}/log.d/scripts/services/clamav-milter
369 #%{_sysconfdir}/log.d/conf/services/clamav-milter.conf
370 %attr(755,root,root) %{_sbindir}/clamav-milter
371 %{_mandir}/man8/clamav-milter.8*
372 %attr(700,clamav,clamav) /var/spool/clamav
373 %endif
374
375 %files libs
376 %defattr(644,root,root,755)
377 %attr(755,root,root) %{_libdir}/libclamav.so.*.*.*
378 %attr(755,root,root) %ghost %{_libdir}/libclamav.so.6
379 %attr(755,root,root) %{_libdir}/libclamunrar.so.*.*.*
380 %attr(755,root,root) %ghost %{_libdir}/libclamunrar.so.6
381 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so.*.*.*
382 %attr(755,root,root) %ghost %{_libdir}/libclamunrar_iface.so.6
383
384 %files devel
385 %defattr(644,root,root,755)
386 %attr(755,root,root) %{_bindir}/clamav-config
387 %attr(755,root,root) %{_libdir}/libclamav.so
388 %attr(755,root,root) %{_libdir}/libclamunrar.so
389 %attr(755,root,root) %{_libdir}/libclamunrar_iface.so
390 %{_libdir}/libclamav.la
391 %{_libdir}/libclamunrar.la
392 %{_libdir}/libclamunrar_iface.la
393 %{_includedir}/clamav.h
394 %{_pkgconfigdir}/libclamav.pc
395
396 %files static
397 %defattr(644,root,root,755)
398 %{_libdir}/libclamav.a
399 %{_libdir}/libclamunrar.a
400 %{_libdir}/libclamunrar_iface.a
This page took 0.094753 seconds and 3 git commands to generate.