cyrus-imapd-2.4.18.ebuild 5.2 KB

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