cyrus-imapd-2.4.16.ebuild 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. inherit db-use eutils multilib pam ssl-cert user
  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. }
  67. src_configure() {
  68. local myconf
  69. if use mysql ; then
  70. myconf=$(mysql_config --include)
  71. myconf="--with-mysql-incdir=${myconf#-I}"
  72. fi
  73. if use afs ; then
  74. myconf+=" --with-afs-libdir=/usr/$(get_libdir)"
  75. myconf+=" --with-afs-incdir=/usr/include/afs"
  76. fi
  77. if use berkdb ; then
  78. myconf+=" --with-bdb-incdir=$(db_includedir)"
  79. fi
  80. econf \
  81. --enable-murder \
  82. --enable-netscapehack \
  83. --enable-idled \
  84. --with-service-path=/usr/$(get_libdir)/cyrus \
  85. --with-cyrus-user=cyrus \
  86. --with-cyrus-group=mail \
  87. --with-com_err=yes \
  88. --with-sasl \
  89. --without-perl \
  90. --without-krb \
  91. --without-krbdes \
  92. --with-zlib \
  93. $(use_enable afs) \
  94. $(use_enable afs krb5afspts) \
  95. $(use_with berkdb bdb) \
  96. $(use_enable nntp) \
  97. $(use_enable replication) \
  98. $(use_enable kerberos gssapi) \
  99. $(use_with mysql) \
  100. $(use_with postgres pgsql) \
  101. $(use_with sqlite) \
  102. $(use_with ssl openssl) \
  103. $(use_enable sieve) \
  104. $(use_with snmp) \
  105. $(use_with tcpd libwrap) \
  106. ${myconf}
  107. }
  108. src_install() {
  109. emake DESTDIR="${D}" install
  110. # file collision - bug #368245
  111. if ! use nntp ; then
  112. rm "${D}"/usr/share/man/man8/fetchnews.8*
  113. fi
  114. dodoc README*
  115. dohtml doc/*.html doc/murder.png
  116. docinto text
  117. dodoc doc/text/*
  118. cp doc/cyrusv2.mc "${D}/usr/share/doc/${PF}/html"
  119. cp -r contrib tools "${D}/usr/share/doc/${PF}"
  120. rm -f doc/text/Makefile*
  121. insinto /etc
  122. doins "${FILESDIR}/cyrus.conf" "${FILESDIR}/imapd.conf"
  123. # turn off sieve if not installed
  124. if ! use sieve; then
  125. sed -i -e "/sieve/s/^/#/" "${D}/etc/cyrus.conf" || die
  126. fi
  127. newinitd "${FILESDIR}/cyrus.rc6" cyrus
  128. newconfd "${FILESDIR}/cyrus.confd" cyrus
  129. newpamd "${FILESDIR}/cyrus.pam-include" sieve
  130. for subdir in imap/{,db,log,msg,proc,socket,sieve} spool/imap/{,stage.} ; do
  131. keepdir "/var/${subdir}"
  132. fowners cyrus:mail "/var/${subdir}"
  133. fperms 0750 "/var/${subdir}"
  134. done
  135. for subdir in imap/{user,quota,sieve} spool/imap ; do
  136. 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
  137. keepdir "/var/${subdir}/${i}"
  138. fowners cyrus:mail "/var/${subdir}/${i}"
  139. fperms 0750 "/var/${subdir}/${i}"
  140. done
  141. done
  142. }
  143. pkg_postinst() {
  144. # do not install server.{key,pem) if they exist.
  145. if use ssl ; then
  146. if [ ! -f "${ROOT}"etc/ssl/cyrus/server.key ]; then
  147. install_cert /etc/ssl/cyrus/server
  148. chown cyrus:mail "${ROOT}"etc/ssl/cyrus/server.{key,pem}
  149. fi
  150. fi
  151. elog "For correct logging add the following to /etc/syslog.conf:"
  152. elog " local6.* /var/log/imapd.log"
  153. elog " auth.debug /var/log/auth.log"
  154. echo
  155. elog "You have to add user cyrus to the sasldb2. Do this with:"
  156. elog " saslpasswd2 cyrus"
  157. }