cyrus-imapd-2.4.17-r1.ebuild 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. # Copyright 1999-2015 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. # 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 )
  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 squatter segfaults, see:
  45. # https://bugzilla.cyrusimap.org/show_bug.cgi?id=3757
  46. epatch "${FILESDIR}/${P}-statuscache.diff"
  47. # Fix master(8)->cyrusmaster(8) manpage.
  48. for i in `grep -rl -e 'master\.8' -e 'master(8)' "${S}"` ; do
  49. sed -i -e 's:master\.8:cyrusmaster.8:g' \
  50. -e 's:master(8):cyrusmaster(8):g' \
  51. "${i}" || die "sed failed" || die "sed failed"
  52. done
  53. mv man/master.8 man/cyrusmaster.8 || die "mv failed"
  54. sed -i -e "s:MASTER:CYRUSMASTER:g" \
  55. -e "s:Master:Cyrusmaster:g" \
  56. -e "s:master:cyrusmaster:g" \
  57. man/cyrusmaster.8 || die "sed failed"
  58. # do not strip
  59. sed -i -e '/(INSTALL/s/-s //' "${S}"/imtest/Makefile.in
  60. # correct afs include and liblwp.a directory
  61. sed -i -e '/I${with_afs_incdir/s/\/include//' \
  62. -e '/liblwp/s/liblwp/afs\/liblwp/' \
  63. "${S}"/configure{,.in} || die
  64. # same with lock.h
  65. sed -i -e '/lock.h/s:lock.h:afs/lock.h:' \
  66. ptclient/afskrb.c || die
  67. # libcom_err.a to libafscom_err.a
  68. sed -i -e '/afs\/libcom_err.a/s:libcom_err.a:libafscom_err.a:' \
  69. configure{,.in} || die
  70. sed -i -e "s/ar cr/$(tc-getAR) cr/" \
  71. perl/sieve/lib/Makefile.in \
  72. imap/Makefile.in \
  73. lib/Makefile.in \
  74. installsieve/Makefile.in \
  75. com_err/et/Makefile.in \
  76. sieve/Makefile.in \
  77. syslog/Makefile.in || die
  78. AT_M4DIR="cmulocal" eautoreconf
  79. }
  80. src_configure() {
  81. local myconf
  82. if use mysql ; then
  83. myconf="--with-mysql-incdir=$(mysql_config --variable=pkgincludedir)"
  84. myconf+=" --with-mysql-libdir=$(mysql_config --variable=pkglibdir)"
  85. fi
  86. if use afs ; then
  87. myconf+=" --with-afs-libdir=/usr/$(get_libdir)"
  88. myconf+=" --with-afs-incdir=/usr/include/afs"
  89. fi
  90. if use berkdb ; then
  91. myconf+=" --with-bdb-incdir=$(db_includedir)"
  92. fi
  93. econf \
  94. --enable-murder \
  95. --enable-netscapehack \
  96. --enable-idled \
  97. --with-service-path=/usr/$(get_libdir)/cyrus \
  98. --with-cyrus-user=cyrus \
  99. --with-cyrus-group=mail \
  100. --with-com_err=yes \
  101. --with-sasl \
  102. --without-perl \
  103. --without-krb \
  104. --without-krbdes \
  105. --with-zlib \
  106. $(use_enable afs) \
  107. $(use_enable afs krb5afspts) \
  108. $(use_with berkdb bdb) \
  109. $(use_enable nntp) \
  110. $(use_enable replication) \
  111. $(use_enable kerberos gssapi) \
  112. $(use_with mysql) \
  113. $(use_with postgres pgsql) \
  114. $(use_with sqlite) \
  115. $(use_with ssl openssl) \
  116. $(use_enable sieve) \
  117. $(use_with snmp) \
  118. $(use_with tcpd libwrap) \
  119. ${myconf}
  120. }
  121. src_install() {
  122. emake DESTDIR="${D}" install
  123. # file collision - bug #368245
  124. if ! use nntp ; then
  125. rm "${D}"/usr/share/man/man8/fetchnews.8*
  126. fi
  127. dodoc README*
  128. dohtml doc/*.html doc/murder.png
  129. docinto text
  130. dodoc doc/text/*
  131. cp doc/cyrusv2.mc "${D}/usr/share/doc/${PF}/html"
  132. cp -r contrib tools "${D}/usr/share/doc/${PF}"
  133. rm -f doc/text/Makefile*
  134. insinto /etc
  135. doins "${FILESDIR}/cyrus.conf" "${FILESDIR}/imapd.conf"
  136. # turn off sieve if not installed
  137. if ! use sieve; then
  138. sed -i -e "/sieve/s/^/#/" "${D}/etc/cyrus.conf" || die
  139. fi
  140. newinitd "${FILESDIR}/cyrus.rc6" cyrus
  141. newconfd "${FILESDIR}/cyrus.confd" cyrus
  142. newpamd "${FILESDIR}/cyrus.pam-include" sieve
  143. for subdir in imap/{,db,log,msg,proc,socket,sieve} spool/imap/{,stage.} ; do
  144. keepdir "/var/${subdir}"
  145. fowners cyrus:mail "/var/${subdir}"
  146. fperms 0750 "/var/${subdir}"
  147. done
  148. for subdir in imap/{user,quota,sieve} spool/imap ; do
  149. 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
  150. keepdir "/var/${subdir}/${i}"
  151. fowners cyrus:mail "/var/${subdir}/${i}"
  152. fperms 0750 "/var/${subdir}/${i}"
  153. done
  154. done
  155. }
  156. pkg_preinst() {
  157. if ! has_version ${CATEGORY}/${PN} ; then
  158. elog "For correct logging add the following to /etc/syslog.conf:"
  159. elog " local6.* /var/log/imapd.log"
  160. elog " auth.debug /var/log/auth.log"
  161. echo
  162. elog "You have to add user cyrus to the sasldb2. Do this with:"
  163. elog " saslpasswd2 cyrus"
  164. fi
  165. }
  166. pkg_postinst() {
  167. # do not install server.{key,pem) if they exist.
  168. if use ssl ; then
  169. if [ ! -f "${ROOT}"etc/ssl/cyrus/server.key ]; then
  170. install_cert /etc/ssl/cyrus/server
  171. chown cyrus:mail "${ROOT}"etc/ssl/cyrus/server.{key,pem}
  172. fi
  173. fi
  174. }