1.1 --- a/scripts/saveSample.sh.in Fri Jun 26 19:09:22 2009 +0200
1.2 +++ b/scripts/saveSample.sh.in Fri Jun 26 19:09:22 2009 +0200
1.3 @@ -59,18 +59,21 @@
1.4 CT_LOG_WARN=y
1.5 CT_LOG_LEVEL_MAX="WARN"
1.6
1.7 -# Create the sample directory
1.8 -if [ ! -d "samples/${CT_TARGET}" ]; then
1.9 - mkdir -p "samples/${CT_TARGET}"
1.10 -fi
1.11 +# Compute the name of the sample directory
1.12 +case "${CT_TOOLCHAIN_TYPE}" in
1.13 + cross) samp_name="${CT_TARGET}";;
1.14 + *) CT_Abort "Unsupported toolchain type '${CT_TOOLCHAIN_TYPE}'";;
1.15 +esac
1.16 +samp_dir="samples/${samp_name}"
1.17 +mkdir -p "${samp_dir}"
1.18
1.19 # Save the crosstool-NG config file
1.20 -"${sed}" -r -e 's|^(CT_PREFIX_DIR)=.*|\1="${HOME}/x-tools/${CT_TARGET}"|;' \
1.21 +"${sed}" -r -e 's|^(CT_PREFIX_DIR)=.*|\1="${HOME}/x-tools/${samp_name}"|;' \
1.22 -e 's|^# CT_LOG_TO_FILE is not set$|CT_LOG_TO_FILE=y|;' \
1.23 -e 's|^# CT_LOG_FILE_COMPRESS is not set$|CT_LOG_FILE_COMPRESS=y|;' \
1.24 -e 's|^(CT_LOCAL_TARBALLS_DIR)=.*|\1="${HOME}/src"|;' \
1.25 <.config \
1.26 - >"samples/${CT_TARGET}/crosstool.config"
1.27 + >"${samp_dir}/crosstool.config"
1.28
1.29 # Function to copy a file to the sample directory
1.30 # Needed in case the file is already there (think of a previously available sample)
1.31 @@ -94,12 +97,12 @@
1.32 # Save the uClibc .config file
1.33 if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
1.34 # We save the file, and then point the saved sample to this file
1.35 - CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
1.36 - "${sed}" -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE)=.+$|\1="'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
1.37 - "samples/${CT_TARGET}/crosstool.config"
1.38 + CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${samp_dir}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
1.39 + "${sed}" -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE)=.+$|\1="'"${samp_top_dir}"'/${samp_dir}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
1.40 + "${samp_dir}/crosstool.config"
1.41 else
1.42 # remove any dangling files
1.43 - for f in "samples/${CT_TARGET}/${CT_LIBC}-"*.config; do
1.44 + for f in "${samp_dir}/${CT_LIBC}-"*.config; do
1.45 if [ -f "${f}" ]; then rm -f "${f}"; fi
1.46 done
1.47 fi
1.48 @@ -108,7 +111,7 @@
1.49 exec >&7
1.50
1.51 # Fill-in the reported-by info
1.52 -[ -f "samples/${CT_TARGET}/reported.by" ] && . "samples/${CT_TARGET}/reported.by"
1.53 +[ -f "${samp_dir}/reported.by" ] && . "${samp_dir}/reported.by"
1.54 old_name="${reporter_name}"
1.55 old_url="${reporter_url}"
1.56 read -p "Reporter name [${reporter_name}]: " reporter_name
1.57 @@ -123,4 +126,4 @@
1.58 ( echo "reporter_name=\"${reporter_name:=${old_name}}\""
1.59 echo "reporter_url=\"${reporter_url:=${old_url}}\""
1.60 printf "reporter_comment=\"${reporter_comment}\"\n"
1.61 -) >"samples/${CT_TARGET}/reported.by"
1.62 +) >"${samp_dir}/reported.by"