Gentoo Archives: gentoo-commits

From: "Andreas K. Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libxcrypt/
Date: Sat, 17 Jul 2021 17:12:08
Message-Id: 1626541873.31faab1325ce5042620ef12ad8eac9e7d0b1e9fc.dilfridge@gentoo
1 commit: 31faab1325ce5042620ef12ad8eac9e7d0b1e9fc
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 16 22:10:43 2021 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 17 17:11:13 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=31faab13
7
8 sys-libs/libxcrypt: block sys-libs/glibc[crypt(+)]
9
10 Bug: https://bugs.gentoo.org/802207
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12 Closes: https://github.com/gentoo/gentoo/pull/21680
13 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
14
15 sys-libs/libxcrypt/libxcrypt-4.4.23-r2.ebuild | 211 ++++++++++++++++++++++++++
16 1 file changed, 211 insertions(+)
17
18 diff --git a/sys-libs/libxcrypt/libxcrypt-4.4.23-r2.ebuild b/sys-libs/libxcrypt/libxcrypt-4.4.23-r2.ebuild
19 new file mode 100644
20 index 00000000000..9a542cc2117
21 --- /dev/null
22 +++ b/sys-libs/libxcrypt/libxcrypt-4.4.23-r2.ebuild
23 @@ -0,0 +1,211 @@
24 +# Copyright 2004-2021 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=7
28 +
29 +PYTHON_COMPAT=( python3_{8..10} )
30 +# NEED_BOOTSTRAP is for developers to quickly generate a tarball
31 +# for publishing to the tree.
32 +NEED_BOOTSTRAP="no"
33 +inherit multibuild python-any-r1 multilib-minimal
34 +
35 +DESCRIPTION="Extended crypt library for descrypt, md5crypt, bcrypt, and others"
36 +HOMEPAGE="https://github.com/besser82/libxcrypt"
37 +if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
38 + inherit autotools
39 + SRC_URI="https://github.com/besser82/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
40 +else
41 + SRC_URI="https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-autotools.tar.xz"
42 +fi
43 +
44 +LICENSE="LGPL-2.1+ public-domain BSD BSD-2"
45 +SLOT="0/1"
46 +#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
47 +IUSE="+compat split-usr +static-libs system test"
48 +REQUIRED_USE="split-usr? ( system )"
49 +RESTRICT="!test? ( test )"
50 +
51 +DEPEND="system? (
52 + elibc_glibc? (
53 + sys-libs/glibc[-crypt(+)]
54 + !sys-libs/glibc[crypt(+)]
55 + )
56 + !sys-libs/musl
57 + )
58 +"
59 +RDEPEND="${DEPEND}"
60 +BDEPEND="dev-lang/perl
61 + sys-apps/findutils
62 + test? ( $(python_gen_any_dep 'dev-python/passlib[${PYTHON_USEDEP}]') )"
63 +
64 +python_check_deps() {
65 + has_version -b "dev-python/passlib[${PYTHON_USEDEP}]"
66 +}
67 +
68 +pkg_setup() {
69 + MULTIBUILD_VARIANTS=(
70 + $(usex compat 'xcrypt_compat' '')
71 + xcrypt_nocompat
72 + )
73 +
74 + use test && python-any-r1_pkg_setup
75 +}
76 +
77 +src_prepare() {
78 + default
79 +
80 + # WARNING: Please read on bumping or applying patches!
81 + #
82 + # There are two circular dependencies to be aware of:
83 + # 1)
84 + # if we're bootstrapping configure and makefiles:
85 + # libxcrypt -> automake -> perl -> libxcrypt
86 + #
87 + # mitigation:
88 + # toolchain@ manually runs `make dist` after running autoconf + `./configure`
89 + # and the ebuild uses that.
90 + # (Don't include the pre-generated Perl artefacts.)
91 + #
92 + # solution for future:
93 + # Upstream are working on producing `make dist` tarballs.
94 + # https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
95 + #
96 + # 2)
97 + # configure *unconditionally* needs Perl at build time to generate
98 + # a list of enabled algorithms based on the set passed to `configure`:
99 + # libxcrypt -> perl -> libxcrypt
100 + #
101 + # mitigation:
102 + # None at the moment.
103 + #
104 + # solution for future:
105 + # Not possible right now. Upstream intend on depending on Perl for further
106 + # configuration options.
107 + # https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
108 + #
109 + # Therefore, on changes (inc. bumps):
110 + # * You must check whether upstream have started providing tarballs with bootstrapped
111 + # auto{conf,make};
112 + #
113 + # * diff the build system changes!
114 + #
115 + if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
116 + # Facilitate our split variant build for compat + non-compat
117 + eapply "${FILESDIR}"/${PN}-4.4.19-multibuild.patch
118 + eautoreconf
119 + fi
120 +}
121 +
122 +src_configure() {
123 + multibuild_foreach_variant multilib-minimal_src_configure
124 +}
125 +
126 +get_xclibdir() {
127 + printf -- "%s/%s/%s\n" \
128 + "$(usex split-usr '' '/usr')" \
129 + "$(get_libdir)" \
130 + "$(usex system '' 'xcrypt')"
131 +}
132 +
133 +multilib_src_configure() {
134 + local -a myconf=(
135 + --disable-werror
136 + --libdir="${EPREFIX}"$(get_xclibdir)
137 + --with-pkgconfigdir="${EPREFIX}/usr/$(get_libdir)/pkgconfig"
138 + --includedir="${EPREFIX}/usr/include/$(usex system '' 'xcrypt')"
139 + )
140 +
141 + case "${MULTIBUILD_ID}" in
142 + xcrypt_compat-*)
143 + myconf+=(
144 + --disable-static
145 + --disable-xcrypt-compat-files
146 + --enable-obsolete-api=yes
147 + )
148 + ;;
149 + xcrypt_nocompat-*)
150 + myconf+=(
151 + --enable-obsolete-api=no
152 + $(use_enable static-libs static)
153 + )
154 + ;;
155 + *) die "Unexpected MULTIBUILD_ID: ${MULTIBUILD_ID}";;
156 + esac
157 +
158 + ECONF_SOURCE="${S}" econf "${myconf[@]}"
159 +}
160 +
161 +src_compile() {
162 + multibuild_foreach_variant multilib-minimal_src_compile
163 +}
164 +
165 +multilib_src_test() {
166 + emake check
167 +}
168 +
169 +src_test() {
170 + multibuild_foreach_variant multilib-minimal_src_test
171 +}
172 +
173 +src_install() {
174 + multibuild_foreach_variant multilib-minimal_src_install
175 +
176 + (
177 + shopt -s failglob || die "failglob failed"
178 +
179 + # Make sure our man pages do not collide with glibc or man-pages.
180 + for manpage in "${ED}"/usr/share/man/man3/crypt{,_r}.?*; do
181 + mv -n "${manpage}" "$(dirname "${manpage}")/xcrypt_$(basename "${manpage}")" \
182 + || die "mv failed"
183 + done
184 + ) || die "failglob error"
185 +
186 + # Remove useless stuff from installation
187 + find "${ED}"/usr/share/doc/${PF} -type l -delete || die
188 + find "${ED}" -name '*.la' -delete || die
189 +}
190 +
191 +multilib_src_install() {
192 + emake DESTDIR="${D}" install
193 +
194 + # Don't install the libcrypt.so symlink for the "compat" version
195 + case "${MULTIBUILD_ID}" in
196 + xcrypt_compat-*)
197 + rm "${ED}"$(get_xclibdir)/libcrypt$(get_libname) \
198 + || die "failed to remove extra compat libraries"
199 + ;;
200 + xcrypt_nocompat-*)
201 + if use split-usr; then
202 + (
203 + if use static-libs; then
204 + # .a files are installed to /$(get_libdir) by default
205 + # Move static libraries to /usr prefix or portage will abort
206 + shopt -s nullglob || die "failglob failed"
207 + static_libs=( "${ED}"/$(get_xclibdir)/*.a )
208 +
209 + if [[ -n ${static_libs[*]} ]]; then
210 + dodir "/usr/$(get_xclibdir)"
211 + mv "${static_libs[@]}" "${ED}/usr/$(get_xclibdir)" \
212 + || die "Moving static libs failed"
213 + fi
214 + fi
215 +
216 + if use system; then
217 + # Move versionless .so symlinks from /$(get_libdir) to /usr/$(get_libdir)
218 + # to allow linker to correctly find shared libraries.
219 + shopt -s failglob || die "failglob failed"
220 +
221 + for lib_file in "${ED}"$(get_xclibdir)/*$(get_libname); do
222 + lib_file_basename="$(basename "${lib_file}")"
223 + lib_file_target="$(basename "$(readlink -f "${lib_file}")")"
224 + dosym "../../$(get_libdir)/${lib_file_target}" "/usr/$(get_xclibdir)/${lib_file_basename}"
225 + done
226 +
227 + rm "${ED}"$(get_xclibdir)/*$(get_libname) || die "Removing symlinks in incorrect location failed"
228 + fi
229 + )
230 + fi
231 + ;;
232 + *) die "Unexpected MULTIBUILD_ID: ${MULTIBUILD_ID}";;
233 + esac
234 +}