# HG changeset patch # User "Yann E. MORIN" # Date 1311544348 -7200 # Node ID 3f70dd642d347ef29057e665187fc1e546c78574 # Parent ddaae597fd7ce72c1654ab40fb8e0fbf60848267 binutils: add frontends for building to run on the build machine In canadian-cross, we need binutils running on the build machine to be able to build the target C library. Signed-off-by: "Yann E. MORIN" diff -r ddaae597fd7c -r 3f70dd642d34 scripts/build/binutils/binutils.sh --- a/scripts/build/binutils/binutils.sh Sun Jul 17 18:56:30 2011 +0200 +++ b/scripts/build/binutils/binutils.sh Sun Jul 24 23:52:28 2011 +0200 @@ -15,6 +15,26 @@ CT_Patch "binutils" "${CT_BINUTILS_VERSION}" } +# 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}" ) + + do_binutils_backend "${binutils_opts[@]}" + + CT_Popd + CT_EndStep +} + # Build binutils for host -> target do_binutils_for_host() { local -a binutils_tools diff -r ddaae597fd7c -r 3f70dd642d34 scripts/build/binutils/elf2flt.sh --- a/scripts/build/binutils/elf2flt.sh Sun Jul 17 18:56:30 2011 +0200 +++ b/scripts/build/binutils/elf2flt.sh Sun Jul 24 23:52:28 2011 +0200 @@ -6,6 +6,7 @@ # Default: do nothing do_elf2flt_get() { :; } do_elf2flt_extract() { :; } +do_elf2flt_for_build() { :; } do_elf2flt_for_host() { :; } if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then @@ -25,6 +26,27 @@ CT_Patch "elf2flt-cvs" "${CT_ELF2FLT_VERSION}" } +# Build elf2flt for build -> target +do_elf2flt_for_build() { + local -a elf2flt_opts + + case "${CT_TOOLCHAIN_TYPE}" in + native|cross) return 0;; + esac + + CT_DoStep INFO "Installing elf2flt for build" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}" + + elf2flt_opts+=( "host=${CT_BUILD}" ) + elf2flt_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" ) + elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_HOST}" ) + + do_elf2flt_backend "${elf2flt_opts[@]}" + + CT_Popd + CT_EndStep +} + # Build elf2flt for host -> target do_elf2flt_for_host() { local -a elf2flt_opts @@ -36,6 +58,7 @@ elf2flt_opts+=( "prefix=${CT_PREFIX_DIR}" ) elf2flt_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" ) elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" ) + elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" ) do_elf2flt_backend "${elf2flt_opts[@]}" @@ -75,14 +98,14 @@ local prefix local static_build local cflags + local binutils_bld + local binutils_src local arg for arg in "$@"; do eval "${arg// /\\ }" done - elf2flt_opts= - binutils_bld="${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" binutils_src="${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}" CT_DoLog EXTRA "Configuring elf2flt"