clamav/clamav.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 498
c6b0e6c7f67d
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

michael@226 1 ##
michael@226 2 ## clamav.spec -- OpenPKG RPM Package Specification
michael@226 3 ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@226 4 ##
michael@226 5 ## Permission to use, copy, modify, and distribute this software for
michael@226 6 ## any purpose with or without fee is hereby granted, provided that
michael@226 7 ## the above copyright notice and this permission notice appear in all
michael@226 8 ## copies.
michael@226 9 ##
michael@226 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@226 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@226 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@226 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@226 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@226 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@226 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@226 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@226 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@226 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@226 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@226 21 ## SUCH DAMAGE.
michael@226 22 ##
michael@226 23
michael@393 24 # MSvB FIXME:
michael@393 25 # MSvB FIXME: Problem with logging to syslog instead of FSL...
michael@393 26 # MSvB FIXME:
michael@393 27 # MSvB FIXME: Oct 2 10:15:47 host.name.tld clamav-milter[25958]: [ID 909925 user.error] ClamAV: thread_create() failed: 11, try again
michael@393 28 # MSvB FIXME: Oct 2 10:17:28 host.name.tld last message repeated 1 time
michael@393 29 # MSvB FIXME:
michael@393 30
michael@226 31 # package information
michael@226 32 Name: clamav
michael@226 33 Summary: Clam Antivirus
michael@226 34 URL: http://www.clamav.net/
michael@226 35 Vendor: Tomasz Kojm
michael@226 36 Packager: OpenPKG Foundation e.V.
michael@226 37 Distribution: OpenPKG Community
michael@226 38 Class: EVAL
michael@226 39 Group: AntiVirus
michael@226 40 License: GPL
michael@498 41 Version: 0.97.5
michael@498 42 Release: 20120800
michael@226 43
michael@226 44 # package options
michael@226 45 %option with_milter no
michael@226 46
michael@226 47 # list of sources
michael@226 48 Source0: http://switch.dl.sourceforge.net/clamav/clamav-%{version}.tar.gz
michael@226 49 Source1: rc.clamav
michael@226 50 Patch0: clamav.patch
michael@226 51
michael@226 52 # build information
michael@498 53 BuildPreReq: OpenPKG, openpkg >= 20100101, gcc, bzip2, pkgconfig, bc
michael@498 54 PreReq: OpenPKG, openpkg >= 20100101
michael@226 55 BuildPreReq: zlib, bzip2, curl, gmp, libiconv, openssl
michael@226 56 PreReq: zlib, bzip2, curl, gmp, libiconv, openssl
michael@226 57 %if "%{with_milter}" == "yes"
michael@226 58 BuildPreReq: milter
michael@226 59 PreReq: milter
michael@226 60 %endif
michael@226 61
michael@226 62 %description
michael@226 63 Clam AntiVirus is an anti-virus toolkit for UNIX. The main
michael@226 64 purpose of this software is the integration with mail servers
michael@226 65 (attachment scanning). The package provides a flexible and scalable
michael@226 66 multi-threaded daemon, a command line scanner, and a tool for
michael@226 67 automatic updating via Internet. The programs are based on a shared
michael@226 68 library distributed with the Clam AntiVirus package, which you can
michael@226 69 use with your own software. The virus database is based on the virus
michael@226 70 database from OpenAntiVirus, but contains additional signatures.
michael@226 71
michael@226 72 %track
michael@226 73 prog clamav = {
michael@226 74 version = %{version}
michael@226 75 url = http://sourceforge.net/projects/clamav/files/
michael@226 76 regex = clamav-(\d+\.\d+(\.\d+)*)\.tar\.gz
michael@226 77 }
michael@226 78
michael@226 79 %prep
michael@226 80 %setup -q
michael@226 81 %patch -p0
michael@498 82 %{l_shtool} subst \
michael@498 83 -e 's;lib\(milter/mfapi.h\);\1;' \
michael@498 84 configure
michael@674 85 %{l_shtool} subst \
michael@674 86 -e 's;test -s *\(.*\) *-a -s;test -e \1 -a -e;' \
michael@674 87 database/Makefile.in
michael@226 88
michael@226 89 %build
michael@226 90 # configure package
michael@226 91 CC="%{l_cc}" \
michael@226 92 CFLAGS="%{l_cflags -O}" \
michael@226 93 CPPFLAGS="%{l_cppflags}" \
michael@226 94 LDFLAGS="%{l_ldflags}" \
michael@226 95 GREP="grep" \
michael@226 96 ./configure \
michael@226 97 --prefix=%{l_prefix} \
michael@498 98 --libdir=%{l_prefix}/lib \
michael@226 99 --mandir=%{l_prefix}/man \
michael@226 100 --sysconfdir=%{l_prefix}/etc/clamav \
michael@226 101 --with-zlib=%{l_prefix} \
michael@226 102 --with-libcurl \
michael@226 103 --with-user=%{l_rusr} \
michael@226 104 --with-group=%{l_rgrp} \
michael@226 105 --without-tcpwrappers \
michael@226 106 --disable-clamav \
michael@226 107 --disable-clamuko \
michael@226 108 --disable-urandom \
michael@226 109 --disable-cr \
michael@226 110 %if "%{with_milter}" == "yes"
michael@226 111 --enable-milter \
michael@226 112 --with-sendmail=/dev/null \
michael@226 113 %else
michael@226 114 --disable-milter \
michael@226 115 %endif
michael@226 116 --disable-unrar \
michael@226 117 --disable-shared
michael@226 118
michael@226 119 # build package
michael@226 120 %{l_make} %{l_mflags -O}
michael@226 121
michael@226 122 %install
michael@226 123 # perform standard package installation
michael@498 124 %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
michael@226 125
michael@226 126 # install default configuration
michael@226 127 %{l_shtool} mkdir -f -p -m 755 \
michael@226 128 $RPM_BUILD_ROOT%{l_prefix}/etc/clamav
michael@226 129 %{l_shtool} install -c -m 644 \
michael@226 130 -e 's;^\(Example\);#\1;' \
michael@226 131 -e 's;^#\(LogFile\) /.*;\1 %{l_prefix}/var/clamav/clamd.log;' \
michael@226 132 -e 's;^#\(LogTime.*\);\1;' \
michael@226 133 -e 's;^#\(PidFile\).*;\1 %{l_prefix}/var/clamav/clamd.pid;' \
michael@226 134 -e 's;^\(LocalSocket\).*;\1 %{l_prefix}/var/clamav/clamd.sock;' \
michael@226 135 -e 's;^#\(FixStaleSocket.*\);\1;' \
michael@226 136 -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
michael@226 137 -e 's;^#\(User\).*;\1 %{l_rusr};' \
michael@226 138 etc/clamd.conf \
michael@226 139 $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
michael@226 140 %{l_shtool} install -c -m 644 \
michael@226 141 -e 's;^\(Example\);#\1;' \
michael@226 142 -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
michael@226 143 -e 's;^#\(UpdateLogFile\).*;\1 %{l_prefix}/var/clamav/freshclam.log;' \
michael@226 144 -e 's;^#\(NotifyClamd\).*;\1 %{l_prefix}/etc/clamav/clamd.conf;' \
michael@226 145 etc/freshclam.conf \
michael@226 146 $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
michael@226 147
michael@226 148 # install run-command script
michael@226 149 %{l_shtool} mkdir -f -p -m 755 \
michael@226 150 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@226 151 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@226 152 %{SOURCE rc.clamav} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@226 153
michael@226 154 # strip-down installation hierarchy
michael@226 155 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@226 156 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
michael@226 157 %if "%{with_milter}" == "no"
michael@226 158 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/clamav-milter.8
michael@226 159 %endif
michael@226 160
michael@226 161 # create additional installation directory
michael@226 162 %{l_shtool} mkdir -f -p -m 755 \
michael@226 163 $RPM_BUILD_ROOT%{l_prefix}/var/clamav
michael@226 164
michael@226 165 # determine installation files
michael@226 166 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
michael@226 167 %{l_files_std} \
michael@226 168 '%config %{l_prefix}/etc/clamav/*.conf' \
michael@674 169 '%attr(755,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/clamav' \
michael@674 170 '%attr(755,%{l_rusr},%{l_mgrp}) %{l_prefix}/share/clamav'
michael@226 171
michael@226 172 %files -f files
michael@226 173
michael@226 174 %clean
michael@226 175
michael@226 176 %pre
michael@226 177 # before upgrade, save status and stop service
michael@226 178 [ $1 -eq 2 ] || exit 0
michael@226 179 eval `%{l_rc} clamav status 2>/dev/null | tee %{l_tmpfile}`
michael@226 180 %{l_rc} clamav stop 2>/dev/null
michael@226 181 exit 0
michael@226 182
michael@226 183 %post
michael@226 184 if [ $1 -eq 2 ]; then
michael@226 185 # after upgrade, restore status
michael@226 186 eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
michael@226 187 [ ".$clamav_active" = .yes ] && %{l_rc} clamav start
michael@226 188 fi
michael@226 189 exit 0
michael@226 190
michael@226 191 %preun
michael@226 192 # before erase, stop service and remove log files
michael@226 193 [ $1 -eq 0 ] || exit 0
michael@226 194 %{l_rc} clamav stop 2>/dev/null
michael@226 195 rm -f $RPM_INSTALL_PREFIX/var/clamav/*.log* >/dev/null 2>&1 || true
michael@226 196 exit 0
michael@226 197

mercurial