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 CT_GetCVS "elf2flt-cvs-${CT_ELF2FLT_VERSION}" \
17 ":pserver:anonymous@cvs.uclinux.org:/var/cvs" \
20 "elf2flt-cvs-${CT_ELF2FLT_VERSION}"
24 do_elf2flt_extract() {
25 CT_Extract "elf2flt-cvs-${CT_ELF2FLT_VERSION}"
26 CT_Patch "elf2flt-cvs" "${CT_ELF2FLT_VERSION}"
29 # Build elf2flt for build -> target
30 do_elf2flt_for_build() {
33 case "${CT_TOOLCHAIN_TYPE}" in
34 native|cross) return 0;;
37 CT_DoStep INFO "Installing elf2flt for build"
38 CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-build-${CT_BUILD}"
40 elf2flt_opts+=( "host=${CT_BUILD}" )
41 elf2flt_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
42 elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-build-${CT_HOST}" )
44 do_elf2flt_backend "${elf2flt_opts[@]}"
50 # Build elf2flt for host -> target
51 do_elf2flt_for_host() {
54 CT_DoStep INFO "Installing elf2flt for host"
55 CT_mkdir_pushd "${CT_BUILD_DIR}/build-elf2flt-host-${CT_HOST}"
57 elf2flt_opts+=( "host=${CT_HOST}" )
58 elf2flt_opts+=( "prefix=${CT_PREFIX_DIR}" )
59 elf2flt_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
60 elf2flt_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
61 elf2flt_opts+=( "binutils_bld=${CT_BUILD_DIR}/build-binutils-host-${CT_HOST}" )
63 do_elf2flt_backend "${elf2flt_opts[@]}"
65 # Make those new tools available to the core C compilers to come.
66 # Note: some components want the ${TARGET}-{ar,as,ld,strip} commands as
68 # Don't do it for canadian or cross-native, because the binutils
69 # are not executable on the build machine.
70 case "${CT_TOOLCHAIN_TYPE}" in
72 mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin"
73 mkdir -p "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
74 for t in elf2flt flthdr; do
75 CT_DoExecLog ALL ln -sv \
76 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" \
77 "${CT_BUILDTOOLS_PREFIX_DIR}/${CT_TARGET}/bin/${t}"
78 CT_DoExecLog ALL ln -sv \
79 "${CT_PREFIX_DIR}/bin/${CT_TARGET}-${t}" \
80 "${CT_BUILDTOOLS_PREFIX_DIR}/bin/${CT_TARGET}-${t}"
90 # Build elf2flt for X -> target
91 # Parameter : description : type : default
92 # host : machine to run on : tuple : (none)
93 # prefix : prefix to install into : dir : (none)
94 # static_build : build statcially : bool : no
95 # cflags : host cflags to use : string : (empty)
96 do_elf2flt_backend() {
109 binutils_src="${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}"
111 CT_DoLog EXTRA "Configuring elf2flt"
113 CFLAGS="${host_cflags}" \
114 "${CT_SRC_DIR}/elf2flt-cvs-${CT_ELF2FLT_VERSION}/configure" \
115 --build=${CT_BUILD} \
117 --target=${CT_TARGET} \
119 --with-bfd-include-dir=${binutils_bld}/bfd \
120 --with-binutils-include-dir=${binutils_src}/include \
121 --with-libbfd=${binutils_bld}/bfd/libbfd.a \
122 --with-libiberty=${binutils_bld}/libiberty/libiberty.a \
124 "${CT_ELF2FLT_EXTRA_CONFIG_ARRAY[@]}"
126 CT_DoLog EXTRA "Building elf2flt"
127 CT_DoExecLog ALL make ${JOBSFLAGS}
129 CT_DoLog EXTRA "Installing elf2flt"
130 CT_DoExecLog ALL make install
133 fi # CT_ARCH_BINFMT_FLAT