1 |
commit: 396d03cf9e193197cbf003fffd1d4913510b6367 |
2 |
Author: Julian Ospald <hasufell <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 30 11:08:55 2015 +0000 |
4 |
Commit: Julian Ospald <hasufell <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 30 11:59:01 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=396d03cf |
7 |
|
8 |
mail-mta/courier: add libressl support |
9 |
|
10 |
mail-mta/courier/courier-0.75.0-r1.ebuild | 313 ++++++++++++++++++++++++++++++ |
11 |
1 file changed, 313 insertions(+) |
12 |
|
13 |
diff --git a/mail-mta/courier/courier-0.75.0-r1.ebuild b/mail-mta/courier/courier-0.75.0-r1.ebuild |
14 |
new file mode 100644 |
15 |
index 0000000..7b96015 |
16 |
--- /dev/null |
17 |
+++ b/mail-mta/courier/courier-0.75.0-r1.ebuild |
18 |
@@ -0,0 +1,313 @@ |
19 |
+# Copyright 1999-2015 Gentoo Foundation |
20 |
+# Distributed under the terms of the GNU General Public License v2 |
21 |
+# $Id$ |
22 |
+ |
23 |
+EAPI=5 |
24 |
+inherit eutils flag-o-matic multilib |
25 |
+ |
26 |
+DESCRIPTION="An MTA designed specifically for maildirs" |
27 |
+SRC_URI="mirror://sourceforge/courier/${P}.tar.bz2" |
28 |
+HOMEPAGE="http://www.courier-mta.org/" |
29 |
+SLOT="0" |
30 |
+LICENSE="GPL-2" |
31 |
+# not in keywords due to missing dependencies: |
32 |
+# ~s390 ~ppc64 ~alpha ~ia64 ~sparc ~x86 |
33 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~sparc ~x86" |
34 |
+IUSE="postgres ldap libressl mysql pam nls ipv6 spell fax crypt norewrite \ |
35 |
+ fam web webmail gnutls" |
36 |
+REQUIRED_USE="?? ( gnutls libressl )" |
37 |
+ |
38 |
+DEPEND=" |
39 |
+ >=net-libs/courier-authlib-0.66.3 |
40 |
+ >=net-libs/courier-unicode-1.3 |
41 |
+ !gnutls? ( !libressl? ( dev-libs/openssl:0= ) ) |
42 |
+ libressl? ( dev-libs/libressl:= ) |
43 |
+ gnutls? ( net-libs/gnutls ) |
44 |
+ >=sys-libs/gdbm-1.8.0 |
45 |
+ dev-libs/libpcre |
46 |
+ app-misc/mime-types |
47 |
+ fax? ( >=media-libs/netpbm-9.12 app-text/ghostscript-gpl >=net-dialup/mgetty-1.1.28 ) |
48 |
+ pam? ( virtual/pam ) |
49 |
+ mysql? ( virtual/mysql ) |
50 |
+ ldap? ( >=net-nds/openldap-1.2.11 ) |
51 |
+ postgres? ( dev-db/postgresql:= ) |
52 |
+ spell? ( app-text/aspell ) |
53 |
+ fam? ( virtual/fam ) |
54 |
+ !mail-filter/maildrop |
55 |
+ !mail-mta/esmtp |
56 |
+ !mail-mta/exim |
57 |
+ !mail-mta/mini-qmail |
58 |
+ !mail-mta/msmtp |
59 |
+ !mail-mta/netqmail |
60 |
+ !mail-mta/nullmailer |
61 |
+ !mail-mta/postfix |
62 |
+ !mail-mta/qmail-ldap |
63 |
+ !mail-mta/sendmail |
64 |
+ !mail-mta/ssmtp |
65 |
+ !mail-mta/opensmtpd |
66 |
+ !net-mail/dot-forward |
67 |
+ !sys-apps/ucspi-tcp |
68 |
+ " |
69 |
+ |
70 |
+RDEPEND="${DEPEND} |
71 |
+ dev-lang/perl |
72 |
+ sys-process/procps" |
73 |
+ |
74 |
+# get rid of old style virtual/imapd - bug 350792 |
75 |
+# all blockers really needed? |
76 |
+RDEPEND="${RDEPEND} |
77 |
+ !net-mail/bincimap |
78 |
+ !net-mail/courier-imap |
79 |
+ !net-mail/cyrus-imapd |
80 |
+ !net-mail/uw-imap" |
81 |
+ |
82 |
+PDEPEND="pam? ( net-mail/mailbase ) |
83 |
+ crypt? ( >=app-crypt/gnupg-1.0.4 )" |
84 |
+ |
85 |
+src_prepare() { |
86 |
+# unpack ${A} |
87 |
+# cd "${S}" |
88 |
+ use norewrite && epatch "${FILESDIR}/norewrite.patch" |
89 |
+} |
90 |
+ |
91 |
+src_configure() { |
92 |
+ filter-flags '-fomit-frame-pointer' |
93 |
+ |
94 |
+ local myconf |
95 |
+ myconf="" |
96 |
+ |
97 |
+ use ldap && myconf="${myconf} --with-ldapconfig=/etc/courier/maildropldap.conf" |
98 |
+ |
99 |
+ econf ${myconf} \ |
100 |
+ $(use_with fam) \ |
101 |
+ $(use_with ipv6) \ |
102 |
+ $(use_with spell ispell) \ |
103 |
+ $(use_with ldap ldapaliasd) \ |
104 |
+ $(use_enable ldap maildroldap) \ |
105 |
+ $(use_with gnutls) \ |
106 |
+ --enable-mimetypes=/etc/mime.types \ |
107 |
+ --prefix=/usr \ |
108 |
+ --disable-root-check \ |
109 |
+ --mandir=/usr/share/man \ |
110 |
+ --sysconfdir=/etc/courier \ |
111 |
+ --libexecdir=/usr/$(get_libdir)/courier \ |
112 |
+ --datadir=/usr/share/courier \ |
113 |
+ --sharedstatedir=/var/lib/courier/com \ |
114 |
+ --localstatedir=/var/lib/courier \ |
115 |
+ --with-piddir=/var/run/courier \ |
116 |
+ --with-authdaemonvar=/var/lib/courier/authdaemon \ |
117 |
+ --with-mailuser=mail \ |
118 |
+ --with-mailgroup=mail \ |
119 |
+ --with-paranoid-smtpext \ |
120 |
+ --with-db=gdbm \ |
121 |
+ --disable-autorenamesent \ |
122 |
+ --cache-file="${S}/configuring.cache" \ |
123 |
+ --host="${CHOST}" debug=true || die "./configure" |
124 |
+ sed -e'/^install-perms-local:/a\ sed -e\"s|^|'"${D}"'|g\" -i permissions.dat' -i Makefile |
125 |
+} |
126 |
+ |
127 |
+src_compile() { |
128 |
+ default |
129 |
+} |
130 |
+ |
131 |
+etc_courier() { |
132 |
+ # Import existing /etc/courier/file if it exists. |
133 |
+ # Add option only if it was not already set or even commented out |
134 |
+ file="${1}" ; word="`echo \"${2}\" | sed -e\"s|=.*$||\" -e\"s|^.*opt ||\"`" |
135 |
+ [ ! -e "${D}/etc/courier/${file}" ] && [ -e "/etc/courier/${file}" ] && \ |
136 |
+ cp "/etc/courier/${file}" "${D}/etc/courier/${file}" |
137 |
+ grep -q "${word}" "${D}/etc/courier/${file}" || \ |
138 |
+ echo "${2}" >> "${D}/etc/courier/${file}" |
139 |
+} |
140 |
+ |
141 |
+etc_courier_chg() { |
142 |
+ file="${1}" ; key="${2}" ; value="${3}" ; section="${4}" |
143 |
+ [ -z "${section}" ] && section="${2}" |
144 |
+ grep -q "${key}" "${file}" && elog "Changing ${file}: ${key} to ${value}" |
145 |
+ sed -i -e"/\#\#NAME: ${section}/,+30 s|${key}=.*|${key}=\"${value}\"|g" ${file} |
146 |
+} |
147 |
+ |
148 |
+src_install() { |
149 |
+ local f |
150 |
+ diropts -o mail -g mail |
151 |
+ keepdir /var/lib/courier/tmp |
152 |
+ keepdir /var/lib/courier/msgs |
153 |
+ make install DESTDIR="${D}" || die "install" |
154 |
+ make install-configure || die "install-configure" |
155 |
+ |
156 |
+ # init script takes care of this |
157 |
+ rm -rf "${D}/var/run" |
158 |
+ |
159 |
+ # Get rid of files we dont want |
160 |
+ if ! use webmail ; then |
161 |
+ rm -rf "${D}/usr/$(get_libdir)/courier/courier/webmail" \ |
162 |
+ "${D}/usr/$(get_libdir)/courier/courier/sqwebmaild" \ |
163 |
+ "${D}/usr/share/courier/sqwebmail/" \ |
164 |
+ "${D}/usr/sbin/webmaild" \ |
165 |
+ "${D}/usr/sbin/webgpg" \ |
166 |
+ "${D}/etc/courier/webmail.authpam" \ |
167 |
+ "${D}/var/lib/courier/webmail-logincache" \ |
168 |
+ "${D}"/etc/courier/sqwebmaild* |
169 |
+ fi |
170 |
+ |
171 |
+ if ! use web ; then |
172 |
+ rm -rf "${D}/usr/share/courier/courierwebadmin/" \ |
173 |
+ "${D}/etc/courier/webadmin" |
174 |
+ fi |
175 |
+ |
176 |
+ for dir2keep in $(cd "${D}" && find ./var/lib/courier -type d) ; do |
177 |
+ keepdir "$dir2keep" || die "failed running keepdir: $dir2keep" |
178 |
+ done |
179 |
+ |
180 |
+ newinitd "${FILESDIR}/courier-init-r4" "courier" |
181 |
+ use fam || sed -i -e's|^.*use famd$||g' "${D}/etc/init.d/courier" |
182 |
+ |
183 |
+ cd "${D}/etc/courier" |
184 |
+ if use webmail ; then |
185 |
+ insinto /etc/courier |
186 |
+ newins "${FILESDIR}/apache-sqwebmail.inc" apache-sqwebmail.inc |
187 |
+ fi |
188 |
+ |
189 |
+ for f in *.dist ; do cp "${f}" "${f%%.dist}" ; done |
190 |
+ if use ldap ; then |
191 |
+ [ -e ldapaliasrc ] && ( chown root:0 ldapaliasrc ; chmod 400 ldapaliasrc ) |
192 |
+ else |
193 |
+ rm -f ldapaliasrc |
194 |
+ fi |
195 |
+ |
196 |
+ ( [ -e /etc/courier/sizelimit ] && cat /etc/courier/sizelimit || echo 0 ) \ |
197 |
+ > "${D}/etc/courier/sizelimit" |
198 |
+ etc_courier maildroprc "" |
199 |
+ etc_courier esmtproutes "" |
200 |
+ etc_courier backuprelay "" |
201 |
+ etc_courier locallowercase "" |
202 |
+ etc_courier bofh "opt BOFHBADMIME=accept" |
203 |
+ etc_courier bofh "opt BOFHSPFTRUSTME=1" |
204 |
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none,error,softfail,fail" |
205 |
+ etc_courier bofh "opt BOFHSPFHELO=pass,neutral,unknown,none" |
206 |
+ etc_courier bofh "opt BOFHSPFFROM=all" |
207 |
+ etc_courier bofh "opt BOFHSPFMAILFROM=all" |
208 |
+ etc_courier bofh "#opt BOFHSPFHARDERROR=fail" |
209 |
+ etc_courier esmtpd "BOFHBADMIME=accept" |
210 |
+ etc_courier esmtpd-ssl "BOFHBADMIME=accept" |
211 |
+ etc_courier esmtpd-msa "BOFHBADMIME=accept" |
212 |
+ |
213 |
+ 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" |
214 |
+ 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" |
215 |
+ |
216 |
+ # Fix for a sandbox violation on subsequential merges |
217 |
+ # - ticho@g.o, 2005-07-10 |
218 |
+ dosym /usr/share/courier/pop3d /usr/sbin/courier-pop3d |
219 |
+ dosym /usr/share/courier/pop3d-ssl /usr/sbin/courier-pop3d-ssl |
220 |
+ dosym /usr/share/courier/imapd /usr/sbin/courier-imapd |
221 |
+ dosym /usr/share/courier/imapd-ssl /usr/sbin/courier-imapd-ssl |
222 |
+ |
223 |
+ cd "${S}" |
224 |
+ cp imap/README README.imap |
225 |
+ use nls && cp unicode/README README.unicode |
226 |
+ dodoc AUTHORS BENCHMARKS COPYING* ChangeLog* INSTALL NEWS README* TODO courier/doc/*.txt |
227 |
+ dodoc libs/tcpd/README.couriertls |
228 |
+ mv "${D}/usr/share/courier/htmldoc" "${D}/usr/share/doc/${PF}/html" |
229 |
+ |
230 |
+ if use webmail ; then |
231 |
+ insinto /usr/$(get_libdir)/courier/courier |
232 |
+ insopts -m 755 -o mail -g mail |
233 |
+ doins "${S}/courier/webmaild" |
234 |
+ fi |
235 |
+ |
236 |
+ if use web ; then |
237 |
+ insinto /etc/courier/webadmin |
238 |
+ insopts -m 400 -o mail -g mail |
239 |
+ doins "${FILESDIR}/password.dist" |
240 |
+ fi |
241 |
+ |
242 |
+ # avoid name collisions in /usr/sbin, make webadmin match |
243 |
+ cd "${D}/usr/sbin" |
244 |
+ for f in imapd imapd-ssl pop3d pop3d-ssl ; do mv "${f}" "courier-${f}" ; done |
245 |
+ if use web ; then |
246 |
+ sed -i -e 's:\$sbindir\/imapd:\$sbindir\/courier-imapd:g' \ |
247 |
+ -e 's:\$sbindir\/imapd-ssl:\$sbindir\/courier-imapd-ssl:g' \ |
248 |
+ "${D}/usr/share/courier/courierwebadmin/admin-40imap.pl" \ |
249 |
+ || ewarn "failed to fix webadmin" |
250 |
+ sed -i -e 's:\$sbindir\/pop3d:\$sbindir\/courier-pop3d:g' \ |
251 |
+ -e 's:\$sbindir\/pop3d-ssl:\$sbindir\/courier-pop3d-ssl:g' \ |
252 |
+ "${D}/usr/share/courier/courierwebadmin/admin-45pop3.pl" \ |
253 |
+ || ewarn "failed to fix webadmin" |
254 |
+ fi |
255 |
+ |
256 |
+ # users should be able to send mail. Could be restricted with suictl. |
257 |
+ chmod u+s "${D}/usr/bin/sendmail" |
258 |
+ |
259 |
+ dosym /usr/bin/sendmail /usr/sbin/sendmail |
260 |
+} |
261 |
+ |
262 |
+src_test() { |
263 |
+ if [ `whoami` != 'root' ]; then |
264 |
+ emake -j1 check || die "Make check failed." |
265 |
+ else |
266 |
+ einfo "make check skipped, can't run as root." |
267 |
+ einfo "You can enable it with FEATURES=\"userpriv\"" |
268 |
+ fi |
269 |
+} |
270 |
+ |
271 |
+pkg_postinst() { |
272 |
+ use fam && elog "fam daemon is needed for courier-imapd" \ |
273 |
+ || ewarn "courier was built without fam support" |
274 |
+} |
275 |
+ |
276 |
+pkg_config() { |
277 |
+ mailhost="$(hostname)" |
278 |
+ export mailhost |
279 |
+ |
280 |
+ domainname="$(domainname)" |
281 |
+ if [ "x$domainname" = "x(none)" ] ; then |
282 |
+ domainname="$(echo ${mailhost} | sed -e "s/[^\.]*\.\(.*\)/\1/")" |
283 |
+ fi |
284 |
+ export domainname |
285 |
+ |
286 |
+ if [ "${ROOT}" = "/" ] ; then |
287 |
+ file="${ROOT}/etc/courier/locals" |
288 |
+ if [ ! -f "${file}" ] ; then |
289 |
+ echo "localhost" > "${file}"; |
290 |
+ echo "${domainname}" >> "${file}"; |
291 |
+ fi |
292 |
+ file="${ROOT}/etc/courier/esmtpacceptmailfor.dir/${domainname}" |
293 |
+ if [ ! -f "${file}" ] ; then |
294 |
+ echo "${domainname}" > "${file}" |
295 |
+ /usr/sbin/makeacceptmailfor |
296 |
+ fi |
297 |
+ |
298 |
+ file="${ROOT}/etc/courier/smtpaccess/${domainname}" |
299 |
+ if [ ! -f "${file}" ] |
300 |
+ then |
301 |
+ netstat -nr | grep "^[1-9]" | while read network gateway netmask rest |
302 |
+ do |
303 |
+ i=1 |
304 |
+ net="" |
305 |
+ TIFS="${IFS}" |
306 |
+ IFS="." |
307 |
+ for o in "${netmask}" |
308 |
+ do |
309 |
+ if [ "${o}" == "255" ] |
310 |
+ then |
311 |
+ [ "_${net}" == "_" ] || net="${net}." |
312 |
+ t="$(echo "${network}" | cut -d " " -f ${i})" |
313 |
+ net="${net}${t}" |
314 |
+ fi |
315 |
+ i="$((${i} + 1))" |
316 |
+ done |
317 |
+ IFS="${TIFS}" |
318 |
+ echo "doing configuration - relay control for the network ${net} !" |
319 |
+ echo "${net} allow,RELAYCLIENT" >> ${file} |
320 |
+ done |
321 |
+ /usr/sbin/makesmtpaccess |
322 |
+ fi |
323 |
+ fi |
324 |
+ |
325 |
+ echo "creating cert for esmtpd-ssl:" |
326 |
+ /usr/sbin/mkesmtpdcert |
327 |
+ echo "creating cert for imapd-ssl:" |
328 |
+ /usr/sbin/mkpop3dcert |
329 |
+ echo "creating cert for pop3d-ssl:" |
330 |
+ /usr/sbin/mkimapdcert |
331 |
+} |