From 5b41901f995f6643872df689c87791646d5eb4a3 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Sun, 3 Mar 2013 15:30:02 +0100 Subject: 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 Signed-off-by: "Yann E. MORIN" 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 +} -- cgit v0.10.2-6-g49f6