scripts/build/debug/300-gdb.sh
changeset 3189 9fa7078581b3
parent 3188 388459fe2c22
child 3190 22556c14a09c
     1.1 --- a/scripts/build/debug/300-gdb.sh	Sun Mar 03 15:25:52 2013 +0100
     1.2 +++ b/scripts/build/debug/300-gdb.sh	Sun Mar 03 15:30:02 2013 +0100
     1.3 @@ -280,26 +280,16 @@
     1.4              gdb_native_CFLAGS+=("-L${CT_BUILD_DIR}/static-target/lib")
     1.5          fi # need_ncurses_src
     1.6  
     1.7 -        if [ "${need_expat_src}" = "y" ]; then
     1.8 -            CT_DoLog EXTRA "Building static target expat"
     1.9 -
    1.10 -            mkdir -p "${CT_BUILD_DIR}/expat-build"
    1.11 -            cd "${CT_BUILD_DIR}/expat-build"
    1.12 -
    1.13 -            CT_DoExecLog CFG                                                \
    1.14 -            "${CT_SRC_DIR}/expat-${CT_DEBUG_GDB_EXPAT_VERSION}/configure"   \
    1.15 -                --build=${CT_BUILD}                                         \
    1.16 -                --host=${CT_TARGET}                                         \
    1.17 -                --prefix="${CT_BUILD_DIR}/static-target"                    \
    1.18 -                --enable-static                                             \
    1.19 -                --disable-shared
    1.20 -
    1.21 -            CT_DoExecLog ALL make ${JOBSFLAGS}
    1.22 -            CT_DoExecLog ALL make install
    1.23 -
    1.24 -            native_extra_config+=("--with-expat")
    1.25 -            native_extra_config+=("--with-libexpat-prefix=${CT_BUILD_DIR}/static-target")
    1.26 -        fi # need_expat_src
    1.27 +        # Build libexpat
    1.28 +        CT_DoLog EXTRA "Building static target expat"
    1.29 +        CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-target-${CT_TARGET}"
    1.30 +        do_expat_backend host="${CT_TARGET}"                    \
    1.31 +                         prefix="${CT_BUILD_DIR}/static-target" \
    1.32 +                         cflags=""                              \
    1.33 +                         ldflags=""
    1.34 +        CT_Popd
    1.35 +        native_extra_config+=("--with-expat")
    1.36 +        native_extra_config+=("--with-libexpat-prefix=${CT_BUILD_DIR}/static-target")
    1.37  
    1.38          CT_DoLog EXTRA "Configuring native gdb"
    1.39  
    1.40 @@ -419,3 +409,32 @@
    1.41          CT_EndStep
    1.42      fi
    1.43  }
    1.44 +
    1.45 +# Build libexpat
    1.46 +#   Parameter     : description               : type      : default
    1.47 +#   host          : machine to run on         : tuple     : (none)
    1.48 +#   prefix        : prefix to install into    : dir       : (none)
    1.49 +#   cflags        : cflags to use             : string    : (empty)
    1.50 +#   ldflags       : ldflags to use            : string    : (empty)
    1.51 +do_gdb_expat_backend() {
    1.52 +    local host
    1.53 +    local prefix
    1.54 +    local cflags
    1.55 +    local ldflags
    1.56 +    local arg
    1.57 +
    1.58 +    for arg in "$@"; do
    1.59 +        eval "${arg// /\\ }"
    1.60 +    done
    1.61 +
    1.62 +    CT_DoExecLog CFG                                                \
    1.63 +    "${CT_SRC_DIR}/expat-${CT_DEBUG_GDB_EXPAT_VERSION}/configure"   \
    1.64 +        --build=${CT_BUILD}                                         \
    1.65 +        --host=${host}                                              \
    1.66 +        --prefix="${prefix}"                                        \
    1.67 +        --enable-static                                             \
    1.68 +        --disable-shared
    1.69 +
    1.70 +    CT_DoExecLog ALL make ${JOBSFLAGS}
    1.71 +    CT_DoExecLog ALL make install
    1.72 +}