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