spamassassin.spec 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 version
  26. %define V_real 3.0.0
  27. %define V_here 3.0.0
  28. %define V_sdir 3.0.0
  29. # package information
  30. Name: spamassassin
  31. Summary: Mail Filter Identifying Spam
  32. URL: http://spamassassin.apache.org/
  33. Vendor: Justin Mason
  34. Packager: The OpenPKG Project
  35. Distribution: OpenPKG
  36. Class: BASE
  37. Group: Mail
  38. License: ASF
  39. Version: %{V_here}
  40. Release: 20040922
  41. # package options
  42. %option with_fsl yes
  43. # list of sources
  44. Source0: http://spamassassin.apache.org/released/Mail-SpamAssassin-%{V_real}.tar.gz
  45. Source1: rc.spamassassin
  46. Source2: local.cf
  47. Source3: fsl.spamassassin
  48. # build information
  49. Prefix: %{l_prefix}
  50. BuildRoot: %{l_buildroot}
  51. BuildPreReq: OpenPKG, openpkg >= 20040130, perl, perl-openpkg >= 5.8.4, perl-db, perl-crypto, perl-xml, make
  52. PreReq: OpenPKG, openpkg >= 20040130, perl, perl-openpkg >= 5.8.4, perl-db, perl-crypto, perl-xml
  53. %if "%{with_fsl}" == "yes"
  54. BuildPreReq: fsl >= 1.3.0
  55. PreReq: fsl >= 1.3.0
  56. %endif
  57. AutoReq: no
  58. AutoReqProv: no
  59. %description
  60. SpamAssassin provides you with a way to reduce if not completely
  61. eliminate Unsolicited Commercial Email (SPAM) from your incoming
  62. email. It uses a genetic-algorithm evolved scoring system to
  63. identify messages which look spammy, then adds headers to the
  64. message so they can be filtered by the user's mail reading software.
  65. This distribution includes the spamd/spamc components which create a
  66. server that considerably speeds processing of mail.
  67. %track
  68. prog spamassassin = {
  69. version = %{V_real}
  70. url = http://spamassassin.apache.org/downloads.html
  71. regex = Mail-SpamAssassin-(__VER__)\.tar\.gz
  72. }
  73. %prep
  74. %setup -q -n Mail-SpamAssassin-%{V_sdir}
  75. %if "%{with_fsl}" == "yes"
  76. %{l_shtool} subst \
  77. -e 's/openlog.*(\(.*\),\(.*\),.*)/openlog(\1,\2, LOG_USER)/' \
  78. spamc/spamc.c
  79. %endif
  80. %build
  81. # configure package
  82. %{l_prefix}/bin/perl-openpkg prepare
  83. export CC="%{l_cc}"
  84. export CFLAGS="%{l_cflags -O}"
  85. export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}"
  86. export LIBS="%{l_ldflags} %{l_fsl_ldflags} %{l_fsl_libs}"
  87. %{l_prefix}/bin/perl-openpkg configure \
  88. -A DESTDIR="$RPM_BUILD_ROOT" \
  89. -A PREFIX="%{l_prefix}" \
  90. -A SYSCONFDIR="%{l_prefix}/etc/spamassassin" \
  91. -A LOCALRULESDIR="%{l_prefix}/etc/spamassassin" \
  92. -A DATADIR="%{l_prefix}/share/spamassassin" \
  93. -A PERL_BIN="%{l_prefix}/bin/perl"
  94. # build package
  95. %{l_make} %{l_mflags}
  96. %install
  97. rm -rf $RPM_BUILD_ROOT
  98. # install package
  99. %{l_make} %{l_mflags} install
  100. # install default configuration
  101. %{l_shtool} mkdir -f -p -m 755 \
  102. $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin
  103. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  104. %{SOURCE local.cf} \
  105. $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin/
  106. # create directory for PID file
  107. %{l_shtool} mkdir -f -p -m 755 \
  108. $RPM_BUILD_ROOT%{l_prefix}/var/spamassassin
  109. # strip installation
  110. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  111. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
  112. # install run-command script
  113. %{l_shtool} mkdir -f -p -m 755 \
  114. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  115. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  116. %{SOURCE rc.spamassassin} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  117. # install OSSP fsl configuration
  118. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  119. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  120. %{SOURCE fsl.spamassassin} \
  121. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  122. # determine installation files
  123. %{l_prefix}/bin/perl-openpkg \
  124. -F perl-openpkg-files \
  125. fixate cleanup
  126. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  127. %{l_files_std} \
  128. '%not %dir %{l_prefix}/etc/fsl' \
  129. '%config %{l_prefix}/etc/fsl/fsl.spamassassin' \
  130. '%config %{l_prefix}/etc/spamassassin/*' \
  131. `cat perl-openpkg-files`
  132. %files -f files
  133. %clean
  134. rm -rf $RPM_BUILD_ROOT
  135. %post
  136. # after upgrade, restart service
  137. [ $1 -eq 2 ] || exit 0
  138. eval `%{l_rc} spamassassin status 2>/dev/null`
  139. [ ".$spamassassin_active" = .yes ] && %{l_rc} spamassassin restart
  140. exit 0
  141. %preun
  142. # before erase, stop service
  143. [ $1 -eq 0 ] || exit 0
  144. %{l_rc} spamassassin stop 2>/dev/null
  145. rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.log* >/dev/null 2>&1 || true
  146. exit 0