11f1329770ac512f524c34a6f8c0136594dbf4ee
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

1) # Copyright 1999-2008 Gentoo Foundation
2) # Distributed under the terms of the GNU General Public License v2
3) # $Header: /var/cvsroot/gentoo-x86/mail-mta/courier/courier-0.55.1-r1.ebuild,v 1.4 2008/02/03 10:51:33 hollow Exp $
4) 
5) WANT_AUTOCONF="latest"
6) WANT_AUTOMAKE="latest"
7) 
8) inherit eutils flag-o-matic autotools
9) 
10) DESCRIPTION="An MTA designed specifically for maildirs"
11) [ -z "${PV/?.??/}" ] && SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
12) [ -z "${PV/?.??.?/}" ] && SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2"
13) [ -z "${SRC_URI}" ] && SRC_URI="http://www.courier-mta.org/beta/courier/${P%%_pre}.tar.bz2"
14) HOMEPAGE="http://www.courier-mta.org/"
15) S="${WORKDIR}/${P%%_pre}"
16) 
17) SLOT="0"
18) LICENSE="GPL-2"
19) # not in keywords due to missing dependencies: ~arm ~s390 ~ppc64
20) KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~sparc ~x86"
21) IUSE="postgres ldap mysql pam nls ipv6 spell fax crypt norewrite mailwrapper fam"
22) 
23) PROVIDE="virtual/mta
24) 	 virtual/mda
25) 	 virtual/imapd"
26) 
27) DEPEND="
28) 	>=net-libs/courier-authlib-0.59
29) 	>=dev-libs/openssl-0.9.6
30) 	>=sys-libs/gdbm-1.8.0
31) 	dev-libs/libpcre
32) 	app-misc/mime-types
33) 	fax? ( >=media-libs/netpbm-9.12 virtual/ghostscript >=net-dialup/mgetty-1.1.28 )
34) 	pam? ( virtual/pam )
35) 	mysql? ( virtual/mysql )
36) 	ldap? ( >=net-nds/openldap-1.2.11 )
37) 	postgres? ( >=dev-db/postgresql-7.1.3 )
38) 	spell? ( virtual/aspell-dict )
39) 	fam? ( virtual/fam )
40) 	!mailwrapper? ( !virtual/mta )
41) 	!virtual/imapd
42) 	!mail-filter/maildrop"
43) 
44) RDEPEND="${DEPEND}
45) 	dev-lang/perl
46) 	sys-process/procps"
47) 
48) PDEPEND="mailwrapper? ( >=net-mail/mailwrapper-0.2 )
49) 	pam? ( net-mail/mailbase )
50) 	crypt? ( >=app-crypt/gnupg-1.0.4 )"
51) 
52) filter-flags '-fomit-frame-pointer'
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

53) filter-ldflags '-Wl,--as-needed'
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

54) 
55) src_unpack() {
56) 	use fam || (
57) 		ewarn "File Alteration Monitor (FAM) is disabled"
58) 		ewarn "courier-imap will fall back to 60 second polls."
59) 		ewarn 'add "fam" to your USE flags to build as usual'
60) 		ebeep 4
61) 		epause 4 )
62) 	unpack ${A}
63) 	cd ${S}
64) 	use norewrite && epatch ${FILESDIR}/norewrite.patch
65) 	use elibc_uclibc && sed -i -e 's:linux-gnu\*:linux-gnu\*\ \|\ linux-uclibc:' config.sub
66) 
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

67) 	epatch "${FILESDIR}/remove-sysconftool.patch"
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

68) 
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

69) 	_elibtoolize --copy --force || die
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

70) }
71) 
72) src_compile() {
73) 	local myconf
74) 	myconf="`use_with ipv6` \
75) 		`use_with ldap ldapaliasd` `use_enable ldap maildropldap`"
76) 
77) 	use ldap && myconf="${myconf} --with-ldapconfig=/etc/courier/maildropldap.conf"
78) 	use spell || myconf="${myconf} --without-ispell"
79) 
80) 	myconf="${myconf} --enable-mimetypes=/etc/mime.types"
81) 
82) 	myconf="${myconf} $(use_with fam)"
83) 
84) 	einfo "Configuring courier: `echo ${myconf} | xargs echo`"
85) 
86) 	econf \
87) 		--prefix=/usr \
88) 		--disable-root-check \
89) 		--mandir=/usr/share/man \
90) 		--sysconfdir=/etc/courier \
91) 		--libexecdir=/usr/$(get_libdir)/courier \
92) 		--datadir=/usr/share/courier \
93) 		--sharedstatedir=/var/lib/courier/com \
94) 		--localstatedir=/var/lib/courier \
95) 		--with-piddir=/var/run/courier \
96) 		--with-authdaemonvar=/var/lib/courier/authdaemon \
97) 		--with-mailuser=mail \
98) 		--with-mailgroup=mail \
99) 		--with-paranoid-smtpext \
100) 		--with-db=gdbm \
101) 		--disable-autorenamesent \
102) 		--cache-file=${S}/configuring.cache \
103) 		--host=${CHOST} ${myconf} debug=true || die "./configure"
104) 	sed -e'/^install-perms-local:/a\	sed -e\"s|^|'${D}'|g\" -i permissions.dat' -i Makefile
105) 	emake || die "Compile problem"
106) }
107) 
108) etc_courier() {
109) 	# Import existing /etc/courier/file if it exists.
110) 	# Add option only if it was not already set or even commented out
111) 	file="${1}" ; word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`"
112) 	[ ! -e "${D}/etc/courier/${file}" ] && [ -e "/etc/courier/${file}" ] && \
113) 			cp "/etc/courier/${file}" "${D}/etc/courier/${file}"
114) 	grep -q "${word}" "${D}/etc/courier/${file}" || \
115) 		echo "${2}" >> "${D}/etc/courier/${file}"
116) }
117) 
118) etc_courier_chg() {
119) 	file="${1}" ; key="${2}" ; value="${3}" ; section="${4}"
120) 	[ -z "${section}" ] && section="${2}"
121) 	grep -q "${key}" "${file}" && elog "Changing ${file}: ${key} to ${value}"
122) 	sed -i -e"/\#\#NAME: ${section}/,+20 s|${key}=.*|${key}=\"${value}\"|g" ${file}
123) }
124) 
125) 
126) src_install() {
127) 	local f
128) 	diropts -o mail -g mail
129) 	keepdir /var/run/courier
130) 	keepdir /var/lib/courier/tmp
131) 	keepdir /var/lib/courier/msgs
132) 	make install DESTDIR=${D} || die "install"
133) 	make install-configure || die "install-configure"
134) 
135) 	for dir2keep in `(cd ${D} && find ./var/lib/courier -type d)` ; do
136) 		keepdir $dir2keep || die "failed running keepdir: $dir2keep"
137) 	done
138) 
139) 	newinitd ${FILESDIR}/courier-init-r1 courier
140) 	use fam || sed -i -e's|^.*use famd$||g' ${D}/etc/init.d/courier
141) 
142) 	cd ${D}/etc/courier
143) 	insinto /etc/courier
144) 	newins ${FILESDIR}/apache-sqwebmail.inc apache-sqwebmail.inc
145) 
146) 	if use pam ; then
147) 		dodir /etc/pam.d
148) 		rm imapd.authpam pop3d.authpam
149) 		for f in *.authpam ; do mv "${f}" "${D}/etc/pam.d/${f%%.authpam}" ; done
150) 	fi
151) 
152) 	for f in *.dist ; do cp ${f} ${f%%.dist} ; done
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

153) 	if use ldap ; then
154) 		[ -e ldapaliasrc ] &&  ( chown root:0 ldapaliasrc ; chmod 400 ldapaliasrc )
155) 	else
156) 		rm -f ldapaliasrc
157) 	fi
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

158) 
159) 	( [ -e /etc/courier/sizelimit ] && cat /etc/courier/sizelimit || echo 0 ) \
160) 		> ${D}/etc/courier/sizelimit
161) 	etc_courier maildroprc ""
162) 	etc_courier esmtproutes ""
163) 	etc_courier backuprelay ""
164) 	etc_courier locallowercase ""
165) 	etc_courier bofh "opt BOFHBADMIME=accept"
166) 	etc_courier bofh "opt BOFHSPFTRUSTME=1"
167) 	etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none,error,softfail,fail"
168) 	etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none"
169) 	etc_courier bofh "opt BOFHSPFFROM=all"
170) 	etc_courier bofh "opt BOFHSPFMAILFROM=all"
171) 	etc_courier bofh "#opt BOFHSPFHARDERROR=fail"
172) 	etc_courier esmtpd "BOFHBADMIME=accept"
173) 	etc_courier esmtpd-ssl "BOFHBADMIME=accept"
174) 	etc_courier esmtpd-msa "BOFHBADMIME=accept"
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

175) 
176) 	# Fix SSL (default SSL3 is incompatible with current openssl-clients)
177) 	#   - bernd@bwurst.org, 2008-03-07
178) 	etc_courier_chg esmtpd TLS_PROTOCOL SSL23
179) 	etc_courier_chg esmtpd-ssl TLS_PROTOCOL SSL23
180) 	etc_courier_chg imapd-ssl TLS_PROTOCOL SSL23
181) 	etc_courier_chg pop3d-ssl TLS_PROTOCOL SSL23
182) 	etc_courier_chg courierd TLS_PROTOCOL SSL23
183) 
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

184) 	use fam && etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE"
185) 	use fam || etc_courier_chg imapd IMAP_CAPABILITY "IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 AUTH=CRAM-SHA1 AUTH=CRAM-SHA256"
186) 
187) 	# Fix for a sandbox violation on subsequential merges
188) 	# - ticho@gentoo.org, 2005-07-10
189) 	rm ${D}/usr/sbin/{pop3d,imapd}{,-ssl}
190) 	dosym /usr/share/courier/pop3d /usr/sbin/courier-pop3d
191) 	dosym /usr/share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl
192) 	dosym /usr/share/courier/imapd /usr/sbin/courier-imapd
193) 	dosym /usr/share/courier/imapd-ssl /usr/sbin/courier-imapd-ssl
194) 
195) 	cd ${S}
196) 	cp imap/README README.imap
197) 	use nls && cp unicode/README README.unicode
198) 	dodoc AUTHORS BENCHMARKS COPYING* ChangeLog* INSTALL NEWS README* TODO courier/doc/*.txt
199) 	dodoc tcpd/README.couriertls
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

200) 	mv ${D}/usr/share/courier/htmldoc ${D}/usr/share/doc/${P}/html
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

201) 
202) 	insinto /usr/$(get_libdir)/courier/courier
203) 	insopts -m 755 -o mail -g mail
204) 	doins ${S}/courier/webmaild
205) 	insinto /etc/courier/webadmin
206) 	insopts -m 400 -o mail -g mail
207) 	doins ${FILESDIR}/password.dist
208) 
209) 	# avoid name collisions in /usr/sbin, make webadmin match
210) 	cd ${D}/usr/sbin
211) 	for f in imapd imapd-ssl pop3d pop3d-ssl ; do mv ${f} courier-${f} ; done
212) 	sed -i -e 's:\$sbindir\/imapd:\$sbindir\/courier-imapd:g' \
213) 		-e 's:\$sbindir\/imapd-ssl:\$sbindir\/courier-imapd-ssl:g' \
214) 		${D}/usr/share/courier/courierwebadmin/admin-40imap.pl \
215) 		|| ewarn "failed to fix webadmin"
216) 	sed -i -e 's:\$sbindir\/pop3d:\$sbindir\/courier-pop3d:g' \
217) 		-e 's:\$sbindir\/pop3d-ssl:\$sbindir\/courier-pop3d-ssl:g' \
218) 		${D}/usr/share/courier/courierwebadmin/admin-45pop3.pl \
219) 		|| ewarn "failed to fix webadmin"
220) 
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

221) 	# users should be able to send mail. Could be restricted with suictl.
222) 	chmod u+s ${D}/usr/bin/sendmail
223)