exim.spec 10 KB

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