1.1 --- a/Makefile.in Sun Feb 01 17:04:00 2009 +0000
1.2 +++ b/Makefile.in Sun Feb 01 17:11:46 2009 +0000
1.3 @@ -103,7 +103,7 @@
1.4 #--------------------------------------
1.5 # Build rules
1.6
1.7 -build-bin: ct-ng scripts/crosstool-NG.sh
1.8 +build-bin: ct-ng scripts/crosstool-NG.sh scripts/saveSample.sh
1.9
1.10 build-lib: paths.mk
1.11
1.12 @@ -150,6 +150,8 @@
1.13 @rm -f ct-ng
1.14 @echo " RM 'script/crosstool-NG.sh'"
1.15 @rm -f scripts/crosstool-NG.sh
1.16 + @echo " RM 'script/saveSample.sh'"
1.17 + @rm -f scripts/saveSample.sh
1.18
1.19 clean-lib:
1.20 @echo " RM 'paths.mk'"
1.21 @@ -173,6 +175,8 @@
1.22 @chmod a+x ct-ng
1.23 @echo " CHMOD 'scripts/crosstool-NG.sh'"
1.24 @chmod a+x scripts/crosstool-NG.sh
1.25 + @echo " CHMOD 'scripts/saveSample.sh'"
1.26 + @chmod a+x scripts/saveSample.sh
1.27
1.28 real-uninstall:
1.29 @true
1.30 @@ -201,6 +205,7 @@
1.31 |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -); \
1.32 done
1.33 @chmod a+x $(DESTDIR)$(LIBDIR)/scripts/crosstool-NG.sh
1.34 + @chmod a+x $(DESTDIR)$(LIBDIR)/scripts/saveSample.sh
1.35 @rm -f "$(DESTDIR)$(LIBDIR)/scripts/addToolVersion.sh"
1.36 @echo " INST 'steps.mk'"
1.37 @$(install) -m 644 steps.mk "$(DESTDIR)$(LIBDIR)/steps.mk"
2.1 --- a/scripts/saveSample.sh Sun Feb 01 17:04:00 2009 +0000
2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3 @@ -1,107 +0,0 @@
2.4 -#!/bin/bash
2.5 -
2.6 -# This script is responsible for saving the current configuration into a
2.7 -# sample to be used later on as a pre-configured target.
2.8 -
2.9 -# What we need to save:
2.10 -# - the .config file
2.11 -# - the uClibc .config file if uClibc selected
2.12 -# - info about who reported the sample
2.13 -
2.14 -# We'll need the stdout later, save it
2.15 -exec 7>&1
2.16 -
2.17 -. "${CT_LIB_DIR}/scripts/functions"
2.18 -
2.19 -# Don't care about any log file
2.20 -exec >/dev/null
2.21 -rm -f "${tmp_log_file}"
2.22 -
2.23 -# Parse the configuration file
2.24 -CT_TestOrAbort "Configuration file not found. Please create one." -f .config
2.25 -. .config
2.26 -
2.27 -# Do not use a progress bar
2.28 -unset CT_LOG_PROGRESS_BAR
2.29 -
2.30 -# Parse architecture and kernel specific functions
2.31 -. "${CT_LIB_DIR}/scripts/build/arch/${CT_ARCH}.sh"
2.32 -. "${CT_LIB_DIR}/scripts/build/kernel/${CT_KERNEL}.sh"
2.33 -
2.34 -# Target tuple: CT_TARGET needs a little love:
2.35 -CT_DoBuildTargetTuple
2.36 -
2.37 -# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
2.38 -# re-parse them:
2.39 -. .config
2.40 -
2.41 -# Override log options
2.42 -unset CT_LOG_PROGRESS_BAR CT_LOG_ERROR CT_LOG_INFO CT_LOG_EXTRA CT_LOG_DEBUG LOG_ALL
2.43 -CT_LOG_WARN=y
2.44 -CT_LOG_LEVEL_MAX="WARN"
2.45 -
2.46 -# Create the sample directory
2.47 -if [ ! -d "samples/${CT_TARGET}" ]; then
2.48 - mkdir -p "samples/${CT_TARGET}"
2.49 -fi
2.50 -
2.51 -# Save the crosstool-NG config file
2.52 -sed -r -e 's|^(CT_PREFIX_DIR)=.*|\1="${HOME}/x-tools/${CT_TARGET}"|;' \
2.53 - -e 's|^# CT_LOG_TO_FILE is not set$|CT_LOG_TO_FILE=y|;' \
2.54 - -e 's|^# CT_LOG_FILE_COMPRESS is not set$|CT_LOG_FILE_COMPRESS=y|;' \
2.55 - -e 's|^(CT_LOCAL_TARBALLS_DIR)=.*|\1="${HOME}/src"|;' \
2.56 - <.config \
2.57 - >"samples/${CT_TARGET}/crosstool.config"
2.58 -
2.59 -# Function to copy a file to the sample directory
2.60 -# Needed in case the file is already there (think of a previously available sample)
2.61 -# Usage: CT_DoAddFileToSample <source> <dest>
2.62 -CT_DoAddFileToSample() {
2.63 - source="$1"
2.64 - dest="$2"
2.65 - inode_s=$(ls -i "${source}" |gawk '{ print $1; }')
2.66 - inode_d=$(ls -i "${dest}" 2>/dev/null |gawk '{ print $1; }' || true)
2.67 - if [ "${inode_s}" != "${inode_d}" ]; then
2.68 - cp "${source}" "${dest}"
2.69 - fi
2.70 -}
2.71 -
2.72 -if [ "${CT_TOP_DIR}" = "${CT_LIB_DIR}" ]; then
2.73 - samp_top_dir="\${CT_LIB_DIR}"
2.74 -else
2.75 - samp_top_dir="\${CT_TOP_DIR}"
2.76 -fi
2.77 -
2.78 -# Save the uClibc .config file
2.79 -if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
2.80 - # We save the file, and then point the saved sample to this file
2.81 - CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
2.82 - sed -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE=).+$|\1"'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
2.83 - "samples/${CT_TARGET}/crosstool.config"
2.84 -else
2.85 - # remove any dangling files
2.86 - for f in "samples/${CT_TARGET}/${CT_LIBC}-"*.config; do
2.87 - if [ -f "${f}" ]; then rm -f "${f}"; fi
2.88 - done
2.89 -fi
2.90 -
2.91 -# Restore stdout now, to be interactive
2.92 -exec >&7
2.93 -
2.94 -# Fill-in the reported-by info
2.95 -[ -f "samples/${CT_TARGET}/reported.by" ] && . "samples/${CT_TARGET}/reported.by"
2.96 -old_name="${reporter_name}"
2.97 -old_url="${reporter_url}"
2.98 -read -p "Reporter name [${reporter_name}]: " reporter_name
2.99 -read -p "Reporter URL [${reporter_url}]: " reporter_url
2.100 -if [ -n "${reporter_comment}" ]; then
2.101 - echo "Old comment if you need to copy-paste:"
2.102 - printf "${reporter_comment}\n"
2.103 -fi
2.104 -echo "Reporter comment (Ctrl-D to finish):"
2.105 -reporter_comment=$(cat)
2.106 -
2.107 -( echo "reporter_name=\"${reporter_name:=${old_name}}\""
2.108 - echo "reporter_url=\"${reporter_url:=${old_url}}\""
2.109 - printf "reporter_comment=\"${reporter_comment}\"\n"
2.110 -) >"samples/${CT_TARGET}/reported.by"
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/scripts/saveSample.sh.in Sun Feb 01 17:11:46 2009 +0000
3.3 @@ -0,0 +1,110 @@
3.4 +#!@@CT_bash@@
3.5 +
3.6 +# This script is responsible for saving the current configuration into a
3.7 +# sample to be used later on as a pre-configured target.
3.8 +
3.9 +# What we need to save:
3.10 +# - the .config file
3.11 +# - the uClibc .config file if uClibc selected
3.12 +# - info about who reported the sample
3.13 +
3.14 +# Parse the tools' paths configuration
3.15 +. "${CT_LIB_DIR}/paths.mk"
3.16 +
3.17 +# We'll need the stdout later, save it
3.18 +exec 7>&1
3.19 +
3.20 +. "${CT_LIB_DIR}/scripts/functions"
3.21 +
3.22 +# Don't care about any log file
3.23 +exec >/dev/null
3.24 +rm -f "${tmp_log_file}"
3.25 +
3.26 +# Parse the configuration file
3.27 +CT_TestOrAbort "Configuration file not found. Please create one." -f .config
3.28 +. .config
3.29 +
3.30 +# Do not use a progress bar
3.31 +unset CT_LOG_PROGRESS_BAR
3.32 +
3.33 +# Parse architecture and kernel specific functions
3.34 +. "${CT_LIB_DIR}/scripts/build/arch/${CT_ARCH}.sh"
3.35 +. "${CT_LIB_DIR}/scripts/build/kernel/${CT_KERNEL}.sh"
3.36 +
3.37 +# Target tuple: CT_TARGET needs a little love:
3.38 +CT_DoBuildTargetTuple
3.39 +
3.40 +# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
3.41 +# re-parse them:
3.42 +. .config
3.43 +
3.44 +# Override log options
3.45 +unset CT_LOG_PROGRESS_BAR CT_LOG_ERROR CT_LOG_INFO CT_LOG_EXTRA CT_LOG_DEBUG LOG_ALL
3.46 +CT_LOG_WARN=y
3.47 +CT_LOG_LEVEL_MAX="WARN"
3.48 +
3.49 +# Create the sample directory
3.50 +if [ ! -d "samples/${CT_TARGET}" ]; then
3.51 + mkdir -p "samples/${CT_TARGET}"
3.52 +fi
3.53 +
3.54 +# Save the crosstool-NG config file
3.55 +"${sed}" -r -e 's|^(CT_PREFIX_DIR)=.*|\1="${HOME}/x-tools/${CT_TARGET}"|;' \
3.56 + -e 's|^# CT_LOG_TO_FILE is not set$|CT_LOG_TO_FILE=y|;' \
3.57 + -e 's|^# CT_LOG_FILE_COMPRESS is not set$|CT_LOG_FILE_COMPRESS=y|;' \
3.58 + -e 's|^(CT_LOCAL_TARBALLS_DIR)=.*|\1="${HOME}/src"|;' \
3.59 + <.config \
3.60 + >"samples/${CT_TARGET}/crosstool.config"
3.61 +
3.62 +# Function to copy a file to the sample directory
3.63 +# Needed in case the file is already there (think of a previously available sample)
3.64 +# Usage: CT_DoAddFileToSample <source> <dest>
3.65 +CT_DoAddFileToSample() {
3.66 + source="$1"
3.67 + dest="$2"
3.68 + inode_s=$(ls -i "${source}" |"${awk}" '{ print $1; }')
3.69 + inode_d=$(ls -i "${dest}" 2>/dev/null |"${awk}" '{ print $1; }' || true)
3.70 + if [ "${inode_s}" != "${inode_d}" ]; then
3.71 + cp "${source}" "${dest}"
3.72 + fi
3.73 +}
3.74 +
3.75 +if [ "${CT_TOP_DIR}" = "${CT_LIB_DIR}" ]; then
3.76 + samp_top_dir="\${CT_LIB_DIR}"
3.77 +else
3.78 + samp_top_dir="\${CT_TOP_DIR}"
3.79 +fi
3.80 +
3.81 +# Save the uClibc .config file
3.82 +if [ -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" ]; then
3.83 + # We save the file, and then point the saved sample to this file
3.84 + CT_DoAddFileToSample "${CT_LIBC_UCLIBC_CONFIG_FILE}" "samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"
3.85 + "${sed}" -r -i -e 's|^(CT_LIBC_UCLIBC_CONFIG_FILE=).+$|\1"'"${samp_top_dir}"'/samples/${CT_TARGET}/${CT_LIBC}-${CT_LIBC_VERSION}.config"|;' \
3.86 + "samples/${CT_TARGET}/crosstool.config"
3.87 +else
3.88 + # remove any dangling files
3.89 + for f in "samples/${CT_TARGET}/${CT_LIBC}-"*.config; do
3.90 + if [ -f "${f}" ]; then rm -f "${f}"; fi
3.91 + done
3.92 +fi
3.93 +
3.94 +# Restore stdout now, to be interactive
3.95 +exec >&7
3.96 +
3.97 +# Fill-in the reported-by info
3.98 +[ -f "samples/${CT_TARGET}/reported.by" ] && . "samples/${CT_TARGET}/reported.by"
3.99 +old_name="${reporter_name}"
3.100 +old_url="${reporter_url}"
3.101 +read -p "Reporter name [${reporter_name}]: " reporter_name
3.102 +read -p "Reporter URL [${reporter_url}]: " reporter_url
3.103 +if [ -n "${reporter_comment}" ]; then
3.104 + echo "Old comment if you need to copy-paste:"
3.105 + printf "${reporter_comment}\n"
3.106 +fi
3.107 +echo "Reporter comment (Ctrl-D to finish):"
3.108 +reporter_comment=$(cat)
3.109 +
3.110 +( echo "reporter_name=\"${reporter_name:=${old_name}}\""
3.111 + echo "reporter_url=\"${reporter_url:=${old_url}}\""
3.112 + printf "reporter_comment=\"${reporter_comment}\"\n"
3.113 +) >"samples/${CT_TARGET}/reported.by"