milter.spec 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. ##
  2. ## milter.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 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. ##
  23. # package version
  24. %define V_libmilter 8.14.3
  25. %define V_sendmail_pmilter 0.95
  26. %define V_mail_milter 0.07
  27. # package information
  28. Name: milter
  29. Summary: Mail Filtering API
  30. URL: http://www.sendmail.org/doc/sendmail-current/libmilter/docs/
  31. Vendor: Eric Allman, Todd Vierling
  32. Packager: OpenPKG Foundation e.V.
  33. Distribution: OpenPKG Community
  34. Class: EVAL
  35. Group: Mail
  36. License: BSD/Artistic
  37. Version: %{V_libmilter}
  38. Release: 20080504
  39. # package options
  40. %option with_perl no
  41. # list of sources
  42. Source0: ftp://ftp.sendmail.org/pub/sendmail/sendmail.%{V_libmilter}.tar.gz
  43. Source1: http://switch.dl.sourceforge.net/sourceforge/pmilter/Sendmail-PMilter-%{V_sendmail_pmilter}.tar.gz
  44. Source2: http://switch.dl.sourceforge.net/sourceforge/pmilter/Mail-Milter-%{V_mail_milter}.tar.gz
  45. Source3: milter.pc
  46. Patch0: milter.patch
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20060823
  51. PreReq: OpenPKG, openpkg >= 20060823
  52. %if "%{with_perl}" == "yes"
  53. BuildPreReq: perl, perl-openpkg
  54. PreReq: perl
  55. %endif
  56. AutoReq: no
  57. AutoReqProv: no
  58. %description
  59. MILTER is the mail and SMTP protocol filtering API developed with
  60. the Sendmail 8 MTA. This package provides Sendmail's original
  61. client-side C API (libmilter) and optionally the alternative
  62. client-side Perl APIs (Sendmail::Milter, Sendmail::PMilter,
  63. Mail::Milter).
  64. %track
  65. prog milter:libmilter = {
  66. version = %{V_libmilter}
  67. url = ftp://ftp.sendmail.org/pub/sendmail/
  68. regex = sendmail.(\d+\.\d+\.\d+)\.tar\.gz
  69. }
  70. prog milter:Sendmail-PMilter = {
  71. version = %{V_sendmail_pmilter}
  72. url = http://prdownloads.sourceforge.net/pmilter/
  73. regex = Sendmail-PMilter-(__VER__)\.tar\.gz
  74. }
  75. prog milter:Mail-Milter = {
  76. version = %{V_mail_milter}
  77. url = http://prdownloads.sourceforge.net/pmilter/
  78. regex = Mail-Milter-(__VER__)\.tar\.gz
  79. }
  80. %prep
  81. %setup -q -c
  82. %setup -q -T -D -a 1
  83. %setup -q -T -D -a 2
  84. %patch -p0
  85. %build
  86. # build C API
  87. ( cd sendmail-%{V_libmilter}
  88. extlibs="%{l_fsl_libs} -ldb"
  89. case "%{l_platform -t}" in
  90. *-sunos* ) extlibs="$extlibs -lrt" ;;
  91. esac
  92. ( echo "define(\`confCC', \`%{l_cc} %{l_cflags}')dnl"
  93. echo "APPENDDEF(\`confINCDIRS', \`%{l_cppflags}')dnl"
  94. echo "APPENDDEF(\`confLIBDIRS', \`%{l_ldflags}')dnl"
  95. echo "APPENDDEF(\`confLIBS', \`$extlibs')dnl"
  96. echo "define(\`confSTDIO_TYPE', \`portable')dnl"
  97. echo "APPENDDEF(\`conf_sendmail_ENVDEF', \`-DMILTER=1')dnl"
  98. echo "APPENDDEF(\`conf_libmilter_ENVDEF', \`-D_FFR_MILTER_ROOT_UNSAFE')dnl"
  99. ) >devtools/Site/site.config.m4
  100. ( cd include
  101. ln -s libmilter milter
  102. ) || exit $?
  103. ( cd libmilter
  104. ./Build
  105. ) || exit $?
  106. ) || exit $?
  107. # build Perl API
  108. %if "%{with_perl}" == "yes"
  109. %{l_prefix}/bin/perl-openpkg prepare
  110. %{l_prefix}/bin/perl-openpkg -d Sendmail-PMilter-%{V_sendmail_pmilter} configure build
  111. %{l_prefix}/bin/perl-openpkg -d Mail-Milter-%{V_mail_milter} configure build
  112. %endif
  113. %install
  114. rm -rf $RPM_BUILD_ROOT
  115. # install C API
  116. ( cd sendmail-%{V_libmilter}
  117. %{l_shtool} mkdir -f -p -m 755 \
  118. $RPM_BUILD_ROOT%{l_prefix}/include/milter \
  119. $RPM_BUILD_ROOT%{l_prefix}/lib/milter
  120. %{l_shtool} install -c -m 644 \
  121. include/libmilter/*.h \
  122. $RPM_BUILD_ROOT%{l_prefix}/include/milter/
  123. %{l_shtool} install -c -m 644 \
  124. obj.*/libmilter/libmilter.a \
  125. $RPM_BUILD_ROOT%{l_prefix}/lib/
  126. ) || exit $?
  127. libs=`grep "^LDOPTS=" sendmail-%{V_libmilter}/obj.*/libmilter/Makefile | sed -e 's;^LDOPTS=;;'`
  128. libs="$libs -lmilter"
  129. case "%{l_platform -t}" in
  130. *-sunos* ) libs="$libs -lrt" ;;
  131. esac
  132. %{l_shtool} mkdir -f -p -m 755 \
  133. $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
  134. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  135. -e "s;@version@;%{version};" \
  136. -e "s;@libs@;$libs;" \
  137. %{SOURCE milter.pc} $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
  138. # install Perl API
  139. %if "%{with_perl}" == "yes"
  140. %{l_prefix}/bin/perl-openpkg -d Sendmail-PMilter-%{V_sendmail_pmilter} install
  141. %{l_prefix}/bin/perl-openpkg -d Mail-Milter-%{V_mail_milter} install
  142. %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
  143. %else
  144. >perl-openpkg-files
  145. %endif
  146. # create parent run-time directory of MILTER application sockets
  147. %{l_shtool} mkdir -f -p -m 755 \
  148. $RPM_BUILD_ROOT%{l_prefix}/var/milter
  149. # determine installation files
  150. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  151. %{l_files_std} `cat perl-openpkg-files`
  152. %files -f files
  153. %clean
  154. rm -rf $RPM_BUILD_ROOT
  155. %post
  156. # create run-time directory of MILTER application sockets
  157. # (which are required to have particular user/group ownerships
  158. # in order to allow all MTAs to access it under run-time)
  159. mkdir $RPM_INSTALL_PREFIX/var/milter/socket 2>/dev/null || true
  160. chown %{l_rusr}:%{l_mgrp} $RPM_INSTALL_PREFIX/var/milter/socket
  161. chmod 2775 $RPM_INSTALL_PREFIX/var/milter/socket
  162. %preun
  163. # try to remove run-time directory of MILTER application sockets
  164. rmdir $RPM_INSTALL_PREFIX/var/milter/socket 2>/dev/null || true