2007-05-12 09:54:29 +00:00
|
|
|
#!/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"
|
|
|
|
|
2007-06-17 11:13:48 +00:00
|
|
|
# Don't care about any log file
|
2007-05-22 20:33:43 +00:00
|
|
|
exec >/dev/null
|
2007-06-17 11:13:48 +00:00
|
|
|
rm -f "${tmp_log_file}"
|
2007-05-12 09:54:29 +00:00
|
|
|
|
|
|
|
# Parse the configuration file:
|
|
|
|
. ${CT_TOP_DIR}/.config
|
|
|
|
|
2007-09-16 08:52:26 +00:00
|
|
|
# Parse the architecture-specific functions
|
|
|
|
. "${CT_LIB_DIR}/arch/${CT_ARCH}/functions"
|
|
|
|
|
|
|
|
# Target tuple: CT_TARGET needs a little love:
|
2007-08-15 16:18:35 +00:00
|
|
|
CT_DoBuildTargetTuple
|
2007-05-12 09:54:29 +00:00
|
|
|
|
|
|
|
# Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
|
|
|
|
# re-parse them:
|
|
|
|
. "${CT_TOP_DIR}/.config"
|
|
|
|
|
2007-06-17 11:13:48 +00:00
|
|
|
# Build a one-line list of files to include
|
|
|
|
CT_DoStep DEBUG "Building list of tarballs to add"
|
2007-05-12 09:54:29 +00:00
|
|
|
CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
|
2007-06-17 11:13:48 +00:00
|
|
|
CT_TARBALLS=""
|
|
|
|
for dir in '' tools debug; do
|
2008-05-20 21:32:39 +00:00
|
|
|
CT_DoStep DEBUG "Scanning directory '${dir}'"
|
2007-06-17 11:13:48 +00:00
|
|
|
for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do
|
2008-05-20 21:32:39 +00:00
|
|
|
CT_DoStep DEBUG "Testing component '${script}'"
|
2007-06-17 11:13:48 +00:00
|
|
|
[ -n "${script}" ] || continue
|
|
|
|
unset do_print_file_name
|
|
|
|
. "${script}"
|
2008-05-20 21:32:39 +00:00
|
|
|
for file in $(do_print_filename); do
|
|
|
|
CT_DoLog DEBUG "Finding tarball for '${file}'"
|
2007-06-17 11:13:48 +00:00
|
|
|
[ -n "${file}" ] || continue
|
2008-05-20 21:32:39 +00:00
|
|
|
ext=$(CT_GetFileExtension "${file}")
|
|
|
|
CT_TestOrAbort "Missing tarball for: '${file}'" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}"
|
|
|
|
CT_DoLog DEBUG "Found '${file}${ext}'"
|
2007-06-17 11:13:48 +00:00
|
|
|
CT_TARBALLS="${CT_TARBALLS} ${file}${ext}"
|
|
|
|
done
|
|
|
|
CT_EndStep
|
2007-05-12 09:54:29 +00:00
|
|
|
done
|
2007-06-17 11:13:48 +00:00
|
|
|
CT_EndStep
|
|
|
|
done
|
|
|
|
CT_EndStep
|
2007-05-12 09:54:29 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2007-07-02 19:40:54 +00:00
|
|
|
# Save crosstool-NG, as it is configured for the current toolchain.
|
2008-05-20 21:32:39 +00:00
|
|
|
topdir=$(basename "${CT_TOP_DIR}")
|
2007-05-12 09:54:29 +00:00
|
|
|
CT_Pushd "${CT_TOP_DIR}/.."
|
|
|
|
|
2008-05-20 21:32:39 +00:00
|
|
|
botdir=$(pwd)
|
2007-05-12 09:54:29 +00:00
|
|
|
|
2007-06-17 11:13:48 +00:00
|
|
|
# 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/*-*-*-*"; \
|
2008-05-20 21:32:39 +00:00
|
|
|
for t in $(ls -1 "${topdir}/targets/tarballs/"); do \
|
2007-06-17 11:13:48 +00:00
|
|
|
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}"
|
|
|
|
|
2007-07-02 19:40:54 +00:00
|
|
|
CT_DoLog INFO "Saving crosstool-NG into the toolchain directory"
|
2007-06-17 11:13:48 +00:00
|
|
|
tar cvjf "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2" \
|
|
|
|
--no-wildcards-match-slash \
|
|
|
|
-X "${exclude_list}" \
|
|
|
|
"${topdir}" 2>&1 |CT_DoLog ALL
|
2007-05-12 09:54:29 +00:00
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
|
2007-06-17 11:13:48 +00:00
|
|
|
CT_DoLog INFO "Saving the toolchain"
|
|
|
|
tar cvjf "${botdir}/${CT_TARGET}.tar.bz2" "${CT_PREFIX_DIR}" 2>&1 |CT_DoLog ALL
|
2007-05-12 09:54:29 +00:00
|
|
|
|
2007-06-17 11:13:48 +00:00
|
|
|
CT_DoLog DEBUG "Getting rid of working directories"
|
2007-05-12 09:54:29 +00:00
|
|
|
rm -f "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"
|
|
|
|
rm -rf "${tempdir}"
|
2007-06-17 11:13:48 +00:00
|
|
|
|
2007-06-17 14:51:37 +00:00
|
|
|
if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
|
|
|
|
# Render the install directory non-writable
|
|
|
|
chmod u-w "${CT_PREFIX_DIR}"
|
|
|
|
fi
|