summaryrefslogtreecommitdiff
path: root/scripts/crosstool-NG.sh.in
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-01-28 07:19:36 (GMT)
committerAlexey Neyman <stilor@att.net>2017-01-30 20:10:47 (GMT)
commita08a4c4b88fa2b2d770bda1fb1590ca80904fca7 (patch)
treeaa69007ee1ec6240ecb360adbf8e4e551389d4fd /scripts/crosstool-NG.sh.in
parenta78dc93b64e856d42516a1d854ad9e8e21c48afb (diff)
Allow for per-tool templates when creating overrides
... will be used to implement a smarter install wrapper. While there, correct the spelling of "OVERIDE". Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/crosstool-NG.sh.in')
-rw-r--r--scripts/crosstool-NG.sh.in28
1 files changed, 16 insertions, 12 deletions
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
index 4aa3975..41c3bcc 100644
--- a/scripts/crosstool-NG.sh.in
+++ b/scripts/crosstool-NG.sh.in
@@ -1,4 +1,3 @@
-#!@@CT_bash@@
# Copyright 2007 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package.
@@ -42,7 +41,7 @@ if [ "${CT_DEBUG_INTERACTIVE}" = "y" -a ! \( -t 0 -a -t 6 -a -t 2 \) ]; then
fi
# Override the locale early, in case we ever translate crosstool-NG messages
-if [ -z "${CT_NO_OVERIDE_LC_MESSAGES}" ]; then
+if [ -z "${CT_NO_OVERRIDE_LC_MESSAGES}" ]; then
export LC_ALL=C
export LANG=C
fi
@@ -104,19 +103,24 @@ CT_TestOrAbort "The CONFIG_SHELL '${CT_CONFIG_SHELL}' is not valid" -f "${CT_CON
# Contains symlinks to the tools found by ./configure
# Note: CT_DoLog and CT_DoExecLog do not use any of those tool, so
# they can be safely used
-CT_TOOLS_OVERIDE_DIR="${CT_WORK_DIR}/tools"
-CT_DoLog DEBUG "Creating bin-override for tools in '${CT_TOOLS_OVERIDE_DIR}'"
-CT_DoExecLog DEBUG mkdir -p "${CT_TOOLS_OVERIDE_DIR}/bin"
+CT_TOOLS_OVERRIDE_DIR="${CT_WORK_DIR}/tools"
+CT_DoLog DEBUG "Creating bin-override for tools in '${CT_TOOLS_OVERRIDE_DIR}'"
+CT_DoExecLog DEBUG mkdir -p "${CT_TOOLS_OVERRIDE_DIR}/bin"
cat "${CT_LIB_DIR}/paths.sh" |while read trash line; do
tool="${line%%=*}"
- path="${line#*=}"
- CT_DoLog DEBUG "Creating script-override for '${tool}' -> '${path}'"
- # Note: we need to supress the " in the path because
- # there can be arguments in there (thanks autostuff...)
- printf "#${BANG}${CT_CONFIG_SHELL}\nexec ${path//\"/} \"\${@}\"\n" >"${CT_TOOLS_OVERIDE_DIR}/bin/${tool}"
- CT_DoExecLog ALL chmod 700 "${CT_TOOLS_OVERIDE_DIR}/bin/${tool}"
+ # Suppress extra quoting
+ eval path=${line#*=}
+ if [ -r "${CT_LIB_DIR}/scripts/override/$tool" ]; then
+ tmpl="${CT_LIB_DIR}/scripts/override/$tool"
+ else
+ tmpl="${CT_LIB_DIR}/scripts/override/__default"
+ fi
+ CT_DoLog DEBUG "Creating script-override for '${tool}' -> '${path}' using '${tmpl}' template"
+ ${sed} -r -e "s#@CONFIG_SHELL@#${CT_CONFIG_SHELL}#g" \
+ -e "s#@TOOL_PATH@#${path}#g" "${tmpl}" > "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
+ CT_DoExecLog ALL chmod 700 "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
done
-export PATH="${CT_TOOLS_OVERIDE_DIR}/bin:${PATH}"
+export PATH="${CT_TOOLS_OVERRIDE_DIR}/bin:${PATH}"
# Start date. Can't be done until we know the locale
# Also requires the bin-override tools