1 # Copyright 2004-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT
=( python3_
{10.
.12} )
7 # NEED_BOOTSTRAP is for developers to quickly generate a tarball
8 # for publishing to the tree.
10 inherit crossdev multilib python-any-r1 flag-o-matic toolchain-funcs multilib-minimal
14 XC_P
="libxcrypt-${XC_PV}"
19 DESCRIPTION
="libxcrypt for liblol"
20 HOMEPAGE
="https://github.com/besser82/libxcrypt https://liblol.aosc.io"
21 if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
23 SRC_URI
="https://github.com/besser82/libxcrypt/releases/download/v${XC_PV}/${XC_P}.tar.xz"
25 SRC_URI
="https://dev.gentoo.org/~sam/distfiles/sys-libs/libxcrypt/${XC_P}-autotools.tar.xz"
28 S
="${WORKDIR}/libxcrypt-${XC_PV}"
29 LICENSE
="LGPL-2.1+ public-domain BSD BSD-2"
31 #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
34 IUSE
="static-libs test headers-only"
35 RESTRICT
="!test? ( test )"
39 sys-libs/glibc[-crypt(-)]
40 !sys-libs/glibc[crypt(-)]
43 sys-libs/musl[-crypt(+)]
44 !sys-libs/musl[crypt(+)]
50 >=dev-util/patchelf-liblol-0.1.4
51 test? ( $(python_gen_any_dep 'dev-python/passlib[${PYTHON_USEDEP}]') )
55 python_has_version
"dev-python/passlib[${PYTHON_USEDEP}]"
59 if has
"distcc" ${FEATURES} ; then
60 ewarn
"Please verify all distcc nodes are using the same versions of GCC (>= 10) and Binutils!"
61 ewarn
"Older/mismatched versions of GCC may lead to a misbehaving library: bug #823179."
63 if [[ ${BUILD_TYPE} != "binary" ]] && tc-is-gcc
&& [[ $
(gcc-major-version
) -lt 10 ]] ; then
64 die
"libxcrypt is known to fail to build or be broken at runtime with < GCC 10 (bug #823179)!"
76 # WARNING: Please read on bumping or applying patches!
78 # There are two circular dependencies to be aware of:
80 # if we're bootstrapping configure and makefiles:
81 # libxcrypt -> automake -> perl -> libxcrypt
84 # toolchain@ manually runs `make dist` after running autoconf + `./configure`
85 # and the ebuild uses that.
86 # (Don't include the pre-generated Perl artefacts.)
88 # solution for future:
89 # Upstream are working on producing `make dist` tarballs.
90 # https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
93 # configure *unconditionally* needs Perl at build time to generate
94 # a list of enabled algorithms based on the set passed to `configure`:
95 # libxcrypt -> perl -> libxcrypt
100 # solution for future:
101 # Not possible right now. Upstream intend on depending on Perl for further
102 # configuration options.
103 # https://github.com/besser82/libxcrypt/issues/134#issuecomment-871833573
105 # Therefore, on changes (inc. bumps):
106 # * You must check whether upstream have started providing tarballs with bootstrapped
109 # * diff the build system changes!
111 if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
112 # Facilitate our split variant build for compat + non-compat
113 eapply
"${FILESDIR}"/libxcrypt-4.4
.19-multibuild.
patch
119 MULTIBUILD_VARIANTS
=(
124 MYSYSROOT
=${ESYSROOT}
126 if target_is_not_host
; then
127 local CHOST
=${CTARGET}
130 MYSYSROOT
=${ESYSROOT}/usr
/${CTARGET}
132 # Ensure we get compatible libdir
133 unset DEFAULT_ABI MULTILIB_ABIS
138 if [[ ${CC} != ${CHOST}-* ]]; then
143 strip-unsupported-flags
146 if use headers-only
; then
147 # Nothing is compiled here which would affect the headers for the target.
148 # So forcing CC is sane.
149 local -x CC
="$(tc-getBUILD_CC)"
152 # Avoid possible "illegal instruction" errors with gold
156 # Doesn't work with LTO: bug #852917.
157 # https://github.com/besser82/libxcrypt/issues/24
160 append-ldflags $
(test-flags-CCLD
-Wl,--undefined-version)
166 multibuild_foreach_variant multilib-minimal_src_configure
169 multilib_src_configure
() {
172 --prefix="${MYPREFIX}/usr"
173 --libdir="${MYPREFIX}/usr/$(get_libdir)"
174 --includedir="${MYPREFIX}/usr/include"
175 --with-pkgconfigdir="${MYPREFIX}/usr/$(get_libdir)/pkgconfig"
176 --with-sysroot="${MYSYSROOT}"
181 case "${MULTIBUILD_ID}" in
186 --disable-xcrypt-compat-files
187 --enable-obsolete-api=yes
190 *) die
"Unexpected MULTIBUILD_ID: ${MULTIBUILD_ID}";;
193 ECONF_SOURCE
="${S}" econf
"${myconf[@]}"
197 use headers-only
&& return
199 multibuild_foreach_variant multilib-minimal_src_compile
202 multilib_src_compile
() {
203 rm -f crypt-symbol-vers.h crypt-symbol-vers.h.stamp
204 emake libcrypt.la SYMVER_FLOOR
=GLIBC_2.27
207 --page-size "$(( 16 * 1024))" \
208 --replace-needed "ld-linux-loongarch-lp64d.so.1" "ld.so.1" \
209 .libs
/libcrypt.so
.1 || die
212 multilib_src_test
() {
213 die
"TODO: check abiversion"
217 multibuild_foreach_variant multilib-minimal_src_test
222 if target_is_not_host
; then
223 DESTDIR
=${ED}/usr
/${CTARGET}
226 multibuild_foreach_variant multilib-minimal_src_install
229 multilib_src_install
() {
230 if use headers-only
; then
234 local liblol_libdir
="$EPREFIX$LOLPREFIX/$(get_libdir)/preload"
235 into
"$liblol_libdir"
238 # the targets are all symlinks, so doins cannot be used
239 cp .libs
/libcrypt.so
.1 "${D}${liblol_libdir}/libcrypt.so.1" || die