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
|
2008-05-20 21:32:39 +00:00
|
|
|
echo "gdb$(do_debug_gdb_suffix)"
|
2008-06-20 10:58:45 +00:00
|
|
|
if [ "${CT_GDB_NATIVE}" = "y" ]; then
|
|
|
|
echo "ncurses-${CT_NCURSES_VERSION}"
|
|
|
|
fi
|
2007-06-16 18:08:14 +00:00
|
|
|
}
|
|
|
|
|
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() {
|
2008-06-18 12:33:32 +00:00
|
|
|
CT_GetFile "gdb$(do_debug_gdb_suffix)" \
|
|
|
|
{ftp,http}://ftp.gnu.org/pub/gnu/gdb \
|
2008-05-03 17:51:16 +00:00
|
|
|
ftp://sources.redhat.com/pub/gdb/{{,old-}releases,snapshots/current}
|
2008-06-18 12:33:32 +00:00
|
|
|
if [ "${CT_GDB_NATIVE}" = "y" ]; then
|
|
|
|
CT_GetFile "ncurses-${CT_NCURSES_VERSION}" \
|
|
|
|
{ftp,http}://ftp.gnu.org/pub/gnu/ncurses \
|
|
|
|
ftp://invisible-island.net/ncurses
|
|
|
|
fi
|
2007-05-17 16:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_debug_gdb_extract() {
|
2008-05-20 21:32:39 +00:00
|
|
|
CT_ExtractAndPatch "gdb$(do_debug_gdb_suffix)"
|
2008-06-20 10:58:45 +00:00
|
|
|
if [ "${CT_GDB_NATIVE}" = "y" ]; then
|
|
|
|
CT_ExtractAndPatch "ncurses-${CT_NCURSES_VERSION}"
|
|
|
|
fi
|
2007-05-17 16:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_debug_gdb_build() {
|
2008-05-20 21:32:39 +00:00
|
|
|
gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
|
2008-06-20 15:16:43 +00:00
|
|
|
cross_extra_config="${extra_config}"
|
2008-07-13 10:32:38 +00:00
|
|
|
if [ "${CT_GMP_MPFR}" = "y" ]; then
|
2008-06-20 15:16:43 +00:00
|
|
|
cross_extra_config="${cross_extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
|
2008-06-19 15:33:33 +00:00
|
|
|
fi
|
|
|
|
case "${CT_THREADS}" in
|
2008-06-20 15:16:43 +00:00
|
|
|
none) cross_extra_config="${cross_extra_config} --disable-threads";;
|
|
|
|
*) cross_extra_config="${cross_extra_config} --enable-threads";;
|
2008-06-19 15:33:33 +00:00
|
|
|
esac
|
|
|
|
|
2008-04-27 10:25:02 +00:00
|
|
|
CC_for_gdb=
|
|
|
|
LD_for_gdb=
|
2008-06-19 15:33:33 +00:00
|
|
|
if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
|
2008-04-27 10:25:02 +00:00
|
|
|
CC_for_gdb="gcc -static"
|
|
|
|
LD_for_gdb="ld -static"
|
|
|
|
fi
|
|
|
|
|
2008-06-20 15:16:43 +00:00
|
|
|
CT_DoLog DEBUG "Extra config passed: '${cross_extra_config# }'"
|
|
|
|
|
2008-04-27 10:25:02 +00:00
|
|
|
CC="${CC_for_gdb}" \
|
2008-06-19 15:33:33 +00:00
|
|
|
LD="${LD_for_gdb}" \
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL \
|
2007-05-17 16:22:51 +00:00
|
|
|
"${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}" \
|
2008-07-14 21:57:57 +00:00
|
|
|
${cross_extra_config}
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building cross-gdb"
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL make ${PARALLELMFLAGS}
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing cross-gdb"
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL make install
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
CT_EndStep
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${CT_GDB_NATIVE}" = "y" ]; then
|
2008-06-18 12:33:32 +00:00
|
|
|
CT_DoStep INFO "Installing native gdb"
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing ncurses library"
|
|
|
|
CT_DoLog EXTRA "Configuring ncurses"
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-ncurses"
|
|
|
|
cd "${CT_BUILD_DIR}/build-ncurses"
|
|
|
|
|
|
|
|
ncurses_opts=
|
|
|
|
[ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts="${ncurses_opts} --without-cxx --without-cxx-binding"
|
2008-06-24 15:44:55 +00:00
|
|
|
[ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts="${ncurses_opts} --without-ada"
|
2008-06-18 12:33:32 +00:00
|
|
|
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL \
|
2008-06-18 12:33:32 +00:00
|
|
|
"${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}/configure" \
|
|
|
|
--build=${CT_BUILD} \
|
|
|
|
--host=${CT_TARGET} \
|
|
|
|
--with-build-cc=${CT_CC} \
|
|
|
|
--with-build-cpp=${CT_CC} \
|
|
|
|
--with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
|
|
|
|
--prefix=/usr \
|
|
|
|
--with-shared \
|
|
|
|
--without-sysmouse \
|
|
|
|
--without-progs \
|
|
|
|
--enable-termcap \
|
2008-07-14 21:57:57 +00:00
|
|
|
${ncurses_opts}
|
2008-06-18 12:33:32 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building ncurses"
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL make ${PARALLELMFLAGS}
|
2008-06-18 12:33:32 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing ncurses"
|
2008-07-14 21:57:57 +00:00
|
|
|
mkdir -p "${CT_SYSROOT_DIR}/usr/bin"
|
|
|
|
CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install
|
2008-06-18 12:33:32 +00:00
|
|
|
|
|
|
|
CT_EndStep
|
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
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
|
|
|
|
2008-06-20 15:16:43 +00:00
|
|
|
native_extra_config="${extra_config}"
|
2008-06-19 15:33:33 +00:00
|
|
|
case "${CT_THREADS}" in
|
2008-06-20 15:16:43 +00:00
|
|
|
none) native_extra_config="${native_extra_config} --disable-threads";;
|
|
|
|
*) native_extra_config="${native_extra_config} --enable-threads";;
|
2008-06-19 15:33:33 +00:00
|
|
|
esac
|
2008-06-25 21:56:36 +00:00
|
|
|
if [ "${CT_GDB_NATIVE_USE_GMP_MPFR}" = "y" ]; then
|
2008-06-20 15:16:43 +00:00
|
|
|
native_extra_config="${native_extra_config} --with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
|
|
|
|
fi
|
2008-06-19 15:33:33 +00:00
|
|
|
|
|
|
|
if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
|
|
|
|
CC_for_gdb="${CT_TARGET}-gcc -static"
|
|
|
|
LD_for_gdb="${CT_TARGET}-ld -static"
|
2008-06-27 11:18:56 +00:00
|
|
|
else
|
|
|
|
CC_for_gdb="${CT_TARGET}-gcc"
|
|
|
|
LD_for_gdb="${CT_TARGET}-ld"
|
2008-06-19 15:33:33 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
export ac_cv_func_strncmp_works=yes
|
|
|
|
|
2008-06-20 15:16:43 +00:00
|
|
|
CT_DoLog DEBUG "Extra config passed: '${native_extra_config# }'"
|
|
|
|
|
2008-06-19 15:33:33 +00:00
|
|
|
CC="${CC_for_gdb}" \
|
|
|
|
LD="${LD_for_gdb}" \
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL \
|
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 \
|
2008-06-19 15:33:33 +00:00
|
|
|
--disable-werror \
|
2007-05-17 16:22:51 +00:00
|
|
|
--without-included-gettext \
|
2008-06-19 15:33:33 +00:00
|
|
|
--without-develop \
|
2008-07-14 21:57:57 +00:00
|
|
|
${native_extra_config}
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building native gdb"
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing native gdb"
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install
|
2007-05-17 16:22:51 +00:00
|
|
|
|
2008-06-19 15:33:33 +00:00
|
|
|
# Building a native gdb also builds a gdbserver
|
|
|
|
find "${CT_DEBUG_INSTALL_DIR}" -type f -name gdbserver -exec rm -fv {} + 2>&1 |CT_DoLog ALL
|
|
|
|
|
|
|
|
unset ac_cv_func_strncmp_works
|
|
|
|
|
|
|
|
CT_EndStep
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
|
|
|
|
CT_DoStep INFO "Installing gdbserver"
|
|
|
|
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"
|
|
|
|
|
|
|
|
gdbserver_LDFLAGS=
|
|
|
|
if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
|
|
|
|
gdbserver_LDFLAGS=-static
|
|
|
|
fi
|
|
|
|
|
2008-06-20 15:16:43 +00:00
|
|
|
gdbserver_extra_config="${extra_config}"
|
|
|
|
|
2008-06-19 15:33:33 +00:00
|
|
|
LDFLAGS="${gdbserver_LDFLAGS}" \
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL \
|
2008-06-19 15:33:33 +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 \
|
|
|
|
--without-develop \
|
2008-07-14 21:57:57 +00:00
|
|
|
${gdbserver_extra_config}
|
2008-06-19 15:33:33 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building gdbserver"
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
|
2008-06-19 15:33:33 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing gdbserver"
|
2008-07-14 21:57:57 +00:00
|
|
|
CT_DoExecLog ALL make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install
|
2008-06-19 15:33:33 +00:00
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
CT_EndStep
|
|
|
|
fi
|
|
|
|
}
|