cc/gcc: implement default for core options
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jun 13 20:31:42 2010 +0200 (2010-06-13)
changeset 19804a3ef29eadcd
parent 1979 22ce0c19f06a
child 1981 7130357d712b
cc/gcc: implement default for core options
scripts/build/cc/gcc.sh
     1.1 --- a/scripts/build/cc/gcc.sh	Sun Jun 13 20:25:00 2010 +0200
     1.2 +++ b/scripts/build/cc/gcc.sh	Sun Jun 13 20:31:42 2010 +0200
     1.3 @@ -49,7 +49,7 @@
     1.4      case "${CT_BARE_METAL},${CT_CANADIAN},${CT_THREADS}" in
     1.5          y,*,*)  do_cc_core mode=baremetal build_libgcc=yes;;
     1.6          ,y,*)   ;;
     1.7 -        ,,nptl) do_cc_core mode=static build_libgcc=no;;
     1.8 +        ,,nptl) do_cc_core mode=static;;
     1.9          *)      ;;
    1.10      esac
    1.11  }
    1.12 @@ -71,7 +71,7 @@
    1.13          *)  if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then
    1.14                  do_cc_core mode=static build_libgcc=yes
    1.15              else
    1.16 -                do_cc_core mode=static build_libgcc=no
    1.17 +                do_cc_core mode=static
    1.18              fi
    1.19              ;;
    1.20      esac
    1.21 @@ -82,27 +82,21 @@
    1.22  # This function is used to build both the static and the shared core C conpiler,
    1.23  # with or without the target libgcc. We need to know wether:
    1.24  #  - we're building static, shared or bare metal: mode=[static|shared|baremetal]
    1.25 -#  - we need to build libgcc or not             : build_libgcc=[yes|no]
    1.26 +#  - we need to build libgcc or not             : build_libgcc=[yes|no]     (default: no)
    1.27  # Usage: do_cc_core_static mode=[static|shared|baremetal] build_libgcc=[yes|no]
    1.28  do_cc_core() {
    1.29      local mode
    1.30 -    local build_libgcc
    1.31 +    local build_libgcc=no
    1.32      local core_prefix_dir
    1.33      local lang_opt
    1.34      local tmp
    1.35      local -a extra_config
    1.36      local core_LDFLAGS
    1.37  
    1.38 -    eval $1
    1.39 -    eval $2
    1.40 -    CT_TestOrAbort "Internal Error: 'mode' must either 'static', 'shared' or 'baremetal', not '${mode:-(empty)}'" "${mode}" = "static" -o "${mode}" = "shared" -o "${mode}" = "baremetal"
    1.41 -    CT_TestOrAbort "Internal Error: 'build_libgcc' must be either 'yes' or 'no', not '${build_libgcc:-(empty)}'" "${build_libgcc}" = "yes" -o "${build_libgcc}" = "no"
    1.42 -    # In normal conditions, ( "${mode}" = "shared" ) implies
    1.43 -    # ( "${build_libgcc}" = "yes" ), but I won't check for that
    1.44 -
    1.45 -    CT_DoStep INFO "Installing ${mode} core C compiler"
    1.46 -    mkdir -p "${CT_BUILD_DIR}/build-cc-core-${mode}"
    1.47 -    cd "${CT_BUILD_DIR}/build-cc-core-${mode}"
    1.48 +    while [ $# -ne 0 ]; do
    1.49 +        eval "${1}"
    1.50 +        shift
    1.51 +    done
    1.52  
    1.53      lang_opt=c
    1.54      case "${mode}" in
    1.55 @@ -126,8 +120,15 @@
    1.56              [ "${CT_CC_LANG_CXX}" = "y" ] && lang_opt="${lang_opt},c++"
    1.57              copy_headers=n
    1.58              ;;
    1.59 +        *)
    1.60 +            CT_Abort "Internal Error: 'mode' must be one of: 'static', 'shared' or 'baremetal', not '${mode:-(empty)}'"
    1.61 +            ;;
    1.62      esac
    1.63  
    1.64 +    CT_DoStep INFO "Installing ${mode} core C compiler"
    1.65 +    mkdir -p "${CT_BUILD_DIR}/build-cc-core-${mode}"
    1.66 +    cd "${CT_BUILD_DIR}/build-cc-core-${mode}"
    1.67 +
    1.68      # Bare metal delivers the core compiler as final compiler, so add version info and bugurl
    1.69      [ -n "${CT_CC_BUGURL}" ]     && extra_config+=("--with-bugurl=${CT_CC_BUGURL}")
    1.70      [ -n "${CT_CC_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_CC_PKGVERSION}")