Try to further fix using of the build and/or host tools for binutils to build properly.
1 # This file adds the function to build the final gcc C compiler
2 # Copyright 2007 Yann E. MORIN
3 # Licensed under the GPL v2. See COPYING in the root of this package
6 CT_DoStep INFO "Installing final C compiler"
8 mkdir -p "${CT_BUILD_DIR}/build-cc"
9 cd "${CT_BUILD_DIR}/build-cc"
11 CT_DoLog EXTRA "Configuring C compiler"
13 # Enable selected languages
15 [ "${CT_CC_LANG_CXX}" = "y" ] && lang_opt="${lang_opt},c++"
16 [ "${CT_CC_LANG_FORTRAN}" = "y" ] && lang_opt="${lang_opt},fortran"
17 [ "${CT_CC_LANG_ADA}" = "y" ] && lang_opt="${lang_opt},ada"
18 [ "${CT_CC_LANG_JAVA}" = "y" ] && lang_opt="${lang_opt},java"
19 [ "${CT_CC_LANG_OBJC}" = "y" ] && lang_opt="${lang_opt},objc"
20 [ "${CT_CC_LANG_OBJCXX}" = "y" ] && lang_opt="${lang_opt},obj-c++"
21 CT_Test "Building Fortran language is not yet supported. Will try..." "${CT_CC_LANG_FORTRAN}" = "y"
22 CT_Test "Building ADA language is not yet supported. Will try..." "${CT_CC_LANG_ADA}" = "y"
23 CT_Test "Building Java language is not yet supported. Will try..." "${CT_CC_LANG_JAVA}" = "y"
24 CT_Test "Building Objective-C language is not yet supported. Will try..." "${CT_CC_LANG_OBJC}" = "y"
25 CT_Test "Building Objective-C++ language is not yet supported. Will try..." "${CT_CC_LANG_OBJCXX}" = "y"
26 CT_Test "Building ${CT_CC_LANG_OTHERS} language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
27 lang_opt=`echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/^(.*),*$/\1/;'`
29 extra_config="--enable-languages=${lang_opt}"
30 [ "${CT_ARCH_FLOAT_SW}" = "y" ] && extra_config="${extra_config} --with-float=soft"
31 [ "${CT_SHARED_LIBS}" = "y" ] || extra_config="${extra_config} --disable-shared"
32 [ -n "${CT_ARCH_CPU}" ] && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}"
33 [ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}"
34 [ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}"
35 [ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}"
36 if [ "${CT_TARGET_MULTILIB}" = "y" ]; then
37 extra_config="${extra_config} --enable-multilib"
39 extra_config="${extra_config} --disable-multilib"
41 [ "${CT_CC_CXA_ATEXIT}" == "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
43 CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
45 # --enable-symvers=gnu really only needed for sh4 to work around a
46 # detection problem only matters for gcc-3.2.x and later, I think.
47 # --disable-nls to work around crash bug on ppc405, but also because
48 # embedded systems don't really need message catalogs...
49 CFLAGS="${CT_CFLAGS_FOR_HOST}" \
50 "${CT_SRC_DIR}/${CT_CC_FILE}/configure" \
52 --target=${CT_TARGET} --host=${CT_HOST} \
53 --prefix="${CT_PREFIX_DIR}" \
56 --with-local-prefix="${CT_SYSROOT_DIR}" \
58 --enable-threads=posix \
59 --enable-symvers=gnu \
62 ${CT_CC_EXTRA_CONFIG} 2>&1 |CT_DoLog DEBUG
64 if [ ! "${CT_CANADIAN}" = "y" ]; then
65 CT_DoLog EXTRA "Building libiberty"
66 make ${PARALLELMFLAGS} all-build-libiberty 2>&1 |CT_DoLog DEBUG
70 # Idea from <cort.dougan at gmail.com>:
71 # Fix lib/lib64 confusion for GCC 3.3.3 on PowerPC64 and x86_64.
72 # GCC 3.4.0 and up don't suffer from this confusion, and don't need this
74 # FIXME: we should patch gcc's source rather than uglify crosstool.sh.
75 # FIXME: is this needed for gcc-3.3.[56]?
76 case "${CT_CC_FILE}" in
78 case "${CT_TARGET}" in
79 powerpc64-unknown-linux-gnu|x86_64-unknown-linux-gnu)
80 for d in `find "${CT_SYSROOT_DIR}" -name lib -type d -empty`; do
81 if [ -d `dirname "${d}"`/lib64 ] ; then
83 ln -s `dirname "${d}"`/lib64 "${d}"
90 CT_DoLog EXTRA "Building C compiler"
91 make ${PARALLELMFLAGS} all 2>&1 |CT_DoLog DEBUG
93 CT_DoLog EXTRA "Installing C compiler"
94 make install 2>&1 |CT_DoLog DEBUG
96 # FIXME: shouldn't people who want this just --disable-multilib in final gcc
97 # and be done with it?
98 # This code should probably be deleted, it was written long ago and hasn't
99 # been tested in ages.
100 # kludge: If the chip does not have a floating point unit
101 # (i.e. if GLIBC_EXTRA_CONFIG contains --without-fp),
102 # and there are shared libraries in /lib/nof, copy them to /lib
103 # so they get used by default.
104 # FIXME: only rs6000/powerpc seem to use nof. See MULTILIB_DIRNAMES
105 # in $GCC_DIR/gcc/config/$TARGET/* to see what your arch calls it.
106 #case "${CT_LIBC_EXTRA_CONFIG}" in
108 # if test -d "${CT_SYSROOT_DIR}/lib/nof"; then
109 # cp -af "${CT_SYSROOT_DIR}/lib/nof/"*.so* "${CT_SYSROOT_DIR}/lib" || true