exim.spec 9.2 KB

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