author | "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> |
Fri May 02 21:53:09 2008 +0000 (2008-05-02) | |
changeset 476 | 29b33ee36ef6 |
parent 465 | 8654a8d49ff9 |
child 486 | 92f6149c4275 |
permissions | -rw-r--r-- |
yann@1 | 1 |
# This file adds functions to build binutils |
yann@1 | 2 |
# Copyright 2007 Yann E. MORIN |
yann@1 | 3 |
# Licensed under the GPL v2. See COPYING in the root of this package |
yann@1 | 4 |
|
yann@161 | 5 |
do_print_filename() { |
yann@164 | 6 |
echo "binutils-${CT_BINUTILS_VERSION}" |
yann@161 | 7 |
} |
yann@161 | 8 |
|
yann@63 | 9 |
# Download binutils |
yann@63 | 10 |
do_binutils_get() { |
yann@63 | 11 |
CT_GetFile "${CT_BINUTILS_FILE}" \ |
yann@63 | 12 |
ftp://ftp.gnu.org/gnu/binutils \ |
yann@63 | 13 |
ftp://ftp.kernel.org/pub/linux/devel/binutils |
yann@63 | 14 |
} |
yann@63 | 15 |
|
yann@63 | 16 |
# Extract binutils |
yann@63 | 17 |
do_binutils_extract() { |
yann@63 | 18 |
CT_ExtractAndPatch "${CT_BINUTILS_FILE}" |
yann@63 | 19 |
} |
yann@63 | 20 |
|
yann@63 | 21 |
# Build binutils |
yann@1 | 22 |
do_binutils() { |
yann@1 | 23 |
mkdir -p "${CT_BUILD_DIR}/build-binutils" |
yann@1 | 24 |
cd "${CT_BUILD_DIR}/build-binutils" |
yann@1 | 25 |
|
yann@1 | 26 |
CT_DoStep INFO "Installing binutils" |
yann@1 | 27 |
|
yann@466 | 28 |
binutils_opts= |
yann@466 | 29 |
# If GMP and MPFR were configured, then use that, |
yann@466 | 30 |
# otherwise let binutils find the system-wide libraries, if they exist. |
yann@466 | 31 |
if [ "${CT_CC_GCC_GMP_MPFR}" = "y" ]; then |
yann@466 | 32 |
binutils_opts="--with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}" |
yann@466 | 33 |
fi |
yann@466 | 34 |
|
yann@1 | 35 |
CT_DoLog EXTRA "Configuring binutils" |
yann@1 | 36 |
CFLAGS="${CT_CFLAGS_FOR_HOST}" \ |
yann@1 | 37 |
"${CT_SRC_DIR}/${CT_BINUTILS_FILE}/configure" \ |
yann@1 | 38 |
${CT_CANADIAN_OPT} \ |
yann@116 | 39 |
--build=${CT_BUILD} \ |
yann@116 | 40 |
--host=${CT_HOST} \ |
yann@1 | 41 |
--target=${CT_TARGET} \ |
yann@1 | 42 |
--prefix=${CT_PREFIX_DIR} \ |
yann@1 | 43 |
--disable-nls \ |
yann@466 | 44 |
${binutils_opts} \ |
yann@1 | 45 |
${CT_BINUTILS_EXTRA_CONFIG} \ |
yann@78 | 46 |
${BINUTILS_SYSROOT_ARG} 2>&1 |CT_DoLog ALL |
yann@1 | 47 |
|
yann@1 | 48 |
CT_DoLog EXTRA "Building binutils" |
yann@78 | 49 |
make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL |
yann@1 | 50 |
|
yann@1 | 51 |
CT_DoLog EXTRA "Installing binutils" |
yann@78 | 52 |
make install 2>&1 |CT_DoLog ALL |
yann@1 | 53 |
|
yann@331 | 54 |
# Make those new tools available to the core C compilers to come. |
yann@1 | 55 |
# Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as |
yann@305 | 56 |
# well. Create that. |
yann@136 | 57 |
mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/bin" |
yann@136 | 58 |
mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}/bin" |
yann@136 | 59 |
mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/bin" |
yann@136 | 60 |
mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}/bin" |
yann@1 | 61 |
for t in ar as ld strip; do |
yann@136 | 62 |
ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/bin/${t}" |
yann@136 | 63 |
ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_STATIC_PREFIX_DIR}/bin/${CT_TARGET}-${t}" |
yann@136 | 64 |
ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/bin/${t}" |
yann@136 | 65 |
ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_SHARED_PREFIX_DIR}/bin/${CT_TARGET}-${t}" |
yann@78 | 66 |
done |CT_DoLog ALL |
yann@1 | 67 |
|
yann@461 | 68 |
CT_EndStep |
yann@461 | 69 |
} |
yann@461 | 70 |
|
yann@461 | 71 |
# Now on for the target libraries |
yann@461 | 72 |
do_binutils_target() { |
yann@458 | 73 |
targets= |
yann@463 | 74 |
[ "${CT_BINUTILS_FOR_TARGET_IBERTY}" = "y" ] && targets="${targets} libiberty" |
yann@463 | 75 |
[ "${CT_BINUTILS_FOR_TARGET_BFD}" = "y" ] && targets="${targets} bfd" |
yann@458 | 76 |
targets="${targets# }" |
yann@458 | 77 |
|
yann@458 | 78 |
if [ -n "${targets}" ]; then |
yann@458 | 79 |
CT_DoStep INFO "Installing binutils for target" |
yann@458 | 80 |
mkdir -p "${CT_BUILD_DIR}/build-binutils-for-target" |
yann@458 | 81 |
CT_Pushd "${CT_BUILD_DIR}/build-binutils-for-target" |
yann@458 | 82 |
|
yann@458 | 83 |
CT_DoLog EXTRA "Configuring binutils for target" |
yann@458 | 84 |
"${CT_SRC_DIR}/${CT_BINUTILS_FILE}/configure" \ |
yann@458 | 85 |
--build=${CT_BUILD} \ |
yann@458 | 86 |
--host=${CT_TARGET} \ |
yann@458 | 87 |
--target=${CT_TARGET} \ |
yann@458 | 88 |
--prefix=/usr \ |
yann@465 | 89 |
--enable-shared --enable-static \ |
yann@458 | 90 |
${CT_BINUTILS_EXTRA_CONFIG} \ |
yann@458 | 91 |
--disable-nls 2>&1 |CT_DoLog ALL |
yann@458 | 92 |
|
yann@458 | 93 |
build_targets=$(echo "${targets}" |sed -r -e 's/(^| +)/\1all-/g;') |
yann@458 | 94 |
install_targets=$(echo "${targets}" |sed -r -e 's/(^| +)/\1install-/g;') |
yann@458 | 95 |
|
yann@458 | 96 |
CT_DoLog EXTRA "Building binutils' libraries (${targets}) for target" |
yann@458 | 97 |
make ${PARALLELMFLAGS} ${build_targets} 2>&1 |CT_DoLog ALL |
yann@458 | 98 |
CT_DoLog EXTRA "Installing binutils' libraries (${targets}) for target" |
yann@458 | 99 |
make DESTDIR="${CT_SYSROOT_DIR}" ${install_targets} 2>&1 |CT_DoLog ALL |
yann@458 | 100 |
|
yann@458 | 101 |
CT_Popd |
yann@458 | 102 |
CT_EndStep |
yann@458 | 103 |
fi |
yann@1 | 104 |
} |