scripts/build/libc/glibc.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jan 22 22:35:58 2011 +0100 (2011-01-22)
changeset 2276 ac021d186cd6
parent 2275 9ab4392430ad
child 2277 71803c9f6de0
permissions -rw-r--r--
libc/glibc: add glibc specifics to the shared code, and use it

Final step at sharing code between glibc and eglibc.
Fall, wall of shame, fall!... :-)

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.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_headers
     7 #   do_libc_start_files
     8 . "${CT_LIB_DIR}/scripts/build/libc/glibc-eglibc.sh-common"
     9 
    10 # Download glibc
    11 do_libc_get() {
    12     local date
    13     local version
    14     local -a addons_list
    15 
    16     addons_list=($(do_libc_add_ons_list " "))
    17 
    18     # Main source
    19     CT_GetFile "glibc-${CT_LIBC_VERSION}"               \
    20                {ftp,http}://ftp.gnu.org/gnu/glibc       \
    21                ftp://gcc.gnu.org/pub/glibc/releases     \
    22                ftp://gcc.gnu.org/pub/glibc/snapshots
    23 
    24     # C library addons
    25     for addon in "${addons_list[@]}"; do
    26         # NPTL addon is not to be downloaded, in any case
    27         [ "${addon}" = "nptl" ] && continue || true
    28         CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}"      \
    29                    {ftp,http}://ftp.gnu.org/gnu/glibc       \
    30                    ftp://gcc.gnu.org/pub/glibc/releases     \
    31                    ftp://gcc.gnu.org/pub/glibc/snapshots
    32     done
    33 
    34     return 0
    35 }
    36 
    37 # Extract glibc
    38 do_libc_extract() {
    39     local -a addons_list
    40 
    41     addons_list=($(do_libc_add_ons_list " "))
    42 
    43     CT_Extract "glibc-${CT_LIBC_VERSION}"
    44 
    45     CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
    46     CT_Patch nochdir "glibc" "${CT_LIBC_VERSION}"
    47 
    48     # C library addons
    49     for addon in "${addons_list[@]}"; do
    50         # NPTL addon is not to be extracted, in any case
    51         [ "${addon}" = "nptl" ] && continue || true
    52         CT_Extract nochdir "glibc-${addon}-${CT_LIBC_VERSION}"
    53 
    54         # Some addons have the 'long' name, while others have the
    55         # 'short' name, but patches are non-uniformly built with
    56         # either the 'long' or 'short' name, whatever the addons name
    57         # so we have to make symlinks from the existing to the missing
    58         # Fortunately for us, [ -d foo ], when foo is a symlink to a
    59         # directory, returns true!
    60         [ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    61         [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ] || CT_DoExecLog ALL ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
    62         CT_Patch nochdir "glibc" "${addon}-${CT_LIBC_VERSION}"
    63     done
    64 
    65     # The configure files may be older than the configure.in files
    66     # if using a snapshot (or even some tarballs). Fake them being
    67     # up to date.
    68     sleep 2
    69     find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
    70 
    71     CT_Popd
    72 
    73     return 0
    74 }
    75 
    76 # There is nothing to do for glibc check config
    77 do_libc_check_config() {
    78     :
    79 }