postfix.spec 9.1 KB

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