scripts/build/libc/glibc.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Thu Jan 10 21:01:59 2013 +0100 (2013-01-10)
changeset 3162 e51eb0a614c7
parent 3041 b9f695c2f5b7
child 3251 ec603d1371b9
permissions -rw-r--r--
libc: get rid of libc_finish

At long last, we no longer have any libc that requries a libc_finish.
Yeah!

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