scripts: add BUILD/HOST extra cflags/ldflags

On some hosts, and for certain toolchains (eg. toolchain targetting
the upcoming Darwin), it may be necessary to pass arbitrary CFLAGS
and/or LDFLAGS when building the components.

And necessary infrastructure:
  - EXTRA_{CFLAGS,LDFLAGS}_FOR_{BUILD,HOST} as config options
  - pass those extra flags to components

Fix-up a slight typo in elf2flt at the same time (misnamed cflags).

Signed-off-by: Yann Diorcet <diorcet.yann@gmail.com>
Message-Id: <d24043276c9243a35421.1353077450@macbook-smorlat.local>
Patchwork-Id: 199645
This commit is contained in:
Yann Diorcet
2012-11-16 15:25:57 +01:00
parent 1af4a119d2
commit b43fdf40f1
11 changed files with 114 additions and 15 deletions

View File

@ -39,6 +39,8 @@ do_binutils_for_build() {
binutils_opts+=( "host=${CT_BUILD}" )
binutils_opts+=( "prefix=${CT_BUILDTOOLS_PREFIX_DIR}" )
binutils_opts+=( "cflags=${CT_CFLAGS_FOR_BUILD}" )
binutils_opts+=( "ldflags=${CT_LDFLAGS_FOR_BUILD}" )
do_binutils_backend "${binutils_opts[@]}"
@ -58,6 +60,7 @@ do_binutils_for_host() {
binutils_opts+=( "prefix=${CT_PREFIX_DIR}" )
binutils_opts+=( "static_build=${CT_STATIC_TOOLCHAIN}" )
binutils_opts+=( "cflags=${CT_CFLAGS_FOR_HOST}" )
binutils_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" )
binutils_opts+=( "build_manuals=${CT_BUILD_MANUALS}" )
do_binutils_backend "${binutils_opts[@]}"
@ -99,13 +102,15 @@ do_binutils_for_host() {
# host : machine to run on : tuple : (none)
# prefix : prefix to install into : dir : (none)
# static_build : build statcially : bool : no
# cflags : host cflags to use : string : (empty)
# cflags : cflags to use : string : (empty)
# ldflags : ldflags to use : string : (empty)
# build_manuals : whether to build manuals : bool : no
do_binutils_backend() {
local host
local prefix
local static_build
local cflags
local ldflags
local build_manuals=no
local -a extra_config
local -a extra_make_flags
@ -158,6 +163,7 @@ do_binutils_backend() {
CT_DoExecLog CFG \
CFLAGS="${cflags}" \
CXXFLAGS="${cflags}" \
LDFLAGS="${ldflags}" \
"${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${host} \