1.1 --- a/scripts/crosstool-NG.sh.in Mon Jun 22 21:51:14 2009 +0200
1.2 +++ b/scripts/crosstool-NG.sh.in Mon Jun 22 21:53:09 2009 +0200
1.3 @@ -28,6 +28,31 @@
1.4 # Overide the locale early, in case we ever translate crosstool-NG messages
1.5 [ -z "${CT_NO_OVERIDE_LC_MESSAGES}" ] && export LC_ALL=C
1.6
1.7 +# Some sanity checks in the environment and needed tools
1.8 +CT_DoLog INFO "Performing some trivial sanity checks"
1.9 +CT_TestAndAbort "Don't set LD_LIBRARY_PATH. It screws up the build." -n "${LD_LIBRARY_PATH}"
1.10 +CT_TestAndAbort "Don't set CFLAGS. It screws up the build." -n "${CFLAGS}"
1.11 +CT_TestAndAbort "Don't set CXXFLAGS. It screws up the build." -n "${CXXFLAGS}"
1.12 +CT_Test "GREP_OPTIONS screws up the build. Resetting." -n "${GREP_OPTIONS}"
1.13 +export GREP_OPTIONS=
1.14 +
1.15 +# Some sanity checks on paths content
1.16 +for d in \
1.17 + LOCAL_TARBALLS \
1.18 + WORK \
1.19 + PREFIX \
1.20 + INSTALL \
1.21 + ; do
1.22 + eval dir="\${CT_${d}_DIR}"
1.23 + case "${dir}" in
1.24 + *" "*)
1.25 +# CT_DoLog ERROR "'CT_${d}_DIR'='${dir}' contains a space in it."
1.26 +# CT_Abort "Don't use spaces in paths, it breaks things."
1.27 + CT_Abort "'CT_${d}_DIR'='${dir}' contains a space in it.\nDon't use spaces in paths, it breaks things."
1.28 + ;;
1.29 + esac
1.30 +done
1.31 +
1.32 # Where will we work?
1.33 CT_WORK_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/targets}"
1.34 CT_DoExecLog ALL mkdir -p "${CT_WORK_DIR}"
1.35 @@ -54,6 +79,7 @@
1.36 export PATH="${CT_BIN_OVERIDE_DIR}:${PATH}"
1.37
1.38 # Start date. Can't be done until we know the locale
1.39 +# Also requires the bin-override tools
1.40 CT_STAR_DATE=$(CT_DoDate +%s%N)
1.41 CT_STAR_DATE_HUMAN=$(CT_DoDate +%Y%m%d.%H%M%S)
1.42
1.43 @@ -67,20 +93,10 @@
1.44 CT_DoExecLog DEBUG grep -E '^(# |)CT_' .config
1.45 CT_EndStep
1.46
1.47 -# Some sanity checks in the environment and needed tools
1.48 -CT_DoLog INFO "Checking environment sanity"
1.49 -
1.50 CT_DoLog DEBUG "Unsetting and unexporting MAKEFLAGS"
1.51 unset MAKEFLAGS
1.52 export MAKEFLAGS
1.53
1.54 -# Other environment sanity checks
1.55 -CT_TestAndAbort "Don't set LD_LIBRARY_PATH. It screws up the build." -n "${LD_LIBRARY_PATH}"
1.56 -CT_TestAndAbort "Don't set CFLAGS. It screws up the build." -n "${CFLAGS}"
1.57 -CT_TestAndAbort "Don't set CXXFLAGS. It screws up the build." -n "${CXXFLAGS}"
1.58 -CT_Test "GREP_OPTIONS screws up the build. Resetting." -n "${GREP_OPTIONS}"
1.59 -export GREP_OPTIONS=
1.60 -
1.61 CT_DoLog INFO "Building environment variables"
1.62
1.63 # Include sub-scripts instead of calling them: that way, we do not have to
1.64 @@ -115,7 +131,7 @@
1.65 CT_CC_CORE_EXTRA_CONFIG="${CT_ARCH_CC_CORE_EXTRA_CONFIG} ${CT_CC_CORE_EXTRA_CONFIG}"
1.66 CT_CC_EXTRA_CONFIG="${CT_ARCH_CC_EXTRA_CONFIG} ${CT_CC_EXTRA_CONFIG}"
1.67
1.68 -# Create the working directories
1.69 +# Compute the working directories names
1.70 CT_TARBALLS_DIR="${CT_WORK_DIR}/tarballs"
1.71 CT_SRC_DIR="${CT_WORK_DIR}/src"
1.72 CT_BUILD_DIR="${CT_WORK_DIR}/${CT_TARGET}/build"
1.73 @@ -146,22 +162,6 @@
1.74 CT_SAVE_TARBALLS=
1.75 fi
1.76
1.77 -# Some more sanity checks now that we have all paths set up
1.78 -for d in \
1.79 - LOCAL_TARBALLS \
1.80 - WORK \
1.81 - PREFIX \
1.82 - INSTALL \
1.83 - ; do
1.84 - eval dir="\${CT_${d}_DIR}"
1.85 - case "${dir}" in
1.86 - *" "*)
1.87 - CT_DoLog ERROR "'CT_${d}_DIR'='${dir}' contains a space in it."
1.88 - CT_Abort "Don't use spaces in paths, it breaks things."
1.89 - ;;
1.90 - esac
1.91 -done
1.92 -
1.93 # Check now if we can write to the destination directory:
1.94 if [ -d "${CT_INSTALL_DIR}" ]; then
1.95 CT_TestAndAbort "Destination directory '${CT_INSTALL_DIR}' is not removable" ! -w $(dirname "${CT_INSTALL_DIR}")