exim.spec 9.5 KB

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