commit:     44e7f86ff7cf80e0ec466778d82695c68a89ead1
Author:     Adrian Ratiu <adrian.ratiu <AT> collabora <DOT> com>
AuthorDate: Fri Oct 14 13:47:13 2022 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sat Oct 15 17:25:27 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=44e7f86f

sys-libs/libxcrypt: fix binary cross compilation

Even though all files are installed in the proper places
when cross compiling, further testing revealed the libxcrypt
binary itself is not correctly cross-complied for the target
architecture, instead it is compiled for the host.

Set up the proper variables to ensure the binary is built for
the correct architecture.

Before:
libcrypt.so.2.0.0: ELF 64-bit LSB shared object, x86-64,
version 1 (SYSV), dynamically linked, BuildID[xxHash]=0d041ee2539129be, stripped

After:
libcrypt.so.2.0.0: ELF 64-bit LSB shared object, ARM aarch64,
version 1 (SYSV), dynamically linked, BuildID[xxHash]=ba09206297aebce3, stripped

Closes: https://bugs.gentoo.org/877093
Signed-off-by: Adrian Ratiu <adrian.ratiu <AT> collabora.com>
Closes: https://github.com/gentoo/gentoo/pull/27780
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 sys-libs/libxcrypt/libxcrypt-4.4.28-r1.ebuild | 11 +++++++++++
 sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/sys-libs/libxcrypt/libxcrypt-4.4.28-r1.ebuild 
b/sys-libs/libxcrypt/libxcrypt-4.4.28-r1.ebuild
index c55c58c004b0..7c7340f29a7b 100644
--- a/sys-libs/libxcrypt/libxcrypt-4.4.28-r1.ebuild
+++ b/sys-libs/libxcrypt/libxcrypt-4.4.28-r1.ebuild
@@ -165,6 +165,7 @@ get_xcpkgconfigdir() {
 
 multilib_src_configure() {
        local -a myconf=(
+               --host=${CTARGET}
                --disable-werror
                --libdir=$(get_xclibdir)
                --with-pkgconfigdir=$(get_xcpkgconfigdir)
@@ -196,6 +197,16 @@ multilib_src_configure() {
                *) die "Unexpected MULTIBUILD_ID: ${MULTIBUILD_ID}";;
        esac
 
+       tc-export PKG_CONFIG
+
+       if is_cross; then
+               if tc-is-clang; then
+                       export CC="${CTARGET}-clang"
+               else
+                       export CC="${CTARGET}-gcc"
+               fi
+       fi
+
        ECONF_SOURCE="${S}" econf "${myconf[@]}"
 }
 

diff --git a/sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild 
b/sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild
index 8cd9318c3373..3f390bf67ca3 100644
--- a/sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild
+++ b/sys-libs/libxcrypt/libxcrypt-4.4.28-r2.ebuild
@@ -167,6 +167,7 @@ get_xcpkgconfigdir() {
 
 multilib_src_configure() {
        local -a myconf=(
+               --host=${CTARGET}
                --disable-werror
                --libdir=$(get_xclibdir)
                --with-pkgconfigdir=$(get_xcpkgconfigdir)
@@ -174,6 +175,16 @@ multilib_src_configure() {
                --mandir="$(get_xcmandir)"
        )
 
+       tc-export PKG_CONFIG
+
+       if is_cross; then
+               if tc-is-clang; then
+                       export CC="${CTARGET}-clang"
+               else
+                       export CC="${CTARGET}-gcc"
+               fi
+       fi
+
        if use elibc_musl; then
                # musl declares getcontext and swapcontext in ucontext.h,
                # but does not implement them in libc.

Reply via email to