1.1 --- a/scripts/build/cc/gcc.sh Tue Aug 23 21:11:26 2011 +0200
1.2 +++ b/scripts/build/cc/gcc.sh Sun Jul 17 22:46:47 2011 +0200
1.3 @@ -487,16 +487,45 @@
1.4 #------------------------------------------------------------------------------
1.5 # Build final gcc
1.6 do_cc() {
1.7 + local -a final_opts
1.8 +
1.9 + final_opts+=( "host=${CT_HOST}" )
1.10 + final_opts+=( "prefix=${CT_PREFIX_DIR}" )
1.11 + final_opts+=( "complibs=${CT_COMPLIBS_DIR}" )
1.12 + final_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
1.13 +
1.14 + do_cc_backend "${final_opts[@]}"
1.15 +}
1.16 +
1.17 +#------------------------------------------------------------------------------
1.18 +# Build final gcc
1.19 +# Usage: do_cc_backend param=value ...
1.20 +# and so on for other parameters:
1.21 +# Parameter : Definition : Type : Default
1.22 +# host : the host we run onto : tuple : (none)
1.23 +# prefix : the runtime prefix : dir : (none)
1.24 +# complibs : the companion libraries prefix : dir : (none)
1.25 +# cflags : the host CFLAGS : string : (empty)
1.26 +do_cc_backend() {
1.27 + local host
1.28 + local prefix
1.29 + local complibs
1.30 + local cflags
1.31 local -a host_libstdcxx_flags
1.32 local -a extra_config
1.33 local -a final_LDFLAGS
1.34 local tmp
1.35 + local arg
1.36
1.37 # If building for bare metal, nothing to be done here, the static core conpiler is enough!
1.38 [ "${CT_BARE_METAL}" = "y" ] && return 0
1.39
1.40 CT_DoStep INFO "Installing final compiler"
1.41
1.42 + for arg in "$@"; do
1.43 + eval "${arg// /\\ }"
1.44 + done
1.45 +
1.46 mkdir -p "${CT_BUILD_DIR}/build-cc"
1.47 cd "${CT_BUILD_DIR}/build-cc"
1.48
1.49 @@ -592,26 +621,26 @@
1.50 fi
1.51
1.52 if [ "${CT_CC_GCC_USE_GMP_MPFR}" = "y" ]; then
1.53 - extra_config+=("--with-gmp=${CT_COMPLIBS_DIR}")
1.54 - extra_config+=("--with-mpfr=${CT_COMPLIBS_DIR}")
1.55 + extra_config+=("--with-gmp=${complibs}")
1.56 + extra_config+=("--with-mpfr=${complibs}")
1.57 fi
1.58 if [ "${CT_CC_GCC_USE_MPC}" = "y" ]; then
1.59 - extra_config+=("--with-mpc=${CT_COMPLIBS_DIR}")
1.60 + extra_config+=("--with-mpc=${complibs}")
1.61 fi
1.62 if [ "${CT_CC_GCC_USE_GRAPHITE}" = "y" ]; then
1.63 - extra_config+=("--with-ppl=${CT_COMPLIBS_DIR}")
1.64 + extra_config+=("--with-ppl=${complibs}")
1.65 # With PPL 0.11+, also pull libpwl if needed
1.66 if [ "${CT_PPL_NEEDS_LIBPWL}" = "y" ]; then
1.67 - host_libstdcxx_flags+=("-L${CT_COMPLIBS_DIR}/lib")
1.68 + host_libstdcxx_flags+=("-L${complibs}/lib")
1.69 host_libstdcxx_flags+=("-lpwl")
1.70 fi
1.71 - extra_config+=("--with-cloog=${CT_COMPLIBS_DIR}")
1.72 + extra_config+=("--with-cloog=${complibs}")
1.73 elif [ "${CT_CC_GCC_HAS_GRAPHITE}" = "y" ]; then
1.74 extra_config+=("--with-ppl=no")
1.75 extra_config+=("--with-cloog=no")
1.76 fi
1.77 if [ "${CT_CC_GCC_USE_LTO}" = "y" ]; then
1.78 - extra_config+=("--with-libelf=${CT_COMPLIBS_DIR}")
1.79 + extra_config+=("--with-libelf=${complibs}")
1.80 elif [ "${CT_CC_GCC_HAS_LTO}" = "y" ]; then
1.81 extra_config+=("--with-libelf=no")
1.82 fi
1.83 @@ -698,16 +727,16 @@
1.84
1.85 CT_DoExecLog CFG \
1.86 CC_FOR_BUILD="${CT_BUILD}-gcc" \
1.87 - CFLAGS="${CT_CFLAGS_FOR_HOST}" \
1.88 + CFLAGS="${cflags}" \
1.89 LDFLAGS="${final_LDFLAGS[*]}" \
1.90 CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
1.91 CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \
1.92 LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \
1.93 "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \
1.94 --build=${CT_BUILD} \
1.95 - --host=${CT_HOST} \
1.96 + --host=${host} \
1.97 --target=${CT_TARGET} \
1.98 - --prefix="${CT_PREFIX_DIR}" \
1.99 + --prefix="${prefix}" \
1.100 ${CC_SYSROOT_ARG} \
1.101 "${extra_config[@]}" \
1.102 --with-local-prefix="${CT_SYSROOT_DIR}" \