1.1 --- a/scripts/build/cc_core_gcc.sh Tue Aug 14 20:11:44 2007 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,195 +0,0 @@
1.4 -# This file adds the function to build the core gcc C compiler
1.5 -# Copyright 2007 Yann E. MORIN
1.6 -# Licensed under the GPL v2. See COPYING in the root of this package
1.7 -
1.8 -do_print_filename() {
1.9 - [ "${CT_CC_CORE}" = "gcc" ] || return 0
1.10 - echo "gcc-${CT_CC_CORE_VERSION}"
1.11 -}
1.12 -
1.13 -# Download core gcc
1.14 -do_cc_core_get() {
1.15 - # Ah! gcc folks are kind of 'different': they store the tarballs in
1.16 - # subdirectories of the same name! That's because gcc is such /crap/ that
1.17 - # it is such /big/ that it needs being splitted for distribution! Sad. :-(
1.18 - # Arrgghh! Some of those versions does not follow this convention:
1.19 - # gcc-3.3.3 lives in releases/gcc-3.3.3, while gcc-2.95.* isn't in a
1.20 - # subdirectory! You bastard!
1.21 - CT_GetFile "${CT_CC_CORE_FILE}" \
1.22 - ftp://ftp.gnu.org/gnu/gcc/${CT_CC_CORE_FILE} \
1.23 - ftp://ftp.gnu.org/gnu/gcc/releases/${CT_CC_CORE_FILE} \
1.24 - ftp://ftp.gnu.org/gnu/gcc
1.25 -}
1.26 -
1.27 -# Extract core gcc
1.28 -do_cc_core_extract() {
1.29 - CT_ExtractAndPatch "${CT_CC_CORE_FILE}"
1.30 -}
1.31 -
1.32 -# Core gcc pass 1
1.33 -do_cc_core_pass_1() {
1.34 - # In case we're NPTL, build the static core gcc;
1.35 - # in any other case, do nothing.
1.36 - case "${CT_THREADS}" in
1.37 - nptl) do_cc_core_static;;
1.38 - *) ;;
1.39 - esac
1.40 -}
1.41 -
1.42 -# Core gcc pass 2
1.43 -do_cc_core_pass_2() {
1.44 - # In case we're NPTL, build the shared core gcc,
1.45 - # in any other case, build the static core gcc.
1.46 - case "${CT_THREADS}" in
1.47 - nptl) do_cc_core_shared;;
1.48 - *) do_cc_core_static;;
1.49 - esac
1.50 -}
1.51 -
1.52 -# Build static core gcc
1.53 -do_cc_core_static() {
1.54 - mkdir -p "${CT_BUILD_DIR}/build-cc-core-static"
1.55 - cd "${CT_BUILD_DIR}/build-cc-core-static"
1.56 -
1.57 - CT_DoStep INFO "Installing static core C compiler"
1.58 -
1.59 - CT_DoLog EXTRA "Copying headers to install area of bootstrap gcc, so it can build libgcc2"
1.60 - mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/include"
1.61 - cp -r "${CT_HEADERS_DIR}"/* "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/include" 2>&1 |CT_DoLog DEBUG
1.62 -
1.63 - CT_DoLog EXTRA "Configuring static core C compiler"
1.64 -
1.65 - extra_config=""
1.66 - [ "${CT_ARCH_FLOAT_SW}" = "y" ] && extra_config="${extra_config} --with-float=soft"
1.67 - [ -n "${CT_ARCH_ABI}" ] && extra_config="${extra_config} --with-abi=${CT_ARCH_ABI}"
1.68 - [ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}"
1.69 - [ -n "${CT_ARCH_CPU}" ] && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}"
1.70 - [ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}"
1.71 - [ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}"
1.72 - [ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
1.73 -
1.74 - CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
1.75 -
1.76 - # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
1.77 - CFLAGS="${CT_CFLAGS_FOR_HOST}" \
1.78 - "${CT_SRC_DIR}/${CT_CC_CORE_FILE}/configure" \
1.79 - ${CT_CANADIAN_OPT} \
1.80 - --host=${CT_HOST} \
1.81 - --target=${CT_TARGET} \
1.82 - --prefix="${CT_CC_CORE_STATIC_PREFIX_DIR}" \
1.83 - --with-local-prefix="${CT_SYSROOT_DIR}" \
1.84 - --disable-multilib \
1.85 - --with-newlib \
1.86 - ${CC_CORE_SYSROOT_ARG} \
1.87 - ${extra_config} \
1.88 - --disable-nls \
1.89 - --enable-threads=no \
1.90 - --enable-symvers=gnu \
1.91 - --enable-languages=c \
1.92 - --disable-shared \
1.93 - ${CT_CC_CORE_EXTRA_CONFIG} 2>&1 |CT_DoLog ALL
1.94 -
1.95 - if [ "${CT_CANADIAN}" = "y" ]; then
1.96 - CT_DoLog EXTRA "Building libiberty"
1.97 - make ${PARALLELMFLAGS} all-build-libiberty 2>&1 |CT_DoLog ALL
1.98 - fi
1.99 -
1.100 - CT_DoLog EXTRA "Building static core C compiler"
1.101 - make ${PARALLELMFLAGS} all-gcc 2>&1 |CT_DoLog ALL
1.102 -
1.103 - CT_DoLog EXTRA "Installing static core C compiler"
1.104 - make install-gcc 2>&1 |CT_DoLog ALL
1.105 -
1.106 - CT_EndStep
1.107 -}
1.108 -
1.109 -# Build shared core gcc
1.110 -do_cc_core_shared() {
1.111 - mkdir -p "${CT_BUILD_DIR}/build-cc-core-shared"
1.112 - cd "${CT_BUILD_DIR}/build-cc-core-shared"
1.113 -
1.114 - CT_DoStep INFO "Installing shared core C compiler"
1.115 -
1.116 - CT_DoLog EXTRA "Copying headers to install area of bootstrap gcc, so it can build libgcc2"
1.117 - mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/include"
1.118 - cp -r "${CT_HEADERS_DIR}"/* "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/include" 2>&1 |CT_DoLog DEBUG
1.119 -
1.120 - CT_DoLog EXTRA "Configuring shared core C compiler"
1.121 -
1.122 - extra_config=""
1.123 - [ "${CT_ARCH_FLOAT_SW}" = "y" ] && extra_config="${extra_config} --with-float=soft"
1.124 - [ -n "${CT_ARCH_ABI}" ] && extra_config="${extra_config} --with-abi=${CT_ARCH_ABI}"
1.125 - [ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}"
1.126 - [ -n "${CT_ARCH_CPU}" ] && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}"
1.127 - [ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}"
1.128 - [ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}"
1.129 - [ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
1.130 -
1.131 - CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
1.132 -
1.133 - CFLAGS="${CT_CFLAGS_FOR_HOST}" \
1.134 - "${CT_SRC_DIR}/${CT_CC_CORE_FILE}/configure" \
1.135 - ${CT_CANADIAN_OPT} \
1.136 - --target=${CT_TARGET} \
1.137 - --host=${CT_HOST} \
1.138 - --prefix="${CT_CC_CORE_SHARED_PREFIX_DIR}" \
1.139 - --with-local-prefix="${CT_SYSROOT_DIR}" \
1.140 - --disable-multilib \
1.141 - ${CC_CORE_SYSROOT_ARG} \
1.142 - ${extra_config} \
1.143 - --disable-nls \
1.144 - --enable-symvers=gnu \
1.145 - --enable-languages=c \
1.146 - --enable-shared \
1.147 - ${CT_CC_CORE_EXTRA_CONFIG} 2>&1 |CT_DoLog ALL
1.148 -
1.149 - # HACK: we need to override SHLIB_LC from gcc/config/t-slibgcc-elf-ver or
1.150 - # gcc/config/t-libunwind so -lc is removed from the link for
1.151 - # libgcc_s.so, as we do not have a target -lc yet.
1.152 - # This is not as ugly as it appears to be ;-) All symbols get resolved
1.153 - # during the glibc build, and we provide a proper libgcc_s.so for the
1.154 - # cross toolchain during the final gcc build.
1.155 - #
1.156 - # As we cannot modify the source tree, nor override SHLIB_LC itself
1.157 - # during configure or make, we have to edit the resultant
1.158 - # gcc/libgcc.mk itself to remove -lc from the link.
1.159 - # This causes us to have to jump through some hoops...
1.160 - #
1.161 - # To produce libgcc.mk to edit we firstly require libiberty.a,
1.162 - # so we configure then build it.
1.163 - # Next we have to configure gcc, create libgcc.mk then edit it...
1.164 - # So much easier if we just edit the source tree, but hey...
1.165 - if [ ! -f "${CT_SRC_DIR}/${CT_CC_CORE_FILE}/gcc/BASE-VER" ]; then
1.166 - make configure-libiberty
1.167 - make -C libiberty libiberty.a
1.168 - make configure-gcc
1.169 - make configure-libcpp
1.170 - make all-libcpp
1.171 - else
1.172 - make configure-gcc
1.173 - make configure-libcpp
1.174 - make configure-build-libiberty
1.175 - make all-libcpp
1.176 - make all-build-libiberty
1.177 - fi 2>&1 |CT_DoLog ALL
1.178 - # HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here.
1.179 - if [ -d "${CT_SRC_DIR}/${CT_CC_CORE_FILE}/libdecnumber" ]; then
1.180 - make configure-libdecnumber
1.181 - make -C libdecnumber libdecnumber.a
1.182 - fi 2>&1 |CT_DoLog ALL
1.183 - make -C gcc libgcc.mk 2>&1 |CT_DoLog ALL
1.184 - sed -r -i -e 's@-lc@@g' gcc/libgcc.mk
1.185 -
1.186 - if [ "${CT_CANADIAN}" = "y" ]; then
1.187 - CT_DoLog EXTRA "Building libiberty"
1.188 - make ${PARALLELMFLAGS} all-build-libiberty 2>&1 |CT_DoLog ALL
1.189 - fi
1.190 -
1.191 - CT_DoLog EXTRA "Building shared core C compiler"
1.192 - make ${PARALLELMFLAGS} all-gcc 2>&1 |CT_DoLog ALL
1.193 -
1.194 - CT_DoLog EXTRA "Installing shared core C compiler"
1.195 - make install-gcc 2>&1 |CT_DoLog ALL
1.196 -
1.197 - CT_EndStep
1.198 -}