sys-libs/glibc: refresh ld.so.cache if natively installing >=2.38 on loong

The 2.38 change is ~loong-only to avoid triggering rebuilds on other
arches.

Closes: https://github.com/gentoo/gentoo/pull/32470
Reviewed-by: Sam James <sam@gentoo.org>
Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
This commit is contained in:
WANG Xuerui
2023-08-27 15:06:07 +08:00
parent 951fca820d
commit 9e5d587b00
2 changed files with 1733 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1638,6 +1638,21 @@ pkg_preinst() {
fi
}
glibc_refresh_ldconfig() {
if [[ ${MERGE_TYPE} == buildonly ]]; then
return
fi
# Version check could be added to avoid unnecessary work, but ldconfig
# should finish quickly enough to not matter.
ebegin "Refreshing ld.so.cache"
ldconfig -i
if ! eend $?; then
ewarn "Failed to refresh the ld.so.cache for you. Some programs may be broken"
ewarn "before you manually do so (ldconfig -i)."
fi
}
pkg_postinst() {
# nothing to do if just installing headers
just_headers && return
@@ -1648,6 +1663,17 @@ pkg_postinst() {
fi
if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
# glibc-2.38+ on loong has ldconfig support added, but the ELF e_flags
# handling has changed as well, which means stale ldconfig auxiliary
# cache entries and failure to lookup libgcc_s / libstdc++ (breaking
# every C++ application) / libgomp etc., among other breakages.
#
# To fix this, simply refresh the ld.so.cache without using the
# auxiliary cache if we're natively installing on loong. This should
# be done relatively soon because we want to minimize the breakage
# window for the affected programs.
use loong && glibc_refresh_ldconfig
use compile-locales || run_locale_gen "${EROOT}/"
fi