libc/uClibc: do not systematically use pre-generated locale data
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Jul 28 01:03:07 2010 +0200 (2010-07-28)
changeset 203667e02b48b595
parent 2034 c3967b2c49b4
child 2037 cd00fdab6117
libc/uClibc: do not systematically use pre-generated locale data

It seems that using pre-generated locale data can be more problematic
than usefull in some circumstances.

Offer a config knob to enable/disable use of the pregen locale data.
Also, do not extract pregen locales data ourselves, it's broken.
config/libc/uClibc.in
scripts/build/libc/uClibc.sh
     1.1 --- a/config/libc/uClibc.in	Thu Jul 22 23:26:08 2010 +0200
     1.2 +++ b/config/libc/uClibc.in	Wed Jul 28 01:03:07 2010 +0200
     1.3 @@ -161,6 +161,18 @@
     1.4  
     1.5        Note that seems to be broken on recent uClibc releases.
     1.6  
     1.7 +config LIBC_UCLIBC_LOCALES_PREGEN_DATA
     1.8 +    bool
     1.9 +    prompt "Use pregen locales"
    1.10 +    depends on LIBC_UCLIBC_LOCALES
    1.11 +    default y
    1.12 +    help
    1.13 +      If you see issues with using pre-generated locales data,
    1.14 +      you can try switching this off.
    1.15 +      
    1.16 +      If so, please report the issue, so we can default this
    1.17 +      to off if too many people complain.
    1.18 +
    1.19  config LIBC_UCLIBC_WCHAR
    1.20      bool
    1.21      prompt "Add support for WCHAR"
     2.1 --- a/scripts/build/libc/uClibc.sh	Thu Jul 22 23:26:08 2010 +0200
     2.2 +++ b/scripts/build/libc/uClibc.sh	Wed Jul 28 01:03:07 2010 +0200
     2.3 @@ -12,7 +12,7 @@
     2.4      # later...
     2.5      CT_GetFile "uClibc-${CT_LIBC_VERSION}" ${libc_src}
     2.6      # uClibc locales
     2.7 -    if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then
     2.8 +    if [ "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y" ]; then
     2.9          CT_GetFile "uClibc-locale-030818" ${libc_src}
    2.10      fi
    2.11  
    2.12 @@ -40,11 +40,14 @@
    2.13      fi
    2.14  
    2.15      # uClibc locales
    2.16 -    if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ]; then
    2.17 +    # Extracting pregen locales ourselves is kinda
    2.18 +    # broken, so just link it in place...
    2.19 +    if [    "${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" = "y"           \
    2.20 +         -a ! -f "${CT_SRC_DIR}/.uClibc-locales-030818.extracted"   ]; then
    2.21          CT_Pushd "$(libc_uclibc_src_dir)/extra/locale"
    2.22 -        CT_Extract nochdir "uClibc-locale-030818"
    2.23 -        CT_Patch nochdir "uClibc" "locale-030818"
    2.24 +        CT_DoExecLog ALL ln -s "${CT_TARBALLS_DIR}/uClibc-locale-030818.tgz" .
    2.25          CT_Popd
    2.26 +        touch "${CT_SRC_DIR}/.uClibc-locales-030818.extracted"
    2.27      fi
    2.28  
    2.29      return 0
    2.30 @@ -354,14 +357,26 @@
    2.31      # arrangements.  Note that having the uClibc Makefile download the
    2.32      # pregenerated locales is not compatible with crosstool; besides,
    2.33      # crosstool downloads them as part of getandpatch.sh.
    2.34 -    if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] ; then
    2.35 -        cat <<-ENDSED
    2.36 -			s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\
    2.37 -			UCLIBC_PREGENERATED_LOCALE_DATA=y\\
    2.38 -			# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\
    2.39 -			# UCLIBC_HAS_XLOCALE is not set/
    2.40 -			ENDSED
    2.41 -    fi
    2.42 +    case "${CT_LIBC_UCLIBC_LOCALES}:${CT_LIBC_UCLIBC_LOCALES_PREGEN_DATA}" in
    2.43 +        :*)
    2.44 +            ;;
    2.45 +        y:)
    2.46 +            cat <<-ENDSED
    2.47 +				s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\
    2.48 +				# UCLIBC_PREGENERATED_LOCALE_DATA is not set\\
    2.49 +				# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\
    2.50 +				# UCLIBC_HAS_XLOCALE is not set/
    2.51 +				ENDSED
    2.52 +            ;;
    2.53 +        y:y)
    2.54 +            cat <<-ENDSED
    2.55 +				s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\
    2.56 +				UCLIBC_PREGENERATED_LOCALE_DATA=y\\
    2.57 +				# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\
    2.58 +				# UCLIBC_HAS_XLOCALE is not set/
    2.59 +				ENDSED
    2.60 +            ;;
    2.61 +    esac
    2.62  
    2.63      # WCHAR support
    2.64      if [ "${CT_LIBC_UCLIBC_WCHAR}" = "y" ] ; then