summaryrefslogtreecommitdiff
path: root/scripts/crosstool-NG.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/crosstool-NG.sh')
-rw-r--r--scripts/crosstool-NG.sh40
1 files changed, 26 insertions, 14 deletions
diff --git a/scripts/crosstool-NG.sh b/scripts/crosstool-NG.sh
index d4414b5..ccfe29c 100644
--- a/scripts/crosstool-NG.sh
+++ b/scripts/crosstool-NG.sh
@@ -74,6 +74,7 @@ for d in \
LOCAL_TARBALLS \
WORK \
PREFIX \
+ BUILD_TOP \
INSTALL \
; do
eval dir="\${CT_${d}_DIR}"
@@ -88,6 +89,17 @@ for d in \
CT_Abort "'CT_${d}_DIR'='${dir}' contains a comma in it.\nDon't use commas in paths, it breaks things."
;;
esac
+ case "${dir}" in
+ /*)
+ # Absolute path, okay
+ ;;
+ *)
+ # Relative path from CT_TOP_DIR, make absolute
+ eval CT_${d}_DIR="${CT_TOP_DIR}/${dir}"
+ # Having .. inside CT_PREFIX breaks relocatability.
+ CT_SanitizeVarDir CT_${d}_DIR
+ ;;
+ esac
done
# Where will we work?
@@ -115,11 +127,14 @@ cat "${paths_sh_location}" |while read trash line; do
tool="${line%%=*}"
# 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"
+ if [ ! -r "${CT_LIB_DIR}/scripts/override/$tool" ]; then
+ if [ -n "${path}" ]; then
+ CT_DoExecLog ALL rm -f "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
+ CT_DoExecLog ALL ln -s "${path}" "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
+ fi
+ continue
fi
+ tmpl="${CT_LIB_DIR}/scripts/override/$tool"
CT_DoLog DEBUG "Creating script-override for '${tool}' -> '${path}' using '${tmpl}' template"
CT_DoExecLog ALL cp "${tmpl}" "${CT_TOOLS_OVERRIDE_DIR}/bin/${tool}"
CT_DoExecLog ALL ${sed} -i -r \
@@ -163,8 +178,8 @@ CT_PREFIX_DIR="$( ${sed} -r -e 's:/+:/:g; s:/*$::;' <<<"${CT_PREFIX_DIR}" )"
# Second kludge: merge user-supplied target CFLAGS with architecture-provided
# target CFLAGS. Do the same for LDFLAGS in case it happens in the future.
# Put user-supplied flags at the end, so that they take precedence.
-CT_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_TARGET_CFLAGS}"
-CT_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_TARGET_LDFLAGS}"
+CT_ALL_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_TARGET_CFLAGS}"
+CT_ALL_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_TARGET_LDFLAGS}"
# FIXME move to gcc.sh
CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_CORE_EXTRA_CONFIG} "${CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY[@]}" )
@@ -193,7 +208,7 @@ CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs"
CT_COMMON_SRC_DIR="${CT_WORK_DIR}/src"
CT_SRC_DIR="${CT_BUILD_TOP_DIR}/src"
CT_BUILDTOOLS_PREFIX_DIR="${CT_BUILD_TOP_DIR}/buildtools"
-CT_STATE_DIR="${CT_WORK_DIR}/${CT_TARGET}/state"
+CT_STATE_DIR="${CT_BUILD_TOP_DIR}/state"
# Note about HOST_COMPLIBS_DIR: it's always gonna be in the buildtools dir, or a
# sub-dir. So we won't have to save/restore it, not even create it.
# In case of cross or native, host-complibs are used for build-complibs;
@@ -301,20 +316,17 @@ CT_DoExecLog ALL mkdir -p "${CT_HOST_COMPLIBS_DIR}"
# Only create the state dir if asked for a restartable build
[ -n "${CT_DEBUG_CT_SAVE_STEPS}" ] && CT_DoExecLog ALL mkdir -p "${CT_STATE_DIR}"
+# Kludge: CT_PREFIX_DIR might have grown read-only if
+# the previous build was successful.
+CT_DoExecLog ALL chmod -R u+w "${CT_PREFIX_DIR}"
+
# Check install file system case-sensitiveness
CT_DoExecLog DEBUG touch "${CT_PREFIX_DIR}/foo"
CT_TestAndAbort "Your file system in '${CT_PREFIX_DIR}' is *not* case-sensitive!" -f "${CT_PREFIX_DIR}/FOO"
CT_DoExecLog DEBUG rm -f "${CT_PREFIX_DIR}/foo"
-# Kludge: CT_PREFIX_DIR might have grown read-only if
-# the previous build was successful.
-CT_DoExecLog ALL chmod -R u+w "${CT_PREFIX_DIR}"
-
# Setting up the rest of the environment only if not restarting
if [ -z "${CT_RESTART}" ]; then
- # Having .. inside CT_PREFIX breaks relocatability.
- CT_SanitizeVarDir CT_PREFIX_DIR
-
case "${CT_SYSROOT_NAME}" in
"") CT_SYSROOT_NAME="sysroot";;
.) CT_Abort "Sysroot name is set to '.' which is forbidden";;