commit:     fbdcef42c8f58fdd5175f2130afd56b8e42ef226
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  8 03:21:04 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Sep 10 11:28:02 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fbdcef42

sys-libs/musl: add USE=crypt for libxcrypt support

Add USE=crypt to allow enabling/disabling crypt.h installation
(to allow sys-libs/libxcrypt[system] usage). Many things are starting
to want functions from libxcrypt itself (additional functions and
algorithms).

musl isn't removing crypt.h (and the relevant functions from its libc),
unlike glibc, but we need to allow disabling the installation of crypt.h
to allow libxcrypt[system] usage (which provides crypt.h & libcrypt.so
instead, with more functionality).

This brings musl in line with the changes we made for glibc a while
ago. The situation with glibc is a bit different because the migration
is mandatory there, while we're just strongly recommending it for musl
because sys-libs/libxcrypt[-system] causes headaches (see linked
PAM bug for an example, but I've also hit a similar issue with Python
yesterday).

Bug: https://bugs.gentoo.org/867991
Bug: https://bugs.gentoo.org/699422
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/musl/{musl-9999.ebuild => musl-1.2.3-r1.ebuild} | 10 +++++++++-
 sys-libs/musl/musl-9999.ebuild                           | 10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-1.2.3-r1.ebuild
similarity index 95%
copy from sys-libs/musl/musl-9999.ebuild
copy to sys-libs/musl/musl-1.2.3-r1.ebuild
index 07ab1388cef8..fedb9137f4cb 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-1.2.3-r1.ebuild
@@ -35,13 +35,16 @@ fi
 
 DESCRIPTION="Light, fast and simple C library focused on standards-conformance 
and safety"
 HOMEPAGE="https://musl.libc.org";
+
 LICENSE="MIT LGPL-2 GPL-2"
 SLOT="0"
-IUSE="headers-only"
+IUSE="crypt headers-only"
 
 QA_SONAME="/usr/lib/libc.so"
 QA_DT_NEEDED="/usr/lib/libc.so"
 
+RDEPEND="crypt? ( sys-libs/libxcrypt[system] )"
+
 is_crosscompile() {
        [[ ${CHOST} != ${CTARGET} ]]
 }
@@ -131,6 +134,11 @@ src_install() {
        local ldso=$(basename "${ED}"${sysroot}/lib/ld-musl-*)
        dosym ${EPREFIX}${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
 
+       if ! use crypt ; then
+               # Allow sys-libs/libxcrypt[system] to provide it instead
+               rm "${ED}"/usr/include/crypt.h || die
+       fi
+
        if [[ ${CATEGORY} != cross-* ]] ; then
                # Fish out of config:
                #   ARCH = ...

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-9999.ebuild
index 07ab1388cef8..fedb9137f4cb 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-9999.ebuild
@@ -35,13 +35,16 @@ fi
 
 DESCRIPTION="Light, fast and simple C library focused on standards-conformance 
and safety"
 HOMEPAGE="https://musl.libc.org";
+
 LICENSE="MIT LGPL-2 GPL-2"
 SLOT="0"
-IUSE="headers-only"
+IUSE="crypt headers-only"
 
 QA_SONAME="/usr/lib/libc.so"
 QA_DT_NEEDED="/usr/lib/libc.so"
 
+RDEPEND="crypt? ( sys-libs/libxcrypt[system] )"
+
 is_crosscompile() {
        [[ ${CHOST} != ${CTARGET} ]]
 }
@@ -131,6 +134,11 @@ src_install() {
        local ldso=$(basename "${ED}"${sysroot}/lib/ld-musl-*)
        dosym ${EPREFIX}${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
 
+       if ! use crypt ; then
+               # Allow sys-libs/libxcrypt[system] to provide it instead
+               rm "${ED}"/usr/include/crypt.h || die
+       fi
+
        if [[ ${CATEGORY} != cross-* ]] ; then
                # Fish out of config:
                #   ARCH = ...

Reply via email to