# HG changeset patch # User "Yann E. MORIN" # Date 1362321002 -3600 # Node ID 9fa7078581b3b8df59aec84bdfdf500e41a14b80 # Parent 388459fe2c229a713a9290fc819367e65ea0023c 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 -r 388459fe2c22 -r 9fa7078581b3 scripts/build/debug/300-gdb.sh --- a/scripts/build/debug/300-gdb.sh Sun Mar 03 15:25:52 2013 +0100 +++ b/scripts/build/debug/300-gdb.sh Sun Mar 03 15:30:02 2013 +0100 @@ -280,26 +280,16 @@ 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 @@ 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 +}