summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Ratiu <adrian.ratiu@collabora.com>2022-04-22 16:38:58 +0300
committerSam James <sam@gentoo.org>2022-04-24 00:54:32 +0100
commitaabea35bb6fdc0e5de5b899c0c2efa8e9570b1e1 (patch)
tree3a82da4c5769b6927f0371e00aa41638f0e90260 /sys-libs
parentsys-libs/glibc: Stabilize 2.34-r10 hppa, #833191 (diff)
downloadgentoo-aabea35bb6fdc0e5de5b899c0c2efa8e9570b1e1.tar.gz
gentoo-aabea35bb6fdc0e5de5b899c0c2efa8e9570b1e1.tar.bz2
gentoo-aabea35bb6fdc0e5de5b899c0c2efa8e9570b1e1.zip
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 <sam@gentoo.org> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com> Closes: https://github.com/gentoo/gentoo/pull/20601 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-libs')
-rw-r--r--sys-libs/libxcrypt/libxcrypt-4.4.28.ebuild64
1 files 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