postfix.spec 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. ##
  2. ## postfix.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2001 Ralf S. Engelschall <rse@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. %define V_here 20010228.5
  25. %define V_real 20010228-pl05
  26. %define V_tls 0.7.9-20010228-pl04-0.9.6b
  27. %define V_pflogsumm 1.0.3
  28. # package information
  29. Name: postfix
  30. Summary: Mail Transfer Agent (MTA)
  31. URL: http://www.postfix.org/
  32. Vendor: Wietse Venema
  33. Packager: The OpenPKG Project
  34. Distribution: OpenPKG [EXP]
  35. Group: Mail
  36. License: GPL
  37. Version: %{V_here}
  38. Release: 11
  39. # list of sources
  40. Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{V_real}.tar.gz
  41. Source1: ftp://ftp.aet.tu-cottbus.de/pub/postfix_tls/pfixtls-%{V_tls}.tar.gz
  42. Source2: ftp://ftp.openpkg.org/DST/postfix/fakesyslog.tar.gz
  43. Source3: http://jimsun.linxnet.com/downloads/pflogsumm-%{V_pflogsumm}.pl
  44. Source4: rc.postfix
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 0.9-33, db, openssl, perl >= 5.6.1-10, pcre, patch
  49. PreReq: OpenPKG, openpkg >= 0.9-33, db, openssl, perl >= 5.6.1-10, pcre
  50. AutoReq: no
  51. AutoReqProv: no
  52. Provides: MTA
  53. %description
  54. Postfix is a new-generation Mail Transfer Agent (MTA) aimed to
  55. replace the Sendmail MTA.
  56. %prep
  57. %setup0 -q -c
  58. %setup1 -q -T -D -a 1
  59. %setup2 -q -T -D -a 2
  60. cd postfix-%{V_real}
  61. %{l_patch} -p1 < ../pfixtls-%{V_tls}/pfixtls.diff
  62. %{l_rpmtool} subst \
  63. 's/var_config_dir, /var_command_dir, /' \
  64. -- src/postfix/postfix.c
  65. %{l_rpmtool} subst \
  66. 's;config_directory/postfix-script;command_directory/postfix-script;' \
  67. -- conf/postfix-script*
  68. %build
  69. # build faked syslog(3) library
  70. fakesyslogdir="`pwd`/fakesyslog"
  71. ( cd fakesyslog
  72. CC="%{l_cc}" \
  73. CFLAGS="%{l_cflags -O}" \
  74. ./configure \
  75. --with-logfile=%{l_prefix}/var/postfix/log/postfix.log
  76. %{l_make} %{l_mflags}
  77. )
  78. # configure Postfix
  79. cd postfix-%{V_real}
  80. unset LD_LIBRARY_PATH || true
  81. CCARGS=""
  82. CCARGS="$CCARGS %{l_cflags -O}"
  83. CCARGS="$CCARGS -I%{l_prefix}/include"
  84. CCARGS="$CCARGS -DDEF_CONFIG_DIR=\\\\\\\"%{l_prefix}/etc/postfix\\\\\\\""
  85. CCARGS="$CCARGS -DHAS_PCRE -DHAS_DB -DHAS_SSL"
  86. AUXLIBS=""
  87. AUXLIBS="$AUXLIBS -L%{l_prefix}/lib -ldb -lssl -lcrypto -lpcre"
  88. AUXLIBS="$AUXLIBS -L$fakesyslogdir -lfakesyslog"
  89. %{l_make} %{l_mflags} makefiles \
  90. CC="%{l_cc}" CCARGS="$CCARGS" AUXLIBS="$AUXLIBS"
  91. # build Postfix
  92. %{l_make} %{l_mflags -O}
  93. %install
  94. rm -rf $RPM_BUILD_ROOT
  95. # perform standard installation procedure
  96. ( cd postfix-%{V_real}
  97. %{l_rpmtool} subst "s;chown;true;" -- INSTALL.sh
  98. install_root=$RPM_BUILD_ROOT \
  99. config_directory=%{l_prefix}/etc/postfix \
  100. daemon_directory=%{l_prefix}/libexec/postfix \
  101. command_directory=%{l_prefix}/sbin \
  102. queue_directory=%{l_prefix}/var/postfix \
  103. sendmail_path=%{l_prefix}/sbin/sendmail \
  104. newaliases_path=%{l_prefix}/sbin/newaliases \
  105. mailq_path=%{l_prefix}/sbin/mailq \
  106. mail_user=%{l_fsusr} \
  107. manpages=%{l_prefix}/man \
  108. setgid=no \
  109. sh INSTALL.sh </dev/null
  110. )
  111. # post-adjust binaries
  112. rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq
  113. ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \
  114. $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq
  115. rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases
  116. ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \
  117. $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases
  118. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  119. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/postfix/* >/dev/null 2>&1 || true
  120. # post-adjust configuration
  121. %{l_rpmtool} subst \
  122. "s;^\\(mail_owner[^=]*=\\).*;\\1 %{l_fsusr};" \
  123. -- $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/main.cf
  124. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/*.orig
  125. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/LICENSE
  126. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/install.cf
  127. mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script \
  128. $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-script
  129. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script*
  130. ( cd $RPM_BUILD_ROOT%{l_prefix}/etc/postfix
  131. %{l_shtool} mkdir -f -p -m 755 sample
  132. for cfg in access aliases canonical pcre_table regexp_table \
  133. relocated sample-* transport virtual main.cf.default; do
  134. mv $cfg sample/
  135. done
  136. )
  137. # pre-create variable stuff
  138. ( cd $RPM_BUILD_ROOT%{l_prefix}/var/postfix
  139. %{l_shtool} mkdir -f -p -m 700 \
  140. active bounce corrupt defer deferred flush incoming private saved
  141. %{l_shtool} mkdir -f -p -m 755 \
  142. log pid public queue
  143. %{l_shtool} install -c -m 755 \
  144. /dev/null log/postfix.log
  145. %{l_shtool} install -c -m 755 \
  146. /dev/null log/postfix.sum
  147. )
  148. # install addons
  149. %{l_shtool} install -c -m 755 \
  150. -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
  151. %{SOURCE3} $RPM_BUILD_ROOT%{l_prefix}/sbin/pflogsumm
  152. # install run-command script
  153. %{l_shtool} mkdir -f -p -m 755 \
  154. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  155. %{l_shtool} install -c -m 755 \
  156. -e 's;@l_prefix@;%{l_prefix};g' \
  157. -e 's;@l_fsusr@;%{l_fsusr};g' \
  158. -e 's;@l_fsgrp@;%{l_fsgrp};g' \
  159. %{SOURCE4} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  160. # generate file list
  161. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  162. %{l_files_std} \
  163. '%config %attr(-,root,%{l_fsgrp}) %{l_prefix}/etc/postfix/*.cf' \
  164. '%attr(-,root,%{l_fsgrp}) %{l_prefix}/etc/postfix' \
  165. '%attr(-,root,%{l_fsgrp}) %{l_prefix}/libexec/postfix/*' \
  166. '%dir %attr(-,root,%{l_fsgrp}) %{l_prefix}/libexec/postfix' \
  167. '%dir %attr(-,root,%{l_fsgrp}) %{l_prefix}/var/postfix'
  168. %files -f files
  169. %clean
  170. # rm -rf $RPM_BUILD_ROOT
  171. %preun
  172. $RPM_INSTALL_PREFIX/sbin/postfix stop
  173. rm -rf $RPM_INSTALL_PREFIX/etc/postfix/prng_exch
  174. rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/*
  175. rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/*
  176. rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/*