scripts/build/debug/300-gdb.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jun 17 22:26:44 2008 +0000 (2008-06-17)
changeset 571 4f4bfcf02c4f
parent 486 92f6149c4275
child 573 2a1803b98186
permissions -rw-r--r--
Fix building D.U.M.A:
- some (presumably 'old') versions have libduma.so.0.0, while others (presumably 'newer') have libduma.so.0.0.0
- don't build the libraries multiple times, do it in one pass
- install a custom LD_PRELOAD wrapper

/trunk/scripts/build/debug/200-duma.sh | 54 33 21 0 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 33 insertions(+), 21 deletions(-)
     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,http}://ftp.gnu.org/pub/gnu/gdb \
    20                ftp://sources.redhat.com/pub/gdb/{{,old-}releases,snapshots/current}
    21 }
    22 
    23 do_debug_gdb_extract() {
    24     CT_ExtractAndPatch "gdb$(do_debug_gdb_suffix)"
    25 }
    26 
    27 do_debug_gdb_build() {
    28     gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
    29 
    30     extra_config=
    31     # Version 6.3 and below behave badly with gdbmi
    32     case "${CT_GDB_VERSION}" in
    33         6.2*|6.3)   extra_config="${extra_config} --disable-gdbmi";;
    34     esac
    35 
    36     if [ "${CT_GDB_CROSS}" = "y" ]; then
    37         CT_DoStep INFO "Installing cross-gdb"
    38         CT_DoLog EXTRA "Configuring cross-gdb"
    39 
    40         mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
    41         cd "${CT_BUILD_DIR}/build-gdb-cross"
    42 
    43         CC_for_gdb=
    44         LD_for_gdb=
    45         if [ "${CT_GDB_CROSS_STATIC_GDBSERVER}" = "y" ]; then
    46             CC_for_gdb="gcc -static"
    47             LD_for_gdb="ld -static"
    48         fi
    49 
    50         CC="${CC_for_gdb}"                              \
    51         LD="${LD_forgdb}"                               \
    52         "${gdb_src_dir}/configure"                      \
    53             --build=${CT_BUILD}                         \
    54             --host=${CT_HOST}                           \
    55             --target=${CT_TARGET}                       \
    56             --prefix="${CT_PREFIX_DIR}"                 \
    57             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    58             --enable-threads                            \
    59             ${extra_config}                             2>&1 |CT_DoLog ALL
    60 
    61         CT_DoLog EXTRA "Building cross-gdb"
    62         make ${PARALLELMFLAGS}                          2>&1 |CT_DoLog ALL
    63 
    64         CT_DoLog EXTRA "Installing cross-gdb"
    65         make install                                    2>&1 |CT_DoLog ALL
    66 
    67         CT_EndStep
    68 
    69         CT_DoStep INFO "Installing gdbserver"
    70         CT_DoLog EXTRA "Configuring gdbserver"
    71 
    72         mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
    73         cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
    74 
    75         # Workaround for bad versions, where the configure
    76         # script for gdbserver is not executable...
    77         # Bah, GNU folks strike again... :-(
    78         chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
    79 
    80         gdbserver_LDFLAGS=
    81         if [ "${CT_GDB_CROSS_STATIC_GDBSERVER}" = "y" ]; then
    82             gdbserver_LDFLAGS=-static
    83         fi
    84 
    85         LDFLAGS="${gdbserver_LDFLAGS}"                  \
    86         "${gdb_src_dir}/gdb/gdbserver/configure"        \
    87             --build=${CT_BUILD}                         \
    88             --host=${CT_TARGET}                         \
    89             --target=${CT_TARGET}                       \
    90             --prefix=/usr                               \
    91             --sysconfdir=/etc                           \
    92             --localstatedir=/var                        \
    93             --includedir="${CT_HEADERS_DIR}"            \
    94             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    95             --program-prefix=                           \
    96             --without-uiout                             \
    97             --disable-tui                               \
    98             --disable-gdbtk                             \
    99             --without-x                                 \
   100             --without-included-gettext                  \
   101             ${extra_config}                             2>&1 |CT_DoLog ALL
   102 
   103         CT_DoLog EXTRA "Building gdbserver"
   104         make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
   105 
   106         CT_DoLog EXTRA "Installing gdbserver"
   107         make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install  2>&1 |CT_DoLog ALL
   108 
   109         CT_EndStep
   110     fi
   111 
   112     if [ "${CT_GDB_NATIVE}" = "y" ]; then
   113         CT_DoStep EXTRA "Installing native gdb"
   114         CT_DoLog EXTRA "Configuring native gdb"
   115 
   116         mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
   117         cd "${CT_BUILD_DIR}/build-gdb-native"
   118 
   119         "${gdb_src_dir}/configure"                      \
   120             --build=${CT_BUILD}                         \
   121             --host=${CT_TARGET}                         \
   122             --target=${CT_TARGET}                       \
   123             --prefix=/usr                               \
   124             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
   125             --without-uiout                             \
   126             --disable-tui                               \
   127             --disable-gdbtk                             \
   128             --without-x                                 \
   129             --disable-sim                               \
   130             --disable-gdbserver                          \
   131             --without-included-gettext                  \
   132             ${extra_config}                             2>&1 |CT_DoLog ALL
   133 
   134         CT_DoLog EXTRA "Building native gdb"
   135         make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
   136 
   137         CT_DoLog EXTRA "Installing native gdb"
   138         make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install  2>&1 |CT_DoLog ALL
   139 
   140         CT_EndStep
   141     fi
   142 }