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.

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

mercurial