scripts/crosstool.sh
changeset 136 22b5ef41df97
parent 135 b2695c2f1919
child 137 927533f2b278
     1.1 --- a/scripts/crosstool.sh	Fri May 25 19:30:42 2007 +0000
     1.2 +++ b/scripts/crosstool.sh	Sun May 27 20:22:06 2007 +0000
     1.3 @@ -31,7 +31,7 @@
     1.4  #  - first of all, save stdout so we can see the live logs: fd #6
     1.5  exec 6>&1
     1.6  #  - then point stdout to the log file (temporary for now)
     1.7 -tmp_log_file="${CT_TOP_DIR}/$$.log"
     1.8 +tmp_log_file="${CT_TOP_DIR}/log.$$"
     1.9  exec >>"${tmp_log_file}"
    1.10  
    1.11  # Are we configured? We'll need that later...
    1.12 @@ -118,7 +118,8 @@
    1.13  # Note: we'll always install the core compiler in its own directory, so as to
    1.14  # not mix the two builds: core and final. Anyway, its generic, wether we use
    1.15  # a different compiler as core, or not.
    1.16 -CT_CC_CORE_PREFIX_DIR="${CT_BUILD_DIR}/${CT_CC}-core"
    1.17 +CT_CC_CORE_STATIC_PREFIX_DIR="${CT_BUILD_DIR}/${CT_CC}-core-static"
    1.18 +CT_CC_CORE_SHARED_PREFIX_DIR="${CT_BUILD_DIR}/${CT_CC}-core-shared"
    1.19  CT_STATE_DIR="${CT_TOP_DIR}/targets/${CT_TARGET}/state"
    1.20  
    1.21  # Make all path absolute, it so much easier!
    1.22 @@ -201,11 +202,12 @@
    1.23  mkdir -p "${CT_INSTALL_DIR}"
    1.24  mkdir -p "${CT_PREFIX_DIR}"
    1.25  mkdir -p "${CT_DEBUG_INSTALL_DIR}"
    1.26 -mkdir -p "${CT_CC_CORE_PREFIX_DIR}"
    1.27 +mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}"
    1.28 +mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}"
    1.29  mkdir -p "${CT_STATE_DIR}"
    1.30  
    1.31  # Kludge: CT_INSTALL_DIR and CT_PREFIX_DIR might have grown read-only if
    1.32 -# the previous build was successfull. To ba able to move the logfile there,
    1.33 +# the previous build was successfull. To be able to move the logfile there,
    1.34  # switch them back to read/write
    1.35  chmod -R u+w "${CT_INSTALL_DIR}" "${CT_PREFIX_DIR}"
    1.36  
    1.37 @@ -269,16 +271,22 @@
    1.38      mkdir -p "${CT_SYSROOT_DIR}/usr/lib"
    1.39  
    1.40      # Canadian-cross are really picky on the way they are built. Tweak the values.
    1.41 +    CT_UNIQ_BUILD=`echo "${CT_BUILD}" |sed -r -e 's/-/-build_/'`
    1.42      if [ "${CT_CANADIAN}" = "y" ]; then
    1.43          # Arrange so that gcc never, ever think that build system == host system
    1.44 -        CT_CANADIAN_OPT="--build=`echo \"${CT_BUILD}\" |sed -r -e 's/-/-build_/'`"
    1.45 +        CT_CANADIAN_OPT="--build=${CT_UNIQ_BUILD}"
    1.46          # We shall have a compiler for this target!
    1.47          # Do test here...
    1.48      else
    1.49          CT_HOST="${CT_BUILD}"
    1.50          CT_CANADIAN_OPT="--build=${CT_BUILD}"
    1.51          # Add the target toolchain in the path so that we can build the C library
    1.52 -        export PATH="${CT_PREFIX_DIR}/bin:${CT_CC_CORE_PREFIX_DIR}/bin:${PATH}"
    1.53 +        # Carefully add paths in the order we want them:
    1.54 +        #  - first try in ${CT_PREFIX_DIR}/bin
    1.55 +        #  - then try in ${CT_CC_CORE_SHARED_PREFIX_DIR}/bin
    1.56 +        #  - then try in ${CT_CC_CORE_STATIC_PREFIX_DIR}/bin
    1.57 +        #  - fall back to searching user's PATH
    1.58 +        export PATH="${CT_PREFIX_DIR}/bin:${CT_CC_CORE_SHARED_PREFIX_DIR}/bin:${CT_CC_CORE_STATIC_PREFIX_DIR}/bin:${PATH}"
    1.59      fi
    1.60  
    1.61      # Modify GCC_HOST to never be equal to $BUILD or $TARGET
    1.62 @@ -294,7 +302,7 @@
    1.63      # (Copied almost as-is from original crosstool):
    1.64      case "${CT_KERNEL},${CT_CANADIAN}" in
    1.65          cygwin,y) ;;
    1.66 -        *)        CT_HOST="`echo \"${CT_HOST}\" |sed -r -e 's/-/-host_/;'`";;
    1.67 +        *,y)      CT_HOST="`echo \"${CT_HOST}\" |sed -r -e 's/-/-host_/;'`";;
    1.68      esac
    1.69  
    1.70      # Ah! Recent versions of binutils need some of the build and/or host system
    1.71 @@ -304,10 +312,9 @@
    1.72      mkdir -p "${CT_PREFIX_DIR}/bin"
    1.73      for tool in ar as dlltool gcc g++ gnatbind gnatmake ld nm ranlib strip windres objcopy objdump; do
    1.74          if [ -n "`which ${tool}`" ]; then
    1.75 -            ln -sv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}"
    1.76 -            case "${CT_TOOLCHAIN_TYPE}" in
    1.77 -                cross|native)   ln -sv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}";;
    1.78 -            esac
    1.79 +            ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_BUILD}-${tool}"
    1.80 +            ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_UNIQ_BUILD}-${tool}"
    1.81 +            ln -sfv "`which ${tool}`" "${CT_PREFIX_DIR}/bin/${CT_HOST}-${tool}"
    1.82          fi |CT_DoLog DEBUG
    1.83      done
    1.84  
    1.85 @@ -392,8 +399,10 @@
    1.86                  kernel_check_config     \
    1.87                  kernel_headers          \
    1.88                  binutils                \
    1.89 +                cc_core_pass_1          \
    1.90                  libc_headers            \
    1.91 -                cc_core                 \
    1.92 +                libc_start_files        \
    1.93 +                cc_core_pass_2          \
    1.94                  libfloat                \
    1.95                  libc                    \
    1.96                  cc                      \