summaryrefslogtreecommitdiff
path: root/scripts/functions
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-03-12 23:56:19 (GMT)
committerAlexey Neyman <stilor@att.net>2017-03-12 23:56:19 (GMT)
commit8600f3ce56f67a2a0d7b4a14eb9e8b1f0ec49dec (patch)
treea6a194e0c2a6a47b4ed6fc12efd31346e3b5289a /scripts/functions
parentcba19622002d9d01d6f99d2e477d0322b92cd916 (diff)
Move tools alias creation to a common function
... and in addition to final toolchain aliasing, use it when configuring multilibs for glibc/musl. Note that uClibc does not need it, it is explicitly selecting the tools using CROSS_PREFIX. Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/functions')
-rw-r--r--scripts/functions53
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/functions b/scripts/functions
index 969e9bf..8b12d8e 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -1762,3 +1762,56 @@ CT_IterateMultilibs() {
multi_index=$((multi_index+1))
done
}
+
+# Create symbolic links in buildtools for binutils using a different
+# target name.
+# Usage:
+# CT_SymlinkTools BIN-DIR SRC-DIR NEW-PREFIX SED-EXPR
+CT_SymlinkTools()
+{
+ local bindir="$1"
+ local srcdir="$2"
+ local newpfx="$3"
+ local sedexpr="$4"
+ local dirpfx
+ local t _t
+
+ # if bindir==srcdir, create symlinks just with the filename
+ if [ "${bindir}" != "${srcdir}" ]; then
+ dirpfx="${srcdir}/"
+ fi
+
+ CT_Pushd "${srcdir}"
+ for t in "${CT_TARGET}-"*; do
+ if [ -n "${newpfx}" -a "${newpfx}" != "${CT_TARGET}" ]; then
+ _t="${newpfx}-${t#${CT_TARGET}-}"
+ CT_DoExecLog ALL ln -sfv "${dirpfx}${t}" "${bindir}/${_t}"
+ fi
+ if [ -n "${sedexpr}" ]; then
+ _t=$( echo "${t}" | sed -r -e "${sedexpr}" )
+ if [ "${_t}" = "${t}" ]; then
+ CT_DoLog WARN "The sed expression '${sedexpr}' has no effect on '${t}'"
+ else
+ CT_DoExecLog ALL ln -sfv "${dirpfx}${t}" "${bindir}/${_t}"
+ fi
+ fi
+ done
+ CT_Popd
+}
+
+# Create symbolic links for multilib iterator. Expects ${multi_target}
+# variable to indicate the desired triplet for the tools.
+CT_SymlinkToolsMultilib()
+{
+ # Make configure detect ${target}-tool binaries even if it is different
+ # from configured tuple. Only symlink to final tools if they're executable
+ # on build.
+ CT_SymlinkTools "${CT_BUILDTOOLS_PREFIX_DIR}/bin" \
+ "${CT_BUILDTOOLS_PREFIX_DIR}/bin" "${multi_target}"
+ case "${CT_TOOLCHAIN_TYPE}" in
+ native|cross)
+ CT_SymlinkTools "${CT_BUILDTOOLS_PREFIX_DIR}/bin" \
+ "${CT_PREFIX_DIR}/bin" "${multi_target}"
+ ;;
+ esac
+}