This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4 of 5] scripts/glibc: add partial support for locales


BenoÃt, All,

On Thursday 28 July 2011 21:10:12 BenoÃt THÃBAUDEAU wrote:
> # HG changeset patch
> # User "BenoÃt THÃBAUDEAU" <benoit.thebaudeau@advansee.com>
> # Date 1311851750 -7200
> # Node ID ac0f1f93198fca8e2f28b9499e197fa387c67234
> # Parent  3b3715d0f1d412df91e472ed563d0cde0afedc6b
> scripts/glibc: add partial support for locales
> 
> This patch adds partial support for glibc locales.
> 
> For now, it only generates the appropriate locales when the host and the target
> have the same endianness and uint32_t alignment.

It would at least warrant a warning in the menuconfig, such as:

if LIBC_eglibc && LIBC_LOCALES
comment "Warning! this only works if this machine and the target:"
comment "         - are the same bitness"
comment "         - and have the same requirements for the alignment of uint32_t."
comment "         You will have to check by yourself (for now)."
endif # glibc && locales

Plus, see comments inlined below...

> Signed-off-by: "BenoÃt THÃBAUDEAU" <benoit.thebaudeau@advansee.com>
> 
> diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
> --- a/scripts/build/libc/glibc.sh
> +++ b/scripts/build/libc/glibc.sh
> @@ -63,7 +63,58 @@
>  }
>  
>  # Build and install the libc locales
> -# Not yet supported
>  do_libc_locales() {
> -    :
> +    local src_dir="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
> +    local -a extra_config
> +
> +    mkdir -p "${CT_BUILD_DIR}/build-localedef"
> +    cd "${CT_BUILD_DIR}/build-localedef"
> +
> +    CT_DoLog EXTRA "Configuring C library localedef"
> +
> +    if [ "${CT_LIBC_EGLIBC_HAS_PKGVERSION_BUGURL}" = "y" ]; then
> +        extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
> +        [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
> +    fi
> +
> +    CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
> +
> +    # ./configure is misled by our tools override wrapper for bash
> +    # so just tell it where the real bash is _on_the_target_!
> +    # Notes:
> +    # - ${ac_cv_path_BASH_SHELL} is only used to set BASH_SHELL
> +    # - ${BASH_SHELL}            is only used to set BASH
> +    # - ${BASH}                  is only used to set the shebang
> +    #                            in two scripts to run on the target
> +    # So we can safely bypass bash detection at compile time.
> +    # Should this change in a future eglibc release, we'd better
> +    # directly mangle the generated scripts _after_ they get built,
> +    # or even after they get installed... eglibc is such a sucker...
> +    echo "ac_cv_path_BASH_SHELL=/bin/bash" >>config.cache
> +
> +    # Configure with --prefix the way we want it on the target...
> +
> +    CT_DoExecLog CFG                                                \
> +    CFLAGS="-O2 -fno-stack-protector -U_FORTIFY_SOURCE"             \

Although, we are building for the build machine here, not for target,
-U_FORTIFY_SOURCE should be conditional on ! LIBC_ENABLE_FORTIFIED_BUILD

> +    "${src_dir}/configure"                                          \
> +        --prefix=/usr                                               \
> +        --cache-file="$(pwd)/config.cache"                          \
> +        --without-cvs                                               \
> +        --disable-profile                                           \
> +        --without-gd                                                \
> +        --disable-debug                                             \
> +        "${extra_config[@]}"
> +
> +    CT_DoLog EXTRA "Building C library localedef"
> +    CT_DoExecLog ALL make ${JOBSFLAGS}

He! Wait! Does that mean we do build a complete glibc just for the sake of
having a single binary 'localedef' ? Woosh...

I'm OK with that if that's what it takes to have locales on the target, but
we should definitely try to find a better make target later, if possible.

> +    # The target's endianness and uint32_t alignment should be passed as options
> +    # to localedef, but glibc's localedef does not support these options, which
> +    # means that the locale files generated here will be suitable for the target
> +    # only if it has the same endianness and uint32_t alignment as the host's.
> +
> +    CT_DoLog EXTRA "Installing C library locales"
> +    CT_DoExecLog ALL make ${JOBSFLAGS}                              \
> +                          install_root="${CT_SYSROOT_DIR}"          \
> +                          localedata/install-locales
>  }
> 

Otherwise, looks good.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]