Gentoo Archives: gentoo-commits

From: Vadim Misbakh-Soloviov <mva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-mail/dovecot/
Date: Tue, 03 May 2022 20:47:01
Message-Id: 1651610741.ff299388f737701d789cd341ff452531526ce850.mva@gentoo
1 commit: ff299388f737701d789cd341ff452531526ce850
2 Author: Vadim Misbakh-Soloviov <mva <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 3 20:45:15 2022 +0000
4 Commit: Vadim Misbakh-Soloviov <mva <AT> gentoo <DOT> org>
5 CommitDate: Tue May 3 20:45:41 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff299388
7
8 net-mail/dovecot: remove postgresql[ldap,threads] blocker
9
10 Dovecot's internals structure heavily changed since than,
11 so there is no mor libraries/binaries that links against
12 libpq (which links to libldap_r, threaded version), and
13 libldap (not-threaded version) at the same time
14
15 So, there is no more crashes because of same-time-linking
16 against both of ldap-libs.
17
18 See liked bug for motivation.
19
20 Bug: https://bugs.gentoo.org/564556
21 Package-Manager: Portage-3.0.30, Repoman-3.0.1
22 Signed-off-by: Vadim Misbakh-Soloviov <mva <AT> gentoo.org>
23
24 net-mail/dovecot/dovecot-2.3.18-r2.ebuild | 307 ++++++++++++++++++++++++++++++
25 1 file changed, 307 insertions(+)
26
27 diff --git a/net-mail/dovecot/dovecot-2.3.18-r2.ebuild b/net-mail/dovecot/dovecot-2.3.18-r2.ebuild
28 new file mode 100644
29 index 000000000000..a0a7853cfdc8
30 --- /dev/null
31 +++ b/net-mail/dovecot/dovecot-2.3.18-r2.ebuild
32 @@ -0,0 +1,307 @@
33 +# Copyright 1999-2022 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=8
37 +
38 +LUA_COMPAT=( lua5-1 lua5-3 )
39 +# do not add a ssl USE flag. ssl is mandatory
40 +SSL_DEPS_SKIP=1
41 +inherit autotools flag-o-matic lua-single ssl-cert systemd toolchain-funcs
42 +
43 +MY_P="${P/_/.}"
44 +#MY_S="${PN}-ce-${PV}"
45 +major_minor="$(ver_cut 1-2)"
46 +sieve_version="0.5.18"
47 +if [[ ${PV} == *_rc* ]]; then
48 + rc_dir="rc/"
49 +else
50 + rc_dir=""
51 +fi
52 +SRC_URI="https://dovecot.org/releases/${major_minor}/${rc_dir}${MY_P}.tar.gz
53 + sieve? (
54 + https://pigeonhole.dovecot.org/releases/${major_minor}/${rc_dir}${PN}-${major_minor}-pigeonhole-${sieve_version}.tar.gz
55 + )
56 + managesieve? (
57 + https://pigeonhole.dovecot.org/releases/${major_minor}/${rc_dir}${PN}-${major_minor}-pigeonhole-${sieve_version}.tar.gz
58 + ) "
59 +DESCRIPTION="An IMAP and POP3 server written with security primarily in mind"
60 +HOMEPAGE="https://www.dovecot.org/"
61 +
62 +SLOT="0"
63 +LICENSE="LGPL-2.1 MIT"
64 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
65 +
66 +IUSE_DOVECOT_AUTH="kerberos ldap lua mysql pam postgres sqlite"
67 +IUSE_DOVECOT_COMPRESS="lz4 zstd"
68 +IUSE_DOVECOT_OTHER="argon2 caps doc ipv6 lucene managesieve rpc
69 + selinux sieve solr static-libs stemmer suid systemd tcpd textcat unwind"
70 +
71 +IUSE="${IUSE_DOVECOT_AUTH} ${IUSE_DOVECOT_COMPRESS} ${IUSE_DOVECOT_OTHER}"
72 +
73 +REQUIRED_USE="lua? ( ${LUA_REQUIRED_USE} )"
74 +
75 +DEPEND="
76 + app-arch/bzip2
77 + app-arch/xz-utils
78 + dev-libs/icu:=
79 + dev-libs/openssl:0=
80 + sys-libs/zlib:=
81 + virtual/libiconv
82 + argon2? ( dev-libs/libsodium:= )
83 + caps? ( sys-libs/libcap )
84 + kerberos? ( virtual/krb5 )
85 + ldap? ( net-nds/openldap:= )
86 + lua? ( ${LUA_DEPS} )
87 + lucene? ( >=dev-cpp/clucene-2.3 )
88 + lz4? ( app-arch/lz4 )
89 + mysql? ( dev-db/mysql-connector-c:0= )
90 + pam? ( sys-libs/pam:= )
91 + postgres? ( dev-db/postgresql:* )
92 + rpc? ( net-libs/libtirpc:= net-libs/rpcsvc-proto )
93 + selinux? ( sec-policy/selinux-dovecot )
94 + solr? ( net-misc/curl dev-libs/expat )
95 + sqlite? ( dev-db/sqlite:* )
96 + stemmer? ( dev-libs/snowball-stemmer:= )
97 + suid? ( acct-group/mail )
98 + systemd? ( sys-apps/systemd:= )
99 + tcpd? ( sys-apps/tcp-wrappers )
100 + textcat? ( app-text/libexttextcat )
101 + unwind? ( sys-libs/libunwind:= )
102 + zstd? ( app-arch/zstd:= )
103 + virtual/libcrypt:=
104 + "
105 +
106 +RDEPEND="
107 + ${DEPEND}
108 + acct-group/dovecot
109 + acct-group/dovenull
110 + acct-user/dovecot
111 + acct-user/dovenull
112 + net-mail/mailbase
113 + "
114 +
115 +S="${WORKDIR}/${MY_P}"
116 +
117 +PATCHES=(
118 + "${FILESDIR}/${PN}"-autoconf-lua-version-v2.patch
119 + "${FILESDIR}/${PN}"-socket-name-too-long.patch
120 +)
121 +
122 +pkg_setup() {
123 + use lua && lua-single_pkg_setup
124 + if use managesieve && ! use sieve; then
125 + ewarn "managesieve USE flag selected but sieve USE flag unselected"
126 + ewarn "sieve USE flag will be turned on"
127 + fi
128 +}
129 +
130 +src_prepare() {
131 + default
132 + # bug 657108
133 + #elibtoolize
134 + eautoreconf
135 +
136 + # Bug #727244
137 + append-cflags -fasynchronous-unwind-tables
138 +}
139 +
140 +src_configure() {
141 + local conf=""
142 +
143 + if use postgres || use mysql || use sqlite; then
144 + conf="${conf} --with-sql"
145 + fi
146 +
147 + # turn valgrind tests off. Bug #340791
148 + VALGRIND=no \
149 + LUAPC="${ELUA}" \
150 + systemdsystemunitdir="$(systemd_get_systemunitdir)" \
151 + econf \
152 + --with-rundir="${EPREFIX}/run/dovecot" \
153 + --with-statedir="${EPREFIX}/var/lib/dovecot" \
154 + --with-moduledir="${EPREFIX}/usr/$(get_libdir)/dovecot" \
155 + --disable-rpath \
156 + --with-bzlib \
157 + --without-libbsd \
158 + --with-lzma \
159 + --with-icu \
160 + --with-ssl \
161 + --with-zlib \
162 + $( use_with argon2 sodium ) \
163 + $( use_with caps libcap ) \
164 + $( use_with kerberos gssapi ) \
165 + $( use_with lua ) \
166 + $( use_with ldap ) \
167 + $( use_with lucene ) \
168 + $( use_with lz4 ) \
169 + $( use_with mysql ) \
170 + $( use_with pam ) \
171 + $( use_with postgres pgsql ) \
172 + $( use_with sqlite ) \
173 + $( use_with solr ) \
174 + $( use_with stemmer ) \
175 + $( use_with systemd ) \
176 + $( use_with tcpd libwrap ) \
177 + $( use_with textcat ) \
178 + $( use_with unwind libunwind ) \
179 + $( use_with zstd ) \
180 + $( use_enable static-libs static ) \
181 + ${conf}
182 +
183 + if use sieve || use managesieve; then
184 + # The sieve plugin needs this file to be build to determine the plugin
185 + # directory and the list of libraries to link to.
186 + emake dovecot-config
187 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
188 + econf \
189 + $( use_enable static-libs static ) \
190 + --localstatedir="${EPREFIX}/var" \
191 + --enable-shared \
192 + --with-dovecot="${S}" \
193 + $( use_with ldap ) \
194 + $( use_with managesieve )
195 + fi
196 +}
197 +
198 +src_compile() {
199 + default
200 + if use sieve || use managesieve; then
201 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
202 + emake CC="$(tc-getCC)" CFLAGS="${CFLAGS}"
203 + fi
204 +}
205 +
206 +src_test() {
207 + default
208 + if use sieve || use managesieve; then
209 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
210 + default
211 + fi
212 +}
213 +
214 +src_install() {
215 + default
216 +
217 + # insecure:
218 + # use suid && fperms u+s /usr/libexec/dovecot/deliver
219 + # better:
220 + if use suid; then
221 + einfo "Changing perms to allow deliver to be suided"
222 + fowners root:mail "/usr/libexec/dovecot/dovecot-lda"
223 + fperms 4750 "/usr/libexec/dovecot/dovecot-lda"
224 + fi
225 +
226 + newinitd "${FILESDIR}"/dovecot.init-r6 dovecot
227 +
228 + rm -rf "${ED}"/usr/share/doc/dovecot
229 +
230 + dodoc AUTHORS NEWS README TODO
231 + dodoc doc/*.{txt,cnf,xml,sh}
232 + docinto example-config
233 + dodoc doc/example-config/*.{conf,ext}
234 + docinto example-config/conf.d
235 + dodoc doc/example-config/conf.d/*.{conf,ext}
236 + docinto wiki
237 + dodoc doc/wiki/*
238 + doman doc/man/*.{1,7}
239 +
240 + # Create the dovecot.conf file from the dovecot-example.conf file that
241 + # the dovecot folks nicely left for us....
242 + local conf="${ED}/etc/dovecot/dovecot.conf"
243 + local confd="${ED}/etc/dovecot/conf.d"
244 +
245 + insinto /etc/dovecot
246 + doins doc/example-config/*.{conf,ext}
247 + insinto /etc/dovecot/conf.d
248 + doins doc/example-config/conf.d/*.{conf,ext}
249 + fperms 0600 /etc/dovecot/dovecot-{ldap,sql}.conf.ext
250 + rm -f "${confd}/../README"
251 +
252 + # .maildir is the Gentoo default
253 + local mail_location="maildir:~/.maildir"
254 + sed -i -e \
255 + "s|#mail_location =|mail_location = ${mail_location}|" \
256 + "${confd}/10-mail.conf" \
257 + || die "failed to update mail location settings in 10-mail.conf"
258 +
259 + # We're using pam files (imap and pop3) provided by mailbase
260 + if use pam; then
261 + sed -i -e '/driver = pam/,/^[ \t]*}/ s|#args = dovecot|args = "\*"|' \
262 + "${confd}/auth-system.conf.ext" \
263 + || die "failed to update PAM settings in auth-system.conf.ext"
264 + # mailbase does not provide a sieve pam file
265 + use managesieve && dosym imap /etc/pam.d/sieve
266 + sed -i -e \
267 + 's/#!include auth-system.conf.ext/!include auth-system.conf.ext/' \
268 + "${confd}/10-auth.conf" \
269 + || die "failed to update PAM settings in 10-auth.conf"
270 + fi
271 +
272 + # Disable ipv6 if necessary
273 + if ! use ipv6; then
274 + sed -i -e 's/^#listen = \*, ::/listen = \*/g' "${conf}" \
275 + || die "failed to update listen settings in dovecot.conf"
276 + fi
277 +
278 + # Update ssl cert locations
279 + sed -i -e 's:^#ssl = yes:ssl = yes:' "${confd}/10-ssl.conf" \
280 + || die "ssl conf failed"
281 + sed -i -e 's:^ssl_cert =.*:ssl_cert = </etc/ssl/dovecot/server.pem:' \
282 + -e 's:^ssl_key =.*:ssl_key = </etc/ssl/dovecot/server.key:' \
283 + "${confd}/10-ssl.conf" || die "failed to update SSL settings in 10-ssl.conf"
284 +
285 + # Install SQL configuration
286 + if use mysql || use postgres; then
287 + sed -i -e \
288 + 's/#!include auth-sql.conf.ext/!include auth-sql.conf.ext/' \
289 + "${confd}/10-auth.conf" || die "failed to update SQL settings in \
290 + 10-auth.conf"
291 + fi
292 +
293 + # Install LDAP configuration
294 + if use ldap; then
295 + sed -i -e \
296 + 's/#!include auth-ldap.conf.ext/!include auth-ldap.conf.ext/' \
297 + "${confd}/10-auth.conf" \
298 + || die "failed to update ldap settings in 10-auth.conf"
299 + fi
300 +
301 + if use sieve || use managesieve; then
302 + cd "../dovecot-${major_minor}-pigeonhole-${sieve_version}" || die "cd failed"
303 + emake DESTDIR="${ED}" install
304 + sed -i -e \
305 + 's/^[[:space:]]*#mail_plugins = $mail_plugins/mail_plugins = sieve/' "${confd}/15-lda.conf" \
306 + || die "failed to update sieve settings in 15-lda.conf"
307 + rm -rf "${ED}"/usr/share/doc/dovecot
308 + docinto example-config/conf.d
309 + dodoc doc/example-config/conf.d/*.conf
310 + insinto /etc/dovecot/conf.d
311 + doins doc/example-config/conf.d/90-sieve{,-extprograms}.conf
312 + use managesieve && doins doc/example-config/conf.d/20-managesieve.conf
313 + docinto sieve/rfc
314 + dodoc doc/rfc/*.txt
315 + docinto sieve/devel
316 + dodoc doc/devel/DESIGN
317 + docinto plugins
318 + dodoc doc/plugins/*.txt
319 + docinto extensions
320 + dodoc doc/extensions/*.txt
321 + docinto locations
322 + dodoc doc/locations/*.txt
323 + doman doc/man/*.{1,7}
324 + fi
325 +
326 + use static-libs || find "${ED}"/usr/lib* -name '*.la' -delete
327 +}
328 +
329 +pkg_postinst() {
330 + # Let's not make a new certificate if we already have one
331 + if ! [[ -e "${ROOT}"/etc/ssl/dovecot/server.pem && \
332 + -e "${ROOT}"/etc/ssl/dovecot/server.key ]]; then
333 + einfo "Creating SSL certificate"
334 + SSL_ORGANIZATION="${SSL_ORGANIZATION:-Dovecot IMAP Server}"
335 + install_cert /etc/ssl/dovecot/server
336 + fi
337 +
338 + elog "Please read https://doc.dovecot.org/installation_guide/upgrading/ for upgrade notes."
339 +}