2009-03-04 17:59:35 +00:00
|
|
|
# This file contains crosstool-NG internal steps
|
|
|
|
|
|
|
|
# This step is called once all components were built, to remove
|
|
|
|
# un-wanted files, to add tuple aliases, and to add the final
|
|
|
|
# crosstool-NG-provided files.
|
|
|
|
do_finish() {
|
2009-06-02 17:33:04 +00:00
|
|
|
local _t
|
|
|
|
|
2009-03-04 17:59:35 +00:00
|
|
|
CT_DoStep INFO "Cleaning-up the toolchain's directory"
|
|
|
|
|
|
|
|
if [ "${CT_BARE_METAL}" != "y" ]; then
|
|
|
|
CT_DoLog EXTRA "Installing the populate helper"
|
|
|
|
sed -r -e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
|
|
|
|
-e 's|@@CT_install@@|'"${install}"'|g;' \
|
|
|
|
-e 's|@@CT_bash@@|'"${bash}"'|g;' \
|
|
|
|
-e 's|@@CT_grep@@|'"${grep}"'|g;' \
|
|
|
|
-e 's|@@CT_make@@|'"${make}"'|g;' \
|
|
|
|
-e 's|@@CT_sed@@|'"${sed}"'|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}")
|
2010-07-07 20:33:49 +00:00
|
|
|
if [ "${_t}" = "${t}" ]; then
|
|
|
|
CT_DoLog WARN "The sed expression '${CT_TARGET_ALIAS_SED_EXPR}' has no effect on '${t}'"
|
|
|
|
else
|
|
|
|
CT_DoExecLog ALL ln -sv "${t}" "${_t}"
|
|
|
|
fi
|
2009-03-04 17:59:35 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
CT_Popd
|
|
|
|
|
2009-06-02 17:33:04 +00:00
|
|
|
# If using the companion libraries, we need a wrapper
|
|
|
|
# that will set LD_LIBRARY_PATH approriately
|
2009-08-29 22:57:40 +00:00
|
|
|
if [ "${CT_WRAPPER_NEEDED}" = "y" ]; then
|
2009-06-02 17:33:04 +00:00
|
|
|
CT_DoLog EXTRA "Installing toolchain wrappers"
|
|
|
|
CT_Pushd "${CT_PREFIX_DIR}/bin"
|
2009-06-02 21:01:19 +00:00
|
|
|
|
2010-05-22 15:30:44 +00:00
|
|
|
case "$CT_SYS_OS" in
|
|
|
|
Darwin|FreeBSD)
|
|
|
|
# wrapper does not work (when using readlink -m)
|
|
|
|
CT_DoLog WARN "Forcing usage of binary tool wrapper"
|
|
|
|
CT_TOOLS_WRAPPER="exec"
|
|
|
|
;;
|
|
|
|
esac
|
2009-08-29 22:27:12 +00:00
|
|
|
# Install the wrapper
|
|
|
|
case "${CT_TOOLS_WRAPPER}" in
|
|
|
|
script)
|
|
|
|
CT_DoExecLog DEBUG install \
|
|
|
|
-m 0755 \
|
|
|
|
"${CT_LIB_DIR}/scripts/wrapper.in" \
|
|
|
|
".${CT_TARGET}-wrapper"
|
|
|
|
;;
|
|
|
|
exec)
|
2009-09-06 15:58:05 +00:00
|
|
|
CT_DoExecLog DEBUG "${CT_HOST}-gcc" \
|
2010-05-22 20:01:18 +00:00
|
|
|
-Wall -Wextra -Werror \
|
|
|
|
-Os \
|
2009-09-06 15:58:05 +00:00
|
|
|
"${CT_LIB_DIR}/scripts/wrapper.c" \
|
|
|
|
-o ".${CT_TARGET}-wrapper"
|
2010-05-22 20:01:18 +00:00
|
|
|
if [ "${CT_DEBUG_CT}" != "y" ]; then
|
|
|
|
# If not debugging crosstool-NG, strip the wrapper
|
|
|
|
CT_DoExecLog DEBUG "${CT_HOST}-strip" ".${CT_TARGET}-wrapper"
|
|
|
|
fi
|
2009-08-29 22:27:12 +00:00
|
|
|
;;
|
|
|
|
esac
|
2009-06-02 21:01:19 +00:00
|
|
|
|
|
|
|
# Replace every tools with the wrapper
|
|
|
|
# Do it unconditionally, even for those tools that happen to be shell
|
|
|
|
# scripts, we don't know if they would in the end spawn a binary...
|
|
|
|
# Just skip symlinks
|
2009-06-14 20:57:57 +00:00
|
|
|
for _t in "${CT_TARGET}-"*; do
|
2010-05-19 16:08:23 +00:00
|
|
|
if [ ! -L "${_t}" ]; then
|
2009-06-18 16:55:07 +00:00
|
|
|
CT_DoExecLog ALL mv "${_t}" ".${_t}"
|
2009-06-14 20:57:57 +00:00
|
|
|
CT_DoExecLog ALL ln ".${CT_TARGET}-wrapper" "${_t}"
|
2009-06-02 21:01:19 +00:00
|
|
|
fi
|
2009-06-02 17:33:04 +00:00
|
|
|
done
|
2009-06-02 21:01:19 +00:00
|
|
|
|
|
|
|
# Get rid of the wrapper, we're using hardlinks
|
|
|
|
CT_DoExecLog DEBUG rm -f ".${CT_TARGET}-wrapper"
|
2009-06-02 17:33:04 +00:00
|
|
|
CT_Popd
|
|
|
|
fi
|
|
|
|
|
2009-09-06 15:58:05 +00:00
|
|
|
CT_DoLog EXTRA "Removing access to the build system tools"
|
|
|
|
CT_DoExecLog DEBUG rm -rf "${CT_PREFIX_DIR}/buildtools"
|
|
|
|
|
2009-03-04 17:59:35 +00:00
|
|
|
# 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_DEBUGROOT_DIR}/"{,usr/}{man,info}
|
|
|
|
fi
|
|
|
|
|
2010-02-28 09:19:13 +00:00
|
|
|
# Remove headers installed by native companion libraries
|
|
|
|
CT_DoForceRmdir "${CT_PREFIX_DIR}/include"
|
|
|
|
|
2009-03-04 17:59:35 +00:00
|
|
|
CT_EndStep
|
|
|
|
}
|