1 |
commit: b7315c4a85743a10719bc4a3b1364b5035944eb8 |
2 |
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 14 19:43:04 2018 +0000 |
4 |
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue May 12 04:14:50 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=b7315c4a |
7 |
|
8 |
locale-gen: Add switch to force use of newly built ld.so for glibc updates |
9 |
|
10 |
Originally 6f89339308241bceb5194a200c99002e6c75dbb6, gentoo/glibc-9999-11 |
11 |
|
12 |
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org> |
13 |
|
14 |
locale-gen | 55 ++++++++++++++++++++++++++++++++++++++++++++----------- |
15 |
1 file changed, 44 insertions(+), 11 deletions(-) |
16 |
|
17 |
diff --git a/locale-gen b/locale-gen |
18 |
index 87dd30e..794cfeb 100755 |
19 |
--- a/locale-gen |
20 |
+++ b/locale-gen |
21 |
@@ -73,8 +73,10 @@ QUIET=0 |
22 |
SET_X="" |
23 |
LOCALE_ARCHIVE=true |
24 |
CUTF_ADDED="" |
25 |
+INPLACE_GLIBC="" |
26 |
while [[ $# -gt 0 ]] ; do |
27 |
case $1 in |
28 |
+ --inplace-glibc) INPLACE_GLIBC=$1;; |
29 |
-k|--keep|--keep-existing) KEEP=$1;; |
30 |
-d|--destdir) shift; DESTDIR=$1; unset ROOT;; |
31 |
-c|--config) shift; CONFIG=$1;; |
32 |
@@ -262,13 +264,30 @@ generate_locale() { |
33 |
# jobs don't tromp on each other |
34 |
x=$( |
35 |
[[ -n ${output} ]] && ebegin "${output}" |
36 |
- "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \ |
37 |
- --no-archive \ |
38 |
- -i "${input}" \ |
39 |
- -f "${charmap}" \ |
40 |
- -A "${ALIAS}" \ |
41 |
- --prefix "${DESTDIR%${EPREFIX}/}/" \ |
42 |
- "${locale}" 2>&1 |
43 |
+ # In most cases, localedef can just use the system glibc. |
44 |
+ # However, if we are within a major glibc upgrade, this may fail |
45 |
+ # in src_* phases since the new localedef links against the new |
46 |
+ # glibc, but the new glibc is not installed yet... |
47 |
+ if [[ -z ${INPLACE_GLIBC} ]] ; then |
48 |
+ "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \ |
49 |
+ --no-archive \ |
50 |
+ -i "${input}" \ |
51 |
+ -f "${charmap}" \ |
52 |
+ -A "${ALIAS}" \ |
53 |
+ --prefix "${DESTDIR%${EPREFIX}/}/" \ |
54 |
+ "${locale}" 2>&1 |
55 |
+ else |
56 |
+ # We assume that the current directory is "${ED}"/$(get_libdir), |
57 |
+ # see the glibc ebuild, function glibc_sanity_check(), for why. |
58 |
+ LC_ALL=C ./ld-*.so --library-path . \ |
59 |
+ "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \ |
60 |
+ --no-archive \ |
61 |
+ -i "${input}" \ |
62 |
+ -f "${charmap}" \ |
63 |
+ -A "${ALIAS}" \ |
64 |
+ --prefix "${DESTDIR%${EPREFIX}/}/" \ |
65 |
+ "${locale}" 2>&1 |
66 |
+ fi |
67 |
ret=$? |
68 |
[[ -n ${output} ]] && eend ${ret} |
69 |
exit ${ret} |
70 |
@@ -363,10 +382,24 @@ if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then |
71 |
for LOC in "${LOCALEDIR}"/*/; do |
72 |
LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it |
73 |
x=$( |
74 |
- "${DESTDIR}"usr/bin/localedef \ |
75 |
- --add-to-archive "${LOC}" \ |
76 |
- --replace \ |
77 |
- --prefix "${DESTDIR%${EPREFIX}/}/" |
78 |
+ # In most cases, localedef can just use the system glibc. |
79 |
+ # However, if we are within a major glibc upgrade, this may fail |
80 |
+ # in src_* phases since the new localedef links against the new |
81 |
+ # glibc, but the new glibc is not installed yet... |
82 |
+ if [[ -z ${INPLACE_GLIBC} ]] ; then |
83 |
+ "${DESTDIR}"usr/bin/localedef \ |
84 |
+ --add-to-archive "${LOC}" \ |
85 |
+ --replace \ |
86 |
+ --prefix "${DESTDIR%${EPREFIX}/}/" |
87 |
+ else |
88 |
+ # We assume that the current directory is "${ED}"/$(get_libdir), |
89 |
+ # see the glibc ebuild, function glibc_sanity_check(), for why. |
90 |
+ LC_ALL=C ./ld-*.so --library-path . \ |
91 |
+ "${DESTDIR}"usr/bin/localedef \ |
92 |
+ --add-to-archive "${LOC}" \ |
93 |
+ --replace \ |
94 |
+ --prefix "${DESTDIR%${EPREFIX}/}/" |
95 |
+ fi |
96 |
ret=$? |
97 |
if [[ -n ${output} ]] ; then |
98 |
echo "${x}" |