libc/glibc: commonalise extraction btw glibc and eglibc
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun May 29 19:24:41 2011 +0200 (2011-05-29)
changeset 2483fa3a18f9abcf
parent 2482 af25723a794f
child 2484 d1a8c2ae7946
libc/glibc: commonalise extraction btw glibc and eglibc

glibc and eglibc have a very similar extraction process, so it
makes sense to commonalise it.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/libc/eglibc.sh
scripts/build/libc/glibc-eglibc.sh-common
scripts/build/libc/glibc.sh
     1.1 --- a/scripts/build/libc/eglibc.sh	Fri May 27 22:02:30 2011 -0300
     1.2 +++ b/scripts/build/libc/eglibc.sh	Sun May 29 19:24:41 2011 +0200
     1.3 @@ -1,10 +1,12 @@
     1.4  # eglibc build functions (initially by Thomas JOURDAN).
     1.5  
     1.6  # Add the definitions common to glibc and eglibc
     1.7 +#   do_libc_extract
     1.8  #   do_libc_start_files
     1.9  #   do_libc
    1.10  #   do_libc_finish
    1.11  #   do_libc_add_ons_list
    1.12 +#   do_libc_min_kernel_config
    1.13  . "${CT_LIB_DIR}/scripts/build/libc/glibc-eglibc.sh-common"
    1.14  
    1.15  # Download eglibc repository
    1.16 @@ -98,48 +100,6 @@
    1.17      return 0
    1.18  }
    1.19  
    1.20 -# Extract eglibc
    1.21 -do_libc_extract() {
    1.22 -    CT_Extract "eglibc-${CT_LIBC_VERSION}"
    1.23 -    CT_Patch "eglibc" "${CT_LIBC_VERSION}"
    1.24 -
    1.25 -    # C library addons
    1.26 -    for addon in $(do_libc_add_ons_list " "); do
    1.27 -        # NPTL addon is not to be extracted, in any case
    1.28 -        [ "${addon}" = "nptl" ] && continue || true
    1.29 -        CT_Pushd "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}"
    1.30 -        CT_Extract nochdir "eglibc-${addon}-${CT_LIBC_VERSION}"
    1.31 -
    1.32 -        CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \
    1.33 -            -d "${addon}" -a -d "eglibc-${addon}-${CT_LIBC_VERSION}"
    1.34 -
    1.35 -        # Some addons have the 'long' name, while others have the
    1.36 -        # 'short' name, but patches are non-uniformly built with
    1.37 -        # either the 'long' or 'short' name, whatever the addons name
    1.38 -        # but we prefer the 'short' name and avoid duplicates.
    1.39 -        if [ -d "eglibc-${addon}-${CT_LIBC_VERSION}" ]; then
    1.40 -            mv "eglibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    1.41 -        fi
    1.42 -
    1.43 -        ln -s "${addon}" "eglibc-${addon}-${CT_LIBC_VERSION}"
    1.44 -
    1.45 -        CT_Patch nochdir "eglibc" "${addon}-${CT_LIBC_VERSION}"
    1.46 -
    1.47 -        # Remove the long name since it can confuse configure scripts to run
    1.48 -        # the same source twice.
    1.49 -        rm "eglibc-${addon}-${CT_LIBC_VERSION}"
    1.50 -
    1.51 -        CT_Popd
    1.52 -    done
    1.53 -
    1.54 -    # The configure files may be older than the configure.in files
    1.55 -    # if using a snapshot (or even some tarballs). Fake them being
    1.56 -    # up to date.
    1.57 -    find "${CT_SRC_DIR}/eglibc-${CT_LIBC_VERSION}" -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
    1.58 -
    1.59 -    return 0
    1.60 -}
    1.61 -
    1.62  # Copy user provided eglibc configuration file if provided
    1.63  do_libc_check_config() {
    1.64      if [ "${CT_EGLIBC_CUSTOM_CONFIG}" != "y" ]; then
     2.1 --- a/scripts/build/libc/glibc-eglibc.sh-common	Fri May 27 22:02:30 2011 -0300
     2.2 +++ b/scripts/build/libc/glibc-eglibc.sh-common	Sun May 29 19:24:41 2011 +0200
     2.3 @@ -1,5 +1,49 @@
     2.4  # This file contains the functions common to glibc and eglibc
     2.5  
     2.6 +# Extract the C library tarball(s)
     2.7 +do_libc_extract() {
     2.8 +    local addon
     2.9 +
    2.10 +    # Extract the main tarball
    2.11 +    CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}"
    2.12 +    CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
    2.13 +    CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}"
    2.14 +
    2.15 +    # Extract the add-opns
    2.16 +    for addon in $(do_libc_add_ons_list " "); do
    2.17 +        # NPTL addon is not to be extracted, in any case
    2.18 +        [ "${addon}" = "nptl" ] && continue || true
    2.19 +
    2.20 +        CT_Extract nochdir "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
    2.21 +
    2.22 +        CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \
    2.23 +            -d "${addon}" -a -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
    2.24 +
    2.25 +        # Some addons have the 'long' name, while others have the
    2.26 +        # 'short' name, but patches are non-uniformly built with
    2.27 +        # either the 'long' or 'short' name, whatever the addons name
    2.28 +        # but we prefer the 'short' name and avoid duplicates.
    2.29 +        if [ -d "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ]; then
    2.30 +            mv "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" "${addon}"
    2.31 +        fi
    2.32 +
    2.33 +        ln -s "${addon}" "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
    2.34 +
    2.35 +        CT_Patch nochdir "${CT_LIBC}" "${addon}-${CT_LIBC_VERSION}"
    2.36 +
    2.37 +        # Remove the long name since it can confuse configure scripts to run
    2.38 +        # the same source twice.
    2.39 +        rm "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
    2.40 +    done
    2.41 +
    2.42 +    # The configure files may be older than the configure.in files
    2.43 +    # if using a snapshot (or even some tarballs). Fake them being
    2.44 +    # up to date.
    2.45 +    find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
    2.46 +
    2.47 +    CT_Popd
    2.48 +}
    2.49 +
    2.50  # Build and install headers and start files
    2.51  do_libc_start_files() {
    2.52      local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
     3.1 --- a/scripts/build/libc/glibc.sh	Fri May 27 22:02:30 2011 -0300
     3.2 +++ b/scripts/build/libc/glibc.sh	Sun May 29 19:24:41 2011 +0200
     3.3 @@ -3,6 +3,7 @@
     3.4  # Licensed under the GPL v2. See COPYING in the root of this package
     3.5  
     3.6  # Add the definitions common to glibc and eglibc
     3.7 +#   do_libc_extract
     3.8  #   do_libc_start_files
     3.9  #   do_libc
    3.10  #   do_libc_finish
    3.11 @@ -37,54 +38,6 @@
    3.12      return 0
    3.13  }
    3.14  
    3.15 -# Extract glibc
    3.16 -do_libc_extract() {
    3.17 -    local -a addons_list
    3.18 -
    3.19 -    addons_list=($(do_libc_add_ons_list " "))
    3.20 -
    3.21 -    CT_Extract "glibc-${CT_LIBC_VERSION}"
    3.22 -
    3.23 -    CT_Pushd "${CT_SRC_DIR}/glibc-${CT_LIBC_VERSION}"
    3.24 -    CT_Patch nochdir "glibc" "${CT_LIBC_VERSION}"
    3.25 -
    3.26 -    # C library addons
    3.27 -    for addon in "${addons_list[@]}"; do
    3.28 -        # NPTL addon is not to be extracted, in any case
    3.29 -        [ "${addon}" = "nptl" ] && continue || true
    3.30 -        CT_Extract nochdir "glibc-${addon}-${CT_LIBC_VERSION}"
    3.31 -
    3.32 -        CT_TestAndAbort "Error in add-on '${addon}': both short and long names in tarball" \
    3.33 -            -d "${addon}" -a -d "glibc-${addon}-${CT_LIBC_VERSION}"
    3.34 -
    3.35 -        # Some addons have the 'long' name, while others have the
    3.36 -        # 'short' name, but patches are non-uniformly built with
    3.37 -        # either the 'long' or 'short' name, whatever the addons name
    3.38 -        # but we prefer the 'short' name and avoid duplicates.
    3.39 -        if [ -d "glibc-${addon}-${CT_LIBC_VERSION}" ]; then
    3.40 -            mv "glibc-${addon}-${CT_LIBC_VERSION}" "${addon}"
    3.41 -        fi
    3.42 -
    3.43 -        ln -s "${addon}" "glibc-${addon}-${CT_LIBC_VERSION}"
    3.44 -
    3.45 -        CT_Patch nochdir "glibc" "${addon}-${CT_LIBC_VERSION}"
    3.46 -
    3.47 -        # Remove the long name since it can confuse configure scripts to run
    3.48 -        # the same source twice.
    3.49 -        rm "glibc-${addon}-${CT_LIBC_VERSION}"
    3.50 -    done
    3.51 -
    3.52 -    # The configure files may be older than the configure.in files
    3.53 -    # if using a snapshot (or even some tarballs). Fake them being
    3.54 -    # up to date.
    3.55 -    sleep 2
    3.56 -    find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
    3.57 -
    3.58 -    CT_Popd
    3.59 -
    3.60 -    return 0
    3.61 -}
    3.62 -
    3.63  # There is nothing to do for glibc check config
    3.64  do_libc_check_config() {
    3.65      :