cc/gcc: add build frontend
author"Yann E. MORIN" <yann.morin.1998@free.fr>
Mon Apr 02 22:54:30 2012 +0200 (2012-04-02)
changeset 29354a563f872440
parent 2934 5926d424d6c5
child 2936 2dfea349d307
cc/gcc: add build frontend

Bizarrely enough, the core gcc are not enough to be able to build a
canadian cross, and a real, full cross compiler is required so that
the canadian cross can be properly built... WTF?!? Sigh...

Add a build-frontend, as was done for the binutils and the complibs.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
scripts/build/cc/gcc.sh
steps.mk
     1.1 --- a/scripts/build/cc/gcc.sh	Sun Apr 01 19:07:11 2012 +0200
     1.2 +++ b/scripts/build/cc/gcc.sh	Mon Apr 02 22:54:30 2012 +0200
     1.3 @@ -481,8 +481,48 @@
     1.4  }
     1.5  
     1.6  #------------------------------------------------------------------------------
     1.7 -# Build final gcc
     1.8 -do_cc() {
     1.9 +# Build complete gcc to run on build
    1.10 +do_cc_for_build() {
    1.11 +    local -a build_final_opts
    1.12 +    local build_final_backend
    1.13 +
    1.14 +    # In case we're canadian or cross-native, it seems that a
    1.15 +    # real, complete compiler is needed?!? WTF? Sigh...
    1.16 +    # Otherwise, there is nothing to do.
    1.17 +    case "${CT_TOOLCHAIN_TYPE}" in
    1.18 +        native|cross)   return 0;;
    1.19 +    esac
    1.20 +
    1.21 +    build_final_opts+=( "host=${CT_BUILD}" )
    1.22 +    build_final_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    1.23 +    build_final_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" )
    1.24 +    build_final_opts+=( "lang_list=$( cc_gcc_lang_list )" )
    1.25 +    if [ "${CT_BARE_METAL}" = "y" ]; then
    1.26 +        # In the tests I've done, bare-metal was not impacted by the
    1.27 +        # lack of such a compiler, but better safe than sorry...
    1.28 +        build_final_opts+=( "mode=baremetal" )
    1.29 +        build_final_opts+=( "build_libgcc=yes" )
    1.30 +        build_final_opts+=( "build_libstdcxx=yes" )
    1.31 +        if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
    1.32 +            build_final_opts+=( "build_staticlinked=yes" )
    1.33 +        fi
    1.34 +        build_final_backend=do_cc_core_backend
    1.35 +    else
    1.36 +        build_final_backend=do_cc_backend
    1.37 +    fi
    1.38 +
    1.39 +    CT_DoStep INFO "Installing final compiler for build"
    1.40 +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final-build-${CT_BUILD}"
    1.41 +
    1.42 +    "${build_final_backend}" "${build_final_opts[@]}"
    1.43 +
    1.44 +    CT_Popd
    1.45 +    CT_EndStep
    1.46 +}
    1.47 +
    1.48 +#------------------------------------------------------------------------------
    1.49 +# Build final gcc to run on host
    1.50 +do_cc_for_host() {
    1.51      local -a final_opts
    1.52      local final_backend
    1.53  
     2.1 --- a/steps.mk	Sun Apr 01 19:07:11 2012 +0200
     2.2 +++ b/steps.mk	Mon Apr 02 22:54:30 2012 +0200
     2.3 @@ -31,7 +31,7 @@
     2.4              libc_start_files    \
     2.5              cc_core_pass_2      \
     2.6              libc                \
     2.7 -            cc                  \
     2.8 +            cc_for_host         \
     2.9              libc_finish         \
    2.10              libelf_for_target   \
    2.11              binutils_for_target \