exim.spec 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. ##
  2. ## exim.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.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. # package information
  26. Name: exim
  27. Summary: Exim Mail Transfer Agent
  28. URL: http://www.exim.org/
  29. Vendor: Philip Hazel
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: PLUS
  33. Group: Mail
  34. License: GPL
  35. Version: 4.43
  36. Release: 20041209
  37. # package options
  38. %option with_auth_cram_md5 no
  39. %option with_auth_plaintext no
  40. %option with_ipv6 no
  41. %option with_mysql no
  42. %option with_pgsql no
  43. %option with_ssl no
  44. %option with_wrap no
  45. # list of sources
  46. Source0: ftp://ftp.csx.cam.ac.uk/pub/software/email/exim/exim4/exim-%{version}.tar.bz2
  47. Source1: rc.exim
  48. Source2: exim.conf
  49. Source3: aliases
  50. # build information
  51. Prefix: %{l_prefix}
  52. BuildRoot: %{l_buildroot}
  53. BuildPreReq: OpenPKG, openpkg >= 20040130, make, perl, gzip
  54. PreReq: OpenPKG, openpkg >= 20040130, make, perl, gzip
  55. BuildPreReq: db >= 4.1.24, libiconv
  56. PreReq: db >= 4.1.24, libiconv
  57. %if "%{with_mysql}" == "yes"
  58. BuildPreReq: mysql
  59. PreReq: mysql
  60. %endif
  61. %if "%{with_pgsql}" == "yes"
  62. BuildPreReq: postgresql, openssl
  63. PreReq: postgresql, openssl
  64. %endif
  65. %if "%{with_ssl}" == "yes"
  66. BuildPreReq: openssl
  67. PreReq: openssl
  68. %endif
  69. %if "%{with_wrap}" == "yes"
  70. BuildPreReq: tcpwrappers
  71. PreReq: tcpwrappers
  72. %endif
  73. AutoReq: no
  74. AutoReqProv: no
  75. Provides: MTA
  76. Conflicts: postfix, sendmail, ssmtp
  77. %description
  78. Exim is a message transfer agent (MTA) developed at the University
  79. of Cambridge for use on Unix systems connected to the Internet.
  80. In style it is similar to Smail 3, but its facilities are more
  81. extensive, and in particular it has some defences against mail
  82. bombs and unsolicited junk mail in the form of options for refusing
  83. messages from particular hosts, networks, or senders. It can be
  84. installed in place of sendmail, although the configuration of Exim
  85. is quite different to that of Sendmail.
  86. %track
  87. prog exim = {
  88. version = %{version}
  89. url = ftp://ftp.csx.cam.ac.uk/pub/software/email/exim/exim4/
  90. regex = exim-(__VER__)\.tar\.bz2
  91. }
  92. %prep
  93. %setup -q
  94. %{l_shtool} subst \
  95. -e 's;STRING_UNKNOWN;"unknown";g' \
  96. src/smtp_in.c
  97. %{l_shtool} subst \
  98. -e 's;\(if \[ $name = exim${EXE}\)\( \]\; then\);\1 -a ".$DESTDIR" = . \2;' \
  99. scripts/exim_install
  100. %build
  101. # correctly specify missing realtime functions library
  102. EXTRALIBS="%{l_ldflags} -liconv"
  103. case "%{l_platform -t}" in
  104. *-sunos* ) EXTRALIBS="$EXTRALIBS -lrt" ;;
  105. esac
  106. # create local compile-time configuration
  107. ( cat src/EDITME
  108. echo 'CC=%{l_cc}'
  109. echo 'INCLUDE=%{l_cppflags}'
  110. echo 'CFLAGS=%{l_cflags -O}'
  111. echo 'LDFLAGS=%{l_ldflags}'
  112. # user/group settings
  113. echo 'EXIM_USER=%{l_rusr}'
  114. echo 'EXIM_GROUP=%{l_rgrp}'
  115. echo 'FIXED_NEVER_USERS=%{l_susr}'
  116. # directory layout
  117. echo 'BIN_DIRECTORY=%{l_prefix}/sbin'
  118. echo 'CONFIGURE_FILE=%{l_prefix}/etc/exim/exim.conf'
  119. echo 'SYSTEM_ALIASES_FILE=%{l_prefix}/etc/exim/aliases'
  120. echo 'LOG_FILE_PATH=%{l_prefix}/var/exim/log/%s.log'
  121. echo 'PID_FILE_PATH=%{l_prefix}/var/exim/run/exim.pid'
  122. echo 'SPOOL_DIRECTORY=%{l_prefix}/var/exim/spool'
  123. # helper applications
  124. echo 'PERL_COMMAND=%{l_prefix}/bin/perl'
  125. echo 'COMPRESS_COMMAND=%{l_prefix}/bin/gzip'
  126. echo 'ZCAT_COMMAND=%{l_prefix}/bin/zcat'
  127. # don't build exim monitor
  128. echo 'EXIM_MONITOR='
  129. # character code conversions used by $header_xxx expansion and
  130. # Sieve filter
  131. echo 'HAVE_ICONV=YES'
  132. echo 'HEADERS_CHARSET=ISO-8859-1'
  133. echo "EXTRALIBS_EXIM+=$EXTRALIBS"
  134. # use Berkeley DB in native mode as DBM library
  135. echo 'USE_DB=yes'
  136. echo 'DBMLIB=%{l_ldflags} -ldb'
  137. # LMTP support
  138. echo 'TRANSPORT_LMTP=yes'
  139. # move frozen mails out of the main spool directory
  140. echo 'SUPPORT_MOVE_FROZEN_MESSAGES=yes'
  141. # AUTH extensions of the SMTP as defined by RFC 2554
  142. %if "%{with_auth_cram_md5}" == "yes"
  143. echo 'AUTH_CRAM_MD5=yes'
  144. %endif
  145. %if "%{with_auth_plaintext}" == "yes"
  146. echo 'AUTH_PLAINTEXT=yes'
  147. %endif
  148. # IPv6 support
  149. %if "%{with_ipv6}" == "yes"
  150. echo 'HAVE_IPV6=YES'
  151. %endif
  152. # support for MySQL lookups
  153. %if "%{with_mysql}" == "yes"
  154. echo 'LOOKUP_MYSQL=yes'
  155. echo 'LOOKUP_INCLUDE+=%{l_cppflags mysql}'
  156. echo 'LOOKUP_LIBS+=%{l_ldflags mysql} -lmysqlclient -lz -lm'
  157. %endif
  158. # support for PostgreSQL lookups
  159. %if "%{with_pgsql}" == "yes"
  160. echo 'LOOKUP_PGSQL=yes'
  161. echo 'LOOKUP_INCLUDE+=%{l_cppflags postgresql}'
  162. echo 'LOOKUP_LIBS+=%{l_ldflags} -lpq -lssl -lcrypto -lcrypt'
  163. %endif
  164. # support for Transport layer security using SSL
  165. %if "%{with_ssl}" == "yes"
  166. echo 'SUPPORT_TLS=yes'
  167. echo 'TLS_INCLUDE=%{l_cppflags}'
  168. echo 'TLS_LIBS=%{l_ldflags} -lssl -lcrypto'
  169. %endif
  170. # TCP wrapper support
  171. %if "%{with_wrap}" == "yes"
  172. echo 'USE_TCP_WRAPPERS=yes'
  173. echo "EXTRALIBS_EXIM+=%{l_ldflags} -lwrap"
  174. %endif
  175. ) >Local/Makefile
  176. case "%{l_platform -t}" in
  177. *-freebsd* )
  178. %{l_shtool} subst \
  179. -e 's;^\.if \([^ ]*\) == \([^ ]*\) *$;ifeq (\1,\2);' \
  180. -e 's;^\.endif.*$;endif;' \
  181. OS/Makefile-FreeBSD
  182. ;;
  183. esac
  184. %{l_make} %{l_mflags} makefile
  185. %{l_make} %{l_mflags}
  186. %install
  187. rm -rf $RPM_BUILD_ROOT
  188. # create directories
  189. %{l_shtool} mkdir -f -p -m 755 \
  190. $RPM_BUILD_ROOT%{l_prefix}/bin \
  191. $RPM_BUILD_ROOT%{l_prefix}/etc/exim \
  192. $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
  193. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  194. $RPM_BUILD_ROOT%{l_prefix}/var/exim/log \
  195. $RPM_BUILD_ROOT%{l_prefix}/var/exim/run
  196. # install default configuration which must be done before the
  197. # installation of exim
  198. %{l_shtool} install -c -m 640 %{l_value -s -a} \
  199. %{SOURCE exim.conf} \
  200. %{SOURCE aliases} \
  201. $RPM_BUILD_ROOT%{l_prefix}/etc/exim/
  202. # install exim
  203. %{l_make} install DESTDIR="$RPM_BUILD_ROOT" INSTALL_ARG="-no_chown"
  204. # install man pages
  205. %{l_shtool} install -c -m 644 \
  206. doc/exim.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  207. # provide backward compatibility
  208. for i in mailq newaliases rmail rsmtp runq sendmail; do
  209. ln -s exim $RPM_BUILD_ROOT%{l_prefix}/sbin/$i
  210. ln -s exim.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/$i.8
  211. done
  212. for i in mailq newaliases rmail; do
  213. ln -s ../sbin/exim $RPM_BUILD_ROOT%{l_prefix}/bin/$i
  214. done
  215. # install run-command script
  216. %{l_shtool} mkdir -f -p -m 755 \
  217. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  218. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  219. %{SOURCE rc.exim} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  220. # strip installation
  221. rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/exicyclog
  222. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  223. # determine installation files
  224. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  225. %{l_files_std} \
  226. '%dir %attr(0750,%{l_susr},%{l_rgrp}) %{l_prefix}/etc/exim' \
  227. '%config %attr(0640,%{l_susr},%{l_rgrp}) %{l_prefix}/etc/exim/*' \
  228. ' %attr(4711,%{l_susr},%{l_sgrp}) %{l_prefix}/sbin/exim' \
  229. '%dir %attr(0755,%{l_susr},%{l_sgrp}) %{l_prefix}/var/exim' \
  230. '%dir %attr(0770,%{l_susr},%{l_rgrp}) %{l_prefix}/var/exim/log' \
  231. '%dir %attr(0755,%{l_susr},%{l_sgrp}) %{l_prefix}/var/exim/run'
  232. %files -f files
  233. %clean
  234. rm -rf $RPM_BUILD_ROOT
  235. %post
  236. # after upgrade, restart service
  237. [ $1 -eq 2 ] || exit 0
  238. eval `%{l_rc} exim status 2>/dev/null`
  239. [ ".$exim_active" = .yes ] && %{l_rc} exim restart
  240. exit 0
  241. %preun
  242. # before erase, stop service and remove log files
  243. [ $1 -eq 0 ] || exit 0
  244. %{l_rc} exim stop 2>/dev/null
  245. rm -f $RPM_INSTALL_PREFIX/var/exim/* >/dev/null 2>&1 || true
  246. exit 0