clamav/clamav.spec

Fri, 22 Oct 2010 19:54:57 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 22 Oct 2010 19:54:57 +0200
changeset 281
acad5c9dea5f
parent 233
f5f6e93f3dc6
child 393
9bafbc9da865
permissions
-rw-r--r--

Correct dependencies and use a canonical package name.

     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 #   package information
    25 Name:         clamav
    26 Summary:      Clam Antivirus
    27 URL:          http://www.clamav.net/
    28 Vendor:       Tomasz Kojm
    29 Packager:     OpenPKG Foundation e.V.
    30 Distribution: OpenPKG Community
    31 Class:        EVAL
    32 Group:        AntiVirus
    33 License:      GPL
    34 Version:      0.95.3
    35 Release:      20091102
    37 #   package options
    38 %option       with_milter  no
    40 #   list of sources
    41 Source0:      http://switch.dl.sourceforge.net/clamav/clamav-%{version}.tar.gz
    42 Source1:      rc.clamav
    43 Patch0:       clamav.patch
    45 #   build information
    46 Prefix:       %{l_prefix}
    47 BuildRoot:    %{l_buildroot}
    48 BuildPreReq:  OpenPKG, openpkg >= 20060823, gcc, bzip2, pkgconfig, bc
    49 PreReq:       OpenPKG, openpkg >= 20060823
    50 BuildPreReq:  zlib, bzip2, curl, gmp, libiconv, openssl
    51 PreReq:       zlib, bzip2, curl, gmp, libiconv, openssl
    52 %if "%{with_milter}" == "yes"
    53 BuildPreReq:  milter
    54 PreReq:       milter
    55 %endif
    56 AutoReq:      no
    57 AutoReqProv:  no
    59 %description
    60     Clam AntiVirus is an anti-virus toolkit for UNIX. The main
    61     purpose of this software is the integration with mail servers
    62     (attachment scanning). The package provides a flexible and scalable
    63     multi-threaded daemon, a command line scanner, and a tool for
    64     automatic updating via Internet. The programs are based on a shared
    65     library distributed with the Clam AntiVirus package, which you can
    66     use with your own software. The virus database is based on the virus
    67     database from OpenAntiVirus, but contains additional signatures.
    69 %track
    70     prog clamav = {
    71         version   = %{version}
    72         url       = http://sourceforge.net/projects/clamav/files/
    73         regex     = clamav-(\d+\.\d+(\.\d+)*)\.tar\.gz
    74     }
    76 %prep
    77     %setup -q
    78     %patch -p0
    80 %build
    81     #   configure package
    82     CC="%{l_cc}" \
    83     CFLAGS="%{l_cflags -O}" \
    84     CPPFLAGS="%{l_cppflags}" \
    85     LDFLAGS="%{l_ldflags}" \
    86     GREP="grep" \
    87     ./configure \
    88         --prefix=%{l_prefix} \
    89         --mandir=%{l_prefix}/man \
    90         --sysconfdir=%{l_prefix}/etc/clamav \
    91         --with-zlib=%{l_prefix} \
    92         --with-libcurl \
    93         --with-user=%{l_rusr} \
    94         --with-group=%{l_rgrp} \
    95         --without-tcpwrappers \
    96         --disable-clamav \
    97         --disable-clamuko \
    98         --disable-urandom \
    99         --disable-cr \
   100 %if "%{with_milter}" == "yes"
   101         --enable-milter \
   102         --with-sendmail=/dev/null \
   103 %else
   104         --disable-milter \
   105 %endif
   106         --disable-unrar \
   107         --disable-shared
   109     #   build package
   110     %{l_make} %{l_mflags -O}
   112 %install
   113     rm -rf $RPM_BUILD_ROOT
   115     #   perform standard package installation
   116     %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
   118     #   install default configuration
   119     %{l_shtool} mkdir -f -p -m 755 \
   120         $RPM_BUILD_ROOT%{l_prefix}/etc/clamav
   121     %{l_shtool} install -c -m 644 \
   122         -e 's;^\(Example\);#\1;' \
   123         -e 's;^#\(LogFile\) /.*;\1 %{l_prefix}/var/clamav/clamd.log;' \
   124         -e 's;^#\(LogTime.*\);\1;' \
   125         -e 's;^#\(PidFile\).*;\1 %{l_prefix}/var/clamav/clamd.pid;' \
   126         -e 's;^\(LocalSocket\).*;\1 %{l_prefix}/var/clamav/clamd.sock;' \
   127         -e 's;^#\(FixStaleSocket.*\);\1;' \
   128         -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
   129         -e 's;^#\(User\).*;\1 %{l_rusr};' \
   130         etc/clamd.conf \
   131         $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
   132     %{l_shtool} install -c -m 644 \
   133         -e 's;^\(Example\);#\1;' \
   134         -e 's;^#\(DatabaseDirectory\).*;\1 %{l_prefix}/share/clamav;' \
   135         -e 's;^#\(UpdateLogFile\).*;\1 %{l_prefix}/var/clamav/freshclam.log;' \
   136         -e 's;^#\(NotifyClamd\).*;\1 %{l_prefix}/etc/clamav/clamd.conf;' \
   137         etc/freshclam.conf \
   138         $RPM_BUILD_ROOT%{l_prefix}/etc/clamav/
   140     #   install run-command script
   141     %{l_shtool} mkdir -f -p -m 755 \
   142         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   143     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   144         %{SOURCE rc.clamav} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   146     #   strip-down installation hierarchy
   147     strip $RPM_BUILD_ROOT%{l_prefix}/bin/*  >/dev/null 2>&1 || true
   148     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   149 %if "%{with_milter}" == "no"
   150     rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man8/clamav-milter.8
   151 %endif
   153     #   create additional installation directory
   154     %{l_shtool} mkdir -f -p -m 755 \
   155         $RPM_BUILD_ROOT%{l_prefix}/var/clamav
   157     #   determine installation files
   158     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   159         %{l_files_std} \
   160         '%config %{l_prefix}/etc/clamav/*.conf' \
   161         '%attr(755,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/clamav' \
   162         '%attr(755,%{l_rusr},%{l_rgrp}) %{l_prefix}/share/clamav'
   164 %files -f files
   166 %clean
   167     rm -rf $RPM_BUILD_ROOT
   169 %pre
   170     #   before upgrade, save status and stop service
   171     [ $1 -eq 2 ] || exit 0
   172     eval `%{l_rc} clamav status 2>/dev/null | tee %{l_tmpfile}`
   173     %{l_rc} clamav stop 2>/dev/null
   174     exit 0
   176 %post
   177     if [ $1 -eq 2 ]; then
   178         #   after upgrade, restore status
   179         eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
   180         [ ".$clamav_active" = .yes ] && %{l_rc} clamav start
   181     fi
   182     exit 0
   184 %preun
   185     #   before erase, stop service and remove log files
   186     [ $1 -eq 0 ] || exit 0
   187     %{l_rc} clamav stop 2>/dev/null
   188     rm -f $RPM_INSTALL_PREFIX/var/clamav/*.log* >/dev/null 2>&1 || true
   189     exit 0

mercurial