spamassassin.spec 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. ##
  2. ## spamassassin.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: spamassassin
  27. Summary: Mail Filter Identifying Spam
  28. URL: http://www.spamassassin.org/
  29. Vendor: Justin Mason
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: BASE
  33. Group: Mail
  34. License: GPL/Artistic
  35. Version: 2.63
  36. Release: 20040211
  37. # package options
  38. %option with_fsl yes
  39. # list of sources
  40. Source0: http://www.spamassassin.org/released/Mail-SpamAssassin-%{version}.tar.gz
  41. Source1: rc.spamassassin
  42. Source2: local.cf
  43. Source3: fsl.spamassassin
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20040130, perl, perl-openpkg >= 20040127, perl-xml, make
  48. PreReq: OpenPKG, openpkg >= 20040130, perl, perl-openpkg >= 20040127, perl-xml
  49. %if "%{with_fsl}" == "yes"
  50. BuildPreReq: fsl >= 1.3.0
  51. PreReq: fsl >= 1.3.0
  52. %endif
  53. AutoReq: no
  54. AutoReqProv: no
  55. %description
  56. SpamAssassin provides you with a way to reduce if not completely
  57. eliminate Unsolicited Commercial Email (SPAM) from your incoming
  58. email. It uses a genetic-algorithm evolved scoring system to
  59. identify messages which look spammy, then adds headers to the
  60. message so they can be filtered by the user's mail reading software.
  61. This distribution includes the spamd/spamc components which create a
  62. server that considerably speeds processing of mail.
  63. %track
  64. prog spamassassin = {
  65. version = %{version}
  66. url = http://www.spamassassin.org/released/
  67. regex = Mail-SpamAssassin-(__VER__)\.tar\.gz
  68. }
  69. %prep
  70. %setup -q -n Mail-SpamAssassin-%{version}
  71. %if "%{with_fsl}" == "yes"
  72. %{l_shtool} subst \
  73. -e 's/openlog.*(\(.*\),\(.*\),.*)/openlog(\1,\2, LOG_USER)/' \
  74. spamd/spamc.c
  75. %endif
  76. %build
  77. # configure package
  78. %{l_prefix}/bin/perl-openpkg prepare
  79. export CC="%{l_cc}"
  80. export CFLAGS="%{l_cflags -O}"
  81. export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}"
  82. export LIBS="%{l_ldflags} %{l_fsl_ldflags} %{l_fsl_libs}"
  83. %{l_prefix}/bin/perl-openpkg configure \
  84. -A DESTDIR="$RPM_BUILD_ROOT" \
  85. -A PREFIX="%{l_prefix}" \
  86. -A SYSCONFDIR="%{l_prefix}/etc/spamassassin" \
  87. -A LOCALRULESDIR="%{l_prefix}/etc/spamassassin" \
  88. -A DATADIR="%{l_prefix}/share/spamassassin" \
  89. -A PERL_BIN="%{l_prefix}/bin/perl"
  90. %{l_make} %{l_mflags} spamd/binaries.mk
  91. # build package
  92. %{l_make} %{l_mflags}
  93. %install
  94. rm -rf $RPM_BUILD_ROOT
  95. # install package
  96. %{l_make} %{l_mflags} install
  97. # install default configuration
  98. %{l_shtool} mkdir -f -p -m 755 \
  99. $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin
  100. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  101. %{SOURCE local.cf} \
  102. $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin/
  103. # create directory for PID file
  104. %{l_shtool} mkdir -f -p -m 755 \
  105. $RPM_BUILD_ROOT%{l_prefix}/var/spamassassin
  106. # strip installation
  107. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  108. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
  109. # install run-command script
  110. %{l_shtool} mkdir -f -p -m 755 \
  111. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  112. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  113. %{SOURCE rc.spamassassin} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  114. # install OSSP fsl configuration
  115. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  116. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  117. %{SOURCE fsl.spamassassin} \
  118. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  119. # determine installation files
  120. %{l_prefix}/bin/perl-openpkg \
  121. -F perl-openpkg-files \
  122. fixate cleanup
  123. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  124. %{l_files_std} \
  125. '%not %dir %{l_prefix}/etc/fsl' \
  126. '%config %{l_prefix}/etc/fsl/fsl.spamassassin' \
  127. '%config %{l_prefix}/etc/spamassassin/*' \
  128. `cat perl-openpkg-files`
  129. %files -f files
  130. %clean
  131. rm -rf $RPM_BUILD_ROOT
  132. %post
  133. # after upgrade, restart service
  134. [ $1 -eq 2 ] || exit 0
  135. eval `%{l_rc} spamassassin status 2>/dev/null`
  136. [ ".$spamassassin_active" = .yes ] && %{l_rc} spamassassin restart
  137. exit 0
  138. %preun
  139. # before erase, stop service
  140. [ $1 -eq 0 ] || exit 0
  141. %{l_rc} spamassassin stop 2>/dev/null
  142. rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.log* >/dev/null 2>&1 || true
  143. exit 0