commit:     884319a75efc97f367338fc9d2f099e7bc1b2b6b
Author:     Adrian Ratiu <adrian.ratiu <AT> collabora <DOT> com>
AuthorDate: Tue Oct 18 17:18:35 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 19 03:14:13 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=884319a7

sys-libs/libxcrypt: add headers-only install

While bootstrapping a pure LLVM based toolchain, compiler-rt-sanitizers
depends on crypt.h, but libxcrypt cannot be built yet because
it requires a working compiler runtime, so the solution is:

1. Install libxcrypt headers-only
2. Build compiler-rt-sanitizers & the rest of llvm/clang
3. Build full libxcrypt

Thus we add the ability to install libxcrypt headers-only,
similar to how glibc does it.

Closes: https://bugs.gentoo.org/877567
Signed-off-by: Adrian Ratiu <adrian.ratiu <AT> collabora.com>
Closes: https://github.com/gentoo/gentoo/pull/27840
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild | 18 ++++++++++++++++--
 sys-libs/libxcrypt/metadata.xml               |  1 +
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild 
b/sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild
index 3f390bf67ca3..430e3dc385ed 100644
--- a/sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild
+++ b/sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild
@@ -21,7 +21,7 @@ fi
 LICENSE="LGPL-2.1+ public-domain BSD BSD-2"
 SLOT="0/1"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
-IUSE="+compat split-usr static-libs system test"
+IUSE="+compat split-usr static-libs system test headers-only"
 REQUIRED_USE="split-usr? ( system )"
 RESTRICT="!test? ( test )"
 
@@ -209,10 +209,18 @@ multilib_src_configure() {
                *) die "Unexpected MULTIBUILD_ID: ${MULTIBUILD_ID}";;
        esac
 
-       ECONF_SOURCE="${S}" econf "${myconf[@]}"
+       if use headers-only; then
+               # Nothing is compiled here which would affect the headers for 
the target.
+               # So forcing CC is sane.
+               headers_only_flags="CC=$(tc-getBUILD_CC)"
+       fi
+
+       ECONF_SOURCE="${S}" econf "${myconf[@]}" "${headers_only_flags}"
 }
 
 src_compile() {
+       use headers-only && return
+
        multibuild_foreach_variant multilib-minimal_src_compile
 }
 
@@ -227,6 +235,7 @@ src_test() {
 src_install() {
        multibuild_foreach_variant multilib-minimal_src_install
 
+       use headers-only || \
        (
                shopt -s failglob || die "failglob failed"
 
@@ -250,6 +259,11 @@ src_install() {
 }
 
 multilib_src_install() {
+       if use headers-only; then
+               emake DESTDIR="${D}" install-nodist_includeHEADERS
+               return
+       fi
+
        emake DESTDIR="${D}" install
 
        # Don't install the libcrypt.so symlink for the "compat" version

diff --git a/sys-libs/libxcrypt/metadata.xml b/sys-libs/libxcrypt/metadata.xml
index 36921daf30b5..cef5e501f632 100644
--- a/sys-libs/libxcrypt/metadata.xml
+++ b/sys-libs/libxcrypt/metadata.xml
@@ -13,6 +13,7 @@
        <use>
                <flag name="compat">Build with compatibility interfaces for 
other crypt implementations</flag>
                <flag name="system">Install as system libcrypt.so rather than 
to an alternate directory (will collide with <pkg>sys-libs/glibc</pkg>'s 
version)</flag>
+               <flag name="headers-only">Build and install only the 
headers.</flag>
        </use>
        <upstream>
                <remote-id type="github">besser82/libxcrypt</remote-id>

Reply via email to