crosstool-ng/scripts/tarball.sh.broken
Yann E. MORIN" 0c4633c37f Get rid of all command (which is a bashism), and replace them with $(command), which is POSIX.
Get rid of all remaining \"text\" in log messages and replace them with 'text'.
Optimise the progress bar, should go un-noticed at log level DEBUG and below.

 /trunk/scripts/build/tools/200-sstrip.sh  |   16     8     8     0 ++--
 /trunk/scripts/build/libc_glibc.sh        |   50    25    25     0 +++++++-------
 /trunk/scripts/build/libc_uClibc.sh       |    4     2     2     0
 /trunk/scripts/build/debug/100-dmalloc.sh |    2     1     1     0
 /trunk/scripts/build/debug/400-ltrace.sh  |    2     1     1     0
 /trunk/scripts/build/debug/300-gdb.sh     |    8     4     4     0 +-
 /trunk/scripts/build/debug/200-duma.sh    |    6     3     3     0 +-
 /trunk/scripts/build/kernel_linux.sh      |   30    15    15     0 ++++----
 /trunk/scripts/build/cc_gcc.sh            |   14     7     7     0 ++--
 /trunk/scripts/crosstool.sh               |   54    27    27     0 ++++++++--------
 /trunk/scripts/functions                  |  128    64    64     0 ++++++++++++++++++------------------
 /trunk/scripts/saveSample.sh              |    4     2     2     0
 /trunk/scripts/tarball.sh.broken          |   20    10    10     0 +++---
 /trunk/tools/addToolVersion.sh            |    8     4     4     0 +-
 /trunk/tools/populate.in                  |   18     9     9     0 ++--
 15 files changed, 182 insertions(+), 182 deletions(-)
2008-05-20 21:32:39 +00:00

103 lines
3.5 KiB
Bash
Executable File

#!/bin/bash
# This scripts makes a tarball of the configured toolchain
# Pre-requisites:
# - crosstool-NG is configured
# - components tarball are available
# - toolchain is built successfully
# We need the functions first:
. "${CT_TOP_DIR}/scripts/functions"
# Don't care about any log file
exec >/dev/null
rm -f "${tmp_log_file}"
# Parse the configuration file:
. ${CT_TOP_DIR}/.config
# Parse the architecture-specific functions
. "${CT_LIB_DIR}/arch/${CT_ARCH}/functions"
# Target tuple: CT_TARGET needs a little love:
CT_DoBuildTargetTuple
# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
# re-parse them:
. "${CT_TOP_DIR}/.config"
# Build a one-line list of files to include
CT_DoStep DEBUG "Building list of tarballs to add"
CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
CT_TARBALLS=""
for dir in '' tools debug; do
CT_DoStep DEBUG "Scanning directory '${dir}'"
for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do
CT_DoStep DEBUG "Testing component '${script}'"
[ -n "${script}" ] || continue
unset do_print_file_name
. "${script}"
for file in $(do_print_filename); do
CT_DoLog DEBUG "Finding tarball for '${file}'"
[ -n "${file}" ] || continue
ext=$(CT_GetFileExtension "${file}")
CT_TestOrAbort "Missing tarball for: '${file}'" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}"
CT_DoLog DEBUG "Found '${file}${ext}'"
CT_TARBALLS="${CT_TARBALLS} ${file}${ext}"
done
CT_EndStep
done
CT_EndStep
done
CT_EndStep
# We need to emulate a build directory:
CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
mkdir -p "${CT_BUILD_DIR}"
CT_MktempDir tempdir
# Save crosstool-NG, as it is configured for the current toolchain.
topdir=$(basename "${CT_TOP_DIR}")
CT_Pushd "${CT_TOP_DIR}/.."
botdir=$(pwd)
# Build the list of files to exclude
CT_DoLog DEBUG "Building list of files to exclude"
exclude_list="${tempdir}/${CT_TARGET}.list"
{ echo ".svn"; \
echo "${topdir}/log.*"; \
echo "${topdir}/targets/src"; \
echo "${topdir}/targets/tst"; \
echo "${topdir}/targets/*-*-*-*"; \
for t in $(ls -1 "${topdir}/targets/tarballs/"); do \
case " ${CT_TARBALLS} " in \
*" ${t} "*) ;; \
*) echo "${topdir}/targets/tarballs/${t}";; \
esac; \
done; \
} >"${exclude_list}"
# Render the install directory writable
chmod u+w "${CT_PREFIX_DIR}"
CT_DoLog INFO "Saving crosstool-NG into the toolchain directory"
tar cvjf "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2" \
--no-wildcards-match-slash \
-X "${exclude_list}" \
"${topdir}" 2>&1 |CT_DoLog ALL
CT_Popd
CT_DoLog INFO "Saving the toolchain"
tar cvjf "${botdir}/${CT_TARGET}.tar.bz2" "${CT_PREFIX_DIR}" 2>&1 |CT_DoLog ALL
CT_DoLog DEBUG "Getting rid of working directories"
rm -f "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"
rm -rf "${tempdir}"
if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
# Render the install directory non-writable
chmod u-w "${CT_PREFIX_DIR}"
fi