Merge patches sent by Robert P. J. Day <rpjday@mindspring.com>.
Warning: the buildroot folks purposedly removed the skip-comment patch but didn't really said why. Keeping it for the sake of having it in svn just in case (removing it will be easier thant not having it at all).
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 compiler"
8 mkdir -p "${CT_BUILD_DIR}/build-cc"
9 cd "${CT_BUILD_DIR}/build-cc"
11 CT_DoLog EXTRA "Configuring final 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/,+/,/g; s/,*$//;'`
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_ABI}" ] && extra_config="${extra_config} --with-abi=${CT_ARCH_ABI}"
33 [ -n "${CT_ARCH_CPU}" ] && extra_config="${extra_config} --with-cpu=${CT_ARCH_CPU}"
34 [ -n "${CT_ARCH_TUNE}" ] && extra_config="${extra_config} --with-tune=${CT_ARCH_TUNE}"
35 [ -n "${CT_ARCH_ARCH}" ] && extra_config="${extra_config} --with-arch=${CT_ARCH_ARCH}"
36 [ -n "${CT_ARCH_FPU}" ] && extra_config="${extra_config} --with-fpu=${CT_ARCH_FPU}"
37 if [ "${CT_TARGET_MULTILIB}" = "y" ]; then
38 extra_config="${extra_config} --enable-multilib"
40 extra_config="${extra_config} --disable-multilib"
42 [ "${CT_CC_CXA_ATEXIT}" == "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
44 CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
46 # --enable-symvers=gnu really only needed for sh4 to work around a
47 # detection problem only matters for gcc-3.2.x and later, I think.
48 # --disable-nls to work around crash bug on ppc405, but also because
49 # embedded systems don't really need message catalogs...
50 CFLAGS="${CT_CFLAGS_FOR_HOST}" \
51 "${CT_SRC_DIR}/${CT_CC_FILE}/configure" \
53 --target=${CT_TARGET} --host=${CT_HOST} \
54 --prefix="${CT_PREFIX_DIR}" \
57 --with-local-prefix="${CT_SYSROOT_DIR}" \
59 --enable-threads=posix \
60 --enable-symvers=gnu \
63 ${CT_CC_EXTRA_CONFIG} 2>&1 |CT_DoLog DEBUG
65 if [ ! "${CT_CANADIAN}" = "y" ]; then
66 CT_DoLog EXTRA "Building libiberty"
67 make ${PARALLELMFLAGS} all-build-libiberty 2>&1 |CT_DoLog DEBUG
71 # Idea from <cort.dougan at gmail.com>:
72 # Fix lib/lib64 confusion for GCC 3.3.3 on PowerPC64 and x86_64.
73 # GCC 3.4.0 and up don't suffer from this confusion, and don't need this
75 # FIXME: we should patch gcc's source rather than uglify crosstool.sh.
76 # FIXME: is this needed for gcc-3.3.[56]?
77 case "${CT_CC_FILE}" in
79 case "${CT_TARGET}" in
80 powerpc64-unknown-linux-gnu|x86_64-unknown-linux-gnu)
81 for d in `find "${CT_SYSROOT_DIR}" -name lib -type d -empty`; do
82 if [ -d `dirname "${d}"`/lib64 ] ; then
84 ln -s `dirname "${d}"`/lib64 "${d}"
91 CT_DoLog EXTRA "Building final compiler"
92 make ${PARALLELMFLAGS} all 2>&1 |CT_DoLog DEBUG
94 CT_DoLog EXTRA "Installing final compiler"
95 make install 2>&1 |CT_DoLog DEBUG
97 # FIXME: shouldn't people who want this just --disable-multilib in final gcc
98 # and be done with it?
99 # This code should probably be deleted, it was written long ago and hasn't
100 # been tested in ages.
101 # kludge: If the chip does not have a floating point unit
102 # (i.e. if GLIBC_EXTRA_CONFIG contains --without-fp),
103 # and there are shared libraries in /lib/nof, copy them to /lib
104 # so they get used by default.
105 # FIXME: only rs6000/powerpc seem to use nof. See MULTILIB_DIRNAMES
106 # in $GCC_DIR/gcc/config/$TARGET/* to see what your arch calls it.
107 #case "${CT_LIBC_EXTRA_CONFIG}" in
109 # if test -d "${CT_SYSROOT_DIR}/lib/nof"; then
110 # cp -af "${CT_SYSROOT_DIR}/lib/nof/"*.so* "${CT_SYSROOT_DIR}/lib" || true