cyrus-imapd-2.4.17.ebuild 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. inherit autotools db-use eutils multilib pam ssl-cert user toolchain-funcs
  5. MY_P=${P/_/}
  6. DESCRIPTION="The Cyrus IMAP Server"
  7. HOMEPAGE="http://www.cyrusimap.org/"
  8. SRC_URI="ftp://ftp.cyrusimap.org/cyrus-imapd/${MY_P}.tar.gz"
  9. LICENSE="BSD-with-attribution"
  10. SLOT="0"
  11. KEYWORDS="amd64 ~arm hppa ~ia64 ppc ppc64 sparc x86"
  12. IUSE="afs berkdb kerberos mysql nntp pam postgres replication sieve snmp sqlite ssl tcpd"
  13. RDEPEND="sys-libs/zlib
  14. >=dev-libs/cyrus-sasl-2.1.13
  15. afs? ( net-fs/openafs )
  16. berkdb? ( >=sys-libs/db-3.2 )
  17. kerberos? ( virtual/krb5 )
  18. mysql? ( virtual/mysql )
  19. nntp? ( !net-nntp/leafnode )
  20. pam? (
  21. virtual/pam
  22. >=net-mail/mailbase-1
  23. )
  24. postgres? ( dev-db/postgresql )
  25. snmp? ( >=net-analyzer/net-snmp-5.2.2-r1 )
  26. sqlite? ( dev-db/sqlite )
  27. ssl? ( >=dev-libs/openssl-0.9.6 )
  28. tcpd? ( >=sys-apps/tcp-wrappers-7.6 snmp? ( net-analyzer/net-snmp[tcpd=] ) )"
  29. DEPEND="$RDEPEND"
  30. # get rid of old style virtual - bug 350792
  31. # all blockers really needed?
  32. RDEPEND="${RDEPEND}
  33. !mail-mta/courier
  34. !net-mail/bincimap
  35. !net-mail/courier-imap
  36. !net-mail/uw-imap"
  37. REQUIRED_USE="afs? ( kerberos )"
  38. S=${WORKDIR}/${MY_P}
  39. pkg_setup() {
  40. enewuser cyrus -1 -1 /usr/cyrus mail
  41. }
  42. src_prepare() {
  43. # Fix master(8)->cyrusmaster(8) manpage.
  44. for i in `grep -rl -e 'master\.8' -e 'master(8)' "${S}"` ; do
  45. sed -i -e 's:master\.8:cyrusmaster.8:g' \
  46. -e 's:master(8):cyrusmaster(8):g' \
  47. "${i}" || die "sed failed" || die "sed failed"
  48. done
  49. mv man/master.8 man/cyrusmaster.8 || die "mv failed"
  50. sed -i -e "s:MASTER:CYRUSMASTER:g" \
  51. -e "s:Master:Cyrusmaster:g" \
  52. -e "s:master:cyrusmaster:g" \
  53. man/cyrusmaster.8 || die "sed failed"
  54. # do not strip
  55. sed -i -e '/(INSTALL/s/-s //' "${S}"/imtest/Makefile.in
  56. # correct afs include and liblwp.a directory
  57. sed -i -e '/I${with_afs_incdir/s/\/include//' \
  58. -e '/liblwp/s/liblwp/afs\/liblwp/' \
  59. "${S}"/configure{,.in} || die
  60. # same with lock.h
  61. sed -i -e '/lock.h/s:lock.h:afs/lock.h:' \
  62. ptclient/afskrb.c || die
  63. # libcom_err.a to libafscom_err.a
  64. sed -i -e '/afs\/libcom_err.a/s:libcom_err.a:libafscom_err.a:' \
  65. configure{,.in} || die
  66. sed -i -e "s/ar cr/$(tc-getAR) cr/" \
  67. perl/sieve/lib/Makefile.in \
  68. imap/Makefile.in \
  69. lib/Makefile.in \
  70. installsieve/Makefile.in \
  71. com_err/et/Makefile.in \
  72. sieve/Makefile.in \
  73. syslog/Makefile.in || die
  74. AT_M4DIR="cmulocal" eautoreconf
  75. }
  76. src_configure() {
  77. local myconf
  78. if use mysql ; then
  79. myconf=$(mysql_config --include)
  80. myconf="--with-mysql-incdir=${myconf#-I}"
  81. fi
  82. if use afs ; then
  83. myconf+=" --with-afs-libdir=/usr/$(get_libdir)"
  84. myconf+=" --with-afs-incdir=/usr/include/afs"
  85. fi
  86. if use berkdb ; then
  87. myconf+=" --with-bdb-incdir=$(db_includedir)"
  88. fi
  89. econf \
  90. --enable-murder \
  91. --enable-netscapehack \
  92. --enable-idled \
  93. --with-service-path=/usr/$(get_libdir)/cyrus \
  94. --with-cyrus-user=cyrus \
  95. --with-cyrus-group=mail \
  96. --with-com_err=yes \
  97. --with-sasl \
  98. --without-perl \
  99. --without-krb \
  100. --without-krbdes \
  101. --with-zlib \
  102. $(use_enable afs) \
  103. $(use_enable afs krb5afspts) \
  104. $(use_with berkdb bdb) \
  105. $(use_enable nntp) \
  106. $(use_enable replication) \
  107. $(use_enable kerberos gssapi) \
  108. $(use_with mysql) \
  109. $(use_with postgres pgsql) \
  110. $(use_with sqlite) \
  111. $(use_with ssl openssl) \
  112. $(use_enable sieve) \
  113. $(use_with snmp) \
  114. $(use_with tcpd libwrap) \
  115. ${myconf}
  116. }
  117. src_install() {
  118. emake DESTDIR="${D}" install
  119. # file collision - bug #368245
  120. if ! use nntp ; then
  121. rm "${D}"/usr/share/man/man8/fetchnews.8*
  122. fi
  123. dodoc README*
  124. dohtml doc/*.html doc/murder.png
  125. docinto text
  126. dodoc doc/text/*
  127. cp doc/cyrusv2.mc "${D}/usr/share/doc/${PF}/html"
  128. cp -r contrib tools "${D}/usr/share/doc/${PF}"
  129. rm -f doc/text/Makefile*
  130. insinto /etc
  131. doins "${FILESDIR}/cyrus.conf" "${FILESDIR}/imapd.conf"
  132. # turn off sieve if not installed
  133. if ! use sieve; then
  134. sed -i -e "/sieve/s/^/#/" "${D}/etc/cyrus.conf" || die
  135. fi
  136. newinitd "${FILESDIR}/cyrus.rc6" cyrus
  137. newconfd "${FILESDIR}/cyrus.confd" cyrus
  138. newpamd "${FILESDIR}/cyrus.pam-include" sieve
  139. for subdir in imap/{,db,log,msg,proc,socket,sieve} spool/imap/{,stage.} ; do
  140. keepdir "/var/${subdir}"
  141. fowners cyrus:mail "/var/${subdir}"
  142. fperms 0750 "/var/${subdir}"
  143. done
  144. for subdir in imap/{user,quota,sieve} spool/imap ; do
  145. for i in a b c d e f g h i j k l m n o p q r s t v u w x y z ; do
  146. keepdir "/var/${subdir}/${i}"
  147. fowners cyrus:mail "/var/${subdir}/${i}"
  148. fperms 0750 "/var/${subdir}/${i}"
  149. done
  150. done
  151. }
  152. pkg_preinst() {
  153. if ! has_version ${CATEGORY}/${PN} ; then
  154. elog "For correct logging add the following to /etc/syslog.conf:"
  155. elog " local6.* /var/log/imapd.log"
  156. elog " auth.debug /var/log/auth.log"
  157. echo
  158. elog "You have to add user cyrus to the sasldb2. Do this with:"
  159. elog " saslpasswd2 cyrus"
  160. fi
  161. }
  162. pkg_postinst() {
  163. # do not install server.{key,pem) if they exist.
  164. if use ssl ; then
  165. if [ ! -f "${ROOT}"etc/ssl/cyrus/server.key ]; then
  166. install_cert /etc/ssl/cyrus/server
  167. chown cyrus:mail "${ROOT}"etc/ssl/cyrus/server.{key,pem}
  168. fi
  169. fi
  170. }