# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 inherit bash-completion eutils autotools libtool DESCRIPTION="New MH mail reader" HOMEPAGE="http://www.nongnu.org/nmh/" SRC_URI="mirror://gentoo/${P}.tar.bz2" SLOT="0" LICENSE="BSD" KEYWORDS="~amd64 ~ppc ~sparc ~x86" IUSE="kerberos sasl debug emacs berkdb gdbm" DEPEND="virtual/libc virtual/libiconv net-libs/liblockfile gdbm? ( !berkdb? ( sys-libs/gdbm ) ) berkdb? ( >=sys-libs/db-4 ) !berkdb? ( !gdbm? ( >=sys-libs/db-4 ) ) sys-libs/ncurses sasl? ( dev-libs/cyrus-sasl ) kerberos? ( app-crypt/mit-krb5 )" RDEPEND="${DEPEND} net-mail/metamail" S="${WORKDIR}/${P}" pkg_setup() { if use kerberos; then if ! built_with_use app-crypt/mit-krb5 krb4; then eerror 'You must emerge app-crypt/mit-krb5 with USE="krb4" or disable the kerberos USE flag for '"${PF}" die fi fi dbconf="--with-ndbmheader=db.h --with-ndbm=db" #sys-libs/db is the default choice. We need either gdbm or berkdb USE flags #to be set, but if there's any doubt, we default to berkdb. if use gdbm || use berkdb; then if ! use berkdb; then myconf='--with-ndbmheader=gdbm/ndbm.h --with-ndbm=gdbm_compat' elif use gdbm && use berkdb; then ewarn "Both gdbm & berkdb use flags are set." ewarn "Defaulting to berkdb" myconf="${dbconf}" else myconf="${dbconf}" fi else ewarn "You have set neither the berkdb or the gdbm use flags." ewarn "Defaulting to berkdb" myconf="${dbconf}" fi #Default to nano and less, unless otherwise indicated. [ -z ${EDITOR} ] \ && EDITOR=$(type -p nano) [ -z ${PAGER} ] \ && PAGER=$(type -p less) myconf="${myconf} --sysconfdir=/etc/nmh --enable-pop --enable-apop --enable-masquerade='' --with-editor=${EDITOR} --with-pager=${PAGER} $(use_enable emacs mhe) $(use_with sasl cyrus-sasl) $(use_with kerberos krb4) $(use_enable debug)" } src_unpack() { unpack ${A} cd "${S}" #Nice manpages patch from Debian. Adds master index 'man nmh' and #a chart of available commands and their options 'man mh-chart'. epatch "${FILESDIR}/${PN}-manpages.patch" #We do libdir = bindir, and it was creating some problems for #us, namely install-mh not being installed. This patch fixes that #and installs symbolic links instead of those nasty hardlinks. epatch "${FILESDIR}/${PN}-install-mh.patch" elibtoolize eautoreconf } src_compile() { econf ${myconf} || die "Configure failed" #Yes, Dorothy, without -j1 this really fails. emake -j1 || die "Compiling failed" } src_install() { make DESTDIR="${D}" libdir=/usr/bin install || die if use bash-completion; then dobashcompletion docs/COMPLETION-BASH nmh fi #Install mhn.defaults snatched from Debian. This makes even more #sense on Gentoo since we don't have RECOMMENDED dependencies to #handle the different mime-types mhn.defaults.sh is able to make #entries for. Let metamail handle it, it is what it's there for. dodir /etc/nmh insinto /etc/nmh insopts -m644 doins "${FILESDIR}"/mhn.defaults || die #Make sure manpages are also available for the installed symlinks. dosym folder.1 /usr/share/man/man1/folders.1 dosym flist.1 /usr/share/man/man1/flists.1 dosym nmh.7 /usr/share/man/man7/mh.7 dodoc docs/* ChangeLog COPYRIGHT README || die "Docs failed" } pkg_postinst() { bash-completion_pkg_postinst elog 'Configuration of nmh is not un-complicated.' elog 'For elaborate documentation and examples, please visit this website where the' elog 'O'"'"'Reilly book "MH & nmh: Email for Users & Programmers" is freely available:' elog 'http://rand-mh.sourceforge.net/book/index.html' elog 'For a readily available source of information, use "man 7 nmh"' }