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