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