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-06-16 18:08:14 +00:00
|
|
|
do_print_filename() {
|
2007-06-16 21:44:45 +00:00
|
|
|
echo "binutils-${CT_BINUTILS_VERSION}"
|
2007-06-16 18:08:14 +00:00
|
|
|
}
|
|
|
|
|
2007-05-07 09:04:02 +00:00
|
|
|
# Download binutils
|
|
|
|
do_binutils_get() {
|
2008-05-03 17:51:16 +00:00
|
|
|
CT_GetFile "${CT_BINUTILS_FILE}" \
|
|
|
|
{ftp,http}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils
|
2007-05-07 09:04:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Extract binutils
|
|
|
|
do_binutils_extract() {
|
|
|
|
CT_ExtractAndPatch "${CT_BINUTILS_FILE}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
|
|
|
|
"${CT_SRC_DIR}/${CT_BINUTILS_FILE}/configure" \
|
|
|
|
${CT_CANADIAN_OPT} \
|
2007-05-22 20:36:05 +00:00
|
|
|
--build=${CT_BUILD} \
|
2007-02-24 11:00:05 +00:00
|
|
|
--host=${CT_HOST} \
|
2007-05-22 20:36:05 +00:00
|
|
|
--target=${CT_TARGET} \
|
2007-02-24 11:00:05 +00:00
|
|
|
--prefix=${CT_PREFIX_DIR} \
|
|
|
|
--disable-nls \
|
2008-05-14 17:58:07 +00:00
|
|
|
--disable-multilib \
|
|
|
|
--disable-werror \
|
2008-04-30 10:43:41 +00:00
|
|
|
${binutils_opts} \
|
2008-05-14 17:58:07 +00:00
|
|
|
${CT_ARCH_WITH_FLOAT} \
|
2007-02-24 11:00:05 +00:00
|
|
|
${CT_BINUTILS_EXTRA_CONFIG} \
|
Huge fixes to glibc build, so that we can build at least (and at last):
- use ports addon even when installing headers,
- use optimisation (-O) when installing headers, to avoid unnecessary warnings (thanks Robert P. J. DAY for pointing this out!),
- lowest kernel version to use is only X.Y.Z, not X.Y.Z.T,
- a bit of preparations for NPTL (RSN I hope),
- fix fixing the linker scripts (changing the backup file is kind of useless and stupid);
Shut uClibc finish step: there really is nothing to do;
Add a patch for glibc-2.3.6 weak aliases handling on some archs (ARM and ALPHA at least);
Did not catch the make errors: fixed the pattern matching in scripts/functions;
Introduce a new log level, ALL:
- send components' build messages there,
- DEBUG log level is destined only for crosstool-NG debug messages,
- migrate sub-actions to use appropriate log levels;
Update the armeb-unknown-linux-gnu sample:
- it builds!
- uses gcc-4.0.4 and glibc-2.3.6,
- updated to latest config options set.
2007-05-08 17:48:32 +00:00
|
|
|
${BINUTILS_SYSROOT_ARG} 2>&1 |CT_DoLog ALL
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building binutils"
|
Huge fixes to glibc build, so that we can build at least (and at last):
- use ports addon even when installing headers,
- use optimisation (-O) when installing headers, to avoid unnecessary warnings (thanks Robert P. J. DAY for pointing this out!),
- lowest kernel version to use is only X.Y.Z, not X.Y.Z.T,
- a bit of preparations for NPTL (RSN I hope),
- fix fixing the linker scripts (changing the backup file is kind of useless and stupid);
Shut uClibc finish step: there really is nothing to do;
Add a patch for glibc-2.3.6 weak aliases handling on some archs (ARM and ALPHA at least);
Did not catch the make errors: fixed the pattern matching in scripts/functions;
Introduce a new log level, ALL:
- send components' build messages there,
- DEBUG log level is destined only for crosstool-NG debug messages,
- migrate sub-actions to use appropriate log levels;
Update the armeb-unknown-linux-gnu sample:
- it builds!
- uses gcc-4.0.4 and glibc-2.3.6,
- updated to latest config options set.
2007-05-08 17:48:32 +00:00
|
|
|
make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing binutils"
|
Huge fixes to glibc build, so that we can build at least (and at last):
- use ports addon even when installing headers,
- use optimisation (-O) when installing headers, to avoid unnecessary warnings (thanks Robert P. J. DAY for pointing this out!),
- lowest kernel version to use is only X.Y.Z, not X.Y.Z.T,
- a bit of preparations for NPTL (RSN I hope),
- fix fixing the linker scripts (changing the backup file is kind of useless and stupid);
Shut uClibc finish step: there really is nothing to do;
Add a patch for glibc-2.3.6 weak aliases handling on some archs (ARM and ALPHA at least);
Did not catch the make errors: fixed the pattern matching in scripts/functions;
Introduce a new log level, ALL:
- send components' build messages there,
- DEBUG log level is destined only for crosstool-NG debug messages,
- migrate sub-actions to use appropriate log levels;
Update the armeb-unknown-linux-gnu sample:
- it builds!
- uses gcc-4.0.4 and glibc-2.3.6,
- updated to latest config options set.
2007-05-08 17:48:32 +00:00
|
|
|
make install 2>&1 |CT_DoLog ALL
|
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}"
|
Huge fixes to glibc build, so that we can build at least (and at last):
- use ports addon even when installing headers,
- use optimisation (-O) when installing headers, to avoid unnecessary warnings (thanks Robert P. J. DAY for pointing this out!),
- lowest kernel version to use is only X.Y.Z, not X.Y.Z.T,
- a bit of preparations for NPTL (RSN I hope),
- fix fixing the linker scripts (changing the backup file is kind of useless and stupid);
Shut uClibc finish step: there really is nothing to do;
Add a patch for glibc-2.3.6 weak aliases handling on some archs (ARM and ALPHA at least);
Did not catch the make errors: fixed the pattern matching in scripts/functions;
Introduce a new log level, ALL:
- send components' build messages there,
- DEBUG log level is destined only for crosstool-NG debug messages,
- migrate sub-actions to use appropriate log levels;
Update the armeb-unknown-linux-gnu sample:
- it builds!
- uses gcc-4.0.4 and glibc-2.3.6,
- updated to latest config options set.
2007-05-08 17:48:32 +00:00
|
|
|
done |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# }"
|
|
|
|
|
|
|
|
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"
|
2008-05-14 17:58:07 +00:00
|
|
|
"${CT_SRC_DIR}/${CT_BINUTILS_FILE}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
|
|
|
--host=${CT_TARGET} \
|
|
|
|
--target=${CT_TARGET} \
|
|
|
|
--prefix=/usr \
|
|
|
|
--disable-werror \
|
|
|
|
--enable-shared \
|
|
|
|
--enable-static \
|
|
|
|
--disable-nls \
|
|
|
|
--disable-multilib \
|
|
|
|
${CT_ARCH_WITH_FLOAT} \
|
|
|
|
${CT_BINUTILS_EXTRA_CONFIG} 2>&1 |CT_DoLog ALL
|
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"
|
|
|
|
make ${PARALLELMFLAGS} ${build_targets} 2>&1 |CT_DoLog ALL
|
|
|
|
CT_DoLog EXTRA "Installing binutils' libraries (${targets}) for target"
|
|
|
|
make DESTDIR="${CT_SYSROOT_DIR}" ${install_targets} 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
CT_EndStep
|
|
|
|
fi
|
2007-02-24 11:00:05 +00:00
|
|
|
}
|