summaryrefslogtreecommitdiff
path: root/scripts/build/binutils
diff options
context:
space:
mode:
authorYann Diorcet <diorcet.yann@gmail.com>2012-11-16 14:25:57 (GMT)
committerYann Diorcet <diorcet.yann@gmail.com>2012-11-16 14:25:57 (GMT)
commitb43fdf40f1f90c4c313dda5b74955cc725a88b40 (patch)
tree70c65d158f49bc2c50fdbc3e4a61a7f62cbe747b /scripts/build/binutils
parent1af4a119d20cd1f806262f5a951ba0a356da3d8a (diff)
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
Diffstat (limited to 'scripts/build/binutils')
-rw-r--r--scripts/build/binutils/binutils.sh8
-rw-r--r--scripts/build/binutils/elf2flt.sh10
2 files changed, 15 insertions, 3 deletions
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index 0aeb393..38bea69 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -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} \
diff --git a/scripts/build/binutils/elf2flt.sh b/scripts/build/binutils/elf2flt.sh
index d9d8e0e..f0dd690 100644
--- a/scripts/build/binutils/elf2flt.sh
+++ b/scripts/build/binutils/elf2flt.sh
@@ -49,6 +49,8 @@ do_elf2flt_for_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[@]}"
@@ -68,6 +70,7 @@ do_elf2flt_for_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[@]}"
@@ -102,12 +105,14 @@ do_elf2flt_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)
do_elf2flt_backend() {
local host
local prefix
local static_build
local cflags
+ local ldflags
local binutils_bld
local binutils_src
local arg
@@ -120,7 +125,8 @@ do_elf2flt_backend() {
CT_DoLog EXTRA "Configuring elf2flt"
CT_DoExecLog CFG \
- CFLAGS="${host_cflags}" \
+ CFLAGS="${cflags}" \
+ LDFLAGS="${ldflags}" \
"${CT_SRC_DIR}/elf2flt-${CT_ELF2FLT_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${host} \