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]

[CT-NG 1.11.1] eglibc internationalization support


Hi Yann, all,

To my surprise, the eglibc locales are not built by CT-NG although the localedef
tarball is downloaded.

I propose the patch below for that purpose (tested successfully). Please tell me
what you think.

Best regards,
BenoÃt
--------------------------------------------------------------------------------
This patch adds support for eglibc localedef.

localedef has to be extracted and symlinked like external eglibc add-ons.

However, it requires a dedicated configure/build/install sequence, which implies
setting only the required add-ons in --enable-add-ons in order to avoid breaking
the libc configure because of localedef being detected as an add-on.

Signed-off-by: BenoÃt ThÃbaudeau <benoit.thebaudeau@advansee.com>
---
diff -Nrdup crosstool-ng-1.11.1.orig/config/libc/glibc-eglibc.in-common crosstool-ng-1.11.1/config/libc/glibc-eglibc.in-common
--- crosstool-ng-1.11.1.orig/config/libc/glibc-eglibc.in-common	2011-05-02 18:11:24.000000000 +0200
+++ crosstool-ng-1.11.1/config/libc/glibc-eglibc.in-common	2011-05-17 18:02:52.466466861 +0200
@@ -141,7 +141,7 @@ config LIBC_ADDONS_LIST

       You need to specify neither linuxthreads nor nptl, as they are added
       automagically for you depending on the threading model you choosed
-      earlier.
+      earlier. Same for localedef.

       Eg.: crypt        (for very old libces)

diff -Nrdup crosstool-ng-1.11.1.orig/scripts/build/libc/eglibc.sh crosstool-ng-1.11.1/scripts/build/libc/eglibc.sh
--- crosstool-ng-1.11.1.orig/scripts/build/libc/eglibc.sh	2011-05-02 18:11:24.000000000 +0200
+++ crosstool-ng-1.11.1/scripts/build/libc/eglibc.sh	2011-05-17 19:38:50.447246778 +0200
@@ -104,7 +104,7 @@ do_libc_extract() {
     CT_Patch "eglibc" "${CT_LIBC_VERSION}"

     # C library addons
-    for addon in $(do_libc_add_ons_list " "); do
+    for addon in $(do_libc_add_ons_list " ") localedef; do
         # NPTL addon is not to be extracted, in any case
         [ "${addon}" = "nptl" ] && continue || true
         CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}"
@@ -174,3 +174,56 @@ do_libc_check_config() {

     CT_EndStep
 }
+
+# This function builds and installs the C library locales
+do_eglibc_localedef() {
+    local libc_src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
+    local src_dir="${libc_src_dir}/localedef"
+    local -a localedef_opts
+
+    CT_DoStep INFO "Installing C library locales"
+
+    mkdir -p "${CT_BUILD_DIR}/build-libc/localedef"
+    cd "${CT_BUILD_DIR}/build-libc/localedef"
+
+    CT_DoLog EXTRA "Configuring C library locales"
+
+    # ./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                                                \
+    "${src_dir}/configure"                                          \
+        --prefix=/usr                                               \
+        --cache-file="$(pwd)/config.cache"                          \
+        --with-glibc="${libc_src_dir}"
+
+    CT_DoLog EXTRA "Building C library locales"
+    CT_DoExecLog ALL make ${JOBSFLAGS}
+
+    # Set the localedef endianness option
+    case "${CT_ARCH_BE},${CT_ARCH_LE}" in
+        y,) localedef_opts+=(--big-endian);;
+        ,y) localedef_opts+=(--little-endian);;
+    esac
+
+    # Set the localedef option for the target's uint32_t alignment in bytes
+    localedef_opts+=(--uint32-align=4)
+
+    CT_DoLog EXTRA "Installing C library locales"
+    CT_DoExecLog ALL make ${JOBSFLAGS}                              \
+                          "LOCALEDEF_OPTS=${localedef_opts[*]}"     \
+                          install_root="${CT_SYSROOT_DIR}"          \
+                          install-locales
+}
diff -Nrdup crosstool-ng-1.11.1.orig/scripts/build/libc/glibc-eglibc.sh-common crosstool-ng-1.11.1/scripts/build/libc/glibc-eglibc.sh-common
--- crosstool-ng-1.11.1.orig/scripts/build/libc/glibc-eglibc.sh-common	2011-05-02 18:11:24.000000000 +0200
+++ crosstool-ng-1.11.1/scripts/build/libc/glibc-eglibc.sh-common	2011-05-17 18:23:49.700466215 +0200
@@ -3,6 +3,7 @@
 # Build and install headers and start files
 do_libc_start_files() {
     local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
+    local -a extra_config

     CT_DoStep INFO "Installing C library headers & start files"

@@ -19,6 +20,11 @@ do_libc_start_files() {
             ;;
     esac

+    case "$(do_libc_add_ons_list ,)" in
+        "") extra_config+=("--enable-add-ons=no");;
+        *)  extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
+    esac
+
     cross_cc=$(CT_Which "${CT_TARGET}-gcc")
     cross_cxx=$(CT_Which "${CT_TARGET}-g++")
     cross_ar=$(CT_Which "${CT_TARGET}-ar")
@@ -53,7 +59,7 @@ do_libc_start_files() {
         --disable-profile                               \
         --without-gd                                    \
         --without-cvs                                   \
-        --enable-add-ons
+        "${extra_config[@]}"

     CT_DoLog EXTRA "Installing C library headers"

@@ -185,7 +191,7 @@ do_libc() {
     fi

     case "$(do_libc_add_ons_list ,)" in
-        "") ;;
+        "") extra_config+=("--enable-add-ons=no");;
         *)  extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
     esac

@@ -272,6 +278,10 @@ do_libc() {
                           install_root="${CT_SYSROOT_DIR}"  \
                           install

+    if [ "${CT_LIBC}" = "eglibc" ]; then
+        do_eglibc_localedef
+    fi
+
     CT_EndStep
 }


--
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]