postfix.spec 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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_ipv6 20010228pl04-v6-20010913a
  27. %define V_tls 0.7.9-20010228-pl04-0.9.6b
  28. %define V_pflogsumm 1.0.3
  29. # build options
  30. # (attention: ipv6 and tls at the same time conflicts!)
  31. %define with_db yes
  32. %define with_pcre yes
  33. %define with_ipv6 yes
  34. %define with_tls no
  35. # package information
  36. Name: postfix
  37. Summary: Mail Transfer Agent (MTA)
  38. URL: http://www.postfix.org/
  39. Vendor: Wietse Venema
  40. Packager: The OpenPKG Project
  41. Distribution: OpenPKG [EXP]
  42. Group: Mail
  43. License: GPL
  44. Version: %{V_here}
  45. Release: 12
  46. # list of sources
  47. Source0: ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{V_real}.tar.gz
  48. Source1: ftp://ftp.aet.tu-cottbus.de/pub/postfix_tls/pfixtls-%{V_tls}.tar.gz
  49. Source2: ftp://ftp.openpkg.org/DST/postfix/fakesyslog.tar.gz
  50. Source3: ftp://ftp.kame.net/pub/kame/misc/postfix-%{V_ipv6}.diff.gz
  51. Source4: http://jimsun.linxnet.com/downloads/pflogsumm-%{V_pflogsumm}.pl
  52. Source5: rc.postfix
  53. # build information
  54. Prefix: %{l_prefix}
  55. BuildRoot: %{l_buildroot}
  56. BuildPreReq: OpenPKG, openpkg >= 0.9-33, perl >= 5.6.1-10
  57. PreReq: OpenPKG, openpkg >= 0.9-33, perl >= 5.6.1-10
  58. %if "%{with_db}" == "yes"
  59. BuildPreReq: db
  60. %endif
  61. %if "%{with_pcre}" == "yes"
  62. BuildPreReq: pcre
  63. %endif
  64. %if "%{with_tls}" == "yes"
  65. BuildPreReq: openssl
  66. %endif
  67. %if "%{with_ipv6}" == "yes" || "%{with_tls}" == "yes"
  68. BuildPreReq: patch
  69. %endif
  70. AutoReq: no
  71. AutoReqProv: no
  72. Provides: MTA
  73. %description
  74. Postfix is a new-generation Mail Transfer Agent (MTA) able to
  75. fully replace the Sendmail MTA.
  76. Local specifics in this OpenPKG version:
  77. o Postfix logs directly to the filesystem and not via syslog(3)
  78. o Optional IPv6 support
  79. o Optional STARTTLS support
  80. o Optional Berkely-DB lookup table support
  81. o Optional PCRE matching support
  82. %prep
  83. %setup0 -q -c
  84. %setup1 -q -T -D -a 1
  85. %setup2 -q -T -D -a 2
  86. cd postfix-%{V_real}
  87. %if "%{with_ipv6}" == "yes"
  88. %{l_gzip} -d -c %{SOURCE postfix-20010228pl04-v6-20010913a.diff.gz} |\
  89. %{l_perl} -e 'my $c = ""; $c .= $_ while (<STDIN>);
  90. $c =~ s/(^|\n)diff[^\n]+(\.indent\.pro|\.cvsignore).+?(?=\ndiff)//sg;
  91. print $c;' |\
  92. %{l_patch} -p1
  93. %endif
  94. %if "%{with_tls}" == "yes"
  95. %{l_patch} -p1 < ../pfixtls-%{V_tls}/pfixtls.diff
  96. %endif
  97. %{l_rpmtool} subst \
  98. 's/var_config_dir, /var_command_dir, /' \
  99. -- src/postfix/postfix.c
  100. %{l_rpmtool} subst \
  101. 's;config_directory/postfix-script;command_directory/postfix-script;' \
  102. -- conf/postfix-script*
  103. %build
  104. # build faked syslog(3) library
  105. fakesyslogdir="`pwd`/fakesyslog"
  106. ( cd fakesyslog
  107. CC="%{l_cc}" \
  108. CFLAGS="%{l_cflags -O}" \
  109. ./configure \
  110. --with-logfile=%{l_prefix}/var/postfix/log/postfix.log
  111. %{l_make} %{l_mflags}
  112. )
  113. # configure Postfix
  114. cd postfix-%{V_real}
  115. unset LD_LIBRARY_PATH || true
  116. CCARGS=""
  117. CCARGS="$CCARGS %{l_cflags -O}"
  118. CCARGS="$CCARGS -I%{l_prefix}/include"
  119. CCARGS="$CCARGS -DDEF_CONFIG_DIR=\\\\\\\"%{l_prefix}/etc/postfix\\\\\\\""
  120. AUXLIBS=""
  121. AUXLIBS="$AUXLIBS -L%{l_prefix}/lib"
  122. %if "%{with_db}" == "yes"
  123. CCARGS="$CCARGS -DHAS_DB"
  124. AUXLIBS="$AUXLIBS -ldb"
  125. %endif
  126. %if "%{with_pcre}" == "yes"
  127. CCARGS="$CCARGS -DHAS_PCRE"
  128. AUXLIBS="$AUXLIBS -lpcre"
  129. %endif
  130. %if "%{with_tls}" == "yes"
  131. CCARGS="$CCARGS -DHAS_SSL"
  132. AUXLIBS="$AUXLIBS -lssl -lcrypto"
  133. %endif
  134. AUXLIBS="$AUXLIBS -L$fakesyslogdir -lfakesyslog"
  135. %{l_make} %{l_mflags} makefiles \
  136. CC="%{l_cc}" CCARGS="$CCARGS" AUXLIBS="$AUXLIBS"
  137. # build Postfix
  138. %{l_make} %{l_mflags -O}
  139. %install
  140. rm -rf $RPM_BUILD_ROOT
  141. # perform standard installation procedure
  142. ( cd postfix-%{V_real}
  143. %{l_rpmtool} subst "s;chown;true;" -- INSTALL.sh
  144. install_root=$RPM_BUILD_ROOT \
  145. config_directory=%{l_prefix}/etc/postfix \
  146. daemon_directory=%{l_prefix}/libexec/postfix \
  147. command_directory=%{l_prefix}/sbin \
  148. queue_directory=%{l_prefix}/var/postfix \
  149. sendmail_path=%{l_prefix}/sbin/sendmail \
  150. newaliases_path=%{l_prefix}/sbin/newaliases \
  151. mailq_path=%{l_prefix}/sbin/mailq \
  152. mail_user=%{l_fsusr} \
  153. manpages=%{l_prefix}/man \
  154. setgid=no \
  155. sh INSTALL.sh </dev/null
  156. )
  157. # post-adjust binaries
  158. rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq
  159. ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \
  160. $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq
  161. rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases
  162. ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \
  163. $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases
  164. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  165. strip $RPM_BUILD_ROOT%{l_prefix}/libexec/postfix/* >/dev/null 2>&1 || true
  166. # post-adjust configuration
  167. %{l_rpmtool} subst \
  168. "s;^\\(mail_owner[^=]*=\\).*;\\1 %{l_fsusr};" \
  169. -- $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/main.cf
  170. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/*.orig
  171. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/LICENSE
  172. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/install.cf
  173. mv $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script \
  174. $RPM_BUILD_ROOT%{l_prefix}/sbin/postfix-script
  175. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/postfix-script*
  176. ( cd $RPM_BUILD_ROOT%{l_prefix}/etc/postfix
  177. %{l_shtool} mkdir -f -p -m 755 sample
  178. for cfg in access aliases canonical pcre_table regexp_table \
  179. relocated sample-* transport virtual main.cf.default; do
  180. mv $cfg sample/
  181. done
  182. )
  183. # pre-create variable stuff
  184. ( cd $RPM_BUILD_ROOT%{l_prefix}/var/postfix
  185. %{l_shtool} mkdir -f -p -m 700 \
  186. incoming active bounce defer deferred flush saved corrupt
  187. %{l_shtool} mkdir -f -p -m 755 \
  188. log pid public
  189. %{l_shtool} install -c -m 755 \
  190. /dev/null log/postfix.log
  191. %{l_shtool} install -c -m 755 \
  192. /dev/null log/postfix.sum
  193. )
  194. # install addons
  195. %{l_shtool} install -c -m 755 \
  196. -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
  197. %{SOURCE3} $RPM_BUILD_ROOT%{l_prefix}/sbin/pflogsumm
  198. # install run-command script
  199. %{l_shtool} mkdir -f -p -m 755 \
  200. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  201. %{l_shtool} install -c -m 755 \
  202. -e 's;@l_prefix@;%{l_prefix};g' \
  203. -e 's;@l_fsusr@;%{l_fsusr};g' \
  204. -e 's;@l_fsgrp@;%{l_fsgrp};g' \
  205. %{SOURCE4} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  206. # generate file list
  207. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  208. %{l_files_std} \
  209. '%config %attr(-,root,%{l_fsgrp}) %{l_prefix}/etc/postfix/*.cf' \
  210. '%attr(-,root,%{l_fsgrp}) %{l_prefix}/etc/postfix' \
  211. '%attr(-,root,%{l_fsgrp}) %{l_prefix}/libexec/postfix/*' \
  212. '%dir %attr(-,root,%{l_fsgrp}) %{l_prefix}/libexec/postfix' \
  213. '%dir %attr(-,root,%{l_fsgrp}) %{l_prefix}/var/postfix'
  214. %files -f files
  215. %clean
  216. rm -rf $RPM_BUILD_ROOT
  217. %preun
  218. $RPM_INSTALL_PREFIX/sbin/postfix stop
  219. rm -rf $RPM_INSTALL_PREFIX/etc/postfix/prng_exch
  220. rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/*
  221. rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/*
  222. rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/*