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() {
|
2012-10-11 04:39:41 +00:00
|
|
|
if [ "${CT_BINUTILS_CUSTOM}" = "y" ]; then
|
2015-11-26 13:06:21 +00:00
|
|
|
CT_GetCustom "binutils" "${CT_BINUTILS_CUSTOM_VERSION}" \
|
|
|
|
"${CT_BINUTILS_CUSTOM_LOCATION}"
|
2012-10-11 04:39:41 +00:00
|
|
|
else
|
2017-01-12 06:20:46 +00:00
|
|
|
case "${CT_BINUTILS_VERSION}" in
|
|
|
|
linaro-*)
|
|
|
|
CT_GetLinaro "binutils" "${CT_BINUTILS_VERSION}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
CT_GetFile "binutils-${CT_BINUTILS_VERSION}" \
|
|
|
|
{http,ftp}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils \
|
|
|
|
ftp://{sourceware.org,gcc.gnu.org}/pub/binutils/{releases,snapshots}
|
|
|
|
;;
|
|
|
|
esac
|
2012-10-11 04:39:41 +00:00
|
|
|
fi
|
2012-11-19 10:21:31 +00:00
|
|
|
|
|
|
|
if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
|
2014-05-11 15:51:33 +00:00
|
|
|
if [ "${CT_ELF2FLT_CUSTOM}" = "y" ]; then
|
2015-11-26 13:06:21 +00:00
|
|
|
CT_GetCustom "elf2flt" "${CT_ELF2FLT_CUSTOM_VERSION}" \
|
|
|
|
"${CT_ELF2FLT_CUSTOM_LOCATION}"
|
2014-05-11 15:51:33 +00:00
|
|
|
else
|
2016-06-10 20:10:20 +00:00
|
|
|
CT_GetGit elf2flt "${CT_ELF2FLT_GIT_CSET}" https://github.com/uclinux-dev/elf2flt.git
|
2014-05-11 15:51:33 +00:00
|
|
|
fi
|
2012-11-19 10:21:31 +00:00
|
|
|
fi
|
2007-05-07 09:04:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Extract binutils
|
|
|
|
do_binutils_extract() {
|
2015-11-26 13:06:21 +00:00
|
|
|
CT_Extract "binutils-${CT_BINUTILS_VERSION}"
|
|
|
|
CT_Patch "binutils" "${CT_BINUTILS_VERSION}"
|
2012-10-11 04:39:41 +00:00
|
|
|
|
2012-11-19 10:21:31 +00:00
|
|
|
if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
|
2015-11-26 13:06:21 +00:00
|
|
|
CT_Extract "elf2flt-${CT_ELF2FLT_GIT_CSET}"
|
|
|
|
CT_Patch "elf2flt" "${CT_ELF2FLT_GIT_CSET}"
|
2012-11-19 10:21:31 +00:00
|
|
|
fi
|
2013-07-24 22:10:47 +00:00
|
|
|
|
|
|
|
if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
|
|
|
|
CT_ConfigureXtensa "binutils" "${CT_BINUTILS_VERSION}"
|
|
|
|
fi
|
2007-05-07 09:04:02 +00:00
|
|
|
}
|
|
|
|
|
2011-07-24 21:52:28 +00:00
|
|
|
# Build binutils for build -> target
|
|
|
|
do_binutils_for_build() {
|
|
|
|
local -a binutils_opts
|
|
|
|
|
|
|
|
case "${CT_TOOLCHAIN_TYPE}" in
|
|
|
|
native|cross) return 0;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing binutils for build"
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-binutils-build-${CT_BUILD}"
|
|
|
|
|
|
|
|
binutils_opts+=( "host=${CT_BUILD}" )
|
|
|
|
binutils_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
|
2012-11-16 14:25:57 +00:00
|
|
|
binutils_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
|
|
|
|
binutils_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
|
2011-07-24 21:52:28 +00:00
|
|
|
|
|
|
|
do_binutils_backend "${binutils_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
2012-11-19 10:21:31 +00:00
|
|
|
|
|
|
|
if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
|
|
|
|
# We re-use binutils' options, plus our owns
|
|
|
|
binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}" )
|
|
|
|
binutils_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_BUILD}" )
|
|
|
|
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}"
|
|
|
|
|
|
|
|
do_elf2flt_backend "${binutils_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
fi
|
|
|
|
|
2011-07-24 21:52:28 +00:00
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
2011-07-17 16:29:35 +00:00
|
|
|
# Build binutils for host -> target
|
|
|
|
do_binutils_for_host() {
|
|
|
|
local -a binutils_tools
|
|
|
|
local -a binutils_opts
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing binutils for host"
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}"
|
|
|
|
|
|
|
|
binutils_opts+=( "host=${CT_HOST}" )
|
|
|
|
binutils_opts+=( "prefix=${CT_PREFIX_DIR}" )
|
|
|
|
binutils_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
|
|
|
|
binutils_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
|
2012-11-16 14:25:57 +00:00
|
|
|
binutils_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
|
2011-07-17 16:29:35 +00:00
|
|
|
binutils_opts+=( "build_manuals=${CT_BUILD_MANUALS}" )
|
|
|
|
|
|
|
|
do_binutils_backend "${binutils_opts[@]}"
|
|
|
|
|
2012-11-19 10:21:31 +00:00
|
|
|
CT_Popd
|
|
|
|
|
|
|
|
if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
|
|
|
|
# We re-use binutils' options, plus our owns
|
|
|
|
binutils_opts+=( "binutils_src=${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}" )
|
|
|
|
binutils_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" )
|
|
|
|
|
|
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-host-${CT_HOST}"
|
|
|
|
|
|
|
|
do_elf2flt_backend "${binutils_opts[@]}"
|
|
|
|
|
|
|
|
CT_Popd
|
|
|
|
fi
|
|
|
|
|
2011-07-17 16:29:35 +00:00
|
|
|
# Make those new tools available to the core C compilers to come.
|
2014-02-04 07:40:45 +00:00
|
|
|
# Note: some components want the ${TARGET}-{ar,as,ld,ranlib,strip} commands
|
|
|
|
# as well. Create that.
|
2011-07-17 16:29:35 +00:00
|
|
|
# Don't do it for canadian or cross-native, because the binutils
|
|
|
|
# are not executable on the build machine.
|
|
|
|
case "${CT_TOOLCHAIN_TYPE}" in
|
|
|
|
cross|native)
|
2014-02-04 07:40:45 +00:00
|
|
|
binutils_tools=( ar as ld ranlib strip )
|
2012-11-19 10:21:31 +00:00
|
|
|
if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
|
|
|
|
binutils_tools+=( elf2flt flthdr )
|
|
|
|
fi
|
2011-07-17 16:29:35 +00:00
|
|
|
case "${CT_BINUTILS_LINKERS_LIST}" in
|
|
|
|
ld) binutils_tools+=( ld.bfd ) ;;
|
|
|
|
gold) binutils_tools+=( ld.gold ) ;;
|
|
|
|
ld,gold) binutils_tools+=( ld.bfd ld.gold ) ;;
|
|
|
|
gold,ld) binutils_tools+=( ld.bfd ld.gold ) ;;
|
|
|
|
esac
|
|
|
|
mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin"
|
|
|
|
mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
|
|
|
|
for t in "${binutils_tools[@]}"; do
|
|
|
|
CT_DoExecLog ALL ln -sv \
|
binutils: make symlinks in a consistent way
On the stage "core gcc pass-2" the following layout is created:
1) buildtools/bin/TARGET-{ar,as,elf2flt,flthdr,ld,ld.bfd,ranlib,strip}
2) buildtools/TARGET/bin/{ar,as,elf2flt,flthdr,ld,ld.bfd,ranlib,strip}
3) x-tools/TARGET/bin/TARGET-{ar,as,elf2flt,flthdr,ld,ld.bfd,ranlib,strip}
4) x-tools/TARGET/TARGET/bin{ar,as,elf2flt,flthdr,ld,ld.bfd,ranlib,strip}
where both (1) and (2) are symlinks to (3). This effectively renders
core pass-2 gcc with elf2flt linker unusable.
Related elf2flt discussion:
https://github.com/crosstool-ng/crosstool-ng/pull/443
Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2016-09-13 19:07:14 +00:00
|
|
|
"${CT_PREFIX_DIR}/${CT_TARGET}/bin/${t}" \
|
2011-07-17 16:29:35 +00:00
|
|
|
"${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin/${t}"
|
|
|
|
CT_DoExecLog ALL ln -sv \
|
|
|
|
"${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" \
|
|
|
|
"${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-${t}"
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
CT_EndStep
|
|
|
|
}
|
|
|
|
|
|
|
|
# Build binutils for X -> target
|
|
|
|
# Parameter : description : type : default
|
|
|
|
# host : machine to run on : tuple : (none)
|
|
|
|
# prefix : prefix to install into : dir : (none)
|
|
|
|
# static_build : build statcially : bool : no
|
2012-11-16 14:25:57 +00:00
|
|
|
# cflags : cflags to use : string : (empty)
|
|
|
|
# ldflags : ldflags to use : string : (empty)
|
2011-07-17 16:29:35 +00:00
|
|
|
# build_manuals : whether to build manuals : bool : no
|
|
|
|
do_binutils_backend() {
|
|
|
|
local host
|
|
|
|
local prefix
|
|
|
|
local static_build
|
|
|
|
local cflags
|
2012-11-16 14:25:57 +00:00
|
|
|
local ldflags
|
2011-07-17 16:29:35 +00:00
|
|
|
local build_manuals=no
|
2009-08-19 17:44:44 +00:00
|
|
|
local -a extra_config
|
2010-12-09 17:55:33 +00:00
|
|
|
local -a extra_make_flags
|
2011-11-15 21:06:21 +00:00
|
|
|
local -a manuals_for
|
|
|
|
local -a manuals_install
|
2011-07-17 16:29:35 +00:00
|
|
|
local arg
|
2009-08-19 17:44:44 +00:00
|
|
|
|
2011-07-17 16:29:35 +00:00
|
|
|
for arg in "$@"; do
|
|
|
|
eval "${arg// /\\ }"
|
|
|
|
done
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Configuring binutils"
|
2010-12-27 23:11:33 +00:00
|
|
|
|
|
|
|
if [ "${CT_BINUTILS_HAS_GOLD}" = "y" ]; then
|
|
|
|
case "${CT_BINUTILS_LINKERS_LIST}" in
|
|
|
|
ld)
|
|
|
|
extra_config+=( --enable-ld=yes --enable-gold=no )
|
|
|
|
;;
|
|
|
|
gold)
|
|
|
|
extra_config+=( --enable-ld=no --enable-gold=yes )
|
|
|
|
;;
|
|
|
|
ld,gold)
|
|
|
|
extra_config+=( --enable-ld=default --enable-gold=yes )
|
|
|
|
;;
|
|
|
|
gold,ld)
|
|
|
|
extra_config+=( --enable-ld=yes --enable-gold=default )
|
|
|
|
;;
|
|
|
|
esac
|
2012-08-07 06:03:03 +00:00
|
|
|
if [ "${CT_BINUTILS_GOLD_THREADS}" = "y" ]; then
|
2011-01-02 12:52:16 +00:00
|
|
|
extra_config+=( --enable-threads )
|
|
|
|
fi
|
2010-12-27 23:11:33 +00:00
|
|
|
fi
|
2011-01-02 12:56:05 +00:00
|
|
|
if [ "${CT_BINUTILS_PLUGINS}" = "y" ]; then
|
|
|
|
extra_config+=( --enable-plugins )
|
|
|
|
fi
|
2011-05-31 18:39:42 +00:00
|
|
|
if [ "${CT_BINUTILS_HAS_PKGVERSION_BUGURL}" = "y" ]; then
|
2011-06-03 15:21:56 +00:00
|
|
|
extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
|
|
|
|
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
|
2011-05-31 18:39:42 +00:00
|
|
|
fi
|
2011-11-23 22:27:12 +00:00
|
|
|
if [ "${CT_MULTILIB}" = "y" ]; then
|
|
|
|
extra_config+=("--enable-multilib")
|
|
|
|
else
|
|
|
|
extra_config+=("--disable-multilib")
|
|
|
|
fi
|
2010-12-27 23:11:33 +00:00
|
|
|
|
2015-11-25 04:40:44 +00:00
|
|
|
# Disable gdb when building from the binutils-gdb repository.
|
|
|
|
extra_config+=("--disable-sim")
|
|
|
|
extra_config+=("--disable-gdb")
|
|
|
|
|
2011-11-17 09:59:44 +00:00
|
|
|
[ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls")
|
|
|
|
|
2010-12-27 23:11:33 +00:00
|
|
|
CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
|
|
|
|
|
2010-10-22 20:02:57 +00:00
|
|
|
CT_DoExecLog CFG \
|
2011-07-17 16:29:35 +00:00
|
|
|
CFLAGS="${cflags}" \
|
|
|
|
CXXFLAGS="${cflags}" \
|
2012-11-16 14:25:57 +00:00
|
|
|
LDFLAGS="${ldflags}" \
|
2009-01-04 14:21:00 +00:00
|
|
|
"${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
2011-07-17 16:29:35 +00:00
|
|
|
--host=${host} \
|
2009-01-04 14:21:00 +00:00
|
|
|
--target=${CT_TARGET} \
|
2011-07-17 16:29:35 +00:00
|
|
|
--prefix=${prefix} \
|
2009-01-04 14:21:00 +00:00
|
|
|
--disable-werror \
|
2009-08-19 17:44:44 +00:00
|
|
|
"${extra_config[@]}" \
|
2009-01-04 14:21:00 +00:00
|
|
|
${CT_ARCH_WITH_FLOAT} \
|
2011-05-15 16:51:40 +00:00
|
|
|
${BINUTILS_SYSROOT_ARG} \
|
2011-05-18 21:00:46 +00:00
|
|
|
"${CT_BINUTILS_EXTRA_CONFIG_ARRAY[@]}"
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2011-07-17 16:29:35 +00:00
|
|
|
if [ "${static_build}" = "y" ]; then
|
2015-12-07 19:21:34 +00:00
|
|
|
extra_make_flags+=("LDFLAGS=${ldflags} -all-static")
|
2010-12-09 17:55:33 +00:00
|
|
|
CT_DoLog EXTRA "Prepare binutils for static build"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} configure-host
|
2010-12-09 17:55:33 +00:00
|
|
|
fi
|
|
|
|
|
2007-02-24 11:00:05 +00:00
|
|
|
CT_DoLog EXTRA "Building binutils"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make "${extra_make_flags[@]}" ${JOBSFLAGS}
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing binutils"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make install
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2011-07-17 16:29:35 +00:00
|
|
|
if [ "${build_manuals}" = "y" ]; then
|
2011-11-15 21:06:21 +00:00
|
|
|
CT_DoLog EXTRA "Building and installing the binutils manuals"
|
|
|
|
manuals_for=( gas binutils ld gprof )
|
|
|
|
if [ "${CT_BINUTILS_LINKER_GOLD}" = "y" ]; then
|
|
|
|
manuals_for+=( gold )
|
|
|
|
fi
|
2015-12-05 14:45:08 +00:00
|
|
|
manuals_install=( "${manuals_for[@]/\#/install-pdf-}" )
|
|
|
|
manuals_install+=( "${manuals_for[@]/\#/install-html-}" )
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
|
|
|
|
CT_DoExecLog ALL make "${manuals_install[@]}"
|
2011-11-15 21:06:21 +00:00
|
|
|
fi
|
|
|
|
|
2010-12-29 17:19:40 +00:00
|
|
|
# Install the wrapper if needed
|
|
|
|
if [ "${CT_BINUTILS_LD_WRAPPER}" = "y" ]; then
|
|
|
|
CT_DoLog EXTRA "Installing ld wrapper"
|
2011-07-17 16:29:35 +00:00
|
|
|
rm -f "${prefix}/bin/${CT_TARGET}-ld"
|
|
|
|
rm -f "${prefix}/${CT_TARGET}/bin/ld"
|
2016-11-21 07:50:17 +00:00
|
|
|
sed -r -e "s/@@DEFAULT_LD@@/${CT_BINUTILS_LINKER_DEFAULT}/" \
|
2015-11-17 10:48:09 +00:00
|
|
|
"${CT_LIB_DIR}/scripts/build/binutils/binutils-ld.in" \
|
2011-07-17 16:29:35 +00:00
|
|
|
>"${prefix}/bin/${CT_TARGET}-ld"
|
|
|
|
chmod +x "${prefix}/bin/${CT_TARGET}-ld"
|
|
|
|
cp -a "${prefix}/bin/${CT_TARGET}-ld" \
|
|
|
|
"${prefix}/${CT_TARGET}/bin/ld"
|
2011-04-04 23:02:28 +00:00
|
|
|
|
|
|
|
# If needed, force using ld.bfd during the toolchain build
|
|
|
|
if [ "${CT_BINUTILS_FORCE_LD_BFD}" = "y" ]; then
|
|
|
|
export CTNG_LD_IS=bfd
|
|
|
|
fi
|
2010-12-29 17:19:40 +00:00
|
|
|
fi
|
2008-04-28 07:38:36 +00:00
|
|
|
}
|
|
|
|
|
2012-11-19 10:21:31 +00:00
|
|
|
# Build elf2flt for X -> target
|
|
|
|
# Parameter : description : type : default
|
|
|
|
# host : machine to run on : tuple : (none)
|
|
|
|
# prefix : prefix to install into : dir : (none)
|
|
|
|
# static_build : build statcially : bool : no
|
|
|
|
# cflags : cflags to use : string : (empty)
|
|
|
|
# ldflags : ldflags to use : string : (empty)
|
|
|
|
# binutils_src : source dir of binutils : dir : (none)
|
|
|
|
# binutils_bld : build dir of binutils : dir : (none)
|
|
|
|
# build_manuals : whether to build manuals : bool : no
|
|
|
|
do_elf2flt_backend() {
|
|
|
|
local host
|
|
|
|
local prefix
|
|
|
|
local static_build
|
|
|
|
local cflags
|
|
|
|
local ldflags
|
|
|
|
local binutils_bld
|
|
|
|
local binutils_src
|
|
|
|
local build_manuals
|
|
|
|
local arg
|
|
|
|
|
|
|
|
for arg in "$@"; do
|
|
|
|
eval "${arg// /\\ }"
|
|
|
|
done
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Configuring elf2flt"
|
|
|
|
CT_DoExecLog CFG \
|
|
|
|
CFLAGS="${cflags}" \
|
|
|
|
LDFLAGS="${ldflags}" \
|
2014-12-05 14:23:13 +00:00
|
|
|
LIBS="-ldl" \
|
2012-11-19 10:21:31 +00:00
|
|
|
"${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
|
|
|
--host=${host} \
|
|
|
|
--target=${CT_TARGET} \
|
|
|
|
--prefix=${prefix} \
|
|
|
|
--with-bfd-include-dir=${binutils_bld}/bfd \
|
|
|
|
--with-binutils-include-dir=${binutils_src}/include \
|
|
|
|
--with-libbfd=${binutils_bld}/bfd/libbfd.a \
|
|
|
|
--with-libiberty=${binutils_bld}/libiberty/libiberty.a \
|
2016-09-20 20:28:29 +00:00
|
|
|
--disable-werror \
|
2012-11-19 10:21:31 +00:00
|
|
|
${elf2flt_opts} \
|
|
|
|
"${CT_ELF2FLT_EXTRA_CONFIG_ARRAY[@]}"
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building elf2flt"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS}
|
2012-11-19 10:21:31 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing elf2flt"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make install
|
2012-11-19 10:21:31 +00:00
|
|
|
}
|
|
|
|
|
2008-04-28 07:38:36 +00:00
|
|
|
# Now on for the target libraries
|
2012-03-04 16:31:23 +00:00
|
|
|
do_binutils_for_target() {
|
2009-08-19 17:44:44 +00:00
|
|
|
local -a extra_config
|
|
|
|
local -a targets
|
|
|
|
local -a build_targets
|
|
|
|
local -a install_targets
|
|
|
|
local t
|
|
|
|
|
|
|
|
[ "${CT_BINUTILS_FOR_TARGET_IBERTY}" = "y" ] && targets+=("libiberty")
|
|
|
|
[ "${CT_BINUTILS_FOR_TARGET_BFD}" = "y" ] && targets+=("bfd")
|
|
|
|
for t in "${targets[@]}"; do
|
|
|
|
build_targets+=("all-${t}")
|
|
|
|
install_targets+=("install-${t}")
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "${#targets[@]}" -ne 0 ]; then
|
2008-04-27 15:08:15 +00:00
|
|
|
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"
|
2011-05-31 18:39:42 +00:00
|
|
|
|
|
|
|
if [ "${CT_BINUTILS_HAS_PKGVERSION_BUGURL}" = "y" ]; then
|
2011-06-03 15:21:56 +00:00
|
|
|
extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
|
|
|
|
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
|
2011-05-31 18:39:42 +00:00
|
|
|
fi
|
2011-11-23 22:27:12 +00:00
|
|
|
if [ "${CT_MULTILIB}" = "y" ]; then
|
|
|
|
extra_config+=("--enable-multilib")
|
|
|
|
else
|
|
|
|
extra_config+=("--disable-multilib")
|
|
|
|
fi
|
2011-05-31 18:39:42 +00:00
|
|
|
|
2016-01-02 11:15:07 +00:00
|
|
|
if [ "${CT_BINUTILS_FOR_TARGET_IBERTY}" = "y" ]; then
|
|
|
|
extra_config+=("--enable-install-libiberty")
|
|
|
|
fi
|
|
|
|
|
2011-11-17 09:59:44 +00:00
|
|
|
[ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && extra_config+=("--disable-nls")
|
|
|
|
|
2011-03-03 22:29:07 +00:00
|
|
|
CT_DoExecLog CFG \
|
2009-01-04 14:21:00 +00:00
|
|
|
"${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 \
|
2009-08-19 17:44:44 +00:00
|
|
|
"${extra_config[@]}" \
|
2009-01-04 14:21:00 +00:00
|
|
|
${CT_ARCH_WITH_FLOAT} \
|
2011-12-12 19:24:05 +00:00
|
|
|
"${CT_BINUTILS_EXTRA_CONFIG_ARRAY[@]}"
|
2008-04-27 15:08:15 +00:00
|
|
|
|
2009-08-19 17:44:44 +00:00
|
|
|
CT_DoLog EXTRA "Building binutils' libraries (${targets[*]}) for target"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} "${build_targets[@]}"
|
2009-08-19 17:44:44 +00:00
|
|
|
CT_DoLog EXTRA "Installing binutils' libraries (${targets[*]}) for target"
|
2016-11-21 07:50:17 +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
|
|
|
}
|