clamav.spec 6.4 KB

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