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
|
2010-12-05 15:27:06 +00:00
|
|
|
local _type
|
2010-08-21 14:45:50 +00:00
|
|
|
local strip_args
|
2011-02-17 20:54:07 +00:00
|
|
|
local gcc_version
|
2009-06-02 17:33:04 +00:00
|
|
|
|
2009-03-04 17:59:35 +00:00
|
|
|
CT_DoStep INFO "Cleaning-up the toolchain's directory"
|
|
|
|
|
2015-11-10 09:59:02 +00:00
|
|
|
if [ "${CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES}" = "y" ]; then
|
2010-08-21 14:45:50 +00:00
|
|
|
case "$CT_HOST" in
|
|
|
|
*darwin*)
|
|
|
|
strip_args=""
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
strip_args="--strip-all -v"
|
|
|
|
;;
|
|
|
|
esac
|
2010-05-27 21:18:19 +00:00
|
|
|
CT_DoLog INFO "Stripping all toolchain executables"
|
|
|
|
CT_Pushd "${CT_PREFIX_DIR}"
|
2012-09-12 09:42:38 +00:00
|
|
|
|
|
|
|
# Strip gdbserver
|
|
|
|
if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
|
2012-09-20 03:20:16 +00:00
|
|
|
CT_DoExecLog ALL "${CT_TARGET}-strip" ${strip_args} \
|
|
|
|
"${CT_TARGET}/debug-root/usr/bin/gdbserver"
|
2012-09-12 09:42:38 +00:00
|
|
|
fi
|
2015-05-29 20:40:52 +00:00
|
|
|
if [ "${CT_CC_gcc}" = "y" ]; then
|
|
|
|
# We can not use the version in CT_CC_GCC_VERSION because
|
|
|
|
# of the Linaro stuff. So, harvest the version string
|
|
|
|
# directly from the gcc sources...
|
|
|
|
# All gcc 4.x seem to have the version in gcc/BASE-VER
|
|
|
|
# while version prior to 4.x have the version in gcc/version.c
|
|
|
|
# Of course, here is not the better place to do that...
|
|
|
|
if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then
|
|
|
|
gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" )
|
|
|
|
else
|
2015-11-17 10:48:09 +00:00
|
|
|
gcc_version=$(${sed} -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
|
|
|
|
"${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \
|
2015-05-29 20:40:52 +00:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
for _t in "bin/${CT_TARGET}-"* \
|
|
|
|
"${CT_TARGET}/bin/"* \
|
|
|
|
"libexec/gcc/${CT_TARGET}/${gcc_version}/"* \
|
|
|
|
"libexec/gcc/${CT_TARGET}/${gcc_version}/install-tools/"* \
|
|
|
|
; do
|
|
|
|
_type="$( file "${_t}" |cut -d ' ' -f 2- )"
|
|
|
|
case "${_type}" in
|
|
|
|
*script*executable*)
|
|
|
|
;;
|
|
|
|
*executable*)
|
|
|
|
CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2011-05-02 16:07:13 +00:00
|
|
|
fi
|
2010-05-27 21:18:19 +00:00
|
|
|
CT_Popd
|
|
|
|
fi
|
|
|
|
|
2009-03-04 17:59:35 +00:00
|
|
|
if [ "${CT_BARE_METAL}" != "y" ]; then
|
|
|
|
CT_DoLog EXTRA "Installing the populate helper"
|
2015-11-17 10:48:09 +00:00
|
|
|
${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" \
|
2009-03-04 17:59:35 +00:00
|
|
|
>"${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
|
|
|
|
CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-populate"
|
|
|
|
fi
|
|
|
|
|
2010-07-22 21:26:08 +00:00
|
|
|
if [ "${CT_LIBC_XLDD}" = "y" ]; then
|
|
|
|
CT_DoLog EXTRA "Installing a cross-ldd helper"
|
2015-11-17 10:48:09 +00:00
|
|
|
${sed} -r -e 's|@@CT_VERSION@@|'"${CT_VERSION}"'|g;' \
|
|
|
|
-e 's|@@CT_TARGET@@|'"${CT_TARGET}"'|g;' \
|
|
|
|
-e 's|@@CT_BITS@@|'"${CT_ARCH_BITNESS}"'|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/xldd.in" \
|
2010-07-22 21:26:08 +00:00
|
|
|
>"${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
|
|
|
|
CT_DoExecLog ALL chmod 755 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-ldd"
|
|
|
|
fi
|
|
|
|
|
2009-03-04 17:59:35 +00:00
|
|
|
# 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
|
2015-11-17 10:48:09 +00:00
|
|
|
_t=$(echo "$t" |${sed} -r -e 's/^'"${CT_TARGET}"'-/'"${CT_TARGET_ALIAS}"'-/;')
|
2011-07-12 21:52:24 +00:00
|
|
|
CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
|
2009-03-04 17:59:35 +00:00
|
|
|
fi
|
|
|
|
if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
|
2015-11-17 10:48:09 +00:00
|
|
|
_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
|
2011-07-12 21:52:24 +00:00
|
|
|
CT_DoExecLog ALL ln -sfv "${t}" "${_t}"
|
2010-07-07 20:33:49 +00:00
|
|
|
fi
|
2009-03-04 17:59:35 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
CT_Popd
|
|
|
|
|
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"
|
2010-12-29 18:41:17 +00:00
|
|
|
CT_DoForceRmdir "${CT_PREFIX_DIR}/"{,usr/}{,share/}{man,info}
|
|
|
|
CT_DoForceRmdir "${CT_SYSROOT_DIR}/"{,usr/}{,share/}{man,info}
|
|
|
|
CT_DoForceRmdir "${CT_DEBUGROOT_DIR}/"{,usr/}{,share/}{man,info}
|
2009-03-04 17:59:35 +00:00
|
|
|
fi
|
|
|
|
|
2010-09-11 15:55:54 +00:00
|
|
|
# Remove the lib* symlinks, now:
|
|
|
|
# The symlinks are needed only during the build process.
|
|
|
|
# The final gcc will still search those dirs, but will also search
|
|
|
|
# the standard lib/ dirs, so we can get rid of the symlinks
|
2011-04-14 22:22:42 +00:00
|
|
|
CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib32"
|
|
|
|
CT_DoExecLog ALL rm -f "${CT_PREFIX_DIR}/lib64"
|
2010-09-11 15:55:54 +00:00
|
|
|
|
2009-03-04 17:59:35 +00:00
|
|
|
CT_EndStep
|
|
|
|
}
|