Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libxcrypt/
Date: Mon, 31 Oct 2022 20:47:48
Message-Id: 1667249253.a0b993a42185dbab43b9694721270b63c3bf7796.sam@gentoo
1 commit: a0b993a42185dbab43b9694721270b63c3bf7796
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Mon Oct 31 20:47:33 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon Oct 31 20:47:33 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0b993a4
7
8 sys-libs/libxcrypt: add 4.4.29
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 sys-libs/libxcrypt/Manifest | 1 +
13 sys-libs/libxcrypt/libxcrypt-4.4.29.ebuild | 336 +++++++++++++++++++++++++++++
14 2 files changed, 337 insertions(+)
15
16 diff --git a/sys-libs/libxcrypt/Manifest b/sys-libs/libxcrypt/Manifest
17 index f39bd81c1c6e..e9b80b386336 100644
18 --- a/sys-libs/libxcrypt/Manifest
19 +++ b/sys-libs/libxcrypt/Manifest
20 @@ -1 +1,2 @@
21 DIST libxcrypt-4.4.28-autotools.tar.xz 618560 BLAKE2B c56d510201651e36cbd950b5a0a32273fdbce1f053109aa5867b2c6a57e2a896c34c981c1a2e732a8f34539b754ebe7f50d1b5bf59f9549a75ad6420921f3e1d SHA512 3c60fd32dea308152c4272522c29668c83e88bea47c98b9fe796ed70f5460ad2a9616ffbe789c03e417b28d3c792361b16031bda3d8bc5b6c06f0ebdc66c8217
22 +DIST libxcrypt-4.4.29-autotools.tar.xz 623720 BLAKE2B a7762a4e4a5cb65c98e69070717a066ffbfb96b5a04ae413d81148f11da2601359bc71b4e6a774dada6328785f03b8964a596c8578a0e5926d3355f29cd280d8 SHA512 278aa6e043855f7ca4e6a4676d8d55120c0bf2179d88619c574e3aea9a8a1cda91242b4a686a53ad39675b1d6dd31ae14c86dd2e5e06f93c558fc2f4fb8adaf0
23
24 diff --git a/sys-libs/libxcrypt/libxcrypt-4.4.29.ebuild b/sys-libs/libxcrypt/libxcrypt-4.4.29.ebuild
25 new file mode 100644
26 index 000000000000..111353e6e533
27 --- /dev/null
28 +++ b/sys-libs/libxcrypt/libxcrypt-4.4.29.ebuild
29 @@ -0,0 +1,336 @@
30 +# Copyright 2004-2022 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=7
34 +
35 +PYTHON_COMPAT=( python3_{8..11} )
36 +# NEED_BOOTSTRAP is for developers to quickly generate a tarball
37 +# for publishing to the tree.
38 +NEED_BOOTSTRAP="no"
39 +inherit eapi8-dosym multibuild multilib python-any-r1 flag-o-matic toolchain-funcs multilib-minimal
40 +
41 +DESCRIPTION="Extended crypt library for descrypt, md5crypt, bcrypt, and others"
42 +HOMEPAGE="https://github.com/besser82/libxcrypt"
43 +if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
44 + inherit autotools
45 + SRC_URI="https://github.com/besser82/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
46 +else
47 + SRC_URI="https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-autotools.tar.xz"
48 +fi
49 +
50 +LICENSE="LGPL-2.1+ public-domain BSD BSD-2"
51 +SLOT="0/1"
52 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
53 +IUSE="+compat split-usr static-libs system test headers-only"
54 +REQUIRED_USE="split-usr? ( system )"
55 +RESTRICT="!test? ( test )"
56 +
57 +export CTARGET=${CTARGET:-${CHOST}}
58 +if [[ ${CTARGET} == ${CHOST} ]] ; then
59 + if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
60 + export CTARGET=${CATEGORY/cross-}
61 + fi
62 +fi
63 +
64 +is_cross() {
65 + local enabled_abis=( $(multilib_get_enabled_abis) )
66 + [[ "${#enabled_abis[@]}" -le 1 ]] && [[ ${CHOST} != ${CTARGET} ]]
67 +}
68 +
69 +DEPEND="system? (
70 + elibc_glibc? (
71 + ${CATEGORY}/glibc[-crypt(+)]
72 + !${CATEGORY}/glibc[crypt(+)]
73 + )
74 + elibc_musl? (
75 + !${CATEGORY}/musl[crypt(+)]
76 + )
77 + )
78 +"
79 +RDEPEND="${DEPEND}"
80 +BDEPEND="dev-lang/perl
81 + test? ( $(python_gen_any_dep 'dev-python/passlib[${PYTHON_USEDEP}]') )"
82 +
83 +python_check_deps() {
84 + python_has_version "dev-python/passlib[${PYTHON_USEDEP}]"
85 +}
86 +
87 +pkg_pretend() {
88 + if has "distcc" ${FEATURES} ; then
89 + ewarn "Please verify all distcc nodes are using the same versions of GCC (>= 10) and Binutils!"
90 + ewarn "Older/mismatched versions of GCC may lead to a misbehaving library: bug #823179."
91 +
92 + if [[ ${BUILD_TYPE} != "binary" ]] && tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]] ; then
93 + die "libxcrypt is known to fail to build or be broken at runtime with < GCC 10 (bug #823179)!"
94 + fi
95 + fi
96 +}
97 +
98 +pkg_setup() {
99 + MULTIBUILD_VARIANTS=(
100 + $(usex compat 'xcrypt_compat' '')
101 + xcrypt_nocompat
102 + )
103 +
104 + use test && python-any-r1_pkg_setup
105 +}
106 +
107 +src_prepare() {
108 + default
109 +
110 + # WARNING: Please read on bumping or applying patches!
111 + #
112 + # There are two circular dependencies to be aware of:
113 + # 1)
114 + # if we're bootstrapping configure and makefiles:
115 + # libxcrypt -> automake -> perl -> libxcrypt
116 + #
117 + # mitigation:
118 + # toolchain@ manually runs `make dist` after running autoconf + `./configure`
119 + # and the ebuild uses that.
120 + # (Don't include the pre-generated Perl artefacts.)
121 + #
122 + # solution for future:
123 + # Upstream are working on producing `make dist` tarballs.
124 + # https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
125 + #
126 + # 2)
127 + # configure *unconditionally* needs Perl at build time to generate
128 + # a list of enabled algorithms based on the set passed to `configure`:
129 + # libxcrypt -> perl -> libxcrypt
130 + #
131 + # mitigation:
132 + # None at the moment.
133 + #
134 + # solution for future:
135 + # Not possible right now. Upstream intend on depending on Perl for further
136 + # configuration options.
137 + # https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
138 + #
139 + # Therefore, on changes (inc. bumps):
140 + # * You must check whether upstream have started providing tarballs with bootstrapped
141 + # auto{conf,make};
142 + #
143 + # * diff the build system changes!
144 + #
145 + if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
146 + # Facilitate our split variant build for compat + non-compat
147 + eapply "${FILESDIR}"/${PN}-4.4.19-multibuild.patch
148 + eautoreconf
149 + fi
150 +}
151 +
152 +src_configure() {
153 + # Avoid possible "illegal instruction" errors with gold
154 + # bug #821496
155 + tc-ld-disable-gold
156 +
157 + # Doesn't work with LTO: bug #852917.
158 + # https://github.com/besser82/libxcrypt/issues/24
159 + filter-lto
160 +
161 + multibuild_foreach_variant multilib-minimal_src_configure
162 +}
163 +
164 +get_xcprefix() {
165 + if is_cross; then
166 + echo "${EPREFIX}/usr/${CTARGET}"
167 + else
168 + echo "${EPREFIX}"
169 + fi
170 +}
171 +
172 +get_xclibdir() {
173 + printf -- "%s/%s/%s/%s\n" \
174 + "$(get_xcprefix)" \
175 + "$(usex split-usr '' '/usr')" \
176 + "$(get_libdir)" \
177 + "$(usex system '' 'xcrypt')"
178 +}
179 +
180 +get_xcincludedir() {
181 + printf -- "%s/usr/include/%s\n" \
182 + "$(get_xcprefix)" \
183 + "$(usex system '' 'xcrypt')"
184 +}
185 +
186 +get_xcmandir() {
187 + printf -- "%s/usr/share/man\n" \
188 + "$(get_xcprefix)"
189 +}
190 +
191 +get_xcpkgconfigdir() {
192 + printf -- "%s/usr/%s/pkgconfig\n" \
193 + "$(get_xcprefix)" \
194 + "$(get_libdir)"
195 +}
196 +
197 +multilib_src_configure() {
198 + local -a myconf=(
199 + --host=${CTARGET}
200 + --disable-werror
201 + --libdir=$(get_xclibdir)
202 + --with-pkgconfigdir=$(get_xcpkgconfigdir)
203 + --includedir=$(get_xcincludedir)
204 + --mandir="$(get_xcmandir)"
205 + )
206 +
207 + tc-export PKG_CONFIG
208 +
209 + if is_cross; then
210 + if tc-is-clang; then
211 + export CC="${CTARGET}-clang"
212 + else
213 + export CC="${CTARGET}-gcc"
214 + fi
215 + fi
216 +
217 + if use elibc_musl; then
218 + # musl declares getcontext and swapcontext in ucontext.h,
219 + # but does not implement them in libc.
220 + # https://bugs.gentoo.org/838172
221 + myconf+=( ac_cv_header_ucontext_h=no )
222 + fi
223 +
224 + case "${MULTIBUILD_ID}" in
225 + xcrypt_compat-*)
226 + myconf+=(
227 + --disable-static
228 + --disable-xcrypt-compat-files
229 + --enable-obsolete-api=yes
230 + )
231 + ;;
232 + xcrypt_nocompat-*)
233 + myconf+=(
234 + --enable-obsolete-api=no
235 + $(use_enable static-libs static)
236 + )
237 + ;;
238 + *) die "Unexpected MULTIBUILD_ID: ${MULTIBUILD_ID}";;
239 + esac
240 +
241 + if use headers-only; then
242 + # Nothing is compiled here which would affect the headers for the target.
243 + # So forcing CC is sane.
244 + headers_only_flags="CC=$(tc-getBUILD_CC)"
245 + fi
246 +
247 + ECONF_SOURCE="${S}" econf "${myconf[@]}" "${headers_only_flags}"
248 +}
249 +
250 +src_compile() {
251 + use headers-only && return
252 +
253 + multibuild_foreach_variant multilib-minimal_src_compile
254 +}
255 +
256 +multilib_src_test() {
257 + emake check
258 +}
259 +
260 +src_test() {
261 + multibuild_foreach_variant multilib-minimal_src_test
262 +}
263 +
264 +src_install() {
265 + multibuild_foreach_variant multilib-minimal_src_install
266 +
267 + use headers-only || \
268 + (
269 + shopt -s failglob || die "failglob failed"
270 +
271 + # Make sure our man pages do not collide with glibc or man-pages.
272 + for manpage in "${D}$(get_xcmandir)"/man3/crypt{,_r}.?*; do
273 + mv -n "${manpage}" "$(dirname "${manpage}")/xcrypt_$(basename "${manpage}")" \
274 + || die "mv failed"
275 + done
276 + ) || die "failglob error"
277 +
278 + # Remove useless stuff from installation
279 + find "${ED}"/usr/share/doc/${PF} -type l -delete || die
280 + find "${ED}" -name '*.la' -delete || die
281 +
282 + # workaround broken upstream cross-* --docdir by installing files in proper locations
283 + if is_cross; then
284 + insinto "$(get_xcprefix)"/usr/share
285 + doins -r "${ED}"/usr/share/doc
286 + rm -r "${ED}"/usr/share/doc || die
287 + fi
288 +}
289 +
290 +multilib_src_install() {
291 + if use headers-only; then
292 + emake DESTDIR="${D}" install-nodist_includeHEADERS
293 + return
294 + fi
295 +
296 + emake DESTDIR="${D}" install
297 +
298 + # Don't install the libcrypt.so symlink for the "compat" version
299 + case "${MULTIBUILD_ID}" in
300 + xcrypt_compat-*)
301 + rm "${D}"$(get_xclibdir)/libcrypt$(get_libname) \
302 + || die "failed to remove extra compat libraries"
303 + ;;
304 + xcrypt_nocompat-*)
305 + if use split-usr; then
306 + (
307 + if use static-libs; then
308 + # .a files are installed to /$(get_libdir) by default
309 + # Move static libraries to /usr prefix or portage will abort
310 + shopt -s nullglob || die "failglob failed"
311 + static_libs=( "${D}"/$(get_xclibdir)/*.a )
312 +
313 + if [[ -n ${static_libs[*]} ]]; then
314 + dodir "/usr/$(get_xclibdir)"
315 + mv "${static_libs[@]}" "${ED}/usr/$(get_xclibdir)" \
316 + || die "Moving static libs failed"
317 + fi
318 + fi
319 +
320 + if use system; then
321 + # Move versionless .so symlinks from /$(get_libdir) to /usr/$(get_libdir)
322 + # to allow linker to correctly find shared libraries.
323 + shopt -s failglob || die "failglob failed"
324 +
325 + for lib_file in "${D}"$(get_xclibdir)/*$(get_libname); do
326 + lib_file_basename="$(basename "${lib_file}")"
327 + lib_file_target="$(basename "$(readlink -f "${lib_file}")")"
328 +
329 + # We already know we're in split-usr (checked above)
330 + # See bug #843209 (also worth keeping in mind bug #802222 too)
331 + local libdir_no_prefix=$(get_xclibdir)
332 + libdir_no_prefix=${libdir_no_prefix#${EPREFIX}}
333 + libdir_no_prefix=${libdir_no_prefix%/usr}
334 + dosym8 -r "/$(get_libdir)/${lib_file_target}" "/usr/${libdir_no_prefix}/${lib_file_basename}"
335 + done
336 +
337 + rm "${D}"$(get_xclibdir)/*$(get_libname) || die "Removing symlinks in incorrect location failed"
338 + fi
339 + )
340 + fi
341 + ;;
342 + *) die "Unexpected MULTIBUILD_ID: ${MULTIBUILD_ID}";;
343 + esac
344 +}
345 +
346 +pkg_preinst() {
347 + # Verify we're not in a bad case like bug #843209 with broken symlinks.
348 + # This can be dropped when, if ever, the split-usr && system && compat case
349 + # is cleaned up in *_src_install.
350 + local broken_symlinks=()
351 + mapfile -d '' broken_symlinks < <(
352 + find "${ED}" -type l ! -exec test -e {} \; -print0 2>/dev/null
353 + )
354 +
355 + [[ -z "${broken_symlinks[@]}" ]] && return
356 +
357 + eerror "Broken symlinks found before merging!"
358 + for symlink in "${broken_symlinks[@]}" ; do
359 + bad_dest="$(readlink -f ${symlink})"
360 + eerror "\t${symlink} is broken!"
361 + eerror "\treadlink -f ${symlink}:"
362 + eerror "\t\t${bad_dest}"
363 + die "Broken symlinks found! Aborting to avoid damaging system. Please report a bug."
364 + done
365 +}