summaryrefslogtreecommitdiff
blob: 9dbcbd3f5594840a7abd454f2720cc197f91062f (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# Maintainer: Donny Davies <woodchip@gentoo.org>
# $Header: /var/cvsroot/gentoo-x86/net-mail/postfix/postfix-1.1.3-r1.ebuild,v 1.1 2002/02/19 00:57:17 woodchip Exp $

DESCRIPTION="A fast and secure drop-in replacement for sendmail"
HOMEPAGE="http://www.postfix.org/"

POSTFIX_TLS_VER="0.8.3-1.1.3-0.9.6c"

S=${WORKDIR}/${P}
SRC_URI="ftp://ftp.porcupine.org/mirrors/postfix-release/official/${P}.tar.gz
	mta-tls? ( ftp://ftp.aet.tu-cottbus.de/pub/postfix_tls/pfixtls-${POSTFIX_TLS_VER}.tar.gz )"

PROVIDE="virtual/mta"
DEPEND="virtual/glibc
	>=sys-libs/db-3.2
	>=dev-libs/libpcre-3.4
	>=dev-libs/cyrus-sasl-1.5.27
	mta-ldap? ( >=net-nds/openldap-1.2 )
	mta-mysql? ( >=dev-db/mysql-3.23.28 )
	mta-tls? ( >=dev-libs/openssl-0.9.6c )"
RDEPEND="${DEPEND} >=net-mail/mailbase-0.00 !virtual/mta"

src_unpack() {
	unpack ${A}

	use mta-tls && \
	( cd ${S} ; patch -p1 < ${WORKDIR}/pfixtls-${POSTFIX_TLS_VER}/pfixtls.diff || die )

	cd ${S}/conf
	cp main.cf main.cf.orig
	sed -e "s:/usr/libexec/postfix:/usr/lib/postfix:" main.cf.orig > main.cf

	cd ${S}/src/global
	cp mail_params.h mail_params.h.orig
	sed -e "s:/usr/libexec/postfix:/usr/lib/postfix:" mail_params.h.orig > mail_params.h

	use mta-mysql && \
	( CCARGS="${CCARGS} -DHAS_MYSQL" ; AUXLIBS="${AUXLIBS} -lmysqlclient -lm" )
	use mta-ldap && \
	( CCARGS="${CCARGS} -DHAS_LDAP" ; AUXLIBS="${AUXLIBS} -lldap -llber" )
	use mta-tls && \
	( CCARGS="${CCARGS} -DHAS_SSL" ; AUXLIBS="${AUXLIBS} -lssl" )

	# stuff we always want...
	CCARGS="${CCARGS} -I/usr/include -DHAS_PCRE -DUSE_SASL_AUTH"
	AUXLIBS="${AUXLIBS} -L/usr/lib -lpcre -lsasl"
	DEBUG=""

	cd ${S}
	make tidy || die
	make makefiles CC="cc" OPT="${CFLAGS}" DEBUG="${DEBUG}" \
		CCARGS="${CCARGS}" AUXLIBS="${AUXLIBS}" || die
}

src_compile() {
	emake || die "compile problem"
}

src_install () {
	dodir /usr/bin /usr/sbin /usr/lib/postfix /etc/postfix/sample

	cd ${S}/bin
	dosbin post* sendmail
	dosym /usr/sbin/sendmail /usr/bin/mail
	dosym /usr/sbin/sendmail /usr/bin/mailq
	dosym /usr/sbin/sendmail /usr/bin/newaliases
	dosym /usr/sbin/sendmail /usr/lib/sendmail

	cd ${S}/libexec
	exeinto /usr/lib/postfix
	doexe *

	cd ${S}/man
	doman man*/*

	cd ${S}
	dodoc *README COMPATIBILITY HISTORY LICENSE PORTING RELEASE_NOTES
	dohtml html/*

	cd ${S}/conf
	insinto /etc/postfix/sample
	doins access aliases canonical relocated transport \
		pcre_table regexp_table postfix-script* *.cf

	exeinto /etc/postfix
	doexe postfix-script post-install postfix-files || die

	insinto /etc/postfix
	doins ${FILESDIR}/main.cf master.cf || die

	exeinto /etc/init.d ; newexe ${FILESDIR}/postfix.rc6 postfix
	insinto /etc/pam.d ; newins ${FILESDIR}/smtp.pam smtp
	insinto /etc/sasl ; doins ${FILESDIR}/smtpd.conf
}

pkg_postinst() {
	install -d 0755 ${ROOT}/var/spool/postfix

        if ! grep -q ^postdrop: /etc/group ; then
                groupadd postdrop || die "problem adding group postdrop"
        fi

	echo
	echo "*****************************************************************"
	echo "* NOTE:  Be sure to update /etc/postfix/master.cf to the latest *"
	echo "*        version or else postfix will no longer work.           *"
	echo "*****************************************************************"
	echo
}