scripts/build/debug/gdb.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri May 18 19:55:49 2007 +0000 (2007-05-18)
changeset 105 5a8d4f6a19c7
parent 97 63a30dd47eb8
child 113 0a1e72093a51
permissions -rw-r--r--
Un-mark gdb and dmalloc being EXPERIMENTAL.
Mark native gdb as being EXPERIMENTAL (it depends on termcap, which we don't have yet).
     1 # Build script for the gdb debug facility
     2 
     3 is_enabled="${CT_GDB}"
     4 
     5 do_debug_gdb_suffix() {
     6     case "${CT_GDB_VERSION}" in
     7         snapshot)   ;;
     8         *)          echo "-${CT_GDB_VERSION}";;
     9     esac
    10 }
    11 
    12 do_debug_gdb_get() {
    13     CT_GetFile "gdb`do_debug_gdb_suffix`"                           \
    14                ftp://ftp.gnu.org/pub/gnu/gdb                        \
    15                ftp://sources.redhat.com/pub/gdb/releases            \
    16                ftp://sources.redhat.com/pub/gdb/old-releases        \
    17                ftp://sources.redhat.com/pub/gdb/snapshots/current 
    18 }
    19 
    20 do_debug_gdb_extract() {
    21     CT_ExtractAndPatch "gdb`do_debug_gdb_suffix`"
    22 }
    23 
    24 do_debug_gdb_build() {
    25     gdb_src_dir="${CT_SRC_DIR}/gdb`do_debug_gdb_suffix`"
    26 
    27     extra_config=
    28     # Version 6.3 and below behave badly with gdbmi
    29     case "${CT_GDB_VERSION}" in
    30         6.2*|6.3)   extra_config="${extra_config} --disable-gdbmi";;
    31     esac
    32 
    33     if [ "${CT_GDB_CROSS}" = "y" ]; then
    34         CT_DoStep INFO "Installing cross-gdb"
    35         CT_DoLog EXTRA "Configuring cross-gdb"
    36 
    37         mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
    38         cd "${CT_BUILD_DIR}/build-gdb-cross"
    39 
    40         "${gdb_src_dir}/configure"                      \
    41             --build=${CT_BUILD}                         \
    42             --host=${CT_HOST}                           \
    43             --target=${CT_TARGET}                       \
    44             --prefix="${CT_INSTALL_DIR}"                \
    45             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    46             --enable-threads                            \
    47             ${extra_config}                             2>&1 |CT_DoLog ALL
    48 
    49         CT_DoLog EXTRA "Building cross-gdb"
    50         make ${PARALLELMFLAGS}                          2>&1 |CT_DoLog ALL
    51 
    52         CT_DoLog EXTRA "Installing cross-gdb"
    53         make install                                    2>&1 |CT_DoLog ALL
    54 
    55         CT_EndStep
    56 
    57         CT_DoStep INFO "Installing gdbserver"
    58         CT_DoLog EXTRA "Configuring gdbserver"
    59 
    60         mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
    61         cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
    62 
    63         # Workaround for bad versions, where the configure
    64         # script for gdbserver is not executable...
    65         # Bah, GNU folks strike again... :-(
    66         chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
    67 
    68         "${gdb_src_dir}/gdb/gdbserver/configure"        \
    69             --build=${CT_BUILD}                         \
    70             --host=${CT_TARGET}                         \
    71             --target=${CT_TARGET}                       \
    72             --prefix=/usr                               \
    73             --sysconfdir=/etc                           \
    74             --localstatedir=/var                        \
    75             --includedir="${CT_HEADERS_DIR}"            \
    76             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    77             --program-prefix=                           \
    78             --without-uiout                             \
    79             --disable-tui                               \
    80             --disable-gdbtk                             \
    81             --without-x                                 \
    82             --without-included-gettext                  \
    83             ${extra_config}                             2>&1 |CT_DoLog ALL
    84 
    85         CT_DoLog EXTRA "Building gdbserver"
    86         make ${PARALLELMFLAGS} CC=${CT_TARGET}-gcc      2>&1 |CT_DoLog ALL
    87 
    88         CT_DoLog EXTRA "Installing gdbserver"
    89         make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install  2>&1 |CT_DoLog ALL
    90 
    91         CT_EndStep
    92     fi
    93 
    94     if [ "${CT_GDB_NATIVE}" = "y" ]; then
    95         CT_DoStep EXTRA "Installing native gdb"
    96         CT_DoLog EXTRA "Configuring native gdb"
    97 
    98         mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
    99         cd "${CT_BUILD_DIR}/build-gdb-native"
   100 
   101         "${gdb_src_dir}/configure"                      \
   102             --build=${CT_BUILD}                         \
   103             --host=${CT_TARGET}                         \
   104             --target=${CT_TARGET}                       \
   105             --prefix=/usr                               \
   106             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
   107             --without-uiout                             \
   108             --disable-tui                               \
   109             --disable-gdbtk                             \
   110             --without-x                                 \
   111             --disable-sim                               \
   112             --disable-gdbserver                          \
   113             --without-included-gettext                  \
   114             ${extra_config}                             2>&1 |CT_DoLog ALL
   115 
   116         CT_DoLog EXTRA "Building native gdb"
   117         make ${PARALLELMFLAGS} CC=${CT_TARGET}-gcc      2>&1 |CT_DoLog ALL
   118 
   119         CT_DoLog EXTRA "Installing native gdb"
   120         make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install  2>&1 |CT_DoLog ALL
   121 
   122         CT_EndStep
   123     fi
   124 }