scripts/build/binutils/elf2flt.sh
changeset 3123 6a5946fbc728
parent 3122 23fbfabd8a0f
child 3124 e097000b5420
     1.1 --- a/scripts/build/binutils/elf2flt.sh	Mon Nov 19 23:24:49 2012 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,149 +0,0 @@
     1.4 -# This file adds functions to build elf2flt
     1.5 -# Copyright 2009 John Williams
     1.6 -# Copyright 2007 Yann E. MORIN
     1.7 -# Licensed under the GPL v2. See COPYING in the root of this package
     1.8 -
     1.9 -# Default: do nothing
    1.10 -do_elf2flt_get()        { :; }
    1.11 -do_elf2flt_extract()    { :; }
    1.12 -do_elf2flt_for_build()  { :; }
    1.13 -do_elf2flt_for_host()   { :; }
    1.14 -
    1.15 -if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
    1.16 -
    1.17 -# Download elf2flt
    1.18 -do_elf2flt_get() {
    1.19 -    if [ "${CT_ELF2FLT_CUSTOM}" = "y" ]; then
    1.20 -        CT_GetCustom "elf2flt" "${ELF2FLT_VERSION}" \
    1.21 -                     "${CT_ELF2FLT_CUSTOM_LOCATION}"
    1.22 -    else
    1.23 -        CT_GetCVS "elf2flt-${CT_ELF2FLT_VERSION}"               \
    1.24 -                  ":pserver:anonymous@cvs.uclinux.org:/var/cvs" \
    1.25 -                  "elf2flt"                                     \
    1.26 -                  "" \
    1.27 -                  "elf2flt-${CT_ELF2FLT_VERSION}"
    1.28 -    fi
    1.29 -}
    1.30 -
    1.31 -# Extract elf2flt
    1.32 -do_elf2flt_extract() {
    1.33 -    # If using custom directory location, nothing to do
    1.34 -    if [    "${CT_ELF2FLT_CUSTOM}" = "y" \
    1.35 -         -a -d "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}" ]; then
    1.36 -        return 0
    1.37 -    fi
    1.38 -    CT_Extract "elf2flt-${CT_ELF2FLT_VERSION}"
    1.39 -    CT_Patch "elf2flt" "${CT_ELF2FLT_VERSION}"
    1.40 -}
    1.41 -
    1.42 -# Build elf2flt for build -> target
    1.43 -do_elf2flt_for_build() {
    1.44 -    local -a elf2flt_opts
    1.45 -
    1.46 -    case "${CT_TOOLCHAIN_TYPE}" in
    1.47 -        native|cross)   return 0;;
    1.48 -    esac
    1.49 -
    1.50 -    CT_DoStep INFO "Installing elf2flt for build"
    1.51 -    CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}"
    1.52 -
    1.53 -    elf2flt_opts+=( "host=${CT_BUILD}" )
    1.54 -    elf2flt_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    1.55 -    elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
    1.56 -    elf2flt_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
    1.57 -    elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_HOST}" )
    1.58 -
    1.59 -    do_elf2flt_backend "${elf2flt_opts[@]}"
    1.60 -
    1.61 -    CT_Popd
    1.62 -    CT_EndStep
    1.63 -}
    1.64 -
    1.65 -# Build elf2flt for host -> target
    1.66 -do_elf2flt_for_host() {
    1.67 -    local -a elf2flt_opts
    1.68 -
    1.69 -    CT_DoStep INFO "Installing elf2flt for host"
    1.70 -    CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-host-${CT_HOST}"
    1.71 -
    1.72 -    elf2flt_opts+=( "host=${CT_HOST}" )
    1.73 -    elf2flt_opts+=( "prefix=${CT_PREFIX_DIR}" )
    1.74 -    elf2flt_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
    1.75 -    elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    1.76 -    elf2flt_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
    1.77 -    elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" )
    1.78 -
    1.79 -    do_elf2flt_backend "${elf2flt_opts[@]}"
    1.80 -
    1.81 -    # Make those new tools available to the core C compilers to come.
    1.82 -    # Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as
    1.83 -    # well. Create that.
    1.84 -    # Don't do it for canadian or cross-native, because the binutils
    1.85 -    # are not executable on the build machine.
    1.86 -    case "${CT_TOOLCHAIN_TYPE}" in
    1.87 -        cross|native)
    1.88 -            mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin"
    1.89 -            mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
    1.90 -            for t in elf2flt flthdr; do
    1.91 -                CT_DoExecLog ALL ln -sv                                         \
    1.92 -                                    "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}"    \
    1.93 -                                    "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin/${t}"
    1.94 -                CT_DoExecLog ALL ln -sv                                         \
    1.95 -                                    "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}"    \
    1.96 -                                    "${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-${t}"
    1.97 -            done
    1.98 -            ;;
    1.99 -        *)  ;;
   1.100 -    esac
   1.101 -
   1.102 -    CT_Popd
   1.103 -    CT_EndStep
   1.104 -}
   1.105 -
   1.106 -# Build elf2flt for X -> target
   1.107 -#     Parameter     : description               : type      : default
   1.108 -#     host          : machine to run on         : tuple     : (none)
   1.109 -#     prefix        : prefix to install into    : dir       : (none)
   1.110 -#     static_build  : build statcially          : bool      : no
   1.111 -#     cflags        : cflags to use             : string    : (empty)
   1.112 -#     ldflags       : ldflags to use            : string    : (empty)
   1.113 -do_elf2flt_backend() {
   1.114 -    local host
   1.115 -    local prefix
   1.116 -    local static_build
   1.117 -    local cflags
   1.118 -    local ldflags
   1.119 -    local binutils_bld
   1.120 -    local binutils_src
   1.121 -    local arg
   1.122 -
   1.123 -    for arg in "$@"; do
   1.124 -        eval "${arg// /\\ }"
   1.125 -    done
   1.126 -
   1.127 -    binutils_src="${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}"
   1.128 -
   1.129 -    CT_DoLog EXTRA "Configuring elf2flt"
   1.130 -    CT_DoExecLog CFG                                            \
   1.131 -    CFLAGS="${cflags}"                                          \
   1.132 -    LDFLAGS="${ldflags}"                                        \
   1.133 -    "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}/configure"     \
   1.134 -        --build=${CT_BUILD}                                     \
   1.135 -        --host=${host}                                          \
   1.136 -        --target=${CT_TARGET}                                   \
   1.137 -        --prefix=${prefix}                                      \
   1.138 -        --with-bfd-include-dir=${binutils_bld}/bfd              \
   1.139 -        --with-binutils-include-dir=${binutils_src}/include     \
   1.140 -        --with-libbfd=${binutils_bld}/bfd/libbfd.a              \
   1.141 -        --with-libiberty=${binutils_bld}/libiberty/libiberty.a  \
   1.142 -        ${elf2flt_opts}                                         \
   1.143 -        "${CT_ELF2FLT_EXTRA_CONFIG_ARRAY[@]}"
   1.144 -
   1.145 -    CT_DoLog EXTRA "Building elf2flt"
   1.146 -    CT_DoExecLog ALL make ${JOBSFLAGS}
   1.147 -
   1.148 -    CT_DoLog EXTRA "Installing elf2flt"
   1.149 -    CT_DoExecLog ALL make install
   1.150 -}
   1.151 -
   1.152 -fi # CT_ARCH_BINFMT_FLAT