scripts/build/libc/glibc.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Thu Dec 23 20:43:32 2010 +0100 (2010-12-23)
changeset 2307 2efd46963086
parent 2277 71803c9f6de0
child 2482 af25723a794f
permissions -rw-r--r--
buildtools: move to working directory

There is absolutely *no* reason for the buildtools (wrappers to gcc, g++,
as, ld... for the local machine) to be in the toolchain directory. Moreover,
they are removed after the build completes.

Move them out of the toolchain directory, and into the build directory (but
yet the part specific to the current toolchain). This means we no longer
need to explicitly remove them either, BTW, but we need to save/restore them
for the restart feature.

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_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         # Some addons have the 'long' name, while others have the
    58         # 'short' name, but patches are non-uniformly built with
    59         # either the 'long' or 'short' name, whatever the addons name
    60         # so we have to make symlinks from the existing to the missing
    61         # Fortunately for us, [ -d foo ], when foo is a symlink to a
    62         # directory, returns true!
    63         [ -d "${addon}" ] || CT_DoExecLog ALL ln -s "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    64         [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ] || CT_DoExecLog ALL ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
    65         CT_Patch nochdir "glibc" "${addon}-${CT_LIBC_VERSION}"
    66     done
    67 
    68     # The configure files may be older than the configure.in files
    69     # if using a snapshot (or even some tarballs). Fake them being
    70     # up to date.
    71     sleep 2
    72     find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
    73 
    74     CT_Popd
    75 
    76     return 0
    77 }
    78 
    79 # There is nothing to do for glibc check config
    80 do_libc_check_config() {
    81     :
    82 }