scripts/build/binutils/elf2flt.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Mon Nov 19 23:24:49 2012 +0100 (2012-11-19)
changeset 3122 23fbfabd8a0f
parent 3090 a221c86d9b33
permissions -rw-r--r--
binutils/elf2flt: remove use of CVS snapshots

The CVS snapshot options are never used, so get rid of them.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
     1 # This file adds functions to build elf2flt
     2 # Copyright 2009 John Williams
     3 # Copyright 2007 Yann E. MORIN
     4 # Licensed under the GPL v2. See COPYING in the root of this package
     5 
     6 # Default: do nothing
     7 do_elf2flt_get()        { :; }
     8 do_elf2flt_extract()    { :; }
     9 do_elf2flt_for_build()  { :; }
    10 do_elf2flt_for_host()   { :; }
    11 
    12 if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
    13 
    14 # Download elf2flt
    15 do_elf2flt_get() {
    16     if [ "${CT_ELF2FLT_CUSTOM}" = "y" ]; then
    17         CT_GetCustom "elf2flt" "${ELF2FLT_VERSION}" \
    18                      "${CT_ELF2FLT_CUSTOM_LOCATION}"
    19     else
    20         CT_GetCVS "elf2flt-${CT_ELF2FLT_VERSION}"               \
    21                   ":pserver:anonymous@cvs.uclinux.org:/var/cvs" \
    22                   "elf2flt"                                     \
    23                   "" \
    24                   "elf2flt-${CT_ELF2FLT_VERSION}"
    25     fi
    26 }
    27 
    28 # Extract elf2flt
    29 do_elf2flt_extract() {
    30     # If using custom directory location, nothing to do
    31     if [    "${CT_ELF2FLT_CUSTOM}" = "y" \
    32          -a -d "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}" ]; then
    33         return 0
    34     fi
    35     CT_Extract "elf2flt-${CT_ELF2FLT_VERSION}"
    36     CT_Patch "elf2flt" "${CT_ELF2FLT_VERSION}"
    37 }
    38 
    39 # Build elf2flt for build -> target
    40 do_elf2flt_for_build() {
    41     local -a elf2flt_opts
    42 
    43     case "${CT_TOOLCHAIN_TYPE}" in
    44         native|cross)   return 0;;
    45     esac
    46 
    47     CT_DoStep INFO "Installing elf2flt for build"
    48     CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}"
    49 
    50     elf2flt_opts+=( "host=${CT_BUILD}" )
    51     elf2flt_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
    52     elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
    53     elf2flt_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
    54     elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_HOST}" )
    55 
    56     do_elf2flt_backend "${elf2flt_opts[@]}"
    57 
    58     CT_Popd
    59     CT_EndStep
    60 }
    61 
    62 # Build elf2flt for host -> target
    63 do_elf2flt_for_host() {
    64     local -a elf2flt_opts
    65 
    66     CT_DoStep INFO "Installing elf2flt for host"
    67     CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-host-${CT_HOST}"
    68 
    69     elf2flt_opts+=( "host=${CT_HOST}" )
    70     elf2flt_opts+=( "prefix=${CT_PREFIX_DIR}" )
    71     elf2flt_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
    72     elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
    73     elf2flt_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
    74     elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" )
    75 
    76     do_elf2flt_backend "${elf2flt_opts[@]}"
    77 
    78     # Make those new tools available to the core C compilers to come.
    79     # Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as
    80     # well. Create that.
    81     # Don't do it for canadian or cross-native, because the binutils
    82     # are not executable on the build machine.
    83     case "${CT_TOOLCHAIN_TYPE}" in
    84         cross|native)
    85             mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin"
    86             mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
    87             for t in elf2flt flthdr; do
    88                 CT_DoExecLog ALL ln -sv                                         \
    89                                     "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}"    \
    90                                     "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin/${t}"
    91                 CT_DoExecLog ALL ln -sv                                         \
    92                                     "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}"    \
    93                                     "${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-${t}"
    94             done
    95             ;;
    96         *)  ;;
    97     esac
    98 
    99     CT_Popd
   100     CT_EndStep
   101 }
   102 
   103 # Build elf2flt for X -> target
   104 #     Parameter     : description               : type      : default
   105 #     host          : machine to run on         : tuple     : (none)
   106 #     prefix        : prefix to install into    : dir       : (none)
   107 #     static_build  : build statcially          : bool      : no
   108 #     cflags        : cflags to use             : string    : (empty)
   109 #     ldflags       : ldflags to use            : string    : (empty)
   110 do_elf2flt_backend() {
   111     local host
   112     local prefix
   113     local static_build
   114     local cflags
   115     local ldflags
   116     local binutils_bld
   117     local binutils_src
   118     local arg
   119 
   120     for arg in "$@"; do
   121         eval "${arg// /\\ }"
   122     done
   123 
   124     binutils_src="${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}"
   125 
   126     CT_DoLog EXTRA "Configuring elf2flt"
   127     CT_DoExecLog CFG                                            \
   128     CFLAGS="${cflags}"                                          \
   129     LDFLAGS="${ldflags}"                                        \
   130     "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}/configure"     \
   131         --build=${CT_BUILD}                                     \
   132         --host=${host}                                          \
   133         --target=${CT_TARGET}                                   \
   134         --prefix=${prefix}                                      \
   135         --with-bfd-include-dir=${binutils_bld}/bfd              \
   136         --with-binutils-include-dir=${binutils_src}/include     \
   137         --with-libbfd=${binutils_bld}/bfd/libbfd.a              \
   138         --with-libiberty=${binutils_bld}/libiberty/libiberty.a  \
   139         ${elf2flt_opts}                                         \
   140         "${CT_ELF2FLT_EXTRA_CONFIG_ARRAY[@]}"
   141 
   142     CT_DoLog EXTRA "Building elf2flt"
   143     CT_DoExecLog ALL make ${JOBSFLAGS}
   144 
   145     CT_DoLog EXTRA "Installing elf2flt"
   146     CT_DoExecLog ALL make install
   147 }
   148 
   149 fi # CT_ARCH_BINFMT_FLAT