scripts/build/libc/glibc.sh
author "Nicolás Reynolds" <fauno@kiwwwi.com.ar>
Fri May 27 22:02:30 2011 -0300 (2011-05-27)
branch1.11
changeset 2553 fe2c448bf3b7
parent 2278 e86826b8621a
child 2483 fa3a18f9abcf
permissions -rw-r--r--
libc/glibc: fix {e,}glibc add-ons with short or long names

Fixes the issue with {e,}glibc addons having short and long names (such as
eglibc-ports-2_13 and ports), which caused configure scripts to run
through them twice and thus configuring incorrectly.

For instance, the mips64el-n32-linux-gnu toolchain would be recognized
correctly first, but then the second pass would change it to mips32,
building a mixed MIPS-III N32 and MIPS-I libc.

Signed-off-by: Nicolás Reynolds <fauno@kiwwwi.com.ar>
[yann.morin.1992@anciens.enib.fr: remove spurious trailing spaces]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from af25723a794f2017f45c300369a6d36849e22236)
     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_start_files
     7 #   do_libc
     8 #   do_libc_finish
     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         # NPTL addon is not to be downloaded, in any case
    30         [ "${addon}" = "nptl" ] && continue || true
    31         CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}"      \
    32                    {ftp,http}://ftp.gnu.org/gnu/glibc       \
    33                    ftp://gcc.gnu.org/pub/glibc/releases     \
    34                    ftp://gcc.gnu.org/pub/glibc/snapshots
    35     done
    36 
    37     return 0
    38 }
    39 
    40 # Extract glibc
    41 do_libc_extract() {
    42     local -a addons_list
    43 
    44     addons_list=($(do_libc_add_ons_list " "))
    45 
    46     CT_Extract "glibc-${CT_LIBC_VERSION}"
    47 
    48     CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
    49     CT_Patch nochdir "glibc" "${CT_LIBC_VERSION}"
    50 
    51     # C library addons
    52     for addon in "${addons_list[@]}"; do
    53         # NPTL addon is not to be extracted, in any case
    54         [ "${addon}" = "nptl" ] && continue || true
    55         CT_Extract nochdir "glibc-${addon}-${CT_LIBC_VERSION}"
    56 
    57         CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \
    58             -d "${addon}" -a -d "glibc-${addon}-${CT_LIBC_VERSION}"
    59 
    60         # Some addons have the 'long' name, while others have the
    61         # 'short' name, but patches are non-uniformly built with
    62         # either the 'long' or 'short' name, whatever the addons name
    63         # but we prefer the 'short' name and avoid duplicates.
    64         if [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ]; then
    65             mv "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    66         fi
    67 
    68         ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
    69 
    70         CT_Patch nochdir "glibc" "${addon}-${CT_LIBC_VERSION}"
    71 
    72         # Remove the long name since it can confuse configure scripts to run
    73         # the same source twice.
    74         rm "glibc-${addon}-${CT_LIBC_VERSION}"
    75     done
    76 
    77     # The configure files may be older than the configure.in files
    78     # if using a snapshot (or even some tarballs). Fake them being
    79     # up to date.
    80     sleep 2
    81     find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
    82 
    83     CT_Popd
    84 
    85     return 0
    86 }
    87 
    88 # There is nothing to do for glibc check config
    89 do_libc_check_config() {
    90     :
    91 }