cc/gcc: pass the install prefix to the core passes
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jul 17 17:56:22 2011 +0200 (2011-07-17)
changeset 2889f3b2199620f1
parent 2888 dd71df95903a
child 2890 a59712c236df
cc/gcc: pass the install prefix to the core passes

Currently, the discrimination on the core compilers prefixes depends on
the type of core compiler to build.

This is not correct, and the caller of the core backend should specify
the prefix.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/cc/gcc.sh
     1.1 --- a/scripts/build/cc/gcc.sh	Sun Jul 17 17:54:21 2011 +0200
     1.2 +++ b/scripts/build/cc/gcc.sh	Sun Jul 17 17:56:22 2011 +0200
     1.3 @@ -68,6 +68,7 @@
     1.4              do_core=y
     1.5              core_opts+=( "mode=static" )
     1.6              core_opts+=( "complibs=${CT_COMPLIBS_DIR}" )
     1.7 +            core_opts+=( "prefix=${CT_CC_CORE_STATIC_PREFIX_DIR}" )
     1.8              ;;
     1.9          ,y,*)
    1.10              ;;
    1.11 @@ -75,6 +76,7 @@
    1.12              do_core=y
    1.13              core_opts+=( "mode=static" )
    1.14              core_opts+=( "complibs=${CT_COMPLIBS_DIR}" )
    1.15 +            core_opts+=( "prefix=${CT_CC_CORE_STATIC_PREFIX_DIR}" )
    1.16              ;;
    1.17          *)
    1.18              ;;
    1.19 @@ -103,6 +105,7 @@
    1.20              core_opts+=( "build_libgcc=yes" )
    1.21              core_opts+=( "build_libstdcxx=yes" )
    1.22              core_opts+=( "complibs=${CT_COMPLIBS_DIR}" )
    1.23 +            core_opts+=( "prefix=${CT_PREFIX_DIR}" )
    1.24              if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
    1.25                  core_opts+=( "build_staticlinked=yes" )
    1.26              fi
    1.27 @@ -114,17 +117,20 @@
    1.28              core_opts+=( "mode=shared" )
    1.29              core_opts+=( "build_libgcc=yes" )
    1.30              core_opts+=( "complibs=${CT_COMPLIBS_DIR}" )
    1.31 +            core_opts+=( "prefix=${CT_CC_CORE_SHARED_PREFIX_DIR}" )
    1.32              ;;
    1.33          ,,win32)
    1.34              do_core=y
    1.35              core_opts+=( "mode=static" )
    1.36              core_opts+=( "build_libgcc=yes" )
    1.37              core_opts+=( "complibs=${CT_COMPLIBS_DIR}" )
    1.38 +            core_opts+=( "prefix=${CT_CC_CORE_STATIC_PREFIX_DIR}" )
    1.39              ;;
    1.40          *)
    1.41              do_core=y
    1.42              core_opts+=( "mode=static" )
    1.43              core_opts+=( "complibs=${CT_COMPLIBS_DIR}" )
    1.44 +            core_opts+=( "prefix=${CT_CC_CORE_STATIC_PREFIX_DIR}" )
    1.45              if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then
    1.46                  core_opts+=( "build_libgcc=yes" )
    1.47              fi
    1.48 @@ -145,6 +151,7 @@
    1.49  #  - we need to build libstdc++ or not          : build_libstdcxx=[yes|no]    (default: no)
    1.50  #  - we need to build statically linked or not  : build_staticlinked=[yes|no] (default: no)
    1.51  #  - where to find the companion libs (prefix)  : complibs=<prefix_dir>       (no default value)
    1.52 +#  - the prefix to install into (directory)     : prefix=<directory>          (no default value)
    1.53  # Usage: do_cc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no]
    1.54  do_cc_core_backend() {
    1.55      local mode
    1.56 @@ -152,7 +159,7 @@
    1.57      local build_libstdcxx=no
    1.58      local build_staticlinked=no
    1.59      local build_manuals=no
    1.60 -    local core_prefix_dir
    1.61 +    local prefix
    1.62      local complibs
    1.63      local lang_opt
    1.64      local tmp
    1.65 @@ -169,7 +176,6 @@
    1.66      lang_opt=c
    1.67      case "${mode}" in
    1.68          static)
    1.69 -            core_prefix_dir="${CT_CC_CORE_STATIC_PREFIX_DIR}"
    1.70              extra_config+=("--with-newlib")
    1.71              extra_config+=("--enable-threads=no")
    1.72              extra_config+=("--disable-shared")
    1.73 @@ -177,12 +183,10 @@
    1.74                              # we copy an empty directory. So, who cares?
    1.75              ;;
    1.76          shared)
    1.77 -            core_prefix_dir="${CT_CC_CORE_SHARED_PREFIX_DIR}"
    1.78              extra_config+=("--enable-shared")
    1.79              copy_headers=y
    1.80              ;;
    1.81          baremetal)
    1.82 -            core_prefix_dir="${CT_PREFIX_DIR}"
    1.83              extra_config+=("--with-newlib")
    1.84              extra_config+=("--enable-threads=no")
    1.85              extra_config+=("--disable-shared")
    1.86 @@ -206,7 +210,7 @@
    1.87  
    1.88      if [ "${copy_headers}" = "y" ]; then
    1.89          CT_DoLog DEBUG "Copying headers to install area of bootstrap gcc, so it can build libgcc2"
    1.90 -        CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}" "${core_prefix_dir}/${CT_TARGET}/include"
    1.91 +        CT_DoExecLog ALL cp -a "${CT_HEADERS_DIR}" "${prefix}/${CT_TARGET}/include"
    1.92      fi
    1.93  
    1.94      CT_DoLog EXTRA "Configuring ${mode} core C compiler"
    1.95 @@ -352,7 +356,7 @@
    1.96          --build=${CT_BUILD}                         \
    1.97          --host=${CT_HOST}                           \
    1.98          --target=${CT_TARGET}                       \
    1.99 -        --prefix="${core_prefix_dir}"               \
   1.100 +        --prefix="${prefix}"                        \
   1.101          --with-local-prefix="${CT_SYSROOT_DIR}"     \
   1.102          --disable-libmudflap                        \
   1.103          ${CC_CORE_SYSROOT_ARG}                      \
   1.104 @@ -442,9 +446,9 @@
   1.105      # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
   1.106      # to call the C compiler with the same, somewhat canonical name.
   1.107      # check whether compiler has an extension
   1.108 -    file="$( ls -1 "${core_prefix_dir}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )"
   1.109 +    file="$( ls -1 "${prefix}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )"
   1.110      [ -z "${file}" ] || ext=".${file##*.}"
   1.111 -    CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${core_prefix_dir}/bin/${CT_TARGET}-cc${ext}"
   1.112 +    CT_DoExecLog ALL ln -sfv "${CT_TARGET}-gcc${ext}" "${prefix}/bin/${CT_TARGET}-cc${ext}"
   1.113  
   1.114      if [ "${CT_MULTILIB}" = "y" ]; then
   1.115          multilibs=( $( "${core_prefix_dir}/bin/${CT_TARGET}-gcc" -print-multi-lib   \