Fix glibc and uClibc downloading and extracting.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon May 07 15:57:02 2007 +0000 (2007-05-07)
changeset 647dab8d1a2426
parent 63 89b41dbffe8d
child 65 312fe9ff8370
Fix glibc and uClibc downloading and extracting.
Although we no longer need the kernel config file, we now need to specify the kernel source directory when installing headers.
Re-order components downloading to match build order.
Fix the saveSample.sh script in case the referenced files are the same as the destination files.
scripts/build/kernel_linux.sh
scripts/build/libc_glibc.sh
scripts/build/libc_uClibc.sh
scripts/crosstool.sh
scripts/saveSample.sh
     1.1 --- a/scripts/build/kernel_linux.sh	Mon May 07 09:04:02 2007 +0000
     1.2 +++ b/scripts/build/kernel_linux.sh	Mon May 07 15:57:02 2007 +0000
     1.3 @@ -102,13 +102,17 @@
     1.4      esac
     1.5  
     1.6      CT_DoLog EXTRA "Installing kernel headers"
     1.7 -    make ARCH=${CT_KERNEL_ARCH}                     \
     1.8 +    make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}"       \
     1.9 +         O="`pwd`"                                  \
    1.10 +         ARCH=${CT_KERNEL_ARCH}                     \
    1.11           INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr"   \
    1.12           ${V_OPT}                                   \
    1.13           headers_install                            2>&1 |CT_DoLog DEBUG
    1.14  
    1.15      CT_DoLog EXTRA "Checking installed headers"
    1.16 -    make ARCH=${CT_KERNEL_ARCH}                     \
    1.17 +    make -C "${CT_SRC_DIR}/${CT_KERNEL_FILE}"       \
    1.18 +         O="`pwd`"                                  \
    1.19 +         ARCH=${CT_KERNEL_ARCH}                     \
    1.20           INSTALL_HDR_PATH="${CT_SYSROOT_DIR}/usr"   \
    1.21           ${V_OPT}                                   \
    1.22           headers_check                              2>&1 |CT_DoLog DEBUG
     2.1 --- a/scripts/build/libc_glibc.sh	Mon May 07 09:04:02 2007 +0000
     2.2 +++ b/scripts/build/libc_glibc.sh	Mon May 07 15:57:02 2007 +0000
     2.3 @@ -3,7 +3,7 @@
     2.4  # Licensed under the GPL v2. See COPYING in the root of this package
     2.5  
     2.6  # Download glibc
     2.7 -do_libc_download() {
     2.8 +do_libc_get() {
     2.9      # Ah! Not all GNU folks seem stupid. All glibc releases are in the same
    2.10      # directory. Good. Alas, there is no snapshot there. I'll deal with them
    2.11      # later on... :-/
    2.12 @@ -15,6 +15,8 @@
    2.13          CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ftp://ftp.gnu.org/gnu/glibc
    2.14      done
    2.15      [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && CT_GetFile "${CT_LIBC}-ports-${CT_LIBC_VERSION}" ftp://ftp.gnu.org/gnu/glibc
    2.16 +
    2.17 +    return 0
    2.18  }
    2.19  
    2.20  # Extract glibc
    2.21 @@ -27,6 +29,8 @@
    2.22          CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
    2.23      done
    2.24      [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && CT_ExtractAndPatch "${CT_LIBC}-ports-${CT_LIBC_VERSION}"
    2.25 +
    2.26 +    return 0
    2.27  }
    2.28  
    2.29  # There is nothing to do for glibc check config
     3.1 --- a/scripts/build/libc_uClibc.sh	Mon May 07 09:04:02 2007 +0000
     3.2 +++ b/scripts/build/libc_uClibc.sh	Mon May 07 15:57:02 2007 +0000
     3.3 @@ -13,6 +13,8 @@
     3.4      CT_GetFile "${CT_LIBC_FILE}" ${libc_src}
     3.5      # uClibc locales
     3.6      [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_GetFile "uClibc-locale-030818" ${libc_src}
     3.7 +
     3.8 +    return 0
     3.9  }
    3.10  
    3.11  # Extract uClibc
    3.12 @@ -20,6 +22,8 @@
    3.13      CT_ExtractAndPatch "${CT_LIBC_FILE}"
    3.14      # uClibc locales
    3.15      [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] && CT_ExtractAndPatch "uClibc-locale-030818"
    3.16 +
    3.17 +    return 0
    3.18  }
    3.19  
    3.20  # Check that uClibc has been previously configured
     4.1 --- a/scripts/crosstool.sh	Mon May 07 09:04:02 2007 +0000
     4.2 +++ b/scripts/crosstool.sh	Mon May 07 15:57:02 2007 +0000
     4.3 @@ -330,9 +330,9 @@
     4.4  	CT_DoStep INFO "Retrieving needed toolchain components' tarballs"
     4.5      do_kernel_get
     4.6      do_binutils_get
     4.7 +    do_cc_core_get
     4.8 +    do_libfloat_get
     4.9      do_libc_get
    4.10 -    do_libfloat_get
    4.11 -    do_cc_core_get
    4.12      do_cc_get
    4.13      CT_EndStep
    4.14  fi
     5.1 --- a/scripts/saveSample.sh	Mon May 07 09:04:02 2007 +0000
     5.2 +++ b/scripts/saveSample.sh	Mon May 07 15:57:02 2007 +0000
     5.3 @@ -27,17 +27,34 @@
     5.4  # Target triplet: CT_TARGET needs a little love:
     5.5  CT_DoBuildTargetTriplet
     5.6  
     5.7 +# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
     5.8 +# re-parse them:
     5.9 +. "${CT_TOP_DIR}/.config"
    5.10 +
    5.11  # Create the sample directory
    5.12  [ -d "${CT_TOP_DIR}/samples/${CT_TARGET}" ] || svn mkdir "${CT_TOP_DIR}/samples/${CT_TARGET}" >/dev/null 2>&1
    5.13  
    5.14  # Save the crosstool-NG config file
    5.15  cp "${CT_TOP_DIR}/.config" "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
    5.16  
    5.17 +# Function to copy a file to the sample directory
    5.18 +# Needed in case the file is already there (think of a previously available sample)
    5.19 +# Usage: CT_DoAddFileToSample <source> <dest>
    5.20 +CT_DoAddFileToSample() {
    5.21 +    source="$1"
    5.22 +    dest="$2"
    5.23 +    inode_s=`ls -i "${source}"`
    5.24 +    inode_d=`ls -i "${dest}"`
    5.25 +    if [ "${inode_s}" != "${inode_d}" ]; then
    5.26 +        cp "${source}" "${dest}"
    5.27 +    fi
    5.28 +    svn add "${dest}" >/dev/null 2>&1
    5.29 +}
    5.30 +
    5.31  # Save the kernel .config file
    5.32  if [ -n "${CT_KERNEL_LINUX_CONFIG_FILE}" ]; then
    5.33      # We save the file, and then point the saved sample to this file
    5.34 -    cp "${CT_KERNEL_LINUX_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"
    5.35 -    svn add "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config" >/dev/null 2>&1
    5.36 +    CT_DoAddFileToSample "${CT_KERNEL_LINUX_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"
    5.37      sed -r -i -e 's|^(CT_KERNEL_LINUX_CONFIG_FILE=).+$|\1"${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_KERNEL}-${CT_KERNEL_VERSION}.config"|;' \
    5.38          "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
    5.39  else
    5.40 @@ -50,8 +67,7 @@
    5.41  # Save the uClibc .config file
    5.42  if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
    5.43      # We save the file, and then point the saved sample to this file
    5.44 -    cp "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
    5.45 -    svn add "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config" >/dev/null 2>&1
    5.46 +    CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
    5.47      sed -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE=).+$|\1"${CT_TOP_DIR}/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
    5.48          "${CT_TOP_DIR}/samples/${CT_TARGET}/crosstool.config"
    5.49  else