scripts/build/debug/300-gdb.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jan 03 21:11:41 2009 +0000 (2009-01-03)
changeset 1112 c72aecd1a9ef
parent 916 68af6b83ff7e
child 1126 1ab3d2e08c8b
permissions -rw-r--r--
Get rid of all stuff related to building a /delivery' traball:
- building a delivery tarball has long been broken (since crostool-Ng is installable)
- get rid of implied do_print_filename, that can be mis-leading now tarballs can not be built

/trunk/scripts/build/kernel/bare-metal.sh | 4 0 4 0 ----
/trunk/scripts/build/kernel/linux.sh | 4 0 4 0 ----
/trunk/scripts/build/tools/000-template.sh | 11 0 11 0 -----------
/trunk/scripts/build/tools/100-libelf.sh | 4 0 4 0 ----
/trunk/scripts/build/tools/200-sstrip.sh | 11 1 10 0 +----------
/trunk/scripts/build/binutils.sh | 4 0 4 0 ----
/trunk/scripts/build/cc/gcc.sh | 5 0 5 0 -----
/trunk/scripts/build/debug/000-template.sh | 11 0 11 0 -----------
/trunk/scripts/build/debug/100-dmalloc.sh | 4 0 4 0 ----
/trunk/scripts/build/debug/400-ltrace.sh | 4 0 4 0 ----
/trunk/scripts/build/debug/300-gdb.sh | 7 0 7 0 -------
/trunk/scripts/build/debug/500-strace.sh | 4 0 4 0 ----
/trunk/scripts/build/debug/200-duma.sh | 4 0 4 0 ----
/trunk/scripts/build/libc/none.sh | 5 0 5 0 -----
/trunk/scripts/build/libc/glibc.sh | 10 0 10 0 ----------
/trunk/scripts/build/libc/uClibc.sh | 6 0 6 0 ------
/trunk/scripts/build/libc/eglibc.sh | 10 0 10 0 ----------
/trunk/scripts/build/gmp.sh | 6 0 6 0 ------
/trunk/scripts/build/mpfr.sh | 6 0 6 0 ------
/trunk/docs/overview.txt | 9 0 9 0 ---------
20 files changed, 1 insertion(+), 128 deletions(-)
yann@479
     1
# Build script for the gdb debug facility
yann@479
     2
yann@479
     3
do_debug_gdb_suffix() {
yann@479
     4
    case "${CT_GDB_VERSION}" in
yann@479
     5
        snapshot)   ;;
yann@479
     6
        *)          echo "-${CT_GDB_VERSION}";;
yann@479
     7
    esac
yann@479
     8
}
yann@479
     9
yann@821
    10
do_debug_gdb_parts() {
yann@821
    11
    do_gdb=
yann@821
    12
    do_insight=
yann@821
    13
    do_ncurses=
yann@821
    14
yann@821
    15
    if [ "${CT_GDB_CROSS}" = y ]; then
yann@821
    16
        if [ "${CT_GDB_CROSS_INSIGHT}" = "y" ]; then
yann@821
    17
            do_insight=y
yann@821
    18
        else
yann@821
    19
            do_gdb=y
yann@821
    20
        fi
yann@821
    21
    fi
yann@821
    22
yann@821
    23
    if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
yann@821
    24
        do_gdb=y
yann@821
    25
    fi
yann@821
    26
yann@821
    27
    if [ "${CT_GDB_NATIVE}" = "y" ]; then
yann@821
    28
        do_gdb=y
yann@821
    29
        do_ncurses=y
yann@821
    30
    fi
yann@821
    31
}
yann@821
    32
yann@479
    33
do_debug_gdb_get() {
yann@821
    34
    do_debug_gdb_parts
yann@821
    35
yann@821
    36
    if [ "${do_gdb}" = "y" ]; then
yann@821
    37
        CT_GetFile "gdb$(do_debug_gdb_suffix)"              \
yann@821
    38
                   {ftp,http}://ftp.gnu.org/pub/gnu/gdb     \
yann@821
    39
                   ftp://sources.redhat.com/pub/gdb/{{,old-}releases,snapshots/current}
yann@821
    40
    fi
yann@821
    41
yann@821
    42
    if [ "${do_insight}" = "y" ]; then
yann@821
    43
        CT_GetFile "insight-${CT_GDB_VERSION}"                                              \
yann@821
    44
                   ftp://sourceware.org/pub/insight/releases                                \
yann@821
    45
                   {ftp,http}://ftp.twaren.net/Unix/Sourceware/insight/releases             \
yann@821
    46
                   {ftp,http}://ftp.gwdg.de/pub/linux/sources.redhat.com/insight/releases
yann@821
    47
    fi
yann@821
    48
yann@821
    49
    if [ "${do_ncurses}" = "y" ]; then
yann@573
    50
        CT_GetFile "ncurses-${CT_NCURSES_VERSION}"          \
yann@573
    51
                   {ftp,http}://ftp.gnu.org/pub/gnu/ncurses \
yann@573
    52
                   ftp://invisible-island.net/ncurses
yann@573
    53
    fi
yann@479
    54
}
yann@479
    55
yann@479
    56
do_debug_gdb_extract() {
yann@821
    57
    do_debug_gdb_parts
yann@821
    58
yann@821
    59
    if [ "${do_gdb}" = "y" ]; then
yann@821
    60
        CT_ExtractAndPatch "gdb$(do_debug_gdb_suffix)"
yann@821
    61
    fi
yann@821
    62
yann@821
    63
    if [ "${do_insight}" = "y" ]; then
yann@821
    64
        CT_ExtractAndPatch "insight-${CT_GDB_VERSION}"
yann@821
    65
    fi
yann@821
    66
yann@821
    67
    if [ "${do_ncurses}" = "y" ]; then
yann@598
    68
        CT_ExtractAndPatch "ncurses-${CT_NCURSES_VERSION}"
yann@598
    69
    fi
yann@479
    70
}
yann@479
    71
yann@479
    72
do_debug_gdb_build() {
yann@523
    73
    gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
yann@821
    74
    insight_src_dir="${CT_SRC_DIR}/insight-${CT_GDB_VERSION}"
yann@479
    75
yann@479
    76
    extra_config=
yann@479
    77
    # Version 6.3 and below behave badly with gdbmi
yann@479
    78
    case "${CT_GDB_VERSION}" in
yann@479
    79
        6.2*|6.3)   extra_config="${extra_config} --disable-gdbmi";;
yann@479
    80
    esac
yann@479
    81
yann@479
    82
    if [ "${CT_GDB_CROSS}" = "y" ]; then
yann@479
    83
        CT_DoStep INFO "Installing cross-gdb"
yann@479
    84
        CT_DoLog EXTRA "Configuring cross-gdb"
yann@479
    85
yann@479
    86
        mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
yann@479
    87
        cd "${CT_BUILD_DIR}/build-gdb-cross"
yann@479
    88
yann@602
    89
        cross_extra_config="${extra_config}"
yann@645
    90
        if [ "${CT_GMP_MPFR}" = "y" ]; then
yann@602
    91
            cross_extra_config="${cross_extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
yann@583
    92
        fi
yann@583
    93
        case "${CT_THREADS}" in
yann@602
    94
            none)   cross_extra_config="${cross_extra_config} --disable-threads";;
yann@602
    95
            *)      cross_extra_config="${cross_extra_config} --enable-threads";;
yann@583
    96
        esac
yann@583
    97
yann@479
    98
        CC_for_gdb=
yann@479
    99
        LD_for_gdb=
yann@583
   100
        if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
yann@479
   101
            CC_for_gdb="gcc -static"
yann@479
   102
            LD_for_gdb="ld -static"
yann@479
   103
        fi
yann@479
   104
yann@821
   105
        gdb_cross_configure="${gdb_src_dir}/configure"
yann@821
   106
        [ "${CT_GDB_CROSS_INSIGHT}" = "y" ] && gdb_cross_configure="${insight_src_dir}/configure"
yann@821
   107
yann@602
   108
        CT_DoLog DEBUG "Extra config passed: '${cross_extra_config# }'"
yann@602
   109
yann@479
   110
        CC="${CC_for_gdb}"                              \
yann@583
   111
        LD="${LD_for_gdb}"                              \
yann@669
   112
        CT_DoExecLog ALL                                \
yann@821
   113
        "${gdb_cross_configure}"                        \
yann@479
   114
            --build=${CT_BUILD}                         \
yann@479
   115
            --host=${CT_HOST}                           \
yann@479
   116
            --target=${CT_TARGET}                       \
yann@479
   117
            --prefix="${CT_PREFIX_DIR}"                 \
yann@479
   118
            --with-build-sysroot="${CT_SYSROOT_DIR}"    \
yann@801
   119
            --disable-werror                            \
yann@669
   120
            ${cross_extra_config}
yann@479
   121
yann@479
   122
        CT_DoLog EXTRA "Building cross-gdb"
yann@669
   123
        CT_DoExecLog ALL make ${PARALLELMFLAGS}
yann@479
   124
yann@479
   125
        CT_DoLog EXTRA "Installing cross-gdb"
yann@669
   126
        CT_DoExecLog ALL make install
yann@479
   127
yann@479
   128
        CT_EndStep
yann@479
   129
    fi
yann@479
   130
yann@479
   131
    if [ "${CT_GDB_NATIVE}" = "y" ]; then
yann@573
   132
        CT_DoStep INFO "Installing native gdb"
yann@573
   133
yann@573
   134
        CT_DoStep INFO "Installing ncurses library"
yann@573
   135
        CT_DoLog EXTRA "Configuring ncurses"
yann@573
   136
        mkdir -p "${CT_BUILD_DIR}/build-ncurses"
yann@573
   137
        cd "${CT_BUILD_DIR}/build-ncurses"
yann@573
   138
yann@573
   139
        ncurses_opts=
yann@573
   140
        [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts="${ncurses_opts} --without-cxx --without-cxx-binding"
yann@609
   141
        [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts="${ncurses_opts} --without-ada"
yann@573
   142
yann@669
   143
        CT_DoExecLog ALL                                        \
yann@573
   144
        "${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}/configure" \
yann@573
   145
            --build=${CT_BUILD}                                 \
yann@573
   146
            --host=${CT_TARGET}                                 \
yann@573
   147
            --with-build-cc=${CT_CC}                            \
yann@573
   148
            --with-build-cpp=${CT_CC}                           \
yann@573
   149
            --with-build-cflags="${CT_CFLAGS_FOR_HOST}"         \
yann@573
   150
            --prefix=/usr                                       \
yann@573
   151
            --with-shared                                       \
yann@573
   152
            --without-sysmouse                                  \
yann@573
   153
            --without-progs                                     \
yann@573
   154
            --enable-termcap                                    \
yann@669
   155
            ${ncurses_opts}
yann@573
   156
yann@573
   157
        CT_DoLog EXTRA "Building ncurses"
yann@669
   158
        CT_DoExecLog ALL make ${PARALLELMFLAGS}
yann@573
   159
yann@573
   160
        CT_DoLog EXTRA "Installing ncurses"
yann@669
   161
        mkdir -p "${CT_SYSROOT_DIR}/usr/bin"
yann@669
   162
        CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install
yann@573
   163
yann@573
   164
        CT_EndStep
yann@573
   165
yann@479
   166
        CT_DoLog EXTRA "Configuring native gdb"
yann@479
   167
yann@479
   168
        mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
yann@479
   169
        cd "${CT_BUILD_DIR}/build-gdb-native"
yann@479
   170
yann@602
   171
        native_extra_config="${extra_config}"
yann@583
   172
        case "${CT_THREADS}" in
yann@602
   173
            none)   native_extra_config="${native_extra_config} --disable-threads";;
yann@602
   174
            *)      native_extra_config="${native_extra_config} --enable-threads";;
yann@583
   175
        esac
yann@622
   176
        if [ "${CT_GDB_NATIVE_USE_GMP_MPFR}" = "y" ]; then
yann@602
   177
            native_extra_config="${native_extra_config} --with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
yann@602
   178
        fi
yann@583
   179
yann@583
   180
        if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
yann@583
   181
            CC_for_gdb="${CT_TARGET}-gcc -static"
yann@583
   182
            LD_for_gdb="${CT_TARGET}-ld -static"
yann@626
   183
        else
yann@626
   184
            CC_for_gdb="${CT_TARGET}-gcc"
yann@626
   185
            LD_for_gdb="${CT_TARGET}-ld"
yann@583
   186
        fi
yann@583
   187
yann@583
   188
        export ac_cv_func_strncmp_works=yes
yann@583
   189
yann@602
   190
        CT_DoLog DEBUG "Extra config passed: '${native_extra_config# }'"
yann@602
   191
yann@583
   192
        CC="${CC_for_gdb}"                              \
yann@583
   193
        LD="${LD_for_gdb}"                              \
yann@669
   194
        CT_DoExecLog ALL                                \
yann@479
   195
        "${gdb_src_dir}/configure"                      \
yann@479
   196
            --build=${CT_BUILD}                         \
yann@479
   197
            --host=${CT_TARGET}                         \
yann@479
   198
            --target=${CT_TARGET}                       \
yann@479
   199
            --prefix=/usr                               \
yann@479
   200
            --with-build-sysroot="${CT_SYSROOT_DIR}"    \
yann@479
   201
            --without-uiout                             \
yann@479
   202
            --disable-tui                               \
yann@479
   203
            --disable-gdbtk                             \
yann@479
   204
            --without-x                                 \
yann@479
   205
            --disable-sim                               \
yann@583
   206
            --disable-werror                            \
yann@479
   207
            --without-included-gettext                  \
yann@583
   208
            --without-develop                           \
yann@669
   209
            ${native_extra_config}
yann@479
   210
yann@479
   211
        CT_DoLog EXTRA "Building native gdb"
yann@669
   212
        CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
yann@479
   213
yann@479
   214
        CT_DoLog EXTRA "Installing native gdb"
yann@669
   215
        CT_DoExecLog ALL make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install
yann@479
   216
yann@583
   217
        # Building a native gdb also builds a gdbserver
yann@818
   218
        find "${CT_DEBUG_INSTALL_DIR}" -type f -name gdbserver -exec rm -fv {} \; 2>&1 |CT_DoLog ALL
yann@583
   219
yann@583
   220
        unset ac_cv_func_strncmp_works
yann@583
   221
yann@583
   222
        CT_EndStep
yann@583
   223
    fi
yann@583
   224
yann@583
   225
    if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
yann@583
   226
        CT_DoStep INFO "Installing gdbserver"
yann@583
   227
        CT_DoLog EXTRA "Configuring gdbserver"
yann@583
   228
yann@583
   229
        mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
yann@583
   230
        cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
yann@583
   231
yann@583
   232
        # Workaround for bad versions, where the configure
yann@583
   233
        # script for gdbserver is not executable...
yann@583
   234
        # Bah, GNU folks strike again... :-(
yann@583
   235
        chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
yann@583
   236
yann@583
   237
        gdbserver_LDFLAGS=
yann@583
   238
        if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
yann@583
   239
            gdbserver_LDFLAGS=-static
yann@583
   240
        fi
yann@583
   241
yann@602
   242
        gdbserver_extra_config="${extra_config}"
yann@602
   243
yann@583
   244
        LDFLAGS="${gdbserver_LDFLAGS}"                  \
yann@669
   245
        CT_DoExecLog ALL                                \
yann@583
   246
        "${gdb_src_dir}/gdb/gdbserver/configure"        \
yann@583
   247
            --build=${CT_BUILD}                         \
yann@583
   248
            --host=${CT_TARGET}                         \
yann@583
   249
            --target=${CT_TARGET}                       \
yann@583
   250
            --prefix=/usr                               \
yann@583
   251
            --sysconfdir=/etc                           \
yann@583
   252
            --localstatedir=/var                        \
yann@583
   253
            --includedir="${CT_HEADERS_DIR}"            \
yann@583
   254
            --with-build-sysroot="${CT_SYSROOT_DIR}"    \
yann@583
   255
            --program-prefix=                           \
yann@583
   256
            --without-uiout                             \
yann@583
   257
            --disable-tui                               \
yann@583
   258
            --disable-gdbtk                             \
yann@583
   259
            --without-x                                 \
yann@583
   260
            --without-included-gettext                  \
yann@583
   261
            --without-develop                           \
yann@801
   262
            --disable-werror                            \
yann@669
   263
            ${gdbserver_extra_config}
yann@583
   264
yann@583
   265
        CT_DoLog EXTRA "Building gdbserver"
yann@669
   266
        CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
yann@583
   267
yann@583
   268
        CT_DoLog EXTRA "Installing gdbserver"
yann@669
   269
        CT_DoExecLog ALL make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install
yann@583
   270
yann@479
   271
        CT_EndStep
yann@479
   272
    fi
yann@479
   273
}