package/bash: fix uclibc build without wchar

Fixes:
 - http://autobuild.buildroot.org/results/298fb9c785e137bff432dd304eb56986e54ce3ed

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Fabrice Fontaine 2020-02-23 12:54:42 +01:00 committed by Peter Korsgaard
parent ba3c50f592
commit 1160427a9a

View File

@ -0,0 +1,84 @@
From 73ca494c60d46103f806325e6ccbe9e400238008 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sun, 23 Feb 2020 11:41:09 +0100
Subject: [PATCH] locale.c: fix build without wchar
bash unconditionally builds locale.c which depends on mblen since
version 5.0 and
https://github.com/bminor/bash/commit/d233b485e83c3a784b803fb894280773f16f2deb
This results in the following build failure if wchar is not available:
/home/buildroot/autobuild/run/instance-0/output-1/host/bin/microblazeel-buildroot-linux-uclibc-gcc -L./builtins -L/home/buildroot/autobuild/run/instance-0/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot/lib -L/home/buildroot/autobuild/run/instance-0/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot/lib -L./lib/glob -L./lib/tilde -L./lib/sh -rdynamic -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -Wno-parentheses -Wno-format-security -o bash shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o expr.o flags.o jobs.o subst.o hashcmd.o hashlib.o mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o alias.o array.o arrayfunc.o assoc.o braces.o bracecomp.o bashhist.o bashline.o list.o stringlib.o locale.o findcmd.o redir.o pcomplete.o pcomplib.o syntax.o xmalloc.o signames.o -lbuiltins -lglob -lsh -lreadline -lhistory -lcurses -ltilde -ldl
/home/buildroot/autobuild/run/instance-0/output-1/host/lib/gcc/microblazeel-buildroot-linux-uclibc/8.3.0/../../../../microblazeel-buildroot-linux-uclibc/bin/ld: locale.o: in function `set_default_locale':
(.text+0x260): undefined reference to `mblen'
To fix this issue, don't use mblen if HANDLE_MULTIBYTE is not defined,
an other possibility would be to use MBLEN wrapper defined in shmbutil.h
Fixes:
- http://autobuild.buildroot.org/results/298fb9c785e137bff432dd304eb56986e54ce3ed
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Upstream status: https://savannah.gnu.org/support/index.php?110200]
---
locale.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/locale.c b/locale.c
index d62547f6..a64c5b4b 100644
--- a/locale.c
+++ b/locale.c
@@ -86,7 +86,9 @@ set_default_locale ()
locale_mb_cur_max = MB_CUR_MAX;
locale_utf8locale = locale_isutf8 (default_locale);
+#if defined (HANDLE_MULTIBYTE)
locale_shiftstates = mblen ((char *)NULL, 0);
+#endif
}
/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_NUMERIC and
@@ -107,7 +109,9 @@ set_default_locale_vars ()
locale_setblanks ();
locale_mb_cur_max = MB_CUR_MAX;
locale_utf8locale = locale_isutf8 (lc_all);
+# if defined (HANDLE_MULTIBYTE)
locale_shiftstates = mblen ((char *)NULL, 0);
+# endif
u32reset ();
}
# endif
@@ -211,7 +215,9 @@ set_locale_var (var, value)
/* if LC_ALL == "", reset_locale_vars has already called this */
if (*lc_all && x)
locale_utf8locale = locale_isutf8 (lc_all);
+# if defined (HANDLE_MULTIBYTE)
locale_shiftstates = mblen ((char *)NULL, 0);
+# endif
u32reset ();
return r;
#else
@@ -231,7 +237,9 @@ set_locale_var (var, value)
/* if setlocale() returns NULL, the locale is not changed */
if (x)
locale_utf8locale = locale_isutf8 (x);
+# if defined (HANDLE_MULTIBYTE)
locale_shiftstates = mblen ((char *)NULL, 0);
+# endif
u32reset ();
}
# endif
@@ -368,7 +376,9 @@ reset_locale_vars ()
locale_mb_cur_max = MB_CUR_MAX;
if (x)
locale_utf8locale = locale_isutf8 (x);
+# if defined (HANDLE_MULTIBYTE)
locale_shiftstates = mblen ((char *)NULL, 0);
+# endif
u32reset ();
#endif
return 1;
--
2.25.0