2007-02-24 11:00:05 +00:00
|
|
|
# This file adds functions to build binutils
|
|
|
|
# Copyright 2007 Yann E. MORIN
|
|
|
|
# Licensed under the GPL v2. See COPYING in the root of this package
|
|
|
|
|
2007-05-07 09:04:02 +00:00
|
|
|
# Download binutils
|
|
|
|
do_binutils_get() {
|
2009-01-04 14:21:00 +00:00
|
|
|
CT_GetFile "binutils-${CT_BINUTILS_VERSION}" \
|
2008-10-15 07:29:07 +00:00
|
|
|
{ftp,http}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils \
|
|
|
|
ftp://gcc.gnu.org/pub/binutils/{releases,snapshots}
|
2007-05-07 09:04:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Extract binutils
|
|
|
|
do_binutils_extract() {
|
2009-01-05 23:02:43 +00:00
|
|
|
CT_Extract "binutils-${CT_BINUTILS_VERSION}"
|
|
|
|
CT_Patch "binutils-${CT_BINUTILS_VERSION}"
|
2007-05-07 09:04:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Build binutils
|
2007-02-24 11:00:05 +00:00
|
|
|
do_binutils() {
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-binutils"
|
|
|
|
cd "${CT_BUILD_DIR}/build-binutils"
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing binutils"
|
|
|
|
|
2008-04-30 10:43:41 +00:00
|
|
|
binutils_opts=
|
|
|
|
# If GMP and MPFR were configured, then use that,
|
|
|
|
# otherwise let binutils find the system-wide libraries, if they exist.
|
2008-07-13 10:32:38 +00:00
|
|
|
if [ "${CT_GMP_MPFR}" = "y" ]; then
|
2008-04-30 10:43:41 +00:00
|
|
|
binutils_opts="--with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
|
|
|
|
fi
|
|
|
|
|
2007-02-24 11:00:05 +00:00
|
|
|
CT_DoLog EXTRA "Configuring binutils"
|
2009-01-04 14:21:00 +00:00
|
|
|
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
|
|
|
|
CT_DoExecLog ALL \
|
|
|
|
"${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
|
|
|
--host=${CT_HOST} \
|
|
|
|
--target=${CT_TARGET} \
|
|
|
|
--prefix=${CT_PREFIX_DIR} \
|
|
|
|
--disable-nls \
|
|
|
|
--disable-multilib \
|
|
|
|
--disable-werror \
|
|
|
|
${binutils_opts} \
|
|
|
|
${CT_ARCH_WITH_FLOAT} \
|
|
|
|
${CT_BINUTILS_EXTRA_CONFIG} \
|
2008-07-14 15:27:20 +00:00
|
|
|
${BINUTILS_SYSROOT_ARG}
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building binutils"
|
2008-07-14 15:27:20 +00:00
|
|
|
CT_DoExecLog ALL make ${PARALLELMFLAGS}
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing binutils"
|
2008-07-14 15:27:20 +00:00
|
|
|
CT_DoExecLog ALL make install
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2007-08-15 10:14:43 +00:00
|
|
|
# Make those new tools available to the core C compilers to come.
|
2007-02-24 11:00:05 +00:00
|
|
|
# Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as
|
2007-07-30 20:02:13 +00:00
|
|
|
# well. Create that.
|
2007-05-27 20:22:06 +00:00
|
|
|
mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/bin"
|
|
|
|
mkdir -p "${CT_CC_CORE_STATIC_PREFIX_DIR}/bin"
|
|
|
|
mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/bin"
|
|
|
|
mkdir -p "${CT_CC_CORE_SHARED_PREFIX_DIR}/bin"
|
2007-02-24 11:00:05 +00:00
|
|
|
for t in ar as ld strip; do
|
2007-05-27 20:22:06 +00:00
|
|
|
ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_STATIC_PREFIX_DIR}/${CT_TARGET}/bin/${t}"
|
|
|
|
ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_STATIC_PREFIX_DIR}/bin/${CT_TARGET}-${t}"
|
|
|
|
ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_SHARED_PREFIX_DIR}/${CT_TARGET}/bin/${t}"
|
|
|
|
ln -sv "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" "${CT_CC_CORE_SHARED_PREFIX_DIR}/bin/${CT_TARGET}-${t}"
|
2008-07-14 15:27:20 +00:00
|
|
|
done 2>&1 |CT_DoLog ALL
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2008-04-28 07:38:36 +00:00
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
|
|
|
# Now on for the target libraries
|
|
|
|
do_binutils_target() {
|
2008-04-27 15:08:15 +00:00
|
|
|
targets=
|
2008-04-28 08:55:00 +00:00
|
|
|
[ "${CT_BINUTILS_FOR_TARGET_IBERTY}" = "y" ] && targets="${targets} libiberty"
|
|
|
|
[ "${CT_BINUTILS_FOR_TARGET_BFD}" = "y" ] && targets="${targets} bfd"
|
2008-04-27 15:08:15 +00:00
|
|
|
targets="${targets# }"
|
|
|
|
|
2008-11-04 18:31:07 +00:00
|
|
|
binutils_opts=
|
|
|
|
# If GMP and MPFR were configured, then use that
|
|
|
|
if [ "${CT_GMP_MPFR_TARGET}" = "y" ]; then
|
|
|
|
binutils_opts="--with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
|
|
|
|
fi
|
|
|
|
|
2008-04-27 15:08:15 +00:00
|
|
|
if [ -n "${targets}" ]; then
|
|
|
|
CT_DoStep INFO "Installing binutils for target"
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-binutils-for-target"
|
|
|
|
CT_Pushd "${CT_BUILD_DIR}/build-binutils-for-target"
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Configuring binutils for target"
|
2009-01-04 14:21:00 +00:00
|
|
|
CT_DoExecLog ALL \
|
|
|
|
"${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
|
|
|
--host=${CT_TARGET} \
|
|
|
|
--target=${CT_TARGET} \
|
|
|
|
--prefix=/usr \
|
|
|
|
--disable-werror \
|
|
|
|
--enable-shared \
|
|
|
|
--enable-static \
|
|
|
|
--disable-nls \
|
|
|
|
--disable-multilib \
|
|
|
|
${binutils_opts} \
|
|
|
|
${CT_ARCH_WITH_FLOAT} \
|
2008-07-14 15:27:20 +00:00
|
|
|
${CT_BINUTILS_EXTRA_CONFIG}
|
2008-04-27 15:08:15 +00:00
|
|
|
|
|
|
|
build_targets=$(echo "${targets}" |sed -r -e 's/(^| +)/\1all-/g;')
|
|
|
|
install_targets=$(echo "${targets}" |sed -r -e 's/(^| +)/\1install-/g;')
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building binutils' libraries (${targets}) for target"
|
2008-07-14 15:42:27 +00:00
|
|
|
CT_DoExecLog ALL make ${PARALLELMFLAGS} ${build_targets}
|
2008-04-27 15:08:15 +00:00
|
|
|
CT_DoLog EXTRA "Installing binutils' libraries (${targets}) for target"
|
2008-07-14 15:42:27 +00:00
|
|
|
CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" ${install_targets}
|
2008-04-27 15:08:15 +00:00
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
fi
|
2007-02-24 11:00:05 +00:00
|
|
|
}
|