scripts/build/debug/gdb.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Feb 17 22:08:06 2008 +0000 (2008-02-17)
changeset 431 8bde4c6ea47a
parent 175 043e44606e28
child 457 578fdd250fcc
permissions -rw-r--r--
Robert P. J. DAY says:

apparently, the patchset for gcc 4.2.1 applies properly to the
source for gcc 4.2.2 and gcc 4.2.3. so, if you want, you can simply
add support for those last two just by augmenting menuconfig and
adding a couple symlinks for those two directories. seems like a
cheap way to add a couple new versions.
     1 # Build script for the gdb debug facility
     2 
     3 is_enabled="${CT_GDB}"
     4 
     5 do_print_filename() {
     6     [ "${CT_GDB}" = "y" ] || return 0
     7     echo "gdb`do_debug_gdb_suffix`"
     8 }
     9 
    10 do_debug_gdb_suffix() {
    11     case "${CT_GDB_VERSION}" in
    12         snapshot)   ;;
    13         *)          echo "-${CT_GDB_VERSION}";;
    14     esac
    15 }
    16 
    17 do_debug_gdb_get() {
    18     CT_GetFile "gdb`do_debug_gdb_suffix`"                           \
    19                ftp://ftp.gnu.org/pub/gnu/gdb                        \
    20                ftp://sources.redhat.com/pub/gdb/releases            \
    21                ftp://sources.redhat.com/pub/gdb/old-releases        \
    22                ftp://sources.redhat.com/pub/gdb/snapshots/current 
    23 }
    24 
    25 do_debug_gdb_extract() {
    26     CT_ExtractAndPatch "gdb`do_debug_gdb_suffix`"
    27 }
    28 
    29 do_debug_gdb_build() {
    30     gdb_src_dir="${CT_SRC_DIR}/gdb`do_debug_gdb_suffix`"
    31 
    32     extra_config=
    33     # Version 6.3 and below behave badly with gdbmi
    34     case "${CT_GDB_VERSION}" in
    35         6.2*|6.3)   extra_config="${extra_config} --disable-gdbmi";;
    36     esac
    37 
    38     if [ "${CT_GDB_CROSS}" = "y" ]; then
    39         CT_DoStep INFO "Installing cross-gdb"
    40         CT_DoLog EXTRA "Configuring cross-gdb"
    41 
    42         mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
    43         cd "${CT_BUILD_DIR}/build-gdb-cross"
    44 
    45         "${gdb_src_dir}/configure"                      \
    46             --build=${CT_BUILD}                         \
    47             --host=${CT_HOST}                           \
    48             --target=${CT_TARGET}                       \
    49             --prefix="${CT_PREFIX_DIR}"                 \
    50             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    51             --enable-threads                            \
    52             ${extra_config}                             2>&1 |CT_DoLog ALL
    53 
    54         CT_DoLog EXTRA "Building cross-gdb"
    55         make ${PARALLELMFLAGS}                          2>&1 |CT_DoLog ALL
    56 
    57         CT_DoLog EXTRA "Installing cross-gdb"
    58         make install                                    2>&1 |CT_DoLog ALL
    59 
    60         CT_EndStep
    61 
    62         CT_DoStep INFO "Installing gdbserver"
    63         CT_DoLog EXTRA "Configuring gdbserver"
    64 
    65         mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
    66         cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
    67 
    68         # Workaround for bad versions, where the configure
    69         # script for gdbserver is not executable...
    70         # Bah, GNU folks strike again... :-(
    71         chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
    72 
    73         gdbserver_LDFLAGS=
    74         if [ "${CT_GDB_CROSS_STATIC_GDBSERVER}" = "y" ]; then
    75             gdbserver_LDFLAGS=-static
    76         fi
    77 
    78         LDFLAGS="${gdbserver_LDFLAGS}"                  \
    79         "${gdb_src_dir}/gdb/gdbserver/configure"        \
    80             --build=${CT_BUILD}                         \
    81             --host=${CT_TARGET}                         \
    82             --target=${CT_TARGET}                       \
    83             --prefix=/usr                               \
    84             --sysconfdir=/etc                           \
    85             --localstatedir=/var                        \
    86             --includedir="${CT_HEADERS_DIR}"            \
    87             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    88             --program-prefix=                           \
    89             --without-uiout                             \
    90             --disable-tui                               \
    91             --disable-gdbtk                             \
    92             --without-x                                 \
    93             --without-included-gettext                  \
    94             ${extra_config}                             2>&1 |CT_DoLog ALL
    95 
    96         CT_DoLog EXTRA "Building gdbserver"
    97         make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
    98 
    99         CT_DoLog EXTRA "Installing gdbserver"
   100         make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install  2>&1 |CT_DoLog ALL
   101 
   102         CT_EndStep
   103     fi
   104 
   105     if [ "${CT_GDB_NATIVE}" = "y" ]; then
   106         CT_DoStep EXTRA "Installing native gdb"
   107         CT_DoLog EXTRA "Configuring native gdb"
   108 
   109         mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
   110         cd "${CT_BUILD_DIR}/build-gdb-native"
   111 
   112         "${gdb_src_dir}/configure"                      \
   113             --build=${CT_BUILD}                         \
   114             --host=${CT_TARGET}                         \
   115             --target=${CT_TARGET}                       \
   116             --prefix=/usr                               \
   117             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
   118             --without-uiout                             \
   119             --disable-tui                               \
   120             --disable-gdbtk                             \
   121             --without-x                                 \
   122             --disable-sim                               \
   123             --disable-gdbserver                          \
   124             --without-included-gettext                  \
   125             ${extra_config}                             2>&1 |CT_DoLog ALL
   126 
   127         CT_DoLog EXTRA "Building native gdb"
   128         make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
   129 
   130         CT_DoLog EXTRA "Installing native gdb"
   131         make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install  2>&1 |CT_DoLog ALL
   132 
   133         CT_EndStep
   134     fi
   135 }