libc/eglibc: add support for locales
author"Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
Fri Jul 29 14:42:20 2011 +0200 (2011-07-29)
changeset 25864f9efd2c6627
parent 2585 45ef0b0660a5
child 2587 7727970d04e9
libc/eglibc: add support for locales

This patch adds support for eglibc locales.

Signed-off-by: "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
scripts/build/libc/eglibc.sh
     1.1 --- a/scripts/build/libc/eglibc.sh	Fri Jul 29 13:25:57 2011 +0200
     1.2 +++ b/scripts/build/libc/eglibc.sh	Fri Jul 29 14:42:20 2011 +0200
     1.3 @@ -14,6 +14,7 @@
     1.4  # snapshots available.
     1.5  do_libc_get() {
     1.6      local addon
     1.7 +    local -a extra_addons
     1.8      local svn_base
     1.9  
    1.10      if [ "${CT_EGLIBC_HTTP}" = "y" ]; then
    1.11 @@ -31,7 +32,11 @@
    1.12                "${svn_base}/libc"            \
    1.13                "${CT_EGLIBC_REVISION:-HEAD}"
    1.14  
    1.15 -    for addon in $(do_libc_add_ons_list " "); do
    1.16 +    if [ "${CT_LIBC_LOCALES}" = "y" ]; then
    1.17 +        extra_addons+=("localedef")
    1.18 +    fi
    1.19 +
    1.20 +    for addon in $(do_libc_add_ons_list " ") "${extra_addons[@]}"; do
    1.21          # Never ever try to download these add-ons,
    1.22          # they've always been internal
    1.23          case "${addon}" in
    1.24 @@ -95,3 +100,71 @@
    1.25  
    1.26      CT_EndStep
    1.27  }
    1.28 +
    1.29 +# Extract the files required for the libc locales
    1.30 +do_libc_locales_extract() {
    1.31 +    CT_Extract "eglibc-localedef-${CT_LIBC_VERSION}"
    1.32 +    CT_Patch "eglibc" "localedef-${CT_LIBC_VERSION}"
    1.33 +}
    1.34 +
    1.35 +# Build and install the libc locales
    1.36 +do_libc_locales() {
    1.37 +    local libc_src_dir="${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}"
    1.38 +    local src_dir="${CT_SRC_DIR}/eglibc-localedef-${CT_LIBC_VERSION}"
    1.39 +    local -a extra_config
    1.40 +    local -a localedef_opts
    1.41 +
    1.42 +    mkdir -p "${CT_BUILD_DIR}/build-localedef"
    1.43 +    cd "${CT_BUILD_DIR}/build-localedef"
    1.44 +
    1.45 +    CT_DoLog EXTRA "Configuring C library localedef"
    1.46 +
    1.47 +    if [ "${CT_LIBC_EGLIBC_HAS_PKGVERSION_BUGURL}" = "y" ]; then
    1.48 +        extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
    1.49 +        [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
    1.50 +    fi
    1.51 +
    1.52 +    CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
    1.53 +
    1.54 +    # ./configure is misled by our tools override wrapper for bash
    1.55 +    # so just tell it where the real bash is _on_the_target_!
    1.56 +    # Notes:
    1.57 +    # - ${ac_cv_path_BASH_SHELL} is only used to set BASH_SHELL
    1.58 +    # - ${BASH_SHELL}            is only used to set BASH
    1.59 +    # - ${BASH}                  is only used to set the shebang
    1.60 +    #                            in two scripts to run on the target
    1.61 +    # So we can safely bypass bash detection at compile time.
    1.62 +    # Should this change in a future eglibc release, we'd better
    1.63 +    # directly mangle the generated scripts _after_ they get built,
    1.64 +    # or even after they get installed... eglibc is such a sucker...
    1.65 +    echo "ac_cv_path_BASH_SHELL=/bin/bash" >>config.cache
    1.66 +
    1.67 +    # Configure with --prefix the way we want it on the target...
    1.68 +
    1.69 +    CT_DoExecLog CFG                                                \
    1.70 +    "${src_dir}/configure"                                          \
    1.71 +        --prefix=/usr                                               \
    1.72 +        --cache-file="$(pwd)/config.cache"                          \
    1.73 +        --with-glibc="${libc_src_dir}"                              \
    1.74 +        "${extra_config[@]}"
    1.75 +
    1.76 +    CT_DoLog EXTRA "Building C library localedef"
    1.77 +    CT_DoExecLog ALL make ${JOBSFLAGS}
    1.78 +
    1.79 +    # Set the localedef endianness option
    1.80 +    case "${CT_ARCH_BE},${CT_ARCH_LE}" in
    1.81 +        y,) localedef_opts+=(--big-endian);;
    1.82 +        ,y) localedef_opts+=(--little-endian);;
    1.83 +    esac
    1.84 +
    1.85 +    # Set the localedef option for the target's uint32_t alignment in bytes.
    1.86 +    # This is target-specific, but for now, 32-bit alignment should work for all
    1.87 +    # supported targets, even 64-bit ones.
    1.88 +    localedef_opts+=(--uint32-align=4)
    1.89 +
    1.90 +    CT_DoLog EXTRA "Installing C library locales"
    1.91 +    CT_DoExecLog ALL make ${JOBSFLAGS}                              \
    1.92 +                          "LOCALEDEF_OPTS=${localedef_opts[*]}"     \
    1.93 +                          install_root="${CT_SYSROOT_DIR}"          \
    1.94 +                          install-locales
    1.95 +}