courier-imap-4.16.2-r1.ebuild 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit autotools eutils multilib libtool systemd
  5. DESCRIPTION="An IMAP daemon designed specifically for maildirs"
  6. HOMEPAGE="http://www.courier-mta.org/"
  7. SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
  8. LICENSE="GPL-3"
  9. SLOT="0"
  10. KEYWORDS="alpha amd64 ~arm hppa ia64 ~mips ppc ppc64 sparc x86"
  11. IUSE="berkdb debug fam +gdbm gnutls ipv6 libressl selinux trashquota"
  12. REQUIRED_USE="|| ( berkdb gdbm )"
  13. CDEPEND="
  14. gnutls? ( net-libs/gnutls )
  15. !gnutls? (
  16. !libressl? ( dev-libs/openssl:0= )
  17. libressl? ( dev-libs/libressl:0= )
  18. )
  19. >=net-libs/courier-authlib-0.61
  20. >=net-libs/courier-unicode-1.3
  21. >=net-mail/mailbase-0.00-r8
  22. berkdb? ( sys-libs/db:= )
  23. fam? ( virtual/fam )
  24. gdbm? ( >=sys-libs/gdbm-1.8.0 )"
  25. DEPEND="${CDEPEND}
  26. dev-lang/perl
  27. !mail-mta/courier
  28. userland_GNU? ( sys-process/procps )"
  29. RDEPEND="${CDEPEND}
  30. selinux? ( sec-policy/selinux-courier )"
  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/cyrus-imapd
  37. !net-mail/uw-imap"
  38. RC_VER="4.0.6-r1"
  39. INITD_VER="4.0.6-r1"
  40. src_prepare() {
  41. # Bug #48838. Patch to enable/disable FAM support.
  42. # 20 Aug 2004 langthang@gentoo.org
  43. # This patch should fix bug #51540. fam USE flag is not needed for shared folder support.
  44. epatch "${FILESDIR}"/${PN}-4.15-disable-fam-configure.ac.patch
  45. # Kill unneeded call to AC_PROG_SYSCONFTOOL (bug #168206).
  46. epatch "${FILESDIR}"/${PN}-4.15-aclocal-fix.patch
  47. # These patches should fix problems detecting BerkeleyDB.
  48. # We now can compile with db4 support.
  49. if use berkdb ; then
  50. epatch \
  51. "${FILESDIR}"/${PN}-4.15-db4-bdbobj_configure.ac.patch \
  52. "${FILESDIR}"/${PN}-4.15-db4-configure.ac.patch
  53. fi
  54. eautoreconf
  55. }
  56. src_configure() {
  57. local myconf=""
  58. # 19 Aug 2004 langthang@gentoo.org
  59. # Default to gdbm if both berkdb and gdbm are present.
  60. if use gdbm ; then
  61. einfo "Building with GDBM support"
  62. myconf="${myconf} --with-db=gdbm"
  63. elif use berkdb ; then
  64. einfo "Building with BerkeleyDB support"
  65. myconf="${myconf} --with-db=db"
  66. fi
  67. if use trashquota ; then
  68. einfo "Building with Trash Quota Support"
  69. myconf="${myconf} --with-trashquota"
  70. fi
  71. use debug && myconf="${myconf} debug=true"
  72. # Do the actual build now
  73. econf \
  74. --disable-root-check \
  75. --bindir=/usr/sbin \
  76. --sysconfdir=/etc/${PN} \
  77. --libexecdir=/usr/$(get_libdir)/${PN} \
  78. --localstatedir=/var/lib/${PN} \
  79. --with-authdaemonvar=/var/lib/${PN}/authdaemon \
  80. --enable-workarounds-for-imap-client-bugs \
  81. --with-mailuser=mail \
  82. --with-mailgroup=mail \
  83. $(use_with fam) \
  84. $(use_with ipv6) \
  85. $(use_with gnutls) \
  86. ${myconf}
  87. # Change the pem file location.
  88. sed -i -e "s:^\(TLS_CERTFILE=\).*:\1/etc/courier-imap/imapd.pem:" \
  89. libs/imap/imapd-ssl.dist || \
  90. die "sed failed"
  91. sed -i -e "s:^\(TLS_CERTFILE=\).*:\1/etc/courier-imap/pop3d.pem:" \
  92. libs/imap/pop3d-ssl.dist || \
  93. die "sed failed"
  94. }
  95. src_compile() {
  96. # spurious failures with parallel compiles
  97. emake -j1
  98. }
  99. src_install() {
  100. dodir /var/lib/${PN} /etc/pam.d
  101. default
  102. rm -Rf "${D}/etc/pam.d" || die
  103. # Avoid name collisions in /usr/sbin wrt imapd and pop3d
  104. cd "${D}/usr/sbin" || die
  105. for name in imapd pop3d ; do
  106. mv -f "${name}" "courier-${name}" || die "Failed to mv ${name} to courier-${name}"
  107. done
  108. # Hack /usr/lib/courier-imap/foo.rc to use ${MAILDIR} instead of
  109. # 'Maildir', and to use /usr/sbin/courier-foo names.
  110. cd "${D}/usr/$(get_libdir)/${PN}" || die
  111. for service in {imapd,pop3d}{,-ssl} ; do
  112. sed -i -e 's/Maildir/${MAILDIR}/' "${service}.rc" || die "sed failed"
  113. sed -i -e "s/\/usr\/sbin\/${service}/\/usr\/sbin\/courier-${service}/" "${service}.rc" || die "sed failed"
  114. done
  115. # Rename the config files correctly and add a value for ${MAILDIR} to them.
  116. cd "${D}/etc/${PN}" || die
  117. for service in {imapd,pop3d}{,-ssl} ; do
  118. mv -f "${service}.dist" "${service}" || die "Failed to mv ${service}.dist to ${service}"
  119. echo -e '\n# Hardwire a value for ${MAILDIR}' >> "${service}"
  120. echo 'MAILDIR=.maildir' >> "${service}"
  121. echo 'MAILDIRPATH=.maildir' >> "${service}"
  122. done
  123. for service in imapd pop3d ; do
  124. echo -e '# Put any program for ${PRERUN} here' >> "${service}"
  125. echo 'PRERUN=' >> "${service}"
  126. echo -e '# Put any program for ${LOGINRUN} here' >> "${service}"
  127. echo -e '# this is for relay-ctrl-allow in 4*' >> "${service}"
  128. echo 'LOGINRUN=' >> "${service}"
  129. done
  130. cd "${D}/usr/sbin"
  131. for x in * ; do
  132. if [[ -L "${x}" ]] ; then
  133. rm -f "${x}" || die "Failed to rm ${x}"
  134. fi
  135. done
  136. cd ../share
  137. mv -f * ../sbin
  138. mv -f ../sbin/man .
  139. cd ..
  140. for x in mkimapdcert mkpop3dcert ; do
  141. mv -f "${D}/usr/sbin/${x}" "${D}/usr/sbin/${x}.orig" || die "Failed to mv /usr/sbin/${x} to /usr/sbin/${x}.orig"
  142. done
  143. dosbin "${FILESDIR}/mkimapdcert" "${FILESDIR}/mkpop3dcert"
  144. dosym /usr/sbin/courierlogger /usr/$(get_libdir)/${PN}/courierlogger
  145. mkdir "${WORKDIR}/tmp" ; cd "${WORKDIR}/tmp"
  146. for initd in courier-{imapd,pop3d}{,-ssl} ; do
  147. sed -e "s:GENTOO_LIBDIR:$(get_libdir):g" "${FILESDIR}/${PN}-${INITD_VER}-${initd}.rc6" > "${initd}" || die "initd libdir-sed failed"
  148. doinitd "${initd}"
  149. done
  150. systemd_newunit "${FILESDIR}"/courier-authdaemond-r1.service courier-authdaemond.service
  151. systemd_newunit "${FILESDIR}"/courier-imapd-ssl-r1.service courier-imapd-ssl.service
  152. systemd_newunit "${FILESDIR}"/courier-imapd-r1.service courier-imapd.service
  153. exeinto /usr/$(get_libdir)/${PN}
  154. for exe in gentoo-{imapd,pop3d}{,-ssl}.rc courier-{imapd,pop3d}.indirect ; do
  155. sed -e "s:GENTOO_LIBDIR:$(get_libdir):g" "${FILESDIR}/${PN}-${RC_VER}-${exe}" > "${exe}" || die "exe libdir-sed failed"
  156. doexe "${exe}"
  157. done
  158. dodir /usr/bin
  159. mv -f "${D}/usr/sbin/maildirmake" "${D}/usr/bin/maildirmake" || die "Failed to mv /usr/sbin/maildirmake to /usr/bin/maildirmake"
  160. # Bug #45953, more docs.
  161. cd "${S}" || die
  162. dohtml -r "${S}"/*
  163. dodoc "${S}"/{AUTHORS,INSTALL,NEWS,README,ChangeLog} "${FILESDIR}"/${PN}-gentoo.readme
  164. docinto imap
  165. dodoc "${S}"/libs/imap/{ChangeLog,BUGS,BUGS.html,README}
  166. docinto maildir
  167. dodoc "${S}"/libs/maildir/{AUTHORS,INSTALL,README.maildirquota.txt,README.sharedfolders.txt}
  168. docinto tcpd
  169. dodoc "${S}"/libs/tcpd/README.couriertls
  170. }
  171. pkg_postinst() {
  172. elog "Please read http://www.courier-mta.org/imap/INSTALL.html#upgrading"
  173. elog "and remove TLS_DHPARAMS from configuration files or run mkdhparams"
  174. elog "For a quick-start howto please refer to"
  175. elog "${PN}-gentoo.readme in /usr/share/doc/${PF}"
  176. # Some users have been reporting that permissions on this directory were
  177. # getting scrambled, so let's ensure that they are sane.
  178. chmod 0755 "${ROOT}/usr/$(get_libdir)/${PN}" || die "Failed to ensure sane permissions on ${ROOT}/usr/$(get_libdir)/${PN}"
  179. }
  180. src_test() {
  181. ewarn "make check is not supported by this package due to the"
  182. ewarn "--enable-workarounds-for-imap-client-bugs option."
  183. }