scripts/build/debug/gdb.sh
changeset 96 aa1a9fbd6eb8
child 97 63a30dd47eb8
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/build/debug/gdb.sh	Thu May 17 16:22:51 2007 +0000
     1.3 @@ -0,0 +1,124 @@
     1.4 +# Build script for the gdb debug facility
     1.5 +
     1.6 +is_enabled="${CT_GDB}"
     1.7 +
     1.8 +do_debug_gdb_suffix() {
     1.9 +    case "${CT_GDB_VERSION}" in
    1.10 +        snapshot)   ;;
    1.11 +        *)          echo "-${CT_GDB_VERSION}";;
    1.12 +    esac
    1.13 +}
    1.14 +
    1.15 +do_debug_gdb_get() {
    1.16 +    CT_GetFile "gdb`do_debug_gdb_suffix`"                           \
    1.17 +               ftp://ftp.gnu.org/pub/gnu/gdb                        \
    1.18 +               ftp://sources.redhat.com/pub/gdb/releases            \
    1.19 +               ftp://sources.redhat.com/pub/gdb/old-releases        \
    1.20 +               ftp://sources.redhat.com/pub/gdb/snapshots/current 
    1.21 +}
    1.22 +
    1.23 +do_debug_gdb_extract() {
    1.24 +    CT_ExtractAndPatch "gdb`do_debug_gdb_suffix`"
    1.25 +}
    1.26 +
    1.27 +do_debug_gdb_build() {
    1.28 +    gdb_src_dir="${CT_SRC_DIR}/gdb`do_debug_gdb_suffix`"
    1.29 +
    1.30 +    extra_config=
    1.31 +    # Version 6.3 and below behave badly with gdbmi
    1.32 +    case "${CT_GDB_VERSION}" in
    1.33 +        6.2*|6.3)   extra_config="${extra_config} --disable-gdbmi";;
    1.34 +    esac
    1.35 +
    1.36 +    if [ "${CT_GDB_CROSS}" = "y" ]; then
    1.37 +        CT_DoStep EXTRA "Installing cross-gdb"
    1.38 +        CT_DoLog EXTRA "Configuring cross-gdb"
    1.39 +
    1.40 +        mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
    1.41 +        cd "${CT_BUILD_DIR}/build-gdb-cross"
    1.42 +
    1.43 +        "${gdb_src_dir}/configure"                      \
    1.44 +            --build=${CT_BUILD}                         \
    1.45 +            --host=${CT_HOST}                           \
    1.46 +            --target=${CT_TARGET}                       \
    1.47 +            --prefix="${CT_INSTALL_DIR}"                \
    1.48 +            --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    1.49 +            --enable-threads                            \
    1.50 +            ${extra_config}                             2>&1 |CT_DoLog ALL
    1.51 +
    1.52 +        CT_DoLog EXTRA "Building cross-gdb"
    1.53 +        make ${PARALLELMFLAGS}                          2>&1 |CT_DoLog ALL
    1.54 +
    1.55 +        CT_DoLog EXTRA "Installing cross-gdb"
    1.56 +        make install                                    2>&1 |CT_DoLog ALL
    1.57 +
    1.58 +        CT_EndStep
    1.59 +
    1.60 +        CT_DoStep EXTRA "Installing gdbserver"
    1.61 +        CT_DoLog EXTRA "Configuring gdbserver"
    1.62 +
    1.63 +        mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
    1.64 +        cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
    1.65 +
    1.66 +        # Workaround for bad versions, where the configure
    1.67 +        # script for gdbserver is not executable...
    1.68 +        # Bah, GNU folks strike again... :-(
    1.69 +        chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
    1.70 +
    1.71 +        "${gdb_src_dir}/gdb/gdbserver/configure"        \
    1.72 +            --build=${CT_BUILD}                         \
    1.73 +            --host=${CT_TARGET}                         \
    1.74 +            --target=${CT_TARGET}                       \
    1.75 +            --prefix=/usr                               \
    1.76 +            --sysconfdir=/etc                           \
    1.77 +            --localstatedir=/var                        \
    1.78 +            --includedir="${CT_HEADERS_DIR}"            \
    1.79 +            --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    1.80 +            --program-prefix=                           \
    1.81 +            --without-uiout                             \
    1.82 +            --disable-tui                               \
    1.83 +            --disable-gdbtk                             \
    1.84 +            --without-x                                 \
    1.85 +            --without-included-gettext                  \
    1.86 +            ${extra_config}                             2>&1 |CT_DoLog ALL
    1.87 +
    1.88 +        CT_DoLog EXTRA "Building gdbserver"
    1.89 +        make ${PARALLELMFLAGS} CC=${CT_TARGET}-gcc      2>&1 |CT_DoLog ALL
    1.90 +
    1.91 +        CT_DoLog EXTRA "Installing gdbserver"
    1.92 +        make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install  2>&1 |CT_DoLog ALL
    1.93 +
    1.94 +        CT_EndStep
    1.95 +    fi
    1.96 +
    1.97 +    if [ "${CT_GDB_NATIVE}" = "y" ]; then
    1.98 +        CT_DoStep EXTRA "Installing native gdb"
    1.99 +        CT_DoLog EXTRA "Configuring native gdb"
   1.100 +
   1.101 +        mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
   1.102 +        cd "${CT_BUILD_DIR}/build-gdb-cross"
   1.103 +
   1.104 +        "${gdb_src_dir}/configure"                      \
   1.105 +            --build=${CT_BUILD}                         \
   1.106 +            --host=${CT_TARGET}                         \
   1.107 +            --target=${CT_TARGET}                       \
   1.108 +            --prefix=/usr                               \
   1.109 +            --with-build-sysroot="${CT_SYSROOT_DIR}"    \
   1.110 +            --without-uiout                             \
   1.111 +            --disable-tui                               \
   1.112 +            --disable-gdbtk                             \
   1.113 +            --without-x                                 \
   1.114 +            --disable-sim                               \
   1.115 +            --enable-gdbserver                          \
   1.116 +            --without-included-gettext                  \
   1.117 +            ${extra_config}                             2>&1 |CT_DoLog ALL
   1.118 +
   1.119 +        CT_DoLog EXTRA "Building native gdb"
   1.120 +        make ${PARALLELMFLAGS} CC=${CT_TARGET}-gcc      2>&1 |CT_DoLog ALL
   1.121 +
   1.122 +        CT_DoLog EXTRA "Installing native gdb"
   1.123 +        make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install  2>&1 |CT_DoLog ALL
   1.124 +
   1.125 +        CT_EndStep
   1.126 +    fi
   1.127 +}