exim.spec 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. ##
  2. ## exim.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 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 Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: PLUS
  32. Group: Mail
  33. License: GPL
  34. Version: 4.64
  35. Release: 20061220
  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. %option with_content_scan no
  50. # list of sources
  51. Source0: ftp://ftp.csx.cam.ac.uk/pub/software/email/exim/exim4/exim-%{version}.tar.bz2
  52. Source1: rc.exim
  53. Source2: exim.conf
  54. Source3: aliases
  55. # build information
  56. Prefix: %{l_prefix}
  57. BuildRoot: %{l_buildroot}
  58. BuildPreReq: OpenPKG, openpkg >= 20060823, make, perl, gzip
  59. PreReq: OpenPKG, openpkg >= 20060823, perl, gzip
  60. BuildPreReq: db >= 4.1.24, libiconv
  61. PreReq: db >= 4.1.24, libiconv
  62. %if "%{with_dlfunc}" == "yes"
  63. BuildPreReq: gcc
  64. %endif
  65. %if "%{with_mysql}" == "yes"
  66. BuildPreReq: mysql, zlib
  67. PreReq: mysql, zlib
  68. %endif
  69. %if "%{with_pgsql}" == "yes"
  70. BuildPreReq: postgresql, openssl
  71. PreReq: postgresql, openssl
  72. %endif
  73. %if "%{with_sqlite}" == "yes"
  74. BuildPreReq: sqlite
  75. PreReq: sqlite
  76. %endif
  77. %if "%{with_ssl}" == "yes"
  78. BuildPreReq: openssl
  79. PreReq: openssl
  80. %endif
  81. %if "%{with_wrap}" == "yes"
  82. BuildPreReq: tcpwrappers
  83. PreReq: tcpwrappers
  84. %endif
  85. AutoReq: no
  86. AutoReqProv: no
  87. Provides: MTA
  88. Conflicts: postfix, sendmail, ssmtp
  89. %description
  90. Exim is a message transfer agent (MTA) developed at the University
  91. of Cambridge for use on Unix systems connected to the Internet.
  92. In style it is similar to Smail 3, but its facilities are more
  93. extensive, and in particular it has some defences against mail
  94. bombs and unsolicited junk mail in the form of options for refusing
  95. messages from particular hosts, networks, or senders. It can be
  96. installed in place of sendmail, although the configuration of Exim
  97. is quite different to that of Sendmail.
  98. %track
  99. prog exim = {
  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. %build
  113. # correctly specify missing realtime functions library
  114. EXTRALIBS="%{l_ldflags} -liconv"
  115. case "%{l_platform -t}" in
  116. *-sunos* ) EXTRALIBS="$EXTRALIBS -lrt" ;;
  117. esac
  118. %if "%{with_dlfunc}" == "yes"
  119. EXTRALIBS="$EXTRALIBS -export-dynamic -shared"
  120. %endif
  121. # create local compile-time configuration
  122. ( cat src/EDITME
  123. echo 'CC=%{l_cc}'
  124. echo 'INCLUDE=%{l_cppflags}'
  125. echo 'CFLAGS=%{l_cflags -O}'
  126. echo 'LDFLAGS=%{l_ldflags}'
  127. echo "EXTRALIBS+=$EXTRALIBS"
  128. echo "EXTRALIBS_EXIM+=$EXTRALIBS"
  129. # user/group settings
  130. echo 'EXIM_USER=%{l_rusr}'
  131. echo 'EXIM_GROUP=%{l_rgrp}'
  132. echo 'FIXED_NEVER_USERS=%{l_susr}'
  133. # directory layout
  134. echo 'BIN_DIRECTORY=%{l_prefix}/sbin'
  135. echo 'CONFIGURE_FILE=%{l_prefix}/etc/exim/exim.conf'
  136. echo 'SYSTEM_ALIASES_FILE=%{l_prefix}/etc/exim/aliases'
  137. echo 'LOG_FILE_PATH=%{l_prefix}/var/exim/log/%s.log'
  138. echo 'PID_FILE_PATH=%{l_prefix}/var/exim/run/exim.pid'
  139. echo 'SPOOL_DIRECTORY=%{l_prefix}/var/exim/spool'
  140. # dynamically loading support
  141. %if "%{with_dlfunc}" == "yes"
  142. echo 'EXPAND_DLFUNC=yes'
  143. %endif
  144. # content scanning support
  145. %if "%{with_content_scan}" == "yes"
  146. echo 'WITH_CONTENT_SCAN=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