summaryrefslogtreecommitdiff
blob: 016dd06a306fd09adcd6d9953deee08f9a640921 (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
97
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-mail/tpop3d/tpop3d-1.5.4-r1.ebuild,v 1.2 2009/07/10 13:51:51 ssuominen Exp $

EAPI=1

inherit eutils flag-o-matic

DESCRIPTION="An extensible POP3 server with vmail-sql/MySQL support."
HOMEPAGE="http://savannah.nongnu.org/projects/tpop3d/"
SRC_URI="http://download.savannah.nongnu.org/releases/tpop3d/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE="authexternal debug drac flatfile gdbm ldap maildir mbox mysql offensive
	pam passwd perl postgres +sha1 shadow ssl tcpd"

RDEPEND="sha1?		( >=dev-libs/openssl-0.9.6 )
	ssl?		( >=dev-libs/openssl-0.9.6 )
	ldap? 		( >=net-nds/openldap-2.0.7 )
	mysql? 		( virtual/mysql )
	postgres?	( >=virtual/postgresql-server-7.3 )
	perl?		( >=dev-lang/perl-5.6.1 )
	pam? 		( virtual/pam
				  >=net-mail/mailbase-0.00-r8 )
	tcpd?		( >=sys-apps/tcp-wrappers-7.6 )"

DEPEND="${RDEPEND}
	drac?		( mail-client/drac )"

src_compile() {
	local myconf=""
	local noauth=0

	elog "This version of the tpop3d ebuild has a lot of new USE flags."
	elog "Make sure that everything you need is enabled."

	# Various authentication methods
	use authexternal && myconf="${myconf} --enable-auth-other"
	use flatfile	&& myconf="${myconf} --enable-auth-flatfile"
	use gdbm		&& myconf="${myconf} --enable-auth-gdbm"
	use ldap		&& myconf="${myconf} --enable-auth-ldap"
	use mysql		&& myconf="${myconf} --enable-auth-mysql"
	use pam			|| myconf="${myconf} --disable-auth-pam"
	use passwd		&& myconf="${myconf} --enable-auth-passwd"
	use perl		&& myconf="${myconf} --enable-auth-perl"
	use postgres	&& myconf="${myconf} --enable-auth-pgsql"
	use shadow		&& myconf="${myconf} --enable-auth-passwd --enable-shadow-passwords"

	use authexternal || use flatfile || use gdbm || use ldap || use mysql ||
		use	pam || use passwd || use perl || use postgres || use shadow ||
		noauth=1

	if [[ ${noauth} -eq 1 ]]; then
		ewarn "None of tpop3d's authentication mechanism USE flags are set."
		ewarn "As a result tpop3d will be built with /etc/passwd authentication only."
		myconf="${myconf} --enable-auth-passwd"
	fi

	# Other optional features
	use debug		&& myconf="${myconf} --enable-backtrace"
	use maildir		&& myconf="${myconf} --enable-mbox-maildir"
	use mbox		|| myconf="${myconf} --disable-mbox-bsd"
	use offensive	|| myconf="${myconf} --disable-snide-comments"
	use sha1		|| myconf="${myconf} --disable-sha1-passwords"
	use ssl			&& myconf="${myconf} --enable-tls"
	use tcpd		&& myconf="${myconf} --enable-tcp-wrappers"

	# Install mail-client/drac for integration with tpop3d
	use drac		&& myconf="${myconf} --enable-drac"

	econf ${myconf} || die "./configure failed"

	# Causes crash with "stack smashing attack" on connect, because of bug in
	# SSP (bug #115285)
	filter-flags -fstack-protector

	emake || die
}

src_install() {
	make DESTDIR="${D}" install || die
	dodir /etc/tpop3d

	if use pam ; then
		dodir /etc/pam.d
		dosym /etc/pam.d/pop3 /etc/pam.d/tpop3d
	fi

	newinitd "${FILESDIR}/${PN}-1.5.4.init" tpop3d
}

pkg_postinst() {
	elog "Read the tpop3d.conf manpage"
	elog "Please create /etc/tpop3d/tpop3d.conf to fit your configuration"
}