1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/scripts/build/cc_gcc.sh Sun Mar 04 22:37:11 2007 +0000
1.3 @@ -0,0 +1,115 @@
1.4 +# This file adds the function to build the final 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_cc() {
1.9 + CT_DoStep INFO "Installing final C compiler"
1.10 +
1.11 + mkdir -p "${CT_BUILD_DIR}/build-cc"
1.12 + cd "${CT_BUILD_DIR}/build-cc"
1.13 +
1.14 + CT_DoLog EXTRA "Configuring C compiler"
1.15 +
1.16 + # Enable selected languages
1.17 + lang_opt="c"
1.18 + [ "${CT_CC_LANG_CXX}" = "y" ] && lang_opt="${lang_opt},c++"
1.19 + [ "${CT_CC_LANG_FORTRAN}" = "y" ] && lang_opt="${lang_opt},fortran"
1.20 + [ "${CT_CC_LANG_ADA}" = "y" ] && lang_opt="${lang_opt},ada"
1.21 + [ "${CT_CC_LANG_JAVA}" = "y" ] && lang_opt="${lang_opt},java"
1.22 + [ "${CT_CC_LANG_OBJC}" = "y" ] && lang_opt="${lang_opt},objc"
1.23 + [ "${CT_CC_LANG_OBJCXX}" = "y" ] && lang_opt="${lang_opt},obj-c++"
1.24 + CT_Test "Building Fortran language is not yet supported. Will try..." "${CT_CC_LANG_FORTRAN}" = "y"
1.25 + CT_Test "Building ADA language is not yet supported. Will try..." "${CT_CC_LANG_ADA}" = "y"
1.26 + CT_Test "Building Java language is not yet supported. Will try..." "${CT_CC_LANG_JAVA}" = "y"
1.27 + CT_Test "Building Objective-C language is not yet supported. Will try..." "${CT_CC_LANG_OBJC}" = "y"
1.28 + CT_Test "Building Objective-C++ language is not yet supported. Will try..." "${CT_CC_LANG_OBJCXX}" = "y"
1.29 + CT_Test "Building ${CT_CC_LANG_OTHERS} language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
1.30 + lang_opt=`echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/^(.*),*$/\1/;'`
1.31 +
1.32 + extra_config="--enable-languages=${lang_opt}"
1.33 + [ "${CT_ARCH_FLOAT_SW}" = "y" ] && extra_config="${extra_config} --with-float=soft"
1.34 + [ "${CT_SHARED_LIBS}" = "y" ] || extra_config="${extra_config} --disable-shared"
1.35 + [ -n "${CT_ARCH_CPU}" ] && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}"
1.36 + [ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}"
1.37 + [ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}"
1.38 + [ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}"
1.39 + if [ "${CT_TARGET_MULTILIB}" = "y" ]; then
1.40 + extra_config="${extra_config} --enable-multilib"
1.41 + else
1.42 + extra_config="${extra_config} --disable-multilib"
1.43 + fi
1.44 +
1.45 + CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
1.46 +
1.47 + # --enable-symvers=gnu really only needed for sh4 to work around a
1.48 + # detection problem only matters for gcc-3.2.x and later, I think.
1.49 + # --disable-nls to work around crash bug on ppc405, but also because
1.50 + # embedded systems don't really need message catalogs...
1.51 + CFLAGS="${CT_CFLAGS_FOR_HOST}" \
1.52 + "${CT_SRC_DIR}/${CT_CC_FILE}/configure" \
1.53 + ${CT_CANADIAN_OPT} \
1.54 + --target=${CT_TARGET} --host=${CT_HOST} \
1.55 + --prefix="${CT_PREFIX_DIR}" \
1.56 + ${CC_SYSROOT_ARG} \
1.57 + ${extra_config} \
1.58 + --with-local-prefix="${CT_SYSROOT_DIR}" \
1.59 + --disable-nls \
1.60 + --enable-threads=posix \
1.61 + --enable-symvers=gnu \
1.62 + --enable-__cxa_atexit \
1.63 + --enable-c99 \
1.64 + --enable-long-long \
1.65 + ${CT_CC_EXTRA_CONFIG} 2>&1 |CT_DoLog DEBUG
1.66 +
1.67 + if [ ! "${CT_CANADIAN}" = "y" ]; then
1.68 + CT_DoLog EXTRA "Building libiberty"
1.69 + make ${PARALLELMFLAGS} all-build-libiberty 2>&1 |CT_DoLog DEBUG
1.70 + fi
1.71 +
1.72 +
1.73 + # Idea from <cort.dougan at gmail.com>:
1.74 + # Fix lib/lib64 confusion for GCC 3.3.3 on PowerPC64 and x86_64.
1.75 + # GCC 3.4.0 and up don't suffer from this confusion, and don't need this
1.76 + # kludge.
1.77 + # FIXME: we should patch gcc's source rather than uglify crosstool.sh.
1.78 + # FIXME: is this needed for gcc-3.3.[56]?
1.79 + case "${CT_CC_FILE}" in
1.80 + gcc-3.3.[34])
1.81 + case "${CT_TARGET}" in
1.82 + powerpc64-unknown-linux-gnu|x86_64-unknown-linux-gnu)
1.83 + for d in `find "${CT_SYSROOT_DIR}" -name lib -type d -empty`; do
1.84 + if [ -d `dirname "${d}"`/lib64 ] ; then
1.85 + rm -rf "${d}"
1.86 + ln -s `dirname "${d}"`/lib64 "${d}"
1.87 + fi
1.88 + done ;;
1.89 + *) ;;
1.90 + esac ;;
1.91 + esac
1.92 +
1.93 + CT_DoLog EXTRA "Building C compiler"
1.94 + make ${PARALLELMFLAGS} all 2>&1 |CT_DoLog DEBUG
1.95 +
1.96 + CT_DoLog EXTRA "Installing C compiler"
1.97 + make install 2>&1 |CT_DoLog DEBUG
1.98 +
1.99 + # FIXME: shouldn't people who want this just --disable-multilib in final gcc
1.100 + # and be done with it?
1.101 + # This code should probably be deleted, it was written long ago and hasn't
1.102 + # been tested in ages.
1.103 + # kludge: If the chip does not have a floating point unit
1.104 + # (i.e. if GLIBC_EXTRA_CONFIG contains --without-fp),
1.105 + # and there are shared libraries in /lib/nof, copy them to /lib
1.106 + # so they get used by default.
1.107 + # FIXME: only rs6000/powerpc seem to use nof. See MULTILIB_DIRNAMES
1.108 + # in $GCC_DIR/gcc/config/$TARGET/* to see what your arch calls it.
1.109 + #case "${CT_LIBC_EXTRA_CONFIG}" in
1.110 + # *--without-fp*)
1.111 + # if test -d "${CT_SYSROOT_DIR}/lib/nof"; then
1.112 + # cp -af "${CT_SYSROOT_DIR}/lib/nof/"*.so* "${CT_SYSROOT_DIR}/lib" || true
1.113 + # fi
1.114 + # ;;
1.115 + #esac
1.116 +
1.117 + CT_EndStep
1.118 +}