From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CF2D915808E for ; Sat, 23 Apr 2022 23:55:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 710EDE08DD; Sat, 23 Apr 2022 23:55:42 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 53282E08DD for ; Sat, 23 Apr 2022 23:55:38 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7F0B1341590 for ; Sat, 23 Apr 2022 23:55:36 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id F1718DC for ; Sat, 23 Apr 2022 23:55:34 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1650758072.aabea35bb6fdc0e5de5b899c0c2efa8e9570b1e1.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libxcrypt/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-libs/libxcrypt/libxcrypt-4.4.28.ebuild X-VCS-Directories: sys-libs/libxcrypt/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: aabea35bb6fdc0e5de5b899c0c2efa8e9570b1e1 X-VCS-Branch: master Date: Sat, 23 Apr 2022 23:55:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 1de13792-4e08-45b1-8a16-5b84b3a72ed1 X-Archives-Hash: 04600bcd01d74dfc64d9a336db5f2f09 commit: aabea35bb6fdc0e5de5b899c0c2efa8e9570b1e1 Author: Adrian Ratiu collabora com> AuthorDate: Fri Apr 22 13:38:58 2022 +0000 Commit: Sam James gentoo org> CommitDate: Sat Apr 23 23:54:32 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aabea35b sys-libs/libxcrypt: add cross-* build support This logic is required for cross LLVM toolchains built against glibc with its libcrypt disabled because compiler-rt requires a crypt.h header for its sanitizers, leading to a circular build dependency situation: libxcrypt -> compiler-rt -> libxcrypt To break this circular dep other cross-compilation build systems like Yocto have disabled compiler-rt sanitizers entirely [1] or a crypt.h header might be copied into the compiler-rt sources. A better solution than the above two is to directly be able to build libxcrypt before compiler-rt in the cross toolchain setup steps which is what this addition enables. [1] https://github.com/kraj/meta-clang/pull/426 Bug: https://bugs.gentoo.org/699422 Co-authored-by: Sam James gentoo.org> Signed-off-by: Adrian Ratiu collabora.com> Closes: https://github.com/gentoo/gentoo/pull/20601 Signed-off-by: Sam James gentoo.org> sys-libs/libxcrypt/libxcrypt-4.4.28.ebuild | 64 +++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/sys-libs/libxcrypt/libxcrypt-4.4.28.ebuild b/sys-libs/libxcrypt/libxcrypt-4.4.28.ebuild index 9bebb1243fee..3a86e64f4aa3 100644 --- a/sys-libs/libxcrypt/libxcrypt-4.4.28.ebuild +++ b/sys-libs/libxcrypt/libxcrypt-4.4.28.ebuild @@ -25,6 +25,18 @@ IUSE="+compat split-usr static-libs system test" REQUIRED_USE="split-usr? ( system )" RESTRICT="!test? ( test )" +export CTARGET=${CTARGET:-${CHOST}} +if [[ ${CTARGET} == ${CHOST} ]] ; then + if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then + export CTARGET=${CATEGORY/cross-} + fi +fi + +is_cross() { + local enabled_abis=( $(multilib_get_enabled_abis) ) + [[ "${#enabled_abis[@]}" -le 1 ]] && [[ ${CHOST} != ${CTARGET} ]] +} + DEPEND="system? ( elibc_glibc? ( sys-libs/glibc[-crypt(+)] @@ -114,19 +126,46 @@ src_configure() { multibuild_foreach_variant multilib-minimal_src_configure } +get_xcprefix() { + if is_cross; then + echo "${EPREFIX}/usr/${CTARGET}" + else + echo "${EPREFIX}" + fi +} + get_xclibdir() { - printf -- "%s/%s/%s\n" \ + printf -- "%s/%s/%s/%s\n" \ + "$(get_xcprefix)" \ "$(usex split-usr '' '/usr')" \ "$(get_libdir)" \ "$(usex system '' 'xcrypt')" } +get_xcincludedir() { + printf -- "%s/usr/include/%s\n" \ + "$(get_xcprefix)" \ + "$(usex system '' 'xcrypt')" +} + +get_xcmandir() { + printf -- "%s/usr/share/man\n" \ + "$(get_xcprefix)" +} + +get_xcpkgconfigdir() { + printf -- "%s/usr/%s/pkgconfig\n" \ + "$(get_xcprefix)" \ + "$(get_libdir)" +} + multilib_src_configure() { local -a myconf=( --disable-werror - --libdir="${EPREFIX}"$(get_xclibdir) - --with-pkgconfigdir="${EPREFIX}/usr/$(get_libdir)/pkgconfig" - --includedir="${EPREFIX}/usr/include/$(usex system '' 'xcrypt')" + --libdir=$(get_xclibdir) + --with-pkgconfigdir=$(get_xcpkgconfigdir) + --includedir=$(get_xcincludedir) + --mandir="$(get_xcmandir)" ) case "${MULTIBUILD_ID}" in @@ -168,7 +207,7 @@ src_install() { shopt -s failglob || die "failglob failed" # Make sure our man pages do not collide with glibc or man-pages. - for manpage in "${ED}"/usr/share/man/man3/crypt{,_r}.?*; do + for manpage in "${D}$(get_xcmandir)"/man3/crypt{,_r}.?*; do mv -n "${manpage}" "$(dirname "${manpage}")/xcrypt_$(basename "${manpage}")" \ || die "mv failed" done @@ -177,6 +216,13 @@ src_install() { # Remove useless stuff from installation find "${ED}"/usr/share/doc/${PF} -type l -delete || die find "${ED}" -name '*.la' -delete || die + + # workaround broken upstream cross-* --docdir by installing files in proper locations + if is_cross; then + insinto "$(get_xcprefix)"/usr/share + doins -r "${ED}"/usr/share/doc + rm -r "${ED}"/usr/share/doc || die + fi } multilib_src_install() { @@ -185,7 +231,7 @@ multilib_src_install() { # Don't install the libcrypt.so symlink for the "compat" version case "${MULTIBUILD_ID}" in xcrypt_compat-*) - rm "${ED}"$(get_xclibdir)/libcrypt$(get_libname) \ + rm "${D}"$(get_xclibdir)/libcrypt$(get_libname) \ || die "failed to remove extra compat libraries" ;; xcrypt_nocompat-*) @@ -195,7 +241,7 @@ multilib_src_install() { # .a files are installed to /$(get_libdir) by default # Move static libraries to /usr prefix or portage will abort shopt -s nullglob || die "failglob failed" - static_libs=( "${ED}"/$(get_xclibdir)/*.a ) + static_libs=( "${D}"/$(get_xclibdir)/*.a ) if [[ -n ${static_libs[*]} ]]; then dodir "/usr/$(get_xclibdir)" @@ -209,13 +255,13 @@ multilib_src_install() { # to allow linker to correctly find shared libraries. shopt -s failglob || die "failglob failed" - for lib_file in "${ED}"$(get_xclibdir)/*$(get_libname); do + for lib_file in "${D}"$(get_xclibdir)/*$(get_libname); do lib_file_basename="$(basename "${lib_file}")" lib_file_target="$(basename "$(readlink -f "${lib_file}")")" dosym "../../$(get_libdir)/${lib_file_target}" "/usr/$(get_xclibdir)/${lib_file_basename}" done - rm "${ED}"$(get_xclibdir)/*$(get_libname) || die "Removing symlinks in incorrect location failed" + rm "${D}"$(get_xclibdir)/*$(get_libname) || die "Removing symlinks in incorrect location failed" fi ) fi