cyrus-imapd-2.5.9.ebuild 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. http? ( sqlite )"
  44. S=${WORKDIR}/${MY_P}
  45. pkg_setup() {
  46. enewuser cyrus -1 -1 /usr/cyrus mail
  47. }
  48. src_prepare() {
  49. eapply -p0 "${FILESDIR}/${PN}-db.patch"
  50. # Fix master(8)->cyrusmaster(8) manpage.
  51. for i in `grep -rl -e 'master\.8' -e 'master(8)' "${S}"` ; do
  52. sed -i -e 's:master\.8:cyrusmaster.8:g' \
  53. -e 's:master(8):cyrusmaster(8):g' \
  54. "${i}" || die "sed failed" || die "sed failed"
  55. done
  56. mv man/master.8 man/cyrusmaster.8 || die "mv failed"
  57. sed -i -e "s:MASTER:CYRUSMASTER:g" \
  58. -e "s:Master:Cyrusmaster:g" \
  59. -e "s:master:cyrusmaster:g" \
  60. man/cyrusmaster.8 || die "sed failed"
  61. # lock.h to afs/lock.h
  62. sed -i -e '/lock.h/s:lock.h:afs/lock.h:' \
  63. ptclient/afskrb.c || die
  64. eapply_user
  65. eautoreconf
  66. }
  67. src_configure() {
  68. local myconf
  69. if use afs ; then
  70. myconf+=" --with-afs-libdir=/usr/$(get_libdir)"
  71. myconf+=" --with-afs-incdir=/usr/include/afs"
  72. fi
  73. econf \
  74. --enable-murder \
  75. --enable-netscapehack \
  76. --enable-idled \
  77. --enable-event-notification \
  78. --enable-autocreate \
  79. --enable-pcre \
  80. --with-service-path=/usr/$(get_libdir)/cyrus \
  81. --with-cyrus-user=cyrus \
  82. --with-cyrus-group=mail \
  83. --with-com_err=yes \
  84. --with-sasl \
  85. --without-krb \
  86. --without-krbdes \
  87. --with-zlib \
  88. $(use_enable afs) \
  89. $(use_enable afs krb5afspts) \
  90. $(use_with berkdb bdb) \
  91. $(use_with clamav) \
  92. $(use_enable nntp) \
  93. $(use_enable http) \
  94. $(use_enable replication) \
  95. $(use_enable kerberos gssapi) \
  96. $(use_with mysql) \
  97. $(use_with postgres pgsql) \
  98. $(use_with perl) \
  99. $(use_with sqlite) \
  100. $(use_with ssl openssl) \
  101. $(use_enable server) \
  102. $(use_enable sieve) \
  103. $(use_with snmp) \
  104. $(use_enable static-libs static) \
  105. $(use_with tcpd libwrap) \
  106. ${myconf}
  107. }
  108. src_install() {
  109. emake DESTDIR="${D}" INSTALLDIRS=vendor install
  110. dodoc README*
  111. dodoc -r doc
  112. cp doc/cyrusv2.mc "${D}/usr/share/doc/${PF}/html"
  113. cp -r contrib tools "${D}/usr/share/doc/${PF}"
  114. rm -f doc/text/Makefile*
  115. insinto /etc
  116. doins "${FILESDIR}/cyrus.conf" "${FILESDIR}/imapd.conf"
  117. # turn off sieve if not installed
  118. if ! use sieve; then
  119. sed -i -e "/sieve/s/^/#/" "${D}/etc/cyrus.conf" || die
  120. fi
  121. newinitd "${FILESDIR}/cyrus.rc6" cyrus
  122. newconfd "${FILESDIR}/cyrus.confd" cyrus
  123. newpamd "${FILESDIR}/cyrus.pam-include" sieve
  124. for subdir in imap/{,db,log,msg,proc,socket,sieve} spool/imap/{,stage.} ; do
  125. keepdir "/var/${subdir}"
  126. fowners cyrus:mail "/var/${subdir}"
  127. fperms 0750 "/var/${subdir}"
  128. done
  129. for subdir in imap/{user,quota,sieve} spool/imap ; do
  130. 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
  131. keepdir "/var/${subdir}/${i}"
  132. fowners cyrus:mail "/var/${subdir}/${i}"
  133. fperms 0750 "/var/${subdir}/${i}"
  134. done
  135. done
  136. }
  137. pkg_preinst() {
  138. if ! has_version ${CATEGORY}/${PN} ; then
  139. elog "For correct logging add the following to /etc/syslog.conf:"
  140. elog " local6.* /var/log/imapd.log"
  141. elog " auth.debug /var/log/auth.log"
  142. echo
  143. elog "You have to add user cyrus to the sasldb2. Do this with:"
  144. elog " saslpasswd2 cyrus"
  145. fi
  146. }
  147. pkg_postinst() {
  148. # do not install server.{key,pem) if they exist.
  149. if use ssl ; then
  150. if [ ! -f "${ROOT}"etc/ssl/cyrus/server.key ]; then
  151. install_cert /etc/ssl/cyrus/server
  152. chown cyrus:mail "${ROOT}"etc/ssl/cyrus/server.{key,pem}
  153. fi
  154. fi
  155. }