summaryrefslogtreecommitdiff
path: root/scripts/build/debug/300-gdb.sh
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@free.fr>2013-03-03 14:30:02 (GMT)
committerYann E. MORIN" <yann.morin.1998@free.fr>2013-03-03 14:30:02 (GMT)
commit5b41901f995f6643872df689c87791646d5eb4a3 (patch)
tree00651eaa924456bcd6d1b7b211ac30ab487ece70 /scripts/build/debug/300-gdb.sh
parentc31652d67d76978e3e17df81013cc90244cabe0d (diff)
debug/gdb: fix $need_expat_src usage for native-gdb
For the native-gdb (ie on the target), we unconditionally need to build expat. Make it a backend, it makes a litle bit cleaner code. Reported-by: Trevor Woerner <twoerner@gmail.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Diffstat (limited to 'scripts/build/debug/300-gdb.sh')
-rw-r--r--scripts/build/debug/300-gdb.sh59
1 files changed, 39 insertions, 20 deletions
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index 6cbefa4..4b12cc5 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -280,26 +280,16 @@ do_debug_gdb_build() {
gdb_native_CFLAGS+=("-L${CT_BUILD_DIR}/static-target/lib")
fi # need_ncurses_src
- if [ "${need_expat_src}" = "y" ]; then
- CT_DoLog EXTRA "Building static target expat"
-
- mkdir -p "${CT_BUILD_DIR}/expat-build"
- cd "${CT_BUILD_DIR}/expat-build"
-
- CT_DoExecLog CFG \
- "${CT_SRC_DIR}/expat-${CT_DEBUG_GDB_EXPAT_VERSION}/configure" \
- --build=${CT_BUILD} \
- --host=${CT_TARGET} \
- --prefix="${CT_BUILD_DIR}/static-target" \
- --enable-static \
- --disable-shared
-
- CT_DoExecLog ALL make ${JOBSFLAGS}
- CT_DoExecLog ALL make install
-
- native_extra_config+=("--with-expat")
- native_extra_config+=("--with-libexpat-prefix=${CT_BUILD_DIR}/static-target")
- fi # need_expat_src
+ # Build libexpat
+ CT_DoLog EXTRA "Building static target expat"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-target-${CT_TARGET}"
+ do_expat_backend host="${CT_TARGET}" \
+ prefix="${CT_BUILD_DIR}/static-target" \
+ cflags="" \
+ ldflags=""
+ CT_Popd
+ native_extra_config+=("--with-expat")
+ native_extra_config+=("--with-libexpat-prefix=${CT_BUILD_DIR}/static-target")
CT_DoLog EXTRA "Configuring native gdb"
@@ -419,3 +409,32 @@ do_debug_gdb_build() {
CT_EndStep
fi
}
+
+# Build libexpat
+# Parameter : description : type : default
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# cflags : cflags to use : string : (empty)
+# ldflags : ldflags to use : string : (empty)
+do_gdb_expat_backend() {
+ local host
+ local prefix
+ local cflags
+ local ldflags
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ CT_DoExecLog CFG \
+ "${CT_SRC_DIR}/expat-${CT_DEBUG_GDB_EXPAT_VERSION}/configure" \
+ --build=${CT_BUILD} \
+ --host=${host} \
+ --prefix="${prefix}" \
+ --enable-static \
+ --disable-shared
+
+ CT_DoExecLog ALL make ${JOBSFLAGS}
+ CT_DoExecLog ALL make install
+}