1.1 --- a/scripts/functions Sat Jan 23 19:02:46 2010 +0100
1.2 +++ b/scripts/functions Tue Jan 12 19:24:03 2010 +0100
1.3 @@ -566,12 +566,22 @@
1.4 # in the extra/locale sub-directory of uClibc. This is taken into account
1.5 # by the caller, that did a 'cd' into the correct path before calling us
1.6 # and sets nochdir to 'nochdir'.
1.7 -# Usage: CT_Extract <basename> [nochdir]
1.8 +# Usage: CT_Extract [nochdir] <basename>
1.9 CT_Extract() {
1.10 - local basename="$1"
1.11 - local nochdir="$2"
1.12 + local nochdir="$1"
1.13 + local basename
1.14 local ext
1.15
1.16 + if [ "${nochdir}" = "nochdir" ]; then
1.17 + shift
1.18 + nochdir="$(pwd)"
1.19 + else
1.20 + nochdir="${CT_SRC_DIR}"
1.21 + fi
1.22 +
1.23 + basename="$1"
1.24 + shift
1.25 +
1.26 if ! ext="$(CT_GetFileExtension "${basename}")"; then
1.27 CT_TestAndAbort "'${basename}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}"
1.28 fi
1.29 @@ -593,7 +603,7 @@
1.30 fi
1.31 CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracting"
1.32
1.33 - [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}"
1.34 + CT_Pushd "${nochdir}"
1.35
1.36 CT_DoLog EXTRA "Extracting '${basename}'"
1.37 case "${ext}" in
1.38 @@ -611,21 +621,33 @@
1.39 CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.extracted"
1.40 CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.extracting"
1.41
1.42 - [ "${nochdir}" = "nochdir" ] || CT_Popd
1.43 + CT_Popd
1.44 }
1.45
1.46 # Patches the specified component
1.47 -# Usage: CT_Patch <basename> [nochdir]
1.48 +# See CT_Extract, above, for explanations on 'nochdir'
1.49 +# Usage: CT_Patch [nochdir] <basename>
1.50 CT_Patch() {
1.51 - local basename="$1"
1.52 - local nochdir="$2"
1.53 - local base_file="${basename%%-*}"
1.54 - local ver_file="${basename#*-}"
1.55 + local nochdir="$1"
1.56 + local basename
1.57 + local base_file
1.58 + local ver_file
1.59 local d
1.60 local -a patch_dirs
1.61 local bundled_patch_dir
1.62 local local_patch_dir
1.63
1.64 + if [ "${nochdir}" = "nochdir" ]; then
1.65 + shift
1.66 + nochdir="$(pwd)"
1.67 + else
1.68 + nochdir="${CT_SRC_DIR}/${1}"
1.69 + fi
1.70 +
1.71 + basename="$1"
1.72 + base_file="${basename%%-*}"
1.73 + ver_file="${basename#*-}"
1.74 +
1.75 # Check if already patched
1.76 if [ -e "${CT_SRC_DIR}/.${basename}.patched" ]; then
1.77 CT_DoLog DEBUG "Already patched '${basename}'"
1.78 @@ -643,7 +665,7 @@
1.79 fi
1.80 touch "${CT_SRC_DIR}/.${basename}.patching"
1.81
1.82 - [ "${nochdir}" = "nochdir" ] || CT_Pushd "${CT_SRC_DIR}/${basename}"
1.83 + CT_Pushd "${nochdir}"
1.84
1.85 CT_DoLog EXTRA "Patching '${basename}'"
1.86
1.87 @@ -686,7 +708,7 @@
1.88 CT_DoExecLog DEBUG touch "${CT_SRC_DIR}/.${basename}.patched"
1.89 CT_DoExecLog DEBUG rm -f "${CT_SRC_DIR}/.${basename}.patching"
1.90
1.91 - [ "${nochdir}" = "nochdir" ] || CT_Popd
1.92 + CT_Popd
1.93 }
1.94
1.95 # Two wrappers to call config.(guess|sub) either from CT_TOP_DIR or CT_LIB_DIR.