summaryrefslogtreecommitdiff
blob: 5cd74a20eed9c2d24b3cd30f794dcafa7e378acf (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
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-mail/cyrus-imspd/cyrus-imspd-1.7-r1.ebuild,v 1.1 2003/10/10 17:37:08 max Exp $

DESCRIPTION="Internet Message Support Protocol (IMSP) server."
HOMEPAGE="http://asg.web.cmu.edu/cyrus/"
SRC_URI="ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/${PN}-v${PV}.tar.gz"

LICENSE="as-is"
SLOT="0"
KEYWORDS="x86"
IUSE="kerberos ldap ssl"

DEPEND="virtual/glibc
	>=sys-libs/db-3.2
	>=dev-libs/cyrus-sasl-2.1.3
	>=dev-libs/cyrus-imap-dev-2.1.14
	>=sys-apps/sed-4
	kerberos? ( virtual/krb5 )
	ldap? ( >=net-nds/openldap-2.0 )
	ssl? ( >=net-misc/stunnel-4 )"

S="${WORKDIR}/${PN}-v${PV}"

src_unpack() {
	unpack ${A} && cd "${S}"

	epatch "${FILESDIR}/cyrus-imspd-gentoo.patch"
	epatch "${FILESDIR}/cyrus-imspd-db4.patch"

	# cyrus 2.2.x has an extra library.
	if [ "`best_version '=dev-libs/cyrus-imap-dev-2.2*'`" ] ; then
		sed -e "s:-lcyrus:-lcyrus -lcyrus_min:" \
			-i "${S}/imsp/Makefile.in" \
			-i "${S}/cmulocal/libcyrus.m4" || die "sed failed"
	fi

	# recreate configure.
	ebegin "Recreating configure"
	rm -f configure acconfig.h
	sh SMakefile &>/dev/null || die "SMakefile failed"
	eend $?
}

src_compile() {
	local myconf
	myconf="${myconf} `use_with ldap ldap ldap`"
	myconf="${myconf} `use_enable kerberos gssapi`"

	econf \
		--without-krb \
		--with-auth=unix \
		${myconf}
	emake || die "compile problem"
}

src_install() {
	newsbin imsp/cyrus-imspd imspd

	exeinto /etc/init.d
	newexe "${FILESDIR}/imspd.rc6" imspd
	insinto /etc/conf.d
	newins "${FILESDIR}/imspd.conf" imspd

	keepdir /var/imsp{,/user}

	if [ "`use ssl`" ] ; then
		insinto /etc/stunnel
		newins "${FILESDIR}/stunnel.conf" imspd.conf

		dosed "s:#IMSPD_USE_SSL:IMSPD_USE_SSL:" /etc/conf.d/imspd

		ebegin "Generating self-signed test certificate"
		(yes "" | "${FILESDIR}/gentestcrt.sh") &>/dev/null
		eend $?
		ebegin "Generating PEM file"
		(cat server.key && echo && cat server.crt) > server.pem
		eend $?

		insinto /etc/ssl/imspd
		doins server.{key,crt,pem}
		fowners mail:root /etc/ssl/imspd/server.{key,crt,pem}
		fperms 0400 /etc/ssl/imspd/server.{key,crt,pem}
	fi

	dodoc README imsp/options.sample notes/*
}