/[gentoo-x86]/net-mail/dovecot/dovecot-2.0.19.ebuild
Gentoo

Contents of /net-mail/dovecot/dovecot-2.0.19.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Mon May 21 09:23:54 2012 UTC (11 months, 4 weeks ago) by phajdan.jr
Branch: MAIN
Changes since 1.6: +2 -2 lines
x86 stable wrt bug #413531

(Portage version: 2.1.10.49/cvs/Linux i686)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-mail/dovecot/dovecot-2.0.19.ebuild,v 1.6 2012/05/08 15:43:59 ranger Exp $
4
5 EAPI=4
6
7 inherit eutils versionator ssl-cert
8
9 MY_P="${P/_/.}"
10 major_minor="$( get_version_component_range 1-2 )"
11 sieve_version="0.2.6"
12 SRC_URI="http://dovecot.org/releases/${major_minor}/${MY_P}.tar.gz
13 sieve? (
14 http://www.rename-it.nl/dovecot/${major_minor}/dovecot-${major_minor}-pigeonhole-${sieve_version}.tar.gz
15 )
16 managesieve? (
17 http://www.rename-it.nl/dovecot/${major_minor}/dovecot-${major_minor}-pigeonhole-${sieve_version}.tar.gz
18 ) "
19 DESCRIPTION="An IMAP and POP3 server written with security primarily in mind"
20 HOMEPAGE="http://www.dovecot.org/"
21
22 SLOT="0"
23 LICENSE="LGPL-2.1 MIT"
24 KEYWORDS="~alpha amd64 arm hppa ~ia64 ppc ppc64 ~s390 ~sh ~sparc x86 ~x86-fbsd"
25
26 IUSE="bzip2 caps cydir sdbox doc ipv6 kerberos ldap +maildir managesieve mbox
27 mdbox mysql pam postgres sieve sqlite +ssl static-libs suid vpopmail zlib"
28
29 DEPEND="caps? ( sys-libs/libcap )
30 kerberos? ( virtual/krb5 )
31 ldap? ( net-nds/openldap )
32 mysql? ( virtual/mysql )
33 pam? ( virtual/pam )
34 postgres? ( dev-db/postgresql-base !dev-db/postgresql-base[ldap,threads] )
35 sqlite? ( dev-db/sqlite )
36 ssl? ( dev-libs/openssl )
37 vpopmail? ( net-mail/vpopmail )
38 virtual/libiconv"
39
40 RDEPEND="${DEPEND}
41 >=net-mail/mailbase-0.00-r8"
42
43 S=${WORKDIR}/${MY_P}
44
45 pkg_setup() {
46 if use managesieve && ! use sieve; then
47 ewarn "managesieve USE flag selected but sieve USE flag unselected"
48 ewarn "sieve USE flag will be turned on"
49 fi
50
51 # Add user and group for login process (same as for fedora/redhat)
52 # default internal user
53 enewgroup dovecot 97
54 enewuser dovecot 97 -1 /dev/null dovecot
55 # add "mail" group for suid'ing. Better security isolation.
56 if use suid; then
57 enewgroup mail
58 fi
59 # default login user
60 enewuser dovenull -1 -1 /dev/null
61 }
62
63 src_configure() {
64 local conf=""
65
66 if use postgres || use mysql || use sqlite; then
67 conf="${conf} --with-sql"
68 fi
69
70 local storages=""
71 for storage in cydir sdbox mdbox maildir mbox; do
72 use ${storage} && storages="${storage} ${storages}"
73 done
74 [ "${storages}" ] || storages="maildir"
75
76 # turn valgrind tests off. Bug #340791
77 VALGRIND=no econf \
78 --localstatedir="${EPREFIX}/var" \
79 --with-moduledir="${EPREFIX}/usr/$(get_libdir)/dovecot" \
80 $( use_with bzip2 bzlib ) \
81 $( use_with caps libcap ) \
82 $( use_with kerberos gssapi ) \
83 $( use_with ldap ) \
84 $( use_with mysql ) \
85 $( use_with pam ) \
86 $( use_with postgres pgsql ) \
87 $( use_with sqlite ) \
88 $( use_with ssl ) \
89 $( use_with vpopmail ) \
90 $( use_with zlib ) \
91 $( use_enable static-libs static ) \
92 --with-storages="${storages}" \
93 --disable-rpath \
94 --without-systemdsystemunitdir \
95 ${conf}
96
97 if use sieve || use managesieve ; then
98 # The sieve plugin needs this file to be build to determine the plugin
99 # directory and the list of libraries to link to.
100 emake dovecot-config || die "emake dovecot-config failed"
101 cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
102 econf \
103 $( use_enable static-libs static ) \
104 --localstatedir="${EPREFIX}/var" \
105 --enable-shared \
106 --with-dovecot="../${MY_P}" \
107 $( use_with managesieve )
108 fi
109 }
110
111 src_compile() {
112 emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"
113
114 if use sieve || use managesieve ; then
115 cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
116 emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"
117 fi
118 }
119
120 src_test() {
121 default_src_test
122 if use sieve || use managesieve ; then
123 cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
124 default_src_test
125 fi
126 }
127
128 src_install () {
129 emake DESTDIR="${ED}" install
130
131 # insecure:
132 # use suid && fperms u+s /usr/libexec/dovecot/deliver
133 # better:
134 if use suid;then
135 einfo "Changing perms to allow deliver to be suided"
136 fowners root:mail "${EPREFIX}/usr/libexec/dovecot/dovecot-lda"
137 fperms 4750 "${EPREFIX}/usr/libexec/dovecot/dovecot-lda"
138 fi
139
140 newinitd "${FILESDIR}"/dovecot.init-r3 dovecot
141
142 rm -rf "${ED}"/usr/share/doc/dovecot
143
144 dodoc AUTHORS NEWS README TODO
145 dodoc doc/*.{txt,cnf,xml,sh}
146 docinto example-config
147 dodoc doc/example-config/*.{conf,ext}
148 docinto example-config/conf.d
149 dodoc doc/example-config/conf.d/*.{conf,ext}
150 docinto wiki
151 dodoc doc/wiki/*
152 doman doc/man/*.{1,7}
153
154 # Create the dovecot.conf file from the dovecot-example.conf file that
155 # the dovecot folks nicely left for us....
156 local conf="${ED}/etc/dovecot/dovecot.conf"
157 local confd="${ED}/etc/dovecot/conf.d"
158
159 insinto /etc/dovecot
160 doins doc/example-config/*.{conf,ext}
161 insinto /etc/dovecot/conf.d
162 doins doc/example-config/conf.d/*.{conf,ext}
163 fperms 0600 "${EPREFIX}"/etc/dovecot/dovecot-{ldap,sql}.conf.ext
164 rm -f "${confd}/../README"
165
166 # .maildir is the Gentoo default
167 local mail_location="maildir:~/.maildir"
168 if ! use maildir; then
169 if use mbox; then
170 mail_location="mbox:/var/spool/mail/%u:INDEX=/var/dovecot/%u"
171 keepdir /var/dovecot
172 sed -i -e 's|#mail_privileged_group =|mail_privileged_group = mail|' \
173 "${confd}/10-mail.conf" || die "sed failed"
174 elif use sdbox ; then
175 mail_location="sdbox:~/.sdbox"
176 elif use mdbox ; then
177 mail_location="mdbox:~/.mdbox"
178 fi
179 fi
180 sed -i -e \
181 "s|#mail_location =|mail_location = ${mail_location}|" \
182 "${confd}/10-mail.conf" \
183 || die "failed to update mail location settings in 10-mail.conf"
184
185 # We're using pam files (imap and pop3) provided by mailbase
186 if use pam; then
187 sed -i -e '/driver = pam/,/^[ \t]*}/ s|#args = dovecot|args = "\*"|' \
188 "${confd}/auth-system.conf.ext" \
189 || die "failed to update PAM settings in auth-system.conf.ext"
190 # mailbase does not provide a sieve pam file
191 use managesieve && dosym imap /etc/pam.d/sieve
192 sed -i -e \
193 's/#!include auth-system.conf.ext/!include auth-system.conf.ext/' \
194 "${confd}/10-auth.conf" \
195 || die "failed to update PAM settings in 10-auth.conf"
196 fi
197
198 # Disable ipv6 if necessary
199 if ! use ipv6; then
200 sed -i -e 's/^#listen = \*, ::/listen = \*/g' "${conf}" \
201 || die "failed to update listen settings in dovecot.conf"
202 fi
203
204 # Update ssl cert locations
205 if use ssl; then
206 sed -i -e 's:^#ssl = yes:ssl = yes:' "${confd}/10-ssl.conf" \
207 || die "ssl conf failed"
208 sed -i -e 's:^ssl_cert =.*:ssl_cert = </etc/ssl/dovecot/server.pem:' \
209 -e 's:^ssl_key =.*:ssl_key = </etc/ssl/dovecot/server.key:' \
210 "${confd}/10-ssl.conf" || die "failed to update SSL settings in 10-ssl.conf"
211 fi
212
213 # Install SQL configuration
214 if use mysql || use postgres; then
215 sed -i -e \
216 's/#!include auth-sql.conf.ext/!include auth-sql.conf.ext/' \
217 "${confd}/10-auth.conf" || die "failed to update SQL settings in \
218 10-auth.conf"
219 fi
220
221 # Install LDAP configuration
222 if use ldap; then
223 sed -i -e \
224 's/#!include auth-ldap.conf.ext/!include auth-ldap.conf.ext/' \
225 "${confd}/10-auth.conf" \
226 || die "failed to update ldap settings in 10-auth.conf"
227 fi
228
229 if use vpopmail; then
230 sed -i -e \
231 's/#!include auth-vpopmail.conf.ext/!include auth-vpopmail.conf.ext/' \
232 "${confd}/10-auth.conf" \
233 || die "failed to update vpopmail settings in 10-auth.conf"
234 fi
235
236 if use sieve || use managesieve ; then
237 cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
238 emake DESTDIR="${ED}" install
239 sed -i -e \
240 's/^[[:space:]]*#mail_plugins = $mail_plugins/mail_plugins = sieve/' "${confd}/15-lda.conf" \
241 || die "failed to update sieve settings in 15-lda.conf"
242 rm -rf "${ED}"/usr/share/doc/dovecot
243 dodoc doc/*.txt
244 docinto example-config/conf.d
245 dodoc doc/example-config/conf.d/*.conf
246 insinto /etc/dovecot/conf.d
247 doins doc/example-config/conf.d/90-sieve.conf
248 use managesieve && doins doc/example-config/conf.d/20-managesieve.conf
249 docinto sieve/rfc
250 dodoc doc/rfc/*.txt
251 docinto sieve/devel
252 dodoc doc/devel/DESIGN
253 doman doc/man/*.{1,7}
254 fi
255
256 use static-libs || find "${ED}"/usr/lib* -name '*.la' -delete
257 }
258
259 pkg_preinst() {
260 if has_version "<${CATEGORY}/${PN}-2" ; then
261 elog "There are a lot of changes in configuration files in dovecot-2.0."
262 elog "Please read http://wiki.dovecot.org/Upgrading and"
263 elog "check the conf files in ${ROOT}etc/dovecot."
264 elog "You can also run doveconf -n before running etc-update or"
265 elog "dispatch-conf to get an idea about what needs to be changed."
266 ewarn "\nDo NOT {re}start dovecot without checking your conf files"
267 ewarn "and making the necessary changes.\n"
268 fi
269 }
270
271 pkg_postinst() {
272 if use ssl; then
273 # Let's not make a new certificate if we already have one
274 if ! [[ -e "${ROOT}"/etc/ssl/dovecot/server.pem && \
275 -e "${ROOT}"/etc/ssl/dovecot/server.key ]]; then
276 einfo "Creating SSL certificate"
277 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Dovecot IMAP Server}"
278 install_cert /etc/ssl/dovecot/server
279 fi
280 fi
281 }

  ViewVC Help
Powered by ViewVC 1.1.13