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