summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@free.fr>2012-04-02 20:54:30 (GMT)
committerYann E. MORIN" <yann.morin.1998@free.fr>2012-04-02 20:54:30 (GMT)
commitb485733f263b6dafdb691fe877bce5c1135ea7c0 (patch)
treed4176023fff467cd9861858dd0dafa750c48d043
parent6471f1598c949b4ce8af441aeedd61273ca5df3a (diff)
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>
-rw-r--r--scripts/build/cc/gcc.sh44
-rw-r--r--steps.mk2
2 files changed, 43 insertions, 3 deletions
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index ac217d6..f177474 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -481,8 +481,48 @@ do_cc_core_backend() {
}
#------------------------------------------------------------------------------
-# Build final gcc
-do_cc() {
+# Build complete gcc to run on build
+do_cc_for_build() {
+ local -a build_final_opts
+ local build_final_backend
+
+ # In case we're canadian or cross-native, it seems that a
+ # real, complete compiler is needed?!? WTF? Sigh...
+ # Otherwise, there is nothing to do.
+ case "${CT_TOOLCHAIN_TYPE}" in
+ native|cross) return 0;;
+ esac
+
+ build_final_opts+=( "host=${CT_BUILD}" )
+ build_final_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
+ build_final_opts+=( "complibs=${CT_BUILDTOOLS_PREFIX_DIR}" )
+ build_final_opts+=( "lang_list=$( cc_gcc_lang_list )" )
+ if [ "${CT_BARE_METAL}" = "y" ]; then
+ # In the tests I've done, bare-metal was not impacted by the
+ # lack of such a compiler, but better safe than sorry...
+ build_final_opts+=( "mode=baremetal" )
+ build_final_opts+=( "build_libgcc=yes" )
+ build_final_opts+=( "build_libstdcxx=yes" )
+ if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
+ build_final_opts+=( "build_staticlinked=yes" )
+ fi
+ build_final_backend=do_cc_core_backend
+ else
+ build_final_backend=do_cc_backend
+ fi
+
+ CT_DoStep INFO "Installing final compiler for build"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final-build-${CT_BUILD}"
+
+ "${build_final_backend}" "${build_final_opts[@]}"
+
+ CT_Popd
+ CT_EndStep
+}
+
+#------------------------------------------------------------------------------
+# Build final gcc to run on host
+do_cc_for_host() {
local -a final_opts
local final_backend
diff --git a/steps.mk b/steps.mk
index f58ea29..9822c95 100644
--- a/steps.mk
+++ b/steps.mk
@@ -31,7 +31,7 @@ CT_STEPS := libc_check_config \
libc_start_files \
cc_core_pass_2 \
libc \
- cc \
+ cc_for_host \
libc_finish \
libelf_for_target \
binutils_for_target \