40cbfa8d2982fbf3e44414a2fae079dd38cbe175
Bernd Wurst version bump

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 \
Hanno Böck change nowebmail and noweba...

Hanno Böck authored 16 years ago

22) 	fam web webmail"
Bernd Wurst version bump

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'
54) filter-ldflags '-Wl,--as-needed'
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) 
68) 	epatch "${FILESDIR}/remove-sysconftool.patch"
69) 
70) 	# some libtool version mismatch
71) 	_elibtoolize --copy --force || die
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)"
85) 	#myconf="${myconf} --without-webmail --without-webadmin"
86) 
87) 	einfo "Configuring courier: $(echo ${myconf} | xargs echo)"
88) 
89) 	econf \
90) 		--prefix=/usr \
91) 		--disable-root-check \
92) 		--mandir=/usr/share/man \
93) 		--sysconfdir=/etc/courier \
94) 		--libexecdir=/usr/$(get_libdir)/courier \
95) 		--datadir=/usr/share/courier \
96) 		--sharedstatedir=/var/lib/courier/com \
97) 		--localstatedir=/var/lib/courier \
98) 		--with-piddir=/var/run/courier \
99) 		--with-authdaemonvar=/var/lib/courier/authdaemon \
100) 		--with-mailuser=mail \
101) 		--with-mailgroup=mail \
102) 		--with-paranoid-smtpext \
103) 		--with-db=gdbm \
104) 		--disable-autorenamesent \
105) 		--cache-file="${S}/configuring.cache" \
106) 		--host="${CHOST}" ${myconf} debug=true || die "./configure"
107) 	sed -e'/^install-perms-local:/a\	sed -e\"s|^|'"${D}"'|g\" -i permissions.dat' -i Makefile
108) 	emake || die "Compile problem"
109) }
110) 
111) etc_courier() {
112) 	# Import existing /etc/courier/file if it exists.
113) 	# Add option only if it was not already set or even commented out
114) 	file="${1}" ; word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`"
115) 	[ ! -e "${D}/etc/courier/${file}" ] && [ -e "/etc/courier/${file}" ] && \
116) 			cp "/etc/courier/${file}" "${D}/etc/courier/${file}"
117) 	grep -q "${word}" "${D}/etc/courier/${file}" || \
118) 		echo "${2}" >> "${D}/etc/courier/${file}"
119) }
120) 
121) etc_courier_chg() {
122) 	file="${1}" ; key="${2}" ; value="${3}" ; section="${4}"
123) 	[ -z "${section}" ] && section="${2}"
124) 	grep -q "${key}" "${file}" && elog "Changing ${file}: ${key} to ${value}"
125) 	sed -i -e"/\#\#NAME: ${section}/,+30 s|${key}=.*|${key}=\"${value}\"|g" ${file}
126) }
127) 
128) 
129) src_install() {
130) 	local f
131) 	diropts -o mail -g mail
132) 	keepdir /var/run/courier
133) 	keepdir /var/lib/courier/tmp
134) 	keepdir /var/lib/courier/msgs
135) 	make install DESTDIR="${D}" || die "install"
136) 	make install-configure || die "install-configure"
137) 
138) 	# Get rid of files we dont want
Hanno Böck change nowebmail and noweba...

Hanno Böck authored 16 years ago

139) 	if ! use webmail ; then
Bernd Wurst version bump

Bernd Wurst authored 16 years ago

140) 		cd "${D}"
141) 		cat "${FILESDIR}/webmail_files" | xargs rm -rf
142) 	fi
143) 
Hanno Böck change nowebmail and noweba...

Hanno Böck authored 16 years ago

144) 	if ! use web ; then
Bernd Wurst version bump

Bernd Wurst authored 16 years ago

145) 		cd "${D}"
146) 		cat "${FILESDIR}/webadmin_files" | xargs rm -rf
147) 	fi
148) 
149) 	for dir2keep in $(cd "${D}" && find ./var/lib/courier -type d) ; do
150) 		keepdir "$dir2keep" || die "failed running keepdir: $dir2keep"
151) 	done
152) 
153) 	newinitd "${FILESDIR}/courier-init-r1 courier"
154) 	use fam || sed -i -e's|^.*use famd$||g' "${D}/etc/init.d/courier"
155) 
156) 	cd "${D}/etc/courier"
Hanno Böck change nowebmail and noweba...

Hanno Böck authored 16 years ago

157) 	if use webmail ; then
Bernd Wurst version bump

Bernd Wurst authored 16 years ago

158) 		insinto /etc/courier
159) 		newins "${FILESDIR}/apache-sqwebmail.inc" apache-sqwebmail.inc
160) 	fi
161) 
162) 	for f in *.dist ; do cp "${f}" "${f%%.dist}" ; done
163) 	if use ldap ; then
164) 		[ -e ldapaliasrc ] &&  ( chown root:0 ldapaliasrc ; chmod 400 ldapaliasrc )
165) 	else
166) 		rm -f ldapaliasrc
167) 	fi
168) 
169) 	( [ -e /etc/courier/sizelimit ] && cat /etc/courier/sizelimit || echo 0 ) \
170) 		> "${D}/etc/courier/sizelimit"
171) 	etc_courier maildroprc ""
172) 	etc_courier esmtproutes ""
173) 	etc_courier backuprelay ""
174) 	etc_courier locallowercase ""
175) 	etc_courier bofh "opt BOFHBADMIME=accept"
176) 	etc_courier bofh "opt BOFHSPFTRUSTME=1"
177) 	etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none,error,softfail,fail"
178) 	etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none"
179) 	etc_courier bofh "opt BOFHSPFFROM=all"
180) 	etc_courier bofh "opt BOFHSPFMAILFROM=all"
181) 	etc_courier bofh "#opt BOFHSPFHARDERROR=fail"
182) 	etc_courier esmtpd "BOFHBADMIME=accept"
183) 	etc_courier esmtpd-ssl "BOFHBADMIME=accept"
184) 	etc_courier esmtpd-msa "BOFHBADMIME=accept"
185) 
186) 	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"
187) 	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"
188) 
189) 	# Fix for a sandbox violation on subsequential merges
190) 	# - ticho@gentoo.org, 2005-07-10
191) 	rm "${D}"/usr/sbin/{pop3d,imapd}{,-ssl}
192) 	dosym /usr/share/courier/pop3d /usr/sbin/courier-pop3d
193) 	dosym /usr/share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl
194) 	dosym /usr/share/courier/imapd /usr/sbin/courier-imapd
195) 	dosym /usr/share/courier/imapd-ssl /usr/sbin/courier-imapd-ssl
196) 
197) 	cd "${S}"
198) 	cp imap/README README.imap
199) 	use nls && cp unicode/README README.unicode
200) 	dodoc AUTHORS BENCHMARKS COPYING* ChangeLog* INSTALL NEWS README* TODO courier/doc/*.txt
201) 	dodoc tcpd/README.couriertls
202) 	mv "${D}/usr/share/courier/htmldoc" "${D}/usr/share/doc/${P}/html"
203) 
Hanno Böck change nowebmail and noweba...

Hanno Böck authored 16 years ago

204) 	if use webmail ; then
Bernd Wurst version bump

Bernd Wurst authored 16 years ago

205) 		insinto /usr/$(get_libdir)/courier/courier
206) 		insopts -m 755 -o mail -g mail
207) 		doins "${S}/courier/webmaild"
208) 	fi
209) 
Hanno Böck change nowebmail and noweba...

Hanno Böck authored 16 years ago

210) 	if use web ; then
Bernd Wurst version bump

Bernd Wurst authored 16 years ago

211) 		insinto /etc/courier/webadmin
212) 		insopts -m 400 -o mail -g mail
213) 		doins "${FILESDIR}/password.dist"
214) 	fi
215) 
216) 	# avoid name collisions in /usr/sbin, make webadmin match
217) 	cd "${D}/usr/sbin"
218) 	for f in imapd imapd-ssl pop3d pop3d-ssl ; do mv "${f}" "courier-${f}" ; done
Hanno Böck change nowebmail and noweba...

Hanno Böck authored 16 years ago

219) 	if use web ; then