www-apps/follow-bin: fix xdg-open follow:// failure
[gentoo-zh.git] / app-emulation / liblol-libxcrypt / liblol-libxcrypt-0.1.5.ebuild
blobc64cd46c30e55145705e18a71db63783914cbd34
1 # Copyright 2004-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=8
6 PYTHON_COMPAT=( python3_{10..12} )
7 # NEED_BOOTSTRAP is for developers to quickly generate a tarball
8 # for publishing to the tree.
9 NEED_BOOTSTRAP="no"
10 inherit crossdev multilib python-any-r1 flag-o-matic toolchain-funcs multilib-minimal
12 # upstream metadata
13 XC_PV="4.4.36"
14 XC_P="libxcrypt-${XC_PV}"
16 # liblol additions
17 LOLPREFIX=/opt/lol
19 DESCRIPTION="libxcrypt for liblol"
20 HOMEPAGE="https://github.com/besser82/libxcrypt https://liblol.aosc.io"
21 if [[ ${NEED_BOOTSTRAP} == "yes" ]] ; then
22 inherit autotools
23 SRC_URI="https://github.com/besser82/libxcrypt/releases/download/v${XC_PV}/${XC_P}.tar.xz"
24 else
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"
30 SLOT="0/1"
31 #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
32 KEYWORDS="-* ~loong"
34 IUSE="static-libs test headers-only"
35 RESTRICT="!test? ( test )"
37 DEPEND="
38 elibc_glibc? (
39 sys-libs/glibc[-crypt(-)]
40 !sys-libs/glibc[crypt(-)]
42 elibc_musl? (
43 sys-libs/musl[-crypt(+)]
44 !sys-libs/musl[crypt(+)]
47 RDEPEND="${DEPEND}"
48 BDEPEND="
49 dev-lang/perl
50 >=dev-util/patchelf-liblol-0.1.4
51 test? ( $(python_gen_any_dep 'dev-python/passlib[${PYTHON_USEDEP}]') )
54 python_check_deps() {
55 python_has_version "dev-python/passlib[${PYTHON_USEDEP}]"
58 pkg_pretend() {
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)!"
69 pkg_setup() {
73 src_prepare() {
74 default
76 # WARNING: Please read on bumping or applying patches!
78 # There are two circular dependencies to be aware of:
79 # 1)
80 # if we're bootstrapping configure and makefiles:
81 # libxcrypt -> automake -> perl -> libxcrypt
83 # mitigation:
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
92 # 2)
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
97 # mitigation:
98 # None at the moment.
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
107 # auto{conf,make};
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
114 eautoreconf
118 src_configure() {
119 MULTIBUILD_VARIANTS=(
120 xcrypt_compat
123 MYPREFIX=${EPREFIX}
124 MYSYSROOT=${ESYSROOT}
126 if target_is_not_host; then
127 local CHOST=${CTARGET}
129 MYPREFIX=
130 MYSYSROOT=${ESYSROOT}/usr/${CTARGET}
132 # Ensure we get compatible libdir
133 unset DEFAULT_ABI MULTILIB_ABIS
134 multilib_env
135 ABI=${DEFAULT_ABI}
137 tc-getCC >/dev/null
138 if [[ ${CC} != ${CHOST}-* ]]; then
139 unset CC
140 tc-getCC >/dev/null
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
153 # bug #821496
154 tc-ld-disable-gold
156 # Doesn't work with LTO: bug #852917.
157 # https://github.com/besser82/libxcrypt/issues/24
158 filter-lto
160 append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
162 if use test; then
163 python_setup
166 multibuild_foreach_variant multilib-minimal_src_configure
169 multilib_src_configure() {
170 local myconf=(
171 --disable-werror
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}"
179 tc-export PKG_CONFIG
181 case "${MULTIBUILD_ID}" in
182 xcrypt_compat-*)
183 myconf+=(
184 --disable-static
185 --enable-shared
186 --disable-xcrypt-compat-files
187 --enable-obsolete-api=yes
190 *) die "Unexpected MULTIBUILD_ID: ${MULTIBUILD_ID}";;
191 esac
193 ECONF_SOURCE="${S}" econf "${myconf[@]}"
196 src_compile() {
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
206 patchelf-liblol \
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"
216 src_test() {
217 multibuild_foreach_variant multilib-minimal_src_test
220 src_install() {
221 local DESTDIR=${D}
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
231 return
234 local liblol_libdir="$EPREFIX$LOLPREFIX/$(get_libdir)/preload"
235 into "$liblol_libdir"
237 # pwd is builddir
238 # the targets are all symlinks, so doins cannot be used
239 cp .libs/libcrypt.so.1 "${D}${liblol_libdir}/libcrypt.so.1" || die