summaryrefslogtreecommitdiff
path: root/scripts/build/internals.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build/internals.sh')
-rw-r--r--scripts/build/internals.sh76
1 files changed, 43 insertions, 33 deletions
diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh
index 18ada66..821761c 100644
--- a/scripts/build/internals.sh
+++ b/scripts/build/internals.sh
@@ -1,5 +1,27 @@
# This file contains crosstool-NG internal steps
+create_ldso_conf()
+{
+ local multi_dir multi_os_dir multi_os_dir_gcc multi_root multi_flags multi_index multi_count multi_target
+ local b d
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ CT_DoExecLog ALL mkdir -p "${multi_root}/etc"
+ for b in /lib /usr/lib "${CT_LDSO_CONF_EXTRA_DIRS_ARRAY[@]}"; do
+ d="${b}/${multi_os_dir}"
+ CT_SanitizeVarDir d
+ echo "${d}" >> "${multi_root}/etc/ld.so.conf"
+ if [ "${multi_os_dir}" != "${multi_os_dir_gcc}" ]; then
+ d="${b}/${multi_os_dir_gcc}"
+ CT_SanitizeVarDir d
+ echo "${d}" >> "${multi_root}/etc/ld.so.conf"
+ fi
+ done
+}
+
# 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.
@@ -10,13 +32,23 @@ do_finish() {
local gcc_version
local exe_suffix
- CT_DoStep INFO "Cleaning-up the toolchain's directory"
+ CT_DoStep INFO "Finalizing the toolchain's directory"
+
+ if [ "${CT_CREATE_LDSO_CONF}" = "y" ]; then
+ # Create /etc/ld.so.conf
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-create-ldso"
+ CT_IterateMultilibs create_ldso_conf create-ldso
+ CT_Popd
+ fi
if [ "${CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES}" = "y" ]; then
case "$CT_HOST" in
*darwin*)
strip_args=""
;;
+ *freebsd*)
+ strip_args="--strip-all"
+ ;;
*)
strip_args="--strip-all -v"
;;
@@ -37,20 +69,11 @@ do_finish() {
CT_DoExecLog ALL "${CT_TARGET}-strip" ${strip_args} \
"${CT_TARGET}/debug-root/usr/bin/gdbserver${exe_suffix}"
fi
- if [ "${CT_CC_gcc}" = "y" ]; then
- # We can not use the version in CT_CC_GCC_VERSION because
+ if [ "${CT_CC_GCC}" = "y" ]; then
+ # We can not use the version in CT_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
- gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
- "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \
- )
- fi
+ gcc_version=$( cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER" )
for _t in "bin/${CT_TARGET}-"* \
"${CT_TARGET}/bin/"* \
"libexec/gcc/${CT_TARGET}/${gcc_version}/"* \
@@ -60,7 +83,7 @@ do_finish() {
case "${_type}" in
*script*executable*)
;;
- *executable*)
+ *executable*|*shared*object*)
CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}"
;;
esac
@@ -100,25 +123,8 @@ do_finish() {
# 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 -sfv "${t}" "${_t}"
- fi
- if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
- _t=$(echo "$t" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
- 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 -sfv "${t}" "${_t}"
- fi
- fi
- done
- CT_Popd
-
- CT_DoLog EXTRA "Removing access to the build system tools"
- CT_DoExecLog DEBUG rm -rf "${CT_PREFIX_DIR}/buildtools"
+ CT_SymlinkTools "${CT_PREFIX_DIR}/bin" "${CT_PREFIX_DIR}/bin" \
+ "${CT_TARGET_ALIAS}" "${CT_TARGET_ALIAS_SED_EXPR}"
# Remove the generated documentation files
if [ "${CT_REMOVE_DOCS}" = "y" ]; then
@@ -128,5 +134,9 @@ do_finish() {
CT_DoForceRmdir "${CT_DEBUGROOT_DIR}/"{,usr/}{,share/}{man,info}
fi
+ if [ "${CT_INSTALL_LICENSES}" = y ]; then
+ CT_InstallCopyingInformation
+ fi
+
CT_EndStep
}