2007-05-17 16:22:51 +00:00
|
|
|
# Build script for the gdb debug facility
|
|
|
|
|
|
|
|
is_enabled="${CT_GDB}"
|
|
|
|
|
2007-06-16 18:08:14 +00:00
|
|
|
do_print_filename() {
|
|
|
|
[ "${CT_GDB}" = "y" ] || return 0
|
|
|
|
echo "gdb`do_debug_gdb_suffix`"
|
|
|
|
}
|
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
do_debug_gdb_suffix() {
|
|
|
|
case "${CT_GDB_VERSION}" in
|
|
|
|
snapshot) ;;
|
|
|
|
*) echo "-${CT_GDB_VERSION}";;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
do_debug_gdb_get() {
|
|
|
|
CT_GetFile "gdb`do_debug_gdb_suffix`" \
|
|
|
|
ftp://ftp.gnu.org/pub/gnu/gdb \
|
|
|
|
ftp://sources.redhat.com/pub/gdb/releases \
|
|
|
|
ftp://sources.redhat.com/pub/gdb/old-releases \
|
|
|
|
ftp://sources.redhat.com/pub/gdb/snapshots/current
|
|
|
|
}
|
|
|
|
|
|
|
|
do_debug_gdb_extract() {
|
|
|
|
CT_ExtractAndPatch "gdb`do_debug_gdb_suffix`"
|
|
|
|
}
|
|
|
|
|
|
|
|
do_debug_gdb_build() {
|
|
|
|
gdb_src_dir="${CT_SRC_DIR}/gdb`do_debug_gdb_suffix`"
|
|
|
|
|
|
|
|
extra_config=
|
|
|
|
# Version 6.3 and below behave badly with gdbmi
|
|
|
|
case "${CT_GDB_VERSION}" in
|
|
|
|
6.2*|6.3) extra_config="${extra_config} --disable-gdbmi";;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ "${CT_GDB_CROSS}" = "y" ]; then
|
2007-05-17 22:10:48 +00:00
|
|
|
CT_DoStep INFO "Installing cross-gdb"
|
2007-05-17 16:22:51 +00:00
|
|
|
CT_DoLog EXTRA "Configuring cross-gdb"
|
|
|
|
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
|
|
|
|
cd "${CT_BUILD_DIR}/build-gdb-cross"
|
|
|
|
|
|
|
|
"${gdb_src_dir}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
|
|
|
--host=${CT_HOST} \
|
|
|
|
--target=${CT_TARGET} \
|
2007-05-20 16:18:40 +00:00
|
|
|
--prefix="${CT_PREFIX_DIR}" \
|
2007-05-17 16:22:51 +00:00
|
|
|
--with-build-sysroot="${CT_SYSROOT_DIR}" \
|
|
|
|
--enable-threads \
|
|
|
|
${extra_config} 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building cross-gdb"
|
|
|
|
make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing cross-gdb"
|
|
|
|
make install 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
CT_EndStep
|
|
|
|
|
2007-05-17 22:10:48 +00:00
|
|
|
CT_DoStep INFO "Installing gdbserver"
|
2007-05-17 16:22:51 +00:00
|
|
|
CT_DoLog EXTRA "Configuring gdbserver"
|
|
|
|
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
|
|
|
|
cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
|
|
|
|
|
|
|
|
# Workaround for bad versions, where the configure
|
|
|
|
# script for gdbserver is not executable...
|
|
|
|
# Bah, GNU folks strike again... :-(
|
|
|
|
chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
|
|
|
|
|
2007-06-17 15:46:13 +00:00
|
|
|
gdbserver_LDFLAGS=
|
|
|
|
if [ "${CT_GDB_CROSS_STATIC_GDBSERVER}" = "y" ]; then
|
|
|
|
gdbserver_LDFLAGS=-static
|
|
|
|
fi
|
|
|
|
|
|
|
|
LDFLAGS="${gdbserver_LDFLAGS}" \
|
2007-05-17 16:22:51 +00:00
|
|
|
"${gdb_src_dir}/gdb/gdbserver/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
|
|
|
--host=${CT_TARGET} \
|
|
|
|
--target=${CT_TARGET} \
|
|
|
|
--prefix=/usr \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--localstatedir=/var \
|
|
|
|
--includedir="${CT_HEADERS_DIR}" \
|
|
|
|
--with-build-sysroot="${CT_SYSROOT_DIR}" \
|
|
|
|
--program-prefix= \
|
|
|
|
--without-uiout \
|
|
|
|
--disable-tui \
|
|
|
|
--disable-gdbtk \
|
|
|
|
--without-x \
|
|
|
|
--without-included-gettext \
|
|
|
|
${extra_config} 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building gdbserver"
|
|
|
|
make ${PARALLELMFLAGS} CC=${CT_TARGET}-gcc 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing gdbserver"
|
|
|
|
make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
CT_EndStep
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${CT_GDB_NATIVE}" = "y" ]; then
|
|
|
|
CT_DoStep EXTRA "Installing native gdb"
|
|
|
|
CT_DoLog EXTRA "Configuring native gdb"
|
|
|
|
|
2007-05-18 19:55:49 +00:00
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
|
|
|
|
cd "${CT_BUILD_DIR}/build-gdb-native"
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
"${gdb_src_dir}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
|
|
|
--host=${CT_TARGET} \
|
|
|
|
--target=${CT_TARGET} \
|
|
|
|
--prefix=/usr \
|
|
|
|
--with-build-sysroot="${CT_SYSROOT_DIR}" \
|
|
|
|
--without-uiout \
|
|
|
|
--disable-tui \
|
|
|
|
--disable-gdbtk \
|
|
|
|
--without-x \
|
|
|
|
--disable-sim \
|
2007-05-18 19:55:49 +00:00
|
|
|
--disable-gdbserver \
|
2007-05-17 16:22:51 +00:00
|
|
|
--without-included-gettext \
|
|
|
|
${extra_config} 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building native gdb"
|
|
|
|
make ${PARALLELMFLAGS} CC=${CT_TARGET}-gcc 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing native gdb"
|
|
|
|
make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
CT_EndStep
|
|
|
|
fi
|
|
|
|
}
|