scripts/build/libc/glibc.sh
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Mon Apr 16 15:25:36 2012 +0200 (2012-04-16)
changeset 2941 13e40098fffc
parent 2504 3fc114996b20
child 3041 b9f695c2f5b7
permissions -rw-r--r--
cc/gcc: update Linaro GCC revisions to 2012.04

Update Linaro GCC with the latest available revisions.

The 4.7 revision is also released, but the infrastructure is not yet ready for
it in CT-NG.

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
     1 # This file adds functions to build glibc
     2 # Copyright 2007 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 # Add the definitions common to glibc and eglibc
     6 #   do_libc_extract
     7 #   do_libc_start_files
     8 #   do_libc
     9 #   do_libc_finish
    10 #   do_libc_add_ons_list
    11 #   do_libc_min_kernel_config
    12 . "${CT_LIB_DIR}/scripts/build/libc/glibc-eglibc.sh-common"
    13 
    14 # Download glibc
    15 do_libc_get() {
    16     local date
    17     local version
    18     local -a addons_list
    19 
    20     addons_list=($(do_libc_add_ons_list " "))
    21 
    22     # Main source
    23     CT_GetFile "glibc-${CT_LIBC_VERSION}"               \
    24                {ftp,http}://ftp.gnu.org/gnu/glibc       \
    25                ftp://gcc.gnu.org/pub/glibc/releases     \
    26                ftp://gcc.gnu.org/pub/glibc/snapshots
    27 
    28     # C library addons
    29     for addon in "${addons_list[@]}"; do
    30         # Never ever try to download these add-ons,
    31         # they've always been internal
    32         case "${addon}" in
    33             nptl)   continue;;
    34         esac
    35 
    36         if ! CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}"     \
    37                         {ftp,http}://ftp.gnu.org/gnu/glibc      \
    38                         ftp://gcc.gnu.org/pub/glibc/releases    \
    39                         ftp://gcc.gnu.org/pub/glibc/snapshots
    40         then
    41             # Some add-ons are bundled with glibc, others are
    42             # bundled in their own tarball. Eg. NPTL is internal,
    43             # while LinuxThreads was external. Also, for old
    44             # versions of glibc, the libidn add-on was external,
    45             # but with version >=2.10, it is internal.
    46             CT_DoLog DEBUG "Addon '${addon}' could not be downloaded."
    47             CT_DoLog DEBUG "We'll see later if we can find it in the source tree"
    48         fi
    49     done
    50 
    51     return 0
    52 }
    53 
    54 # There is nothing to do for glibc check config
    55 do_libc_check_config() {
    56     :
    57 }
    58 
    59 # Extract the files required for the libc locales
    60 # Nothing to do
    61 do_libc_locales_extract() {
    62     :
    63 }
    64 
    65 # Build and install the libc locales
    66 do_libc_locales() {
    67     local src_dir="${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
    68     local -a extra_config
    69     local glibc_cflags
    70 
    71     mkdir -p "${CT_BUILD_DIR}/build-localedef"
    72     cd "${CT_BUILD_DIR}/build-localedef"
    73 
    74     CT_DoLog EXTRA "Configuring C library localedef"
    75 
    76     if [ "${CT_LIBC_EGLIBC_HAS_PKGVERSION_BUGURL}" = "y" ]; then
    77         extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
    78         [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
    79     fi
    80 
    81     CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
    82 
    83     glibc_cflags="-O2 -fno-stack-protector"
    84     case "${CT_LIBC_ENABLE_FORTIFIED_BUILD}" in
    85         y)  ;;
    86         *)  glibc_cflags+=" -U_FORTIFY_SOURCE";;
    87     esac
    88 
    89     # ./configure is misled by our tools override wrapper for bash
    90     # so just tell it where the real bash is _on_the_target_!
    91     # Notes:
    92     # - ${ac_cv_path_BASH_SHELL} is only used to set BASH_SHELL
    93     # - ${BASH_SHELL}            is only used to set BASH
    94     # - ${BASH}                  is only used to set the shebang
    95     #                            in two scripts to run on the target
    96     # So we can safely bypass bash detection at compile time.
    97     # Should this change in a future eglibc release, we'd better
    98     # directly mangle the generated scripts _after_ they get built,
    99     # or even after they get installed... eglibc is such a sucker...
   100     echo "ac_cv_path_BASH_SHELL=/bin/bash" >>config.cache
   101 
   102     # Configure with --prefix the way we want it on the target...
   103 
   104     CT_DoExecLog CFG                                                \
   105     CFLAGS="${glibc_cflags}"                                        \
   106     "${src_dir}/configure"                                          \
   107         --prefix=/usr                                               \
   108         --cache-file="$(pwd)/config.cache"                          \
   109         --without-cvs                                               \
   110         --disable-profile                                           \
   111         --without-gd                                                \
   112         --disable-debug                                             \
   113         "${extra_config[@]}"
   114 
   115     CT_DoLog EXTRA "Building C library localedef"
   116     CT_DoExecLog ALL make ${JOBSFLAGS}
   117 
   118     # The target's endianness and uint32_t alignment should be passed as options
   119     # to localedef, but glibc's localedef does not support these options, which
   120     # means that the locale files generated here will be suitable for the target
   121     # only if it has the same endianness and uint32_t alignment as the host's.
   122 
   123     CT_DoLog EXTRA "Installing C library locales"
   124     CT_DoExecLog ALL make ${JOBSFLAGS}                              \
   125                           install_root="${CT_SYSROOT_DIR}"          \
   126                           localedata/install-locales
   127 }