postfix.spec 9.3 KB

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