scripts/build/libc/glibc.sh
author Bryan Hundven <bryanhundven@gmail.com>
Sun Jun 26 03:26:54 2011 -0700 (2011-06-26)
changeset 2515 364b06df9e3a
parent 2496 cc9b84a83b34
child 2587 7727970d04e9
permissions -rw-r--r--
glibc: Refactor startfiles/headers into do_libc_backend()

Refactor the contents of 'do_libc_start_files()' and 'do_libc()' into a
parameterized 'do_libc_backend()'. 'do_libc_start_files()' and 'do_libc()'
call 'do_libc_backend()' with either 'libc_mode=startfiles' or
'libc_mode=final' (respectively) so that the startfiles/headers and
the final libc builds are configured and built with the same options.

One example of where this is needed is when building a mips toolchain.
Previously, if you were building an n32 toolchain, you wouldn't have
noticed an issue, because if '-mabi' is not in CFLAGS, n32 is the
default:

http://sourceware.org/git/?p=glibc-ports.git;a=blob;f=sysdeps/mips/preconfigure;hb=HEAD

But when trying to build an o32 or n64 toolchain the build would
have failed. This is because (e)glibc expects "-mabi={o32,n32,n64}" to be
in CFLAGS, but was not previously provided in 'do_libc_start_files()'.
The build failure would happen in the shared-core gcc when it tries to
configure an n64 or o32 gcc with an n32 libc.

A simpler solution would have been to just add TARGET_CFLAGS to configure
in 'do_libc_start_files()', but this way makes configure and make
consistent for both steps.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.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 }