cyrus-imapd-2.5.8.ebuild 4.6 KB

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