scripts/build/debug/300-gdb.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri May 02 21:59:14 2008 +0000 (2008-05-02)
changeset 479 05c62432ec19
child 486 92f6149c4275
permissions -rw-r--r--
For tools/ and debug/ build scripts, annd a numeric prefix, so that they always get built in the same order, in case of library dependencies.

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