summaryrefslogtreecommitdiff
blob: e87c4dee696fdd5d1ffff8112d3cf3721004411b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-mail/mailutils/mailutils-2.2.ebuild,v 1.7 2011/09/25 17:10:39 armin76 Exp $

EAPI="3"
PYTHON_DEPEND="python? 2"

inherit eutils flag-o-matic libtool python

DESCRIPTION="A useful collection of mail servers, clients, and filters."
HOMEPAGE="http://www.gnu.org/software/mailutils/mailutils.html"
SRC_URI="http://ftp.gnu.org/gnu/mailutils/${P}.tar.bz2"
LICENSE="GPL-2 LGPL-2.1"
SLOT="0"

KEYWORDS="amd64 ~hppa ~ppc x86 ~ppc-macos ~x64-macos ~x86-macos"
IUSE="bidi gdbm guile ldap mysql nls pam postgres python test tokyocabinet"

RDEPEND="!mail-client/nmh
	!mail-filter/libsieve
	!mail-client/mailx
	!mail-client/nail
	bidi? ( dev-libs/fribidi )
	guile? ( dev-scheme/guile )
	gdbm? ( sys-libs/gdbm )
	ldap? ( net-nds/openldap )
	mysql? ( virtual/mysql )
	nls? ( sys-devel/gettext )
	postgres? ( dev-db/postgresql-base )
	tokyocabinet? ( dev-db/tokyocabinet )
	virtual/mta"

DEPEND="${RDEPEND}
	test? ( dev-util/dejagnu )"

pkg_setup() {
	if use python; then
		python_set_active_version 2
		python_pkg_setup
	fi
}

src_prepare() {
	epatch "${FILESDIR}"/${PN}-2.1-python.patch
	elibtoolize  # for Darwin bundles

	# Disable bytecompilation of Python modules.
	echo "#!/bin/sh" > build-aux/py-compile
}

src_configure() {
	# TODO: Fix this breakage, starting in examples/cpp/
	append-ldflags $(no-as-needed)

	local myconf="--localstatedir=${EPREFIX}/var --sharedstatedir=${EPREFIX}/var"
	myconf="${myconf} --enable-mh"

	# We need sendmail or compiling will fail
	myconf="${myconf} --enable-sendmail"

	econf ${myconf} \
		$(use_with bidi fribidi) \
		$(use_with gdbm) \
		$(use_with guile) \
		$(use_with ldap) \
		$(use_with mysql) \
		$(use_enable nls) \
		$(use_enable pam) \
		$(use_with postgres) \
		$(use_with python) \
		$(use_with tokyocabinet)
}

src_install() {
	emake DESTDIR="${D}" install || die
	# mail.rc stolen from mailx, resolve bug #37302.
	insinto /etc
	doins "${FILESDIR}/mail.rc"

	if use python; then
		python_clean_installation_image
		rm -f "${ED}$(python_get_sitedir)/mailutils/c_api.a"
	fi
}

pkg_postinst() {
	if use python; then
		python_mod_optimize mailutils
	fi
}

pkg_postrm() {
	if use python; then
		python_mod_cleanup mailutils
	fi
}