Overwrite existing symlinks when installing crosstool-NG.
3 # This scripts makes a tarball of the configured toolchain
5 # - crosstool-NG is configured
6 # - components tarball are available
7 # - toolchain is built successfully
9 # We need the functions first:
10 . "${CT_TOP_DIR}/scripts/functions"
12 # Don't care about any log file
14 rm -f "${tmp_log_file}"
16 # Parse the configuration file:
17 . ${CT_TOP_DIR}/.config
19 CT_DoBuildTargetTriplet
21 # Kludge: if any of the config options needs either CT_TARGET or CT_TOP_DIR,
23 . "${CT_TOP_DIR}/.config"
25 # Build a one-line list of files to include
26 CT_DoStep DEBUG "Building list of tarballs to add"
27 CT_TARBALLS_DIR="${CT_TOP_DIR}/targets/tarballs"
29 for dir in '' tools debug; do
30 CT_DoStep DEBUG "Scanning directory \"${dir}\""
31 for script in "${CT_TOP_DIR}/scripts/build/${dir}/"*.sh; do
32 CT_DoStep DEBUG "Testing component \"${script}\""
33 [ -n "${script}" ] || continue
34 unset do_print_file_name
36 for file in `do_print_filename`; do
37 CT_DoLog DEBUG "Finding tarball for \"${file}\""
38 [ -n "${file}" ] || continue
39 ext=`CT_GetFileExtension "${file}"`
40 CT_TestOrAbort "Missing tarball for: \"${file}\"" -f "${CT_TOP_DIR}/targets/tarballs/${file}${ext}"
41 CT_DoLog DEBUG "Found \"${file}${ext}\""
42 CT_TARBALLS="${CT_TARBALLS} ${file}${ext}"
50 # We need to emulate a build directory:
51 CT_BUILD_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/build"
52 mkdir -p "${CT_BUILD_DIR}"
55 # Save crosstool-NG, as it is configured for the current toolchain.
56 topdir=`basename "${CT_TOP_DIR}"`
57 CT_Pushd "${CT_TOP_DIR}/.."
61 # Build the list of files to exclude
62 CT_DoLog DEBUG "Building list of files to exclude"
63 exclude_list="${tempdir}/${CT_TARGET}.list"
65 echo "${topdir}/log.*"; \
66 echo "${topdir}/targets/src"; \
67 echo "${topdir}/targets/tst"; \
68 echo "${topdir}/targets/*-*-*-*"; \
69 for t in `ls -1 "${topdir}/targets/tarballs/"`; do \
70 case " ${CT_TARBALLS} " in \
72 *) echo "${topdir}/targets/tarballs/${t}";; \
77 # Render the install directory writable
78 chmod u+w "${CT_PREFIX_DIR}"
80 CT_DoLog INFO "Saving crosstool-NG into the toolchain directory"
81 tar cvjf "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2" \
82 --no-wildcards-match-slash \
83 -X "${exclude_list}" \
84 "${topdir}" 2>&1 |CT_DoLog ALL
88 CT_DoLog INFO "Saving the toolchain"
89 tar cvjf "${botdir}/${CT_TARGET}.tar.bz2" "${CT_PREFIX_DIR}" 2>&1 |CT_DoLog ALL
91 CT_DoLog DEBUG "Getting rid of working directories"
92 rm -f "${CT_PREFIX_DIR}/${topdir}.${CT_TARGET}.tar.bzip2"
95 if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
96 # Render the install directory non-writable
97 chmod u-w "${CT_PREFIX_DIR}"