scripts/build/cc_core_gcc.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue May 08 12:12:40 2007 +0000 (2007-05-08)
changeset 75 56db62f2932a
parent 63 89b41dbffe8d
child 78 c3868084d81a
permissions -rw-r--r--
Cosmetics: newline at end of file, ports are now a separate option.
     1 # This file adds the function to build the core gcc C compiler
     2 # Copyright 2007 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 # Download core gcc
     6 do_cc_core_get() {
     7     # Ah! gcc folks are kind of 'different': they store the tarballs in
     8     # subdirectories of the same name! That's because gcc is such /crap/ that
     9     # it is such /big/ that it needs being splitted for distribution! Sad. :-(
    10     # Arrgghh! Some of those versions does not follow this convention:
    11     # gcc-3.3.3 lives in releases/gcc-3.3.3, while gcc-2.95.* isn't in a
    12     # subdirectory! You bastard!
    13     CT_GetFile "${CT_CC_CORE_FILE}"                                    \
    14                ftp://ftp.gnu.org/gnu/gcc/${CT_CC_CORE_FILE}            \
    15                ftp://ftp.gnu.org/gnu/gcc/releases/${CT_CC_CORE_FILE}   \
    16                ftp://ftp.gnu.org/gnu/gcc
    17 }
    18 
    19 # Extract core gcc
    20 do_cc_core_extract() {
    21     CT_ExtractAndPatch "${CT_CC_CORE_FILE}"
    22 }
    23 
    24 # Build core gcc
    25 do_cc_core() {
    26     mkdir -p "${CT_BUILD_DIR}/build-cc-core"
    27     cd "${CT_BUILD_DIR}/build-cc-core"
    28 
    29     CT_DoStep INFO "Installing core C compiler"
    30 
    31     CT_DoLog EXTRA "Copy headers to install area of bootstrap gcc, so it can build libgcc2"
    32     mkdir -p "${CT_CC_CORE_PREFIX_DIR}/${CT_TARGET}/include"
    33     cp -r "${CT_HEADERS_DIR}"/* "${CT_CC_CORE_PREFIX_DIR}/${CT_TARGET}/include" 2>&1 |CT_DoLog DEBUG
    34 
    35     CT_DoLog EXTRA "Configuring core C compiler"
    36 
    37     extra_config=""
    38     [ "${CT_ARCH_FLOAT_SW}" = "y" ] && extra_config="${extra_config} --with-float=soft"
    39     [ -n "${CT_ARCH_ABI}" ]  && extra_config="${extra_config} --with-abi=${CT_ARCH_ABI}"
    40     [ -n "${CT_ARCH_CPU}" ]  && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}"
    41     [ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}"
    42     [ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}"
    43     [ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}"
    44     [ "${CT_CC_CXA_ATEXIT}" == "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
    45 
    46     CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
    47 
    48     # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
    49     CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
    50     "${CT_SRC_DIR}/${CT_CC_CORE_FILE}/configure"    \
    51         ${CT_CANADIAN_OPT}                          \
    52         --target=${CT_TARGET}                       \
    53         --host=${CT_HOST}                           \
    54         --prefix="${CT_CC_CORE_PREFIX_DIR}"         \
    55         --with-local-prefix="${CT_SYSROOT_DIR}"     \
    56         --disable-multilib                          \
    57         --with-newlib                               \
    58         ${CC_CORE_SYSROOT_ARG}                      \
    59         ${extra_config}                             \
    60         --disable-nls                               \
    61         --enable-threads=no                         \
    62         --enable-symvers=gnu                        \
    63         --enable-languages=c                        \
    64         --disable-shared                            \
    65         ${CT_CC_CORE_EXTRA_CONFIG}                  2>&1 |CT_DoLog DEBUG
    66 
    67     if [ ! "${CT_CANADIAN}" = "y" ]; then
    68         CT_DoLog EXTRA "Building libiberty"
    69         make ${PARALLELMFLAGS} all-build-libiberty 2>&1 |CT_DoLog DEBUG
    70     fi
    71 
    72     CT_DoLog EXTRA "Building core C compiler"
    73     make ${PARALLELMFLAGS} all-gcc 2>&1 |CT_DoLog DEBUG
    74 
    75     CT_DoLog EXTRA "Installing core C compiler"
    76     make install-gcc 2>&1 |CT_DoLog DEBUG
    77 
    78     CT_EndStep
    79 }
    80