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
7 do_elf2flt_get() { :; }
8 do_elf2flt_extract() { :; }
9 do_elf2flt_for_build() { :; }
10 do_elf2flt_for_host() { :; }
12 if [ -n "${CT_ARCH_BINFMT_FLAT}" ]; then
16 if [ "${CT_ELF2FLT_CUSTOM}" = "y" ]; then
17 CT_GetCustom "elf2flt" "${ELF2FLT_VERSION}" \
18 "${CT_ELF2FLT_CUSTOM_LOCATION}"
20 CT_GetCVS "elf2flt-${CT_ELF2FLT_VERSION}" \
21 ":pserver:anonymous@cvs.uclinux.org:/var/cvs" \
24 "elf2flt-${CT_ELF2FLT_VERSION}"
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
35 CT_Extract "elf2flt-${CT_ELF2FLT_VERSION}"
36 CT_Patch "elf2flt" "${CT_ELF2FLT_VERSION}"
39 # Build elf2flt for build -> target
40 do_elf2flt_for_build() {
43 case "${CT_TOOLCHAIN_TYPE}" in
44 native|cross) return 0;;
47 CT_DoStep INFO "Installing elf2flt for build"
48 CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}"
50 elf2flt_opts+=( "host=${CT_BUILD}" )
51 elf2flt_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
52 elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_HOST}" )
54 do_elf2flt_backend "${elf2flt_opts[@]}"
60 # Build elf2flt for host -> target
61 do_elf2flt_for_host() {
64 CT_DoStep INFO "Installing elf2flt for host"
65 CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-host-${CT_HOST}"
67 elf2flt_opts+=( "host=${CT_HOST}" )
68 elf2flt_opts+=( "prefix=${CT_PREFIX_DIR}" )
69 elf2flt_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
70 elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
71 elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" )
73 do_elf2flt_backend "${elf2flt_opts[@]}"
75 # Make those new tools available to the core C compilers to come.
76 # Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as
78 # Don't do it for canadian or cross-native, because the binutils
79 # are not executable on the build machine.
80 case "${CT_TOOLCHAIN_TYPE}" in
82 mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin"
83 mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
84 for t in elf2flt flthdr; do
85 CT_DoExecLog ALL ln -sv \
86 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" \
87 "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin/${t}"
88 CT_DoExecLog ALL ln -sv \
89 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" \
90 "${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-${t}"
100 # Build elf2flt for X -> target
101 # Parameter : description : type : default
102 # host : machine to run on : tuple : (none)
103 # prefix : prefix to install into : dir : (none)
104 # static_build : build statcially : bool : no
105 # cflags : host cflags to use : string : (empty)
106 do_elf2flt_backend() {
119 binutils_src="${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}"
121 CT_DoLog EXTRA "Configuring elf2flt"
123 CFLAGS="${host_cflags}" \
124 "${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}/configure" \
125 --build=${CT_BUILD} \
127 --target=${CT_TARGET} \
129 --with-bfd-include-dir=${binutils_bld}/bfd \
130 --with-binutils-include-dir=${binutils_src}/include \
131 --with-libbfd=${binutils_bld}/bfd/libbfd.a \
132 --with-libiberty=${binutils_bld}/libiberty/libiberty.a \
134 "${CT_ELF2FLT_EXTRA_CONFIG_ARRAY[@]}"
136 CT_DoLog EXTRA "Building elf2flt"
137 CT_DoExecLog ALL make ${JOBSFLAGS}
139 CT_DoLog EXTRA "Installing elf2flt"
140 CT_DoExecLog ALL make install
143 fi # CT_ARCH_BINFMT_FLAT