summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2018-12-14 20:43:04 +0100
committerAndreas K. Hüttel <dilfridge@gentoo.org>2020-05-12 07:14:50 +0300
commitb7315c4a85743a10719bc4a3b1364b5035944eb8 (patch)
treec241f575b082c36954e0d73d12999d65d9c7c158
parentlocale-gen: do not touch locale-archive when no locales requested in config (diff)
downloadlocale-gen-b7315c4a85743a10719bc4a3b1364b5035944eb8.tar.gz
locale-gen-b7315c4a85743a10719bc4a3b1364b5035944eb8.tar.bz2
locale-gen-b7315c4a85743a10719bc4a3b1364b5035944eb8.zip
locale-gen: Add switch to force use of newly built ld.so for glibc updates
Originally 6f89339308241bceb5194a200c99002e6c75dbb6, gentoo/glibc-9999-11 Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
-rwxr-xr-xlocale-gen55
1 files changed, 44 insertions, 11 deletions
diff --git a/locale-gen b/locale-gen
index 87dd30e..794cfeb 100755
--- a/locale-gen
+++ b/locale-gen
@@ -73,8 +73,10 @@ QUIET=0
SET_X=""
LOCALE_ARCHIVE=true
CUTF_ADDED=""
+INPLACE_GLIBC=""
while [[ $# -gt 0 ]] ; do
case $1 in
+ --inplace-glibc) INPLACE_GLIBC=$1;;
-k|--keep|--keep-existing) KEEP=$1;;
-d|--destdir) shift; DESTDIR=$1; unset ROOT;;
-c|--config) shift; CONFIG=$1;;
@@ -262,13 +264,30 @@ generate_locale() {
# jobs don't tromp on each other
x=$(
[[ -n ${output} ]] && ebegin "${output}"
- "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
- --no-archive \
- -i "${input}" \
- -f "${charmap}" \
- -A "${ALIAS}" \
- --prefix "${DESTDIR%${EPREFIX}/}/" \
- "${locale}" 2>&1
+ # In most cases, localedef can just use the system glibc.
+ # However, if we are within a major glibc upgrade, this may fail
+ # in src_* phases since the new localedef links against the new
+ # glibc, but the new glibc is not installed yet...
+ if [[ -z ${INPLACE_GLIBC} ]] ; then
+ "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
+ --no-archive \
+ -i "${input}" \
+ -f "${charmap}" \
+ -A "${ALIAS}" \
+ --prefix "${DESTDIR%${EPREFIX}/}/" \
+ "${locale}" 2>&1
+ else
+ # We assume that the current directory is "${ED}"/$(get_libdir),
+ # see the glibc ebuild, function glibc_sanity_check(), for why.
+ LC_ALL=C ./ld-*.so --library-path . \
+ "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
+ --no-archive \
+ -i "${input}" \
+ -f "${charmap}" \
+ -A "${ALIAS}" \
+ --prefix "${DESTDIR%${EPREFIX}/}/" \
+ "${locale}" 2>&1
+ fi
ret=$?
[[ -n ${output} ]] && eend ${ret}
exit ${ret}
@@ -363,10 +382,24 @@ if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
for LOC in "${LOCALEDIR}"/*/; do
LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it
x=$(
- "${DESTDIR}"usr/bin/localedef \
- --add-to-archive "${LOC}" \
- --replace \
- --prefix "${DESTDIR%${EPREFIX}/}/"
+ # In most cases, localedef can just use the system glibc.
+ # However, if we are within a major glibc upgrade, this may fail
+ # in src_* phases since the new localedef links against the new
+ # glibc, but the new glibc is not installed yet...
+ if [[ -z ${INPLACE_GLIBC} ]] ; then
+ "${DESTDIR}"usr/bin/localedef \
+ --add-to-archive "${LOC}" \
+ --replace \
+ --prefix "${DESTDIR%${EPREFIX}/}/"
+ else
+ # We assume that the current directory is "${ED}"/$(get_libdir),
+ # see the glibc ebuild, function glibc_sanity_check(), for why.
+ LC_ALL=C ./ld-*.so --library-path . \
+ "${DESTDIR}"usr/bin/localedef \
+ --add-to-archive "${LOC}" \
+ --replace \
+ --prefix "${DESTDIR%${EPREFIX}/}/"
+ fi
ret=$?
if [[ -n ${output} ]] ; then
echo "${x}"