scripts/build/binutils/binutils.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed May 20 20:13:13 2009 +0000 (2009-05-20)
changeset 1345 27fec561af53
child 1483 094f442a9d5e
permissions -rw-r--r--
Merge the uClinux/noMMU stuff back to /trunk:
- merge Linux and uClinux back to a single kernel
- add ARCH_USE_MMU and acquainted config options that
architectures can auto-select
- make binutils and elf2flt two "Binary utilities" that
go in a single common sub-{menu,directory} structure

-------- diffstat follows --------
/trunk/scripts/build/kernel/uclinux.sh | 2 0 2 0 -
/trunk/scripts/build/kernel/linux.sh | 206 204 2 0 +++++++++++++++++++++++++++++
/trunk/scripts/build/kernel/linux-common.sh | 198 0 198 0 ----------------------------
/trunk/scripts/build/binutils.sh | 232 0 232 0 --------------------------------
/trunk/scripts/build/elf2flt.sh | 150 0 150 0 ---------------------
/trunk/scripts/crosstool-NG.sh.in | 6 4 2 0 +
/trunk/config/kernel/linux.in | 249 249 0 0 +++++++++++++++++++++++++++++++++++
/trunk/config/kernel/linux.in-common | 252 0 252 0 -----------------------------------
/trunk/config/kernel/uclinux.in | 21 0 21 0 ---
/trunk/config/target.in | 23 22 1 0 +++
/trunk/config/elf2flt.in | 49 0 49 0 -------
/trunk/config/libc/glibc.in | 2 1 1 0
/trunk/config/libc/eglibc.in | 2 1 1 0
/trunk/config/config.in | 1 0 1 0 -
/trunk/config/arch/sh.in | 1 1 0 0 +
/trunk/config/arch/arm.in | 2 1 1 0
/trunk/config/arch/powerpc.in | 1 1 0 0 +
/trunk/config/arch/ia64.in | 1 1 0 0 +
/trunk/config/arch/alpha.in | 1 1 0 0 +
/trunk/config/arch/x86.in | 1 1 0 0 +
/trunk/config/arch/mips.in | 1 1 0 0 +
/trunk/config/arch/powerpc64.in | 1 1 0 0 +
22 files changed, 489 insertions(+), 913 deletions(-)
     1 # This file adds functions to build binutils
     2 # Copyright 2007 Yann E. MORIN
     3 # Licensed under the GPL v2. See COPYING in the root of this package
     4 
     5 # Download binutils
     6 do_binutils_get() {
     7     CT_GetFile "binutils-${CT_BINUTILS_VERSION}"                                        \
     8                {ftp,http}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils   \
     9                ftp://gcc.gnu.org/pub/binutils/{releases,snapshots}
    10 }
    11 
    12 # Extract binutils
    13 do_binutils_extract() {
    14     CT_Extract "binutils-${CT_BINUTILS_VERSION}"
    15     CT_Patch "binutils-${CT_BINUTILS_VERSION}"
    16 }
    17 
    18 # Build binutils
    19 do_binutils() {
    20     mkdir -p "${CT_BUILD_DIR}/build-binutils"
    21     cd "${CT_BUILD_DIR}/build-binutils"
    22 
    23     CT_DoStep INFO "Installing binutils"
    24 
    25     binutils_opts=
    26     # If GMP and MPFR were configured, then use that,
    27     # otherwise let binutils find the system-wide libraries, if they exist.
    28     if [ "${CT_GMP_MPFR}" = "y" ]; then
    29         binutils_opts="--with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
    30     fi
    31 
    32     CT_DoLog EXTRA "Configuring binutils"
    33     CFLAGS="${CT_CFLAGS_FOR_HOST}"                              \
    34     CT_DoExecLog ALL                                            \
    35     "${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure"   \
    36         --build=${CT_BUILD}                                     \
    37         --host=${CT_HOST}                                       \
    38         --target=${CT_TARGET}                                   \
    39         --prefix=${CT_PREFIX_DIR}                               \
    40         --disable-nls                                           \
    41         --disable-multilib                                      \
    42         --disable-werror                                        \
    43         ${binutils_opts}                                        \
    44         ${CT_ARCH_WITH_FLOAT}                                   \
    45         ${CT_BINUTILS_EXTRA_CONFIG}                             \
    46         ${BINUTILS_SYSROOT_ARG}
    47 
    48     CT_DoLog EXTRA "Building binutils"
    49     CT_DoExecLog ALL make ${PARALLELMFLAGS}
    50 
    51     CT_DoLog EXTRA "Installing binutils"
    52     CT_DoExecLog ALL make install
    53 
    54     # Make those new tools available to the core C compilers to come.
    55     # Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as
    56     # well. Create that.
    57     mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/bin"
    58     mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}/bin"
    59     mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/bin"
    60     mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}/bin"
    61     for t in ar as ld strip; do
    62         ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/bin/${t}"
    63         ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_STATIC_PREFIX_DIR}/bin/${CT_TARGET}-${t}"
    64         ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/bin/${t}"
    65         ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_SHARED_PREFIX_DIR}/bin/${CT_TARGET}-${t}"
    66     done 2>&1 |CT_DoLog ALL
    67 
    68     CT_EndStep
    69 }
    70 
    71 # Now on for the target libraries
    72 do_binutils_target() {
    73     targets=
    74     [ "${CT_BINUTILS_FOR_TARGET_IBERTY}" = "y" ] && targets="${targets} libiberty"
    75     [ "${CT_BINUTILS_FOR_TARGET_BFD}"    = "y" ] && targets="${targets} bfd"
    76     targets="${targets# }"
    77 
    78     binutils_opts=
    79     # If GMP and MPFR were configured, then use that
    80     if [ "${CT_GMP_MPFR_TARGET}" = "y" ]; then
    81         binutils_opts="--with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
    82     fi
    83 
    84     if [ -n "${targets}" ]; then
    85         CT_DoStep INFO "Installing binutils for target"
    86         mkdir -p "${CT_BUILD_DIR}/build-binutils-for-target"
    87         CT_Pushd "${CT_BUILD_DIR}/build-binutils-for-target"
    88 
    89         CT_DoLog EXTRA "Configuring binutils for target"
    90         CT_DoExecLog ALL                                            \
    91         "${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure"   \
    92             --build=${CT_BUILD}                                     \
    93             --host=${CT_TARGET}                                     \
    94             --target=${CT_TARGET}                                   \
    95             --prefix=/usr                                           \
    96             --disable-werror                                        \
    97             --enable-shared                                         \
    98             --enable-static                                         \
    99             --disable-nls                                           \
   100             --disable-multilib                                      \
   101             ${binutils_opts}                                        \
   102             ${CT_ARCH_WITH_FLOAT}                                   \
   103             ${CT_BINUTILS_EXTRA_CONFIG}
   104 
   105         build_targets=$(echo "${targets}" |sed -r -e 's/(^| +)/\1all-/g;')
   106         install_targets=$(echo "${targets}" |sed -r -e 's/(^| +)/\1install-/g;')
   107 
   108         CT_DoLog EXTRA "Building binutils' libraries (${targets}) for target"
   109         CT_DoExecLog ALL make ${PARALLELMFLAGS} ${build_targets}
   110         CT_DoLog EXTRA "Installing binutils' libraries (${targets}) for target"
   111         CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" ${install_targets}
   112 
   113         CT_Popd
   114         CT_EndStep
   115     fi
   116 }