75b4100b1779b743038e17f47b9ffe9dea17f44f
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"
Bernd Wurst get rid of webadmin/webmail...

Bernd Wurst authored 16 years ago

21) IUSE="postgres ldap mysql pam nls ipv6 spell fax crypt norewrite mailwrapper \
22) 	fam nowebmail nowebadmin"
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

23) 
24) PROVIDE="virtual/mta
25) 	 virtual/mda
26) 	 virtual/imapd"
27) 
28) DEPEND="
29) 	>=net-libs/courier-authlib-0.59
30) 	>=dev-libs/openssl-0.9.6
31) 	>=sys-libs/gdbm-1.8.0
32) 	dev-libs/libpcre
33) 	app-misc/mime-types
34) 	fax? ( >=media-libs/netpbm-9.12 virtual/ghostscript >=net-dialup/mgetty-1.1.28 )
35) 	pam? ( virtual/pam )
36) 	mysql? ( virtual/mysql )
37) 	ldap? ( >=net-nds/openldap-1.2.11 )
38) 	postgres? ( >=dev-db/postgresql-7.1.3 )
39) 	spell? ( virtual/aspell-dict )
40) 	fam? ( virtual/fam )
41) 	!mailwrapper? ( !virtual/mta )
42) 	!virtual/imapd
43) 	!mail-filter/maildrop"
44) 
45) RDEPEND="${DEPEND}
46) 	dev-lang/perl
47) 	sys-process/procps"
48) 
49) PDEPEND="mailwrapper? ( >=net-mail/mailwrapper-0.2 )
50) 	pam? ( net-mail/mailbase )
51) 	crypt? ( >=app-crypt/gnupg-1.0.4 )"
52) 
53) filter-flags '-fomit-frame-pointer'
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

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

Bernd Wurst authored 16 years ago

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

Bernd Wurst authored 16 years ago

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

Bernd Wurst authored 16 years ago

69) 
Bernd Wurst get rid of webadmin/webmail...

Bernd Wurst authored 16 years ago

70) 	# some libtool version mismatch
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

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

Bernd Wurst authored 16 years ago

72) }
73) 
74) src_compile() {
75) 	local myconf
76) 	myconf="`use_with ipv6` \
77) 		`use_with ldap ldapaliasd` `use_enable ldap maildropldap`"
78) 
79) 	use ldap && myconf="${myconf} --with-ldapconfig=/etc/courier/maildropldap.conf"
80) 	use spell || myconf="${myconf} --without-ispell"
81) 
82) 	myconf="${myconf} --enable-mimetypes=/etc/mime.types"
83) 
84) 	myconf="${myconf} $(use_with fam)"
Bernd Wurst get rid of webadmin/webmail...

Bernd Wurst authored 16 years ago

85) 	
86) 	#myconf="${myconf} --without-webmail --without-webadmin"
87) 
88) 	#if use nowebadmin ; then
89) 	#	sed -i -e 's:\(^ac_subdirs_all=.*\)webadmin \(.*$\):\1\2:' configure
90) 	#fi
91) 	#
92) 	#if use nowebmail ; then
93) 	#	sed -i -e 's:\(^ac_subdirs_all=.*\)webmail \(.*$\):\1\2:' configure
94) 	#	sed -i -e 's:\(^ac_subdirs_all=.*\)ldapaddressbook \(.*$\):\1\2:' configure
95) 	#	sed -i -e 's:\(^ac_subdirs_all=.*\)gpglib \(.*$\):\1\2:' configure
96) 	#fi
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

97) 
98) 	einfo "Configuring courier: `echo ${myconf} | xargs echo`"
99) 
100) 	econf \
101) 		--prefix=/usr \
102) 		--disable-root-check \
103) 		--mandir=/usr/share/man \
104) 		--sysconfdir=/etc/courier \
105) 		--libexecdir=/usr/$(get_libdir)/courier \
106) 		--datadir=/usr/share/courier \
107) 		--sharedstatedir=/var/lib/courier/com \
108) 		--localstatedir=/var/lib/courier \
109) 		--with-piddir=/var/run/courier \
110) 		--with-authdaemonvar=/var/lib/courier/authdaemon \
111) 		--with-mailuser=mail \
112) 		--with-mailgroup=mail \
113) 		--with-paranoid-smtpext \
114) 		--with-db=gdbm \
115) 		--disable-autorenamesent \
116) 		--cache-file=${S}/configuring.cache \
117) 		--host=${CHOST} ${myconf} debug=true || die "./configure"
118) 	sed -e'/^install-perms-local:/a\	sed -e\"s|^|'${D}'|g\" -i permissions.dat' -i Makefile
119) 	emake || die "Compile problem"
120) }
121) 
122) etc_courier() {
123) 	# Import existing /etc/courier/file if it exists.
124) 	# Add option only if it was not already set or even commented out
125) 	file="${1}" ; word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`"
126) 	[ ! -e "${D}/etc/courier/${file}" ] && [ -e "/etc/courier/${file}" ] && \
127) 			cp "/etc/courier/${file}" "${D}/etc/courier/${file}"
128) 	grep -q "${word}" "${D}/etc/courier/${file}" || \
129) 		echo "${2}" >> "${D}/etc/courier/${file}"
130) }
131) 
132) etc_courier_chg() {
133) 	file="${1}" ; key="${2}" ; value="${3}" ; section="${4}"
134) 	[ -z "${section}" ] && section="${2}"
135) 	grep -q "${key}" "${file}" && elog "Changing ${file}: ${key} to ${value}"
Bernd Wurst config changes allowed on 3...

Bernd Wurst authored 16 years ago

136) 	sed -i -e"/\#\#NAME: ${section}/,+30 s|${key}=.*|${key}=\"${value}\"|g" ${file}
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

137) }
138) 
139) 
140) src_install() {
141) 	local f
142) 	diropts -o mail -g mail
143) 	keepdir /var/run/courier
144) 	keepdir /var/lib/courier/tmp
145) 	keepdir /var/lib/courier/msgs
146) 	make install DESTDIR=${D} || die "install"
147) 	make install-configure || die "install-configure"
148) 
Bernd Wurst get rid of webadmin/webmail...

Bernd Wurst authored 16 years ago

149) 	# Get rid of files we dont want
150) 	if use nowebmail ; then
151) 		cd ${D}
152) 		cat ${FILESDIR}/webmail_files | xargs rm -rf
153) 	fi
154) 
155) 	if use nowebadmin ; then
156) 		cd ${D}
157) 		cat ${FILESDIR}/webadmin_files | xargs rm -rf
158) 	fi
159) 
160) 	if ! use fax ; then
161) 		cd ${D}
162) 		cat ${FILESDIR}/fax_files | xargs rm -rf
163) 	fi
164) 
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

165) 	for dir2keep in `(cd ${D} && find ./var/lib/courier -type d)` ; do
166) 		keepdir $dir2keep || die "failed running keepdir: $dir2keep"
167) 	done
168) 
169) 	newinitd ${FILESDIR}/courier-init-r1 courier
170) 	use fam || sed -i -e's|^.*use famd$||g' ${D}/etc/init.d/courier
171) 
172) 	cd ${D}/etc/courier
Bernd Wurst get rid of webadmin/webmail...

Bernd Wurst authored 16 years ago

173) 	if ! use nowebmail ; then
174) 		insinto /etc/courier
175) 		newins ${FILESDIR}/apache-sqwebmail.inc apache-sqwebmail.inc
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

176) 	fi
177) 
178) 	for f in *.dist ; do cp ${f} ${f%%.dist} ; done
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

179) 	if use ldap ; then
180) 		[ -e ldapaliasrc ] &&  ( chown root:0 ldapaliasrc ; chmod 400 ldapaliasrc )
181) 	else
182) 		rm -f ldapaliasrc
183) 	fi
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

184) 
185) 	( [ -e /etc/courier/sizelimit ] && cat /etc/courier/sizelimit || echo 0 ) \
186) 		> ${D}/etc/courier/sizelimit
187) 	etc_courier maildroprc ""
188) 	etc_courier esmtproutes ""
189) 	etc_courier backuprelay ""
190) 	etc_courier locallowercase ""
191) 	etc_courier bofh "opt BOFHBADMIME=accept"
192) 	etc_courier bofh "opt BOFHSPFTRUSTME=1"
193) 	etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none,error,softfail,fail"
194) 	etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none"
195) 	etc_courier bofh "opt BOFHSPFFROM=all"
196) 	etc_courier bofh "opt BOFHSPFMAILFROM=all"
197) 	etc_courier bofh "#opt BOFHSPFHARDERROR=fail"
198) 	etc_courier esmtpd "BOFHBADMIME=accept"
199) 	etc_courier esmtpd-ssl "BOFHBADMIME=accept"
200) 	etc_courier esmtpd-msa "BOFHBADMIME=accept"
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

201) 
202) 	# Fix SSL (default SSL3 is incompatible with current openssl-clients)
203) 	#   - bernd@bwurst.org, 2008-03-07
204) 	etc_courier_chg esmtpd TLS_PROTOCOL SSL23
205) 	etc_courier_chg esmtpd-ssl TLS_PROTOCOL SSL23
206) 	etc_courier_chg imapd-ssl TLS_PROTOCOL SSL23
207) 	etc_courier_chg pop3d-ssl TLS_PROTOCOL SSL23
208) 	etc_courier_chg courierd TLS_PROTOCOL SSL23
209) 
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

210) 	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"
211) 	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"
212) 
213) 	# Fix for a sandbox violation on subsequential merges
214) 	# - ticho@gentoo.org, 2005-07-10
215) 	rm ${D}/usr/sbin/{pop3d,imapd}{,-ssl}
216) 	dosym /usr/share/courier/pop3d /usr/sbin/courier-pop3d
217) 	dosym /usr/share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl
218) 	dosym /usr/share/courier/imapd /usr/sbin/courier-imapd
219) 	dosym /usr/share/courier/imapd-ssl /usr/sbin/courier-imapd-ssl
220) 
221) 	cd ${S}
222) 	cp imap/README README.imap
223) 	use nls && cp unicode/README README.unicode
224) 	dodoc AUTHORS BENCHMARKS COPYING* ChangeLog* INSTALL NEWS README* TODO courier/doc/*.txt
225) 	dodoc tcpd/README.couriertls
Bernd Wurst * usable courier-0.58.0 ebu...

Bernd Wurst authored 16 years ago

226) 	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

227) 
Bernd Wurst get rid of webadmin/webmail...

Bernd Wurst authored 16 years ago

228) 	if ! use nowebmail ; then
229) 		insinto /usr/$(get_libdir)/courier/courier
230) 		insopts -m 755 -o mail -g mail
231) 		doins ${S}/courier/webmaild
232) 	fi
Bernd Wurst Make mailer.conf world-read...

Bernd Wurst authored 16 years ago

233) 
Bernd Wurst get rid of webadmin/webmail...

Bernd Wurst authored 16 years ago

234) 	if ! use nowebadmin ; then
235) 		insinto /etc/courier/webadmin
236) 		insopts -m 400 -o mail -g mail
237) 		doins ${FILESDIR}/password.dist
238) 	fi
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

239) 
240) 	# avoid name collisions in /usr/sbin, make webadmin match
241) 	cd ${D}/usr/sbin
242) 	for f in imapd imapd-ssl pop3d pop3d-ssl ; do mv ${f} courier-${f} ; done
Bernd Wurst get rid of webadmin/webmail...

Bernd Wurst authored 16 years ago

243) 	if ! use nowebadmin ; then
244) 		sed -i -e 's:\$sbindir\/imapd:\$sbindir\/courier-imapd:g' \
245) 			-e 's:\$sbindir\/imapd-ssl:\$sbindir\/courier-imapd-ssl:g' \
246) 			${D}/usr/share/courier/courierwebadmin/admin-40imap.pl \
247) 			|| ewarn "failed to fix webadmin"
248) 		sed -i -e 's:\$sbindir\/pop3d:\$sbindir\/courier-pop3d:g' \
249) 			-e 's:\$sbindir\/pop3d-ssl:\$sbindir\/courier-pop3d-ssl:g' \
250) 			${D}/usr/share/courier/courierwebadmin/admin-45pop3.pl \
251) 			|| ewarn "failed to fix webadmin"
252) 	fi
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

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

Bernd Wurst authored 16 years ago

254) 	# users should be able to send mail. Could be restricted with suictl.
255) 	chmod u+s ${D}/usr/bin/sendmail
256) 
Bernd Wurst Version bump to current ver...

Bernd Wurst authored 16 years ago

257) 	if use mailwrapper ; then
258) 		mv ${D}/usr/bin/sendmail ${D}/usr/bin/sendmail.courier
259) 		mv ${D}/usr/bin/rmail ${D}/usr/bin/rmail.courier
260) 		mv ${D}/usr/bin/mailq ${D}/usr/bin/mailq.courier
261) 
262) 		mv ${D}/usr/share/man/man1/sendmail.1 \
263) 			${D}/usr/share/man/man1/sendmail-courier.1
264) 		mv ${D}/usr/share/man/man1/mailq.1 \
265) 			${D}/usr/share/man/man1/mailq-courier.1
266) 		mv ${D}/usr/share/man/man1/rmail.1 \
267) 			${D}/usr/share/man/man1/rmail-courier.1
268) 
Bernd Wurst Make mailer.conf world-read...

Bernd Wurst authored 16 years ago

269) 		insopts -m 444 -o mail -g mail