diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-01-05 23:02:43 +0000 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2009-01-05 23:02:43 +0000 |
commit | ebf01acb41f0f6bb0e0d5629aac9f98733730329 (patch) | |
tree | 31636a16f970ae3eb86b0c098224ac92b49bf647 /scripts/functions | |
parent | 4bcd72fb1604341116621e7e7655520779592103 (diff) | |
download | crosstool-ng-ebf01acb41f0f6bb0e0d5629aac9f98733730329.tar.gz crosstool-ng-ebf01acb41f0f6bb0e0d5629aac9f98733730329.tar.bz2 crosstool-ng-ebf01acb41f0f6bb0e0d5629aac9f98733730329.zip |
Split CT_ExtractAndPatch in two: CT_Extract and CT_Patch:
- it is unworkable to have CT_ExtactAndPAtch cope with all those silly glibc addons:
- they can have 'short' (as 'ports') or 'long' (as glibc-ports-2.7) names
- patches are against eithe the short or long name, but non-uniformly use one or the other
- it is the reposibility of the component (glibc in this case) to handle corner cases such as those
- update all components to use the new functions
/trunk/scripts/build/tools/000-template.sh | 3 2 1 0 +-
/trunk/scripts/build/tools/100-libelf.sh | 3 2 1 0 +-
/trunk/scripts/build/tools/200-sstrip.sh | 3 2 1 0 +-
/trunk/scripts/build/kernel/linux.sh | 3 2 1 0 +-
/trunk/scripts/build/binutils.sh | 3 2 1 0 +-
/trunk/scripts/build/cc/gcc.sh | 3 2 1 0 +-
/trunk/scripts/build/debug/000-template.sh | 3 2 1 0 +-
/trunk/scripts/build/debug/100-dmalloc.sh | 3 2 1 0 +-
/trunk/scripts/build/debug/400-ltrace.sh | 3 2 1 0 +-
/trunk/scripts/build/debug/300-gdb.sh | 9 6 3 0 +++--
/trunk/scripts/build/debug/500-strace.sh | 7 3 4 0 ++--
/trunk/scripts/build/debug/200-duma.sh | 19 8 11 0 ++++------
/trunk/scripts/build/libc/glibc.sh | 14 12 2 0 ++++++-
/trunk/scripts/build/libc/uClibc.sh | 13 9 4 0 +++++--
/trunk/scripts/build/libc/eglibc.sh | 14 12 2 0 ++++++-
/trunk/scripts/build/gmp.sh | 3 2 1 0 +-
/trunk/scripts/build/mpfr.sh | 3 2 1 0 +-
/trunk/scripts/functions | 68 36 32 0 +++++++++++++++++++-----------------
18 files changed, 108 insertions(+), 69 deletions(-)
Diffstat (limited to 'scripts/functions')
-rw-r--r-- | scripts/functions | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/scripts/functions b/scripts/functions index 203fd4eb..0e105b87 100644 --- a/scripts/functions +++ b/scripts/functions @@ -554,58 +554,60 @@ CT_GetCVS() { CT_DoExecLog ALL rm -rf "${tmp_dir}" } -# Extract a tarball and patch the resulting sources if necessary. +# Extract a tarball # Some tarballs need to be extracted in specific places. Eg.: glibc addons # must be extracted in the glibc directory; uCLibc locales must be extracted # in the extra/locale sub-directory of uClibc. This is taken into account # by the caller, that did a 'cd' into the correct path before calling us # and sets nochdir to 'nochdir'. -# Usage: CT_ExtractAndPatch <basename> [nochdir] -CT_ExtractAndPatch() { - local file="$1" +# Usage: CT_Extract <basename> [nochdir] +CT_Extract() { + local basename="$1" local nochdir="$2" - local base_file=$(echo "${file}" |cut -d - -f 1) - local ver_file=$(echo "${file}" |cut -d - -f 2-) - local official_patch_dir - local custom_patch_dir - local ext=$(CT_GetFileExtension "${file}") - CT_TestAndAbort "'${file}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}" - local full_file="${CT_TARBALLS_DIR}/${file}${ext}" - - [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}" + local ext=$(CT_GetFileExtension "${basename}") + CT_TestAndAbort "'${basename}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}" + local full_file="${CT_TARBALLS_DIR}/${basename}${ext}" # Check if already extracted - if [ -e "${CT_SRC_DIR}/.${file}.extracted" ]; then - CT_DoLog DEBUG "Already extracted '${file}'" + if [ -e "${CT_SRC_DIR}/.${basename}.extracted" ]; then + CT_DoLog DEBUG "Already extracted '${basename}'" return 0 fi - CT_DoLog EXTRA "Extracting and patching '${file}'" + [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}" + + CT_DoLog EXTRA "Extracting '${basename}'" case "${ext}" in .tar.bz2) CT_DoExecLog ALL tar xvjf "${full_file}";; .tar.gz|.tgz) CT_DoExecLog ALL tar xvzf "${full_file}";; .tar) CT_DoExecLog ALL tar xvf "${full_file}";; - *) CT_Abort "Don't know how to handle '${file}': unknown extension" ;; + *) CT_Abort "Don't know how to handle '${basename}${ext}': unknown extension" ;; esac - touch "${CT_SRC_DIR}/.${file}.extracted" - - # Snapshots might not have the version number in the extracted directory - # name. This is also the case for some (odd) packages, such as D.U.M.A. - # Overcome this issue by symlink'ing the directory. - if [ ! -d "${file}" ]; then - case "${ext}" in - .tar.bz2) base=$(tar tjf "${full_file}" |head -n 1 |cut -d / -f 1 || true);; - .tar.gz|.tgz) base=$(tar tzf "${full_file}" |head -n 1 |cut -d / -f 1 || true);; - .tar) base=$(tar tf "${full_file}" |head -n 1 |cut -d / -f 1 || true);; - esac - CT_TestOrAbort "There was a problem when extracting '${file}'" -d "${base}" -o "${base}" != "${file}" - ln -s "${base}" "${file}" + + touch "${CT_SRC_DIR}/.${basename}.extracted" + + [ "${nochdir}" = "nochdir" ] || CT_Popd +} + +# Patches the specified component +# Usage: CT_Patch <basename> [nochdir] +CT_Patch() { + local basename="$1" + local nochdir="$2" + local base_file="${basename%%-*}" + local ver_file="${basename#*-}" + local official_patch_dir + local custom_patch_dir + + # Check if already patched + if [ -e "${CT_SRC_DIR}/.${basename}.patched" ]; then + CT_DoLog DEBUG "Already patched '${basename}'" + return 0 fi - # Kludge: outside this function, we wouldn't know if we had just extracted - # a libc addon, or a plain package. Apply patches now. + [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}/${basename}" - [ "${nochdir}" = "nochdir" ] || cd "${file}" + CT_DoLog EXTRA "Patching '${basename}'" official_patch_dir= custom_patch_dir= @@ -633,6 +635,8 @@ CT_ExtractAndPatch() { done fi + touch "${CT_SRC_DIR}/.${basename}.patched" + [ "${nochdir}" = "nochdir" ] || CT_Popd } |