Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/cyrus-sasl/
Date: Sun, 31 May 2020 10:49:14
Message-Id: 1590922143.3f0534fa9a1ccae7e20a5e007c4b20d3dd3e5f0d.slyfox@gentoo
1 commit: 3f0534fa9a1ccae7e20a5e007c4b20d3dd3e5f0d
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 31 10:48:48 2020 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sun May 31 10:49:03 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f0534fa
7
8 dev-libs/cyrus-sasl: respect user's CC in CC_FOR_BUILD, bug #718868
9
10 Reported-by: Agostino Sarubbo
11 Closes: https://bugs.gentoo.org/718868
12 Package-Manager: Portage-2.3.100, Repoman-2.3.22
13 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
14
15 dev-libs/cyrus-sasl/cyrus-sasl-2.1.27-r4.ebuild | 262 ++++++++++++++++++++++++
16 1 file changed, 262 insertions(+)
17
18 diff --git a/dev-libs/cyrus-sasl/cyrus-sasl-2.1.27-r4.ebuild b/dev-libs/cyrus-sasl/cyrus-sasl-2.1.27-r4.ebuild
19 new file mode 100644
20 index 00000000000..ae70220c3f3
21 --- /dev/null
22 +++ b/dev-libs/cyrus-sasl/cyrus-sasl-2.1.27-r4.ebuild
23 @@ -0,0 +1,262 @@
24 +# Copyright 1999-2020 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=7
28 +
29 +inherit eutils flag-o-matic multilib multilib-minimal autotools pam java-pkg-opt-2 db-use systemd toolchain-funcs
30 +
31 +SASLAUTHD_CONF_VER="2.1.26"
32 +
33 +DESCRIPTION="The Cyrus SASL (Simple Authentication and Security Layer)"
34 +HOMEPAGE="https://www.cyrusimap.org/sasl/"
35 +#SRC_URI="ftp://ftp.cyrusimap.org/cyrus-sasl/${P}.tar.gz"
36 +SRC_URI="https://github.com/cyrusimap/${PN}/releases/download/${P}/${P}.tar.gz"
37 +
38 +LICENSE="BSD-with-attribution"
39 +SLOT="2"
40 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
41 +IUSE="authdaemond berkdb gdbm kerberos ldapdb libressl openldap mysql pam postgres sample selinux sqlite srp ssl static-libs urandom"
42 +
43 +CDEPEND="
44 + net-mail/mailbase
45 + virtual/libcrypt:=
46 + authdaemond? ( || ( net-mail/courier-imap mail-mta/courier ) )
47 + berkdb? ( >=sys-libs/db-4.8.30-r1:=[${MULTILIB_USEDEP}] )
48 + gdbm? ( >=sys-libs/gdbm-1.10-r1:=[${MULTILIB_USEDEP}] )
49 + kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )
50 + openldap? ( >=net-nds/openldap-2.4.38-r1[${MULTILIB_USEDEP}] )
51 + mysql? ( dev-db/mysql-connector-c:0=[${MULTILIB_USEDEP}] )
52 + pam? ( >=sys-libs/pam-0-r1[${MULTILIB_USEDEP}] )
53 + postgres? ( dev-db/postgresql:* )
54 + sqlite? ( >=dev-db/sqlite-3.8.2:3[${MULTILIB_USEDEP}] )
55 + ssl? (
56 + !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
57 + libressl? ( dev-libs/libressl:=[${MULTILIB_USEDEP}] )
58 + )
59 + java? ( >=virtual/jdk-1.6:= )"
60 +
61 +REQUIRED_USE="ldapdb? ( openldap )"
62 +
63 +RDEPEND="
64 + ${CDEPEND}
65 + selinux? ( sec-policy/selinux-sasl )"
66 +
67 +DEPEND="${CDEPEND}"
68 +
69 +MULTILIB_WRAPPED_HEADERS=(
70 + /usr/include/sasl/md5global.h
71 +)
72 +
73 +PATCHES=(
74 + "${FILESDIR}/${PN}-2.1.27-avoid_pic_overwrite.patch"
75 + "${FILESDIR}/${PN}-2.1.27-autotools_fixes.patch"
76 + "${FILESDIR}/${PN}-2.1.27-as_needed.patch"
77 + "${FILESDIR}/${PN}-2.1.25-auxprop.patch"
78 + "${FILESDIR}/${PN}-2.1.27-gss_c_nt_hostbased_service.patch"
79 + "${FILESDIR}/${PN}-2.1.26-missing-size_t.patch"
80 + "${FILESDIR}/${PN}-2.1.27-doc_build_fix.patch"
81 + "${FILESDIR}/${PN}-2.1.27-memmem.patch"
82 + "${FILESDIR}/${PN}-2.1.27-CVE-2019-19906.patch"
83 +)
84 +
85 +pkg_setup() {
86 + java-pkg-opt-2_pkg_setup
87 +}
88 +
89 +src_prepare() {
90 + default
91 +
92 + # Get rid of the -R switch (runpath_switch for Sun)
93 + # >=gcc-4.6 errors out with unknown option
94 + sed -i -e '/LIB_SQLITE.*-R/s/ -R[^"]*//' \
95 + configure.ac || die
96 +
97 + # Use plugindir for sasldir
98 + sed -i '/^sasldir =/s:=.*:= $(plugindir):' \
99 + "${S}"/plugins/Makefile.{am,in} || die "sed failed"
100 +
101 + # #486740 #468556
102 + sed -i -e 's:AM_CONFIG_HEADER:AC_CONFIG_HEADERS:g' \
103 + -e 's:AC_CONFIG_MACRO_DIR:AC_CONFIG_MACRO_DIRS:g' \
104 + configure.ac || die
105 +
106 + eautoreconf
107 +
108 + export CC_FOR_BUILD="$(tc-getBUILD_CC)"
109 +}
110 +
111 +src_configure() {
112 + append-flags -fno-strict-aliasing
113 + if [[ ${CHOST} == *-solaris* ]] ; then
114 + # getpassphrase is defined in /usr/include/stdlib.h
115 + append-cppflags -DHAVE_GETPASSPHRASE
116 + else
117 + # this horrendously breaks things on Solaris
118 + append-cppflags -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -DLDAP_DEPRECATED
119 + fi
120 +
121 + multilib-minimal_src_configure
122 +}
123 +
124 +multilib_src_configure() {
125 + # Java support.
126 + multilib_is_native_abi && use java && export JAVAC="${JAVAC} ${JAVACFLAGS}"
127 +
128 + local myeconfargs=(
129 + --enable-login
130 + --enable-ntlm
131 + --enable-auth-sasldb
132 + --disable-cmulocal
133 + --disable-krb4
134 + --disable-macos-framework
135 + --enable-otp
136 + --without-sqlite
137 + --with-saslauthd="${EPREFIX}"/run/saslauthd
138 + --with-pwcheck="${EPREFIX}"/run/saslauthd
139 + --with-configdir="${EPREFIX}"/etc/sasl2
140 + --with-plugindir="${EPREFIX}"/usr/$(get_libdir)/sasl2
141 + --with-dbpath="${EPREFIX}"/etc/sasl2/sasldb2
142 + --with-sphinx-build=no
143 + $(use_with ssl openssl)
144 + $(use_with pam)
145 + $(use_with openldap ldap)
146 + $(use_enable ldapdb)
147 + $(multilib_native_use_enable sample)
148 + $(use_enable kerberos gssapi)
149 + $(multilib_native_use_enable java)
150 + $(multilib_native_use_with mysql mysql "${EPREFIX}"/usr)
151 + $(multilib_native_use_with postgres pgsql "${EPREFIX}"/usr/$(get_libdir)/postgresql)
152 + $(use_with sqlite sqlite3 "${EPREFIX}"/usr/$(get_libdir))
153 + $(use_enable srp)
154 + $(use_enable static-libs static)
155 +
156 + # Add authdaemond support (bug #56523).
157 + $(usex authdaemond --with-authdaemond="${EPREFIX}"/var/lib/courier/authdaemon/socket '')
158 +
159 + # Fix for bug #59634.
160 + $(usex ssl '' --without-des)
161 +
162 + # Use /dev/urandom instead of /dev/random (bug #46038).
163 + $(usex urandom --with-devrandom=/dev/urandom '')
164 + )
165 +
166 + if use sqlite || { multilib_is_native_abi && { use mysql || use postgres; }; } ; then
167 + myeconfargs+=( --enable-sql )
168 + else
169 + myeconfargs+=( --disable-sql )
170 + fi
171 +
172 + # Default to GDBM if both 'gdbm' and 'berkdb' are present.
173 + if use gdbm ; then
174 + einfo "Building with GNU DB as database backend for your SASLdb"
175 + myeconfargs+=( --with-dblib=gdbm )
176 + elif use berkdb ; then
177 + einfo "Building with BerkeleyDB as database backend for your SASLdb"
178 + myeconfargs+=(
179 + --with-dblib=berkeley
180 + --with-bdb-incdir="$(db_includedir)"
181 + )
182 + else
183 + einfo "Building without SASLdb support"
184 + myeconfargs+=( --with-dblib=none )
185 + fi
186 +
187 + ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
188 +}
189 +
190 +multilib_src_compile() {
191 + emake
192 +
193 + # Default location for java classes breaks OpenOffice (bug #60769).
194 + # Thanks to axxo@g.o for the solution.
195 + if multilib_is_native_abi && use java ; then
196 + jar -cvf ${PN}.jar -C java $(find java -name "*.class")
197 + fi
198 +}
199 +
200 +multilib_src_install() {
201 + default
202 +
203 + if multilib_is_native_abi; then
204 + if use sample ; then
205 + docinto sample
206 + dodoc "${S}"/sample/*.c
207 + exeinto /usr/share/doc/${P}/sample
208 + doexe sample/client sample/server
209 + fi
210 +
211 + # Default location for java classes breaks OpenOffice (bug #60769).
212 + if use java; then
213 + java-pkg_dojar ${PN}.jar
214 + java-pkg_regso "${ED}/usr/$(get_libdir)/libjavasasl$(get_libname)"
215 + # hackish, don't wanna dig through makefile
216 + rm -rf "${ED}/usr/$(get_libdir)/java" || die
217 + docinto "java"
218 + dodoc "${S}/java/README" "${FILESDIR}/java.README.gentoo" "${S}"/java/doc/*
219 + dodir "/usr/share/doc/${PF}/java/Test"
220 + insinto "/usr/share/doc/${PF}/java/Test"
221 + doins "${S}"/java/Test/*.java
222 + fi
223 +
224 + dosbin saslauthd/testsaslauthd
225 + fi
226 +}
227 +
228 +multilib_src_install_all() {
229 + doman man/*
230 +
231 + keepdir /etc/sasl2
232 +
233 + # Reset docinto to default value (#674296)
234 + docinto
235 + dodoc AUTHORS ChangeLog doc/legacy/TODO
236 + newdoc pwcheck/README README.pwcheck
237 +
238 + newdoc docsrc/sasl/release-notes/$(ver_cut 1-2)/index.rst release-notes
239 + edos2unix "${ED}/usr/share/doc/${PF}/release-notes"
240 +
241 + docinto html
242 + dodoc doc/html/*.html
243 +
244 + newpamd "${FILESDIR}/saslauthd.pam-include" saslauthd
245 +
246 + newinitd "${FILESDIR}/pwcheck.rc6" pwcheck
247 + systemd_dounit "${FILESDIR}/pwcheck.service"
248 +
249 + newinitd "${FILESDIR}/saslauthd2.rc7" saslauthd
250 + newconfd "${FILESDIR}/saslauthd-${SASLAUTHD_CONF_VER}.conf" saslauthd
251 + systemd_dounit "${FILESDIR}/saslauthd.service"
252 + systemd_dotmpfilesd "${FILESDIR}/${PN}.conf"
253 +
254 + # The get_modname bit is important: do not remove the .la files on
255 + # platforms where the lib isn't called .so for cyrus searches the .la to
256 + # figure out what the name is supposed to be instead
257 + if ! use static-libs && [[ $(get_modname) == .so ]] ; then
258 + find "${ED}" -name "*.la" -delete || die
259 + fi
260 +}
261 +
262 +pkg_postinst() {
263 + # Generate an empty sasldb2 with correct permissions.
264 + if ( use berkdb || use gdbm ) && [[ ! -f "${EROOT}/etc/sasl2/sasldb2" ]] ; then
265 + einfo "Generating an empty sasldb2 with correct permissions ..."
266 + echo "p" | "${EROOT}/usr/sbin/saslpasswd2" -f "${EROOT}/etc/sasl2/sasldb2" -p login \
267 + || die "Failed to generate sasldb2"
268 + "${EROOT}/usr/sbin/saslpasswd2" -f "${EROOT}/etc/sasl2/sasldb2" -d login \
269 + || die "Failed to delete temp user"
270 + chown root:mail "${EROOT}/etc/sasl2/sasldb2" \
271 + || die "Failed to chown ${EROOT}/etc/sasl2/sasldb2"
272 + chmod 0640 "${EROOT}/etc/sasl2/sasldb2" \
273 + || die "Failed to chmod ${EROOT}/etc/sasl2/sasldb2"
274 + fi
275 +
276 + if use authdaemond ; then
277 + elog "You need to add a user running a service using Courier's"
278 + elog "authdaemon to the 'mail' group. For example, do:"
279 + elog " gpasswd -a postfix mail"
280 + elog "to add the 'postfix' user to the 'mail' group."
281 + fi
282 +
283 + elog "pwcheck and saslauthd home directories have moved to:"
284 + elog " /run/saslauthd, using tmpfiles.d"
285 +}