summaryrefslogtreecommitdiff
path: root/scripts/functions
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/functions')
-rw-r--r--scripts/functions42
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/functions b/scripts/functions
index b8d31a0..d6beccf 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -891,3 +891,45 @@ CT_DoLoadState(){
rm -f "${state_dir}/tail.log"
fi
}
+
+do_finish() {
+ CT_DoStep INFO "Cleaning-up the toolchain's directory"
+
+ CT_DoLog EXTRA "Removing access to the build system tools"
+ find "${CT_PREFIX_DIR}/bin" -name "${CT_BUILD}-"'*' -exec rm -fv {} \; |CT_DoLog DEBUG
+ find "${CT_PREFIX_DIR}/bin" -name "${CT_HOST}-"'*' -exec rm -fv {} \; |CT_DoLog DEBUG
+ CT_DoExecLog DEBUG rm -fv "${CT_PREFIX_DIR}/bin/makeinfo"
+
+ if [ "${CT_BARE_METAL}" != "y" ]; then
+ CT_DoLog EXTRA "Installing the populate helper"
+ sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
+ "${CT_LIB_DIR}/scripts/populate.in" \
+ >"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
+ CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
+ fi
+
+ # Create the aliases to the target tools
+ CT_DoLog EXTRA "Creating toolchain aliases"
+ CT_Pushd "${CT_PREFIX_DIR}/bin"
+ for t in "${CT_TARGET}-"*; do
+ if [ -n "${CT_TARGET_ALIAS}" ]; then
+ _t=$(echo "$t" |sed -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;')
+ CT_DoExecLog ALL ln -sv "${t}" "${_t}"
+ fi
+ if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
+ _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
+ CT_DoExecLog ALL ln -sv "${t}" "${_t}"
+ fi
+ done
+ CT_Popd
+
+ # Remove the generated documentation files
+ if [ "${CT_REMOVE_DOCS}" = "y" ]; then
+ CT_DoLog EXTRA "Removing installed documentation"
+ CT_DoForceRmdir "${CT_PREFIX_DIR}/"{,usr/}{man,info}
+ CT_DoForceRmdir "${CT_SYSROOT_DIR}/"{,usr/}{man,info}
+ CT_DoForceRmdir "${CT_DEBUG_INSTALL_DIR}/"{,usr/}{man,info}
+ fi
+
+ CT_EndStep
+}