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