2007-05-17 16:22:51 +00:00
|
|
|
# Build script for the gdb debug facility
|
|
|
|
|
2008-09-02 10:47:44 +00:00
|
|
|
do_debug_gdb_get() {
|
2017-05-30 05:32:38 +00:00
|
|
|
CT_Fetch GDB
|
2007-05-17 16:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_debug_gdb_extract() {
|
2017-05-30 05:32:38 +00:00
|
|
|
CT_ExtractPatch GDB
|
2007-05-17 16:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_debug_gdb_build() {
|
2009-08-19 17:44:43 +00:00
|
|
|
local -a extra_config
|
|
|
|
|
2017-12-14 05:27:03 +00:00
|
|
|
# These variables should be global and shared between all packages.
|
|
|
|
local CT_TARGET_CPP="${CT_TARGET}-cpp"
|
|
|
|
local CT_TARGET_CC="${CT_TARGET}-gcc"
|
|
|
|
local CT_TARGET_CXX="${CT_TARGET}-g++"
|
|
|
|
local CT_TARGET_LD="${CT_TARGET}-ld"
|
|
|
|
local CT_HOST_CPP="${CT_HOST}-cpp"
|
|
|
|
local CT_HOST_CC="${CT_HOST}-gcc"
|
|
|
|
local CT_HOST_CXX="${CT_HOST}-g++"
|
|
|
|
local CT_HOST_LD="${CT_HOST}-ld"
|
|
|
|
|
|
|
|
local CT_CXXFLAGS_FOR_HOST=${CT_CFLAGS_FOR_HOST}
|
2018-05-26 06:57:29 +00:00
|
|
|
local CT_TARGET_CXXFLAGS=${CT_ALL_TARGET_CFLAGS}
|
2017-12-14 05:27:03 +00:00
|
|
|
|
2017-05-30 05:32:38 +00:00
|
|
|
gdb_src_dir="${CT_SRC_DIR}/gdb"
|
2007-05-17 16:22:51 +00:00
|
|
|
|
2011-05-31 19:03:03 +00:00
|
|
|
if [ "${CT_GDB_HAS_PKGVERSION_BUGURL}" = "y" ]; then
|
2017-09-01 21:24:29 +00:00
|
|
|
[ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
|
2011-06-03 15:21:56 +00:00
|
|
|
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
|
2011-05-31 19:03:03 +00:00
|
|
|
fi
|
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
if [ "${CT_GDB_CROSS}" = "y" ]; then
|
2009-08-19 17:44:43 +00:00
|
|
|
local -a cross_extra_config
|
2017-04-02 02:19:35 +00:00
|
|
|
local gcc_version p _p
|
2018-05-26 06:57:29 +00:00
|
|
|
local cross_CFLAGS cross_CXXFLAGS cross_LDFLAGS
|
2009-08-19 17:44:43 +00:00
|
|
|
|
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"
|
|
|
|
|
2009-08-19 17:44:43 +00:00
|
|
|
cross_extra_config=("${extra_config[@]}")
|
2016-09-11 22:13:55 +00:00
|
|
|
|
2018-05-06 22:20:50 +00:00
|
|
|
if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then
|
|
|
|
cross_extra_config+=("--disable-build-with-cxx")
|
|
|
|
fi
|
|
|
|
|
2016-09-11 22:13:55 +00:00
|
|
|
# For gdb-cross this combination of flags forces
|
|
|
|
# gdb configure to fall back to default '-lexpat' flag
|
|
|
|
# which is acceptable.
|
2016-12-05 20:39:55 +00:00
|
|
|
#
|
2016-03-15 18:51:56 +00:00
|
|
|
# NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
|
|
|
|
# It conflicts with a static build: GDB's configure script will find the shared
|
|
|
|
# version of expat and will attempt to link that, despite the -static flag.
|
|
|
|
# The link will fail, and configure will abort with "expat missing or unusable"
|
|
|
|
# message.
|
2015-11-10 00:08:28 +00:00
|
|
|
cross_extra_config+=("--with-expat")
|
2016-09-09 12:13:23 +00:00
|
|
|
cross_extra_config+=("--without-libexpat-prefix")
|
|
|
|
|
2008-06-19 15:33:33 +00:00
|
|
|
case "${CT_THREADS}" in
|
2009-08-19 17:44:43 +00:00
|
|
|
none) cross_extra_config+=("--disable-threads");;
|
|
|
|
*) cross_extra_config+=("--enable-threads");;
|
2008-06-19 15:33:33 +00:00
|
|
|
esac
|
2017-12-14 05:27:03 +00:00
|
|
|
|
2011-10-08 20:57:21 +00:00
|
|
|
if [ "${CT_GDB_CROSS_PYTHON}" = "y" ]; then
|
2017-04-02 02:19:35 +00:00
|
|
|
if [ -z "${CT_GDB_CROSS_PYTHON_BINARY}" ]; then
|
|
|
|
for p in python python3 python2; do
|
|
|
|
_p=$( which "${p}" || true )
|
|
|
|
if [ -n "${_p}" ]; then
|
2017-12-14 05:27:03 +00:00
|
|
|
cross_extra_config+=("--with-python=${_p}")
|
2017-04-02 02:19:35 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -z "${_p}" ]; then
|
|
|
|
CT_Abort "Python support requested in cross-gdb, but Python not found. Set CT_GDB_CROSS_PYTHON_BINARY in your config."
|
|
|
|
fi
|
|
|
|
else
|
2017-12-14 05:27:03 +00:00
|
|
|
cross_extra_config+=("--with-python=${CT_GDB_CROSS_PYTHON_BINARY}")
|
2017-04-02 02:19:35 +00:00
|
|
|
fi
|
2011-10-08 20:57:21 +00:00
|
|
|
else
|
2017-12-14 05:27:03 +00:00
|
|
|
cross_extra_config+=("--with-python=no")
|
2011-10-08 20:57:21 +00:00
|
|
|
fi
|
2017-12-14 05:27:03 +00:00
|
|
|
|
2011-11-18 08:22:52 +00:00
|
|
|
if [ "${CT_GDB_CROSS_SIM}" = "y" ]; then
|
2017-12-14 05:27:03 +00:00
|
|
|
cross_extra_config+=("--enable-sim")
|
2011-11-18 08:22:52 +00:00
|
|
|
else
|
2017-12-14 05:27:03 +00:00
|
|
|
cross_extra_config+=("--disable-sim")
|
2011-11-18 08:22:52 +00:00
|
|
|
fi
|
2017-12-14 05:27:03 +00:00
|
|
|
|
2013-03-03 16:17:55 +00:00
|
|
|
if [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ]; then
|
|
|
|
cross_extra_config+=("--disable-nls")
|
|
|
|
fi
|
2008-06-19 15:33:33 +00:00
|
|
|
|
2017-12-14 05:27:03 +00:00
|
|
|
cross_CFLAGS="${CT_CFLAGS_FOR_HOST}"
|
|
|
|
cross_CXXFLAGS="${CT_CXXFLAGS_FOR_HOST}"
|
|
|
|
cross_LDFLAGS="${CT_LDFLAGS_FOR_HOST}"
|
|
|
|
|
2008-06-19 15:33:33 +00:00
|
|
|
if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
|
2017-12-17 21:49:16 +00:00
|
|
|
cross_CFLAGS+=" -static"
|
|
|
|
cross_CXXFLAGS+=" -static"
|
|
|
|
cross_LDFLAGS+=" -static"
|
2008-04-27 10:25:02 +00:00
|
|
|
fi
|
2017-12-14 05:27:03 +00:00
|
|
|
|
2017-01-08 07:26:52 +00:00
|
|
|
case "${CT_HOST}" in
|
|
|
|
*darwin*)
|
|
|
|
# FIXME: Really, we should be testing for host compiler being clang.
|
2017-12-17 21:49:16 +00:00
|
|
|
cross_CFLAGS+=" -Qunused-arguments"
|
|
|
|
cross_CXXFLAGS+=" -Qunused-arguments"
|
2017-03-07 08:15:29 +00:00
|
|
|
# clang detects the line from gettext's _ macro as format string
|
|
|
|
# not being a string literal and produces a lot of warnings - which
|
|
|
|
# ct-ng's logger faithfully relays to user if this happens in the
|
|
|
|
# error() function. Suppress them.
|
2017-12-14 05:27:03 +00:00
|
|
|
cross_extra_config+=("--enable-build-warnings=,-Wno-format-nonliteral,-Wno-format-security")
|
2017-01-08 07:26:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
2008-04-27 10:25:02 +00:00
|
|
|
|
2016-03-16 18:41:55 +00:00
|
|
|
# Fix up whitespace. Some older GDB releases (e.g. 6.8a) get confused if there
|
|
|
|
# are multiple consecutive spaces: sub-configure scripts replace them with a
|
|
|
|
# single space and then complain that $CC value changed from that in
|
|
|
|
# the master directory.
|
2017-12-14 05:27:03 +00:00
|
|
|
cross_CFLAGS=`echo ${cross_CFLAGS}`
|
|
|
|
cross_CXXFLAGS=`echo ${cross_CXXFLAGS}`
|
|
|
|
cross_LDFLAGS=`echo ${cross_LDFLAGS}`
|
2016-03-16 18:41:55 +00:00
|
|
|
|
|
|
|
# Disable binutils options when building from the binutils-gdb repo.
|
|
|
|
cross_extra_config+=("--disable-binutils")
|
|
|
|
cross_extra_config+=("--disable-ld")
|
|
|
|
cross_extra_config+=("--disable-gas")
|
2015-11-25 04:40:44 +00:00
|
|
|
|
2009-08-19 17:44:43 +00:00
|
|
|
CT_DoLog DEBUG "Extra config passed: '${cross_extra_config[*]}'"
|
2008-06-20 15:16:43 +00:00
|
|
|
|
2011-03-19 23:55:07 +00:00
|
|
|
CT_DoExecLog CFG \
|
2017-12-14 05:27:03 +00:00
|
|
|
CPP="${CT_HOST_CPP}" \
|
|
|
|
CC="${CT_HOST_CC}" \
|
|
|
|
CXX="${CT_HOST_CXX}" \
|
|
|
|
LD="${CT_HOST_LD}" \
|
|
|
|
CFLAGS="${cross_CFLAGS}" \
|
|
|
|
CXXFLAGS="${cross_CXXFLAGS}" \
|
|
|
|
LDFLAGS="${cross_LDFLAGS}" \
|
2017-01-25 08:06:28 +00:00
|
|
|
${CONFIG_SHELL} \
|
2013-03-03 16:17:55 +00:00
|
|
|
"${gdb_src_dir}/configure" \
|
2007-05-17 16:22:51 +00:00
|
|
|
--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}" \
|
2011-05-25 18:23:48 +00:00
|
|
|
--with-sysroot="${CT_SYSROOT_DIR}" \
|
2008-08-20 12:08:03 +00:00
|
|
|
--disable-werror \
|
2011-11-23 05:15:27 +00:00
|
|
|
"${cross_extra_config[@]}" \
|
|
|
|
"${CT_GDB_CROSS_EXTRA_CONFIG_ARRAY[@]}"
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building cross-gdb"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS}
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing cross-gdb"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make install
|
2007-05-17 16:22:51 +00:00
|
|
|
|
2011-11-15 21:06:21 +00:00
|
|
|
if [ "${CT_BUILD_MANUALS}" = "y" ]; then
|
|
|
|
CT_DoLog EXTRA "Building and installing the cross-GDB manuals"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
|
|
|
|
CT_DoExecLog ALL make install-{pdf,html}-gdb
|
2011-11-15 21:06:21 +00:00
|
|
|
fi
|
|
|
|
|
2011-07-29 22:05:53 +00:00
|
|
|
if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then
|
2013-03-03 16:17:55 +00:00
|
|
|
CT_DoLog EXTRA "Installing '.gdbinit' template"
|
2011-07-29 22:05:53 +00:00
|
|
|
# See in scripts/build/internals.sh for why we do this
|
2017-05-30 05:32:38 +00:00
|
|
|
# TBD GCC 3.x and older not supported
|
|
|
|
if [ -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then
|
2017-12-14 05:27:03 +00:00
|
|
|
gcc_version=$(cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER")
|
2011-07-29 22:05:53 +00:00
|
|
|
else
|
2017-02-27 03:06:35 +00:00
|
|
|
gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
|
2017-05-30 05:32:38 +00:00
|
|
|
"${CT_SRC_DIR}/gcc/gcc/version.c" \
|
2011-07-29 22:05:53 +00:00
|
|
|
)
|
|
|
|
fi
|
2017-12-14 05:27:03 +00:00
|
|
|
sed -r \
|
2011-07-29 22:05:53 +00:00
|
|
|
-e "s:@@PREFIX@@:${CT_PREFIX_DIR}:;" \
|
|
|
|
-e "s:@@VERSION@@:${gcc_version}:;" \
|
|
|
|
"${CT_LIB_DIR}/scripts/build/debug/gdbinit.in" \
|
|
|
|
>"${CT_PREFIX_DIR}/share/gdb/gdbinit"
|
|
|
|
fi # Install gdbinit sample
|
2011-07-24 18:30:52 +00:00
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
CT_EndStep
|
|
|
|
fi
|
|
|
|
|
2017-06-05 05:27:02 +00:00
|
|
|
# TBD combine GDB native and gdbserver backends, build either or both in a single pass.
|
2007-05-17 16:22:51 +00:00
|
|
|
if [ "${CT_GDB_NATIVE}" = "y" ]; then
|
2009-08-19 17:44:43 +00:00
|
|
|
local -a native_extra_config
|
2018-05-26 06:57:29 +00:00
|
|
|
local native_CFLAGS native_CXXFLAGS native_LDFLAGS
|
2009-08-19 17:44:43 +00:00
|
|
|
|
2008-06-18 12:33:32 +00:00
|
|
|
CT_DoStep INFO "Installing native gdb"
|
2017-12-14 05:27:03 +00:00
|
|
|
CT_DoLog EXTRA "Configuring native gdb"
|
|
|
|
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
|
|
|
|
cd "${CT_BUILD_DIR}/build-gdb-native"
|
2008-06-18 12:33:32 +00:00
|
|
|
|
2010-08-23 12:32:16 +00:00
|
|
|
native_extra_config=("${extra_config[@]}")
|
|
|
|
|
2017-02-10 06:14:36 +00:00
|
|
|
# We may not have C++ language configured for target
|
2018-05-06 22:20:50 +00:00
|
|
|
if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then
|
2017-06-05 05:27:02 +00:00
|
|
|
native_extra_config+=("--disable-build-with-cxx")
|
|
|
|
fi
|
2017-02-10 06:14:36 +00:00
|
|
|
|
2010-07-11 20:23:34 +00:00
|
|
|
# GDB on Mingw depends on PDcurses, not ncurses
|
2013-03-03 14:25:52 +00:00
|
|
|
if [ "${CT_MINGW32}" != "y" ]; then
|
2010-08-23 12:32:16 +00:00
|
|
|
native_extra_config+=("--with-curses")
|
2015-11-08 07:31:46 +00:00
|
|
|
fi
|
2009-03-30 21:17:21 +00:00
|
|
|
|
2017-12-11 22:34:50 +00:00
|
|
|
# Build a native gdbserver later if required.
|
|
|
|
# Newer versions enable it automatically for a native target by default.
|
|
|
|
native_extra_config+=("--enable-gdbserver=no")
|
|
|
|
|
2016-09-11 22:13:55 +00:00
|
|
|
# Target libexpat resides in sysroot and does not have
|
|
|
|
# any dependencies, so just passing '-lexpat' to gcc is enough.
|
|
|
|
#
|
|
|
|
# By default gdb configure looks for expat in '$prefix/lib'
|
|
|
|
# directory. In our case '$prefix/lib' resolves to '/usr/lib'
|
|
|
|
# where libexpat for build platform lives, which is
|
|
|
|
# unacceptable for cross-compiling.
|
|
|
|
#
|
|
|
|
# To prevent this '--without-libexpat-prefix' flag must be passed.
|
|
|
|
# Thus configure falls back to '-lexpat', which is exactly what we want.
|
2016-12-05 20:39:55 +00:00
|
|
|
#
|
2016-03-15 18:51:56 +00:00
|
|
|
# NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
|
|
|
|
# It conflicts with a static build: GDB's configure script will find the shared
|
|
|
|
# version of expat and will attempt to link that, despite the -static flag.
|
|
|
|
# The link will fail, and configure will abort with "expat missing or unusable"
|
|
|
|
# message.
|
2013-03-03 14:30:02 +00:00
|
|
|
native_extra_config+=("--with-expat")
|
2016-09-09 12:13:23 +00:00
|
|
|
native_extra_config+=("--without-libexpat-prefix")
|
2010-08-23 08:47:00 +00:00
|
|
|
|
2008-06-19 15:33:33 +00:00
|
|
|
case "${CT_THREADS}" in
|
2009-08-19 17:44:43 +00:00
|
|
|
none) native_extra_config+=("--disable-threads");;
|
|
|
|
*) native_extra_config+=("--enable-threads");;
|
2008-06-19 15:33:33 +00:00
|
|
|
esac
|
|
|
|
|
2017-12-14 05:27:03 +00:00
|
|
|
if [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ]; then
|
|
|
|
native_extra_config+=("--disable-nls")
|
|
|
|
fi
|
|
|
|
|
2018-05-26 06:57:29 +00:00
|
|
|
native_CFLAGS="${CT_ALL_TARGET_CFLAGS}"
|
|
|
|
native_CXXFLAGS="${CT_ALL_TARGET_CFLAGS}"
|
|
|
|
native_LDFLAGS="${CT_ALL_TARGET_LDFLAGS}"
|
2012-09-29 06:34:15 +00:00
|
|
|
|
2008-06-19 15:33:33 +00:00
|
|
|
if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
|
2017-12-17 21:49:16 +00:00
|
|
|
native_CFLAGS+=" -static"
|
|
|
|
native_CXXFLAGS+=" -static"
|
|
|
|
native_LDFLAGS+=" -static"
|
2008-06-19 15:33:33 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
export ac_cv_func_strncmp_works=yes
|
|
|
|
|
2015-12-08 17:09:49 +00:00
|
|
|
# Disable binutils options when building from the binutils-gdb repo.
|
|
|
|
native_extra_config+=("--disable-binutils")
|
|
|
|
native_extra_config+=("--disable-ld")
|
|
|
|
native_extra_config+=("--disable-gas")
|
2015-11-25 04:40:44 +00:00
|
|
|
|
2017-12-14 05:27:03 +00:00
|
|
|
native_CFLAGS=`echo ${native_CFLAGS}`
|
|
|
|
native_CXXFLAGS=`echo ${native_CXXFLAGS}`
|
|
|
|
native_LDFLAGS=`echo ${native_LDFLAGS}`
|
|
|
|
|
2009-08-19 17:44:43 +00:00
|
|
|
CT_DoLog DEBUG "Extra config passed: '${native_extra_config[*]}'"
|
2008-06-20 15:16:43 +00:00
|
|
|
|
2011-03-19 23:55:07 +00:00
|
|
|
CT_DoExecLog CFG \
|
2017-12-14 05:27:03 +00:00
|
|
|
CPP="${CT_TARGET_CPP}" \
|
|
|
|
CC="${CT_TARGET_CC}" \
|
|
|
|
CXX="${CT_TARGET_CXX}" \
|
|
|
|
LD="${CT_TARGET_LD}" \
|
|
|
|
CFLAGS="${native_CFLAGS}" \
|
|
|
|
CXXFLAGS="${native_CXXFLAGS}" \
|
|
|
|
LDFLAGS="${native_LDFLAGS}" \
|
2017-01-25 08:06:28 +00:00
|
|
|
${CONFIG_SHELL} \
|
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 \
|
2009-08-19 17:44:43 +00:00
|
|
|
"${native_extra_config[@]}"
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building native gdb"
|
2017-01-14 03:54:08 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS}
|
2007-05-17 16:22:51 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing native gdb"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_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
|
2009-03-03 17:41:59 +00:00
|
|
|
find "${CT_DEBUGROOT_DIR}" -type f -name gdbserver -exec rm -fv {} \; 2>&1 |CT_DoLog ALL
|
2008-06-19 15:33:33 +00:00
|
|
|
|
|
|
|
unset ac_cv_func_strncmp_works
|
|
|
|
|
2009-03-30 21:17:21 +00:00
|
|
|
CT_EndStep # native gdb build
|
2008-06-19 15:33:33 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
|
2009-08-19 17:44:43 +00:00
|
|
|
local -a gdbserver_extra_config
|
2018-05-26 06:57:29 +00:00
|
|
|
local gdbserver_CFLAGS gdbserver_CXXFLAGS gdbserver_LDFLAGS
|
2009-08-19 17:44:43 +00:00
|
|
|
|
2008-06-19 15:33:33 +00:00
|
|
|
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"
|
|
|
|
|
2009-08-19 17:44:43 +00:00
|
|
|
gdbserver_extra_config=("${extra_config[@]}")
|
2008-06-20 15:16:43 +00:00
|
|
|
|
2017-02-10 06:14:36 +00:00
|
|
|
# We may not have C++ language configured for target
|
2018-05-06 22:20:50 +00:00
|
|
|
if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then
|
2017-06-05 05:27:02 +00:00
|
|
|
gdbserver_extra_config+=("--disable-build-with-cxx")
|
|
|
|
fi
|
2017-02-10 06:14:36 +00:00
|
|
|
|
2012-05-17 15:56:27 +00:00
|
|
|
if [ "${CT_GDB_GDBSERVER_HAS_IPA_LIB}" = "y" ]; then
|
|
|
|
if [ "${CT_GDB_GDBSERVER_BUILD_IPA_LIB}" = "y" ]; then
|
2017-12-14 05:27:03 +00:00
|
|
|
gdbserver_extra_config+=("--enable-inprocess-agent")
|
2012-05-17 15:56:27 +00:00
|
|
|
else
|
2017-12-14 05:27:03 +00:00
|
|
|
gdbserver_extra_config+=("--disable-inprocess-agent")
|
2012-05-17 15:56:27 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2015-12-08 17:09:49 +00:00
|
|
|
# Disable binutils options when building from the binutils-gdb repo.
|
|
|
|
gdbserver_extra_config+=("--disable-binutils")
|
|
|
|
gdbserver_extra_config+=("--disable-ld")
|
|
|
|
gdbserver_extra_config+=("--disable-gas")
|
2015-11-25 04:40:44 +00:00
|
|
|
|
2018-05-26 06:57:29 +00:00
|
|
|
gdbserver_CFLAGS="${CT_ALL_TARGET_CFLAGS}"
|
|
|
|
gdbserver_CXXFLAGS="${CT_ALL_TARGET_CFLAGS}"
|
|
|
|
gdbserver_LDFLAGS="${CT_ALL_TARGET_LDFLAGS}"
|
2017-12-14 05:27:03 +00:00
|
|
|
|
|
|
|
if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
|
2017-12-17 21:49:16 +00:00
|
|
|
gdbserver_CFLAGS+=" -static"
|
|
|
|
gdbserver_CXXFLAGS+=" -static"
|
|
|
|
gdbserver_LDFLAGS+=" -static"
|
2017-12-14 05:27:03 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${CT_GDB_GDBSERVER_STATIC_LIBSTDCXX}" = "y" ]; then
|
2017-12-17 21:49:16 +00:00
|
|
|
gdbserver_LDFLAGS+=" -static-libstdc++"
|
2017-12-14 05:27:03 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
gdbserver_CFLAGS=`echo ${gdbserver_CFLAGS}`
|
|
|
|
gdbserver_CXXFLAGS=`echo ${gdbserver_CXXFLAGS}`
|
|
|
|
gdbserver_LDFLAGS=`echo ${gdbserver_LDFLAGS}`
|
|
|
|
|
|
|
|
CT_DoLog DEBUG "Extra config passed: '${gdbserver_extra_config[*]}'"
|
2017-10-01 01:47:35 +00:00
|
|
|
|
2010-10-22 20:02:57 +00:00
|
|
|
CT_DoExecLog CFG \
|
2017-12-14 05:27:03 +00:00
|
|
|
CPP="${CT_TARGET_CPP}" \
|
|
|
|
CC="${CT_TARGET_CC}" \
|
|
|
|
CXX="${CT_TARGET_CXX}" \
|
|
|
|
LD="${CT_TARGET_LD}" \
|
|
|
|
CFLAGS="${gdbserver_CFLAGS}" \
|
|
|
|
CXXFLAGS="${gdbserver_CXXFLAGS}" \
|
2011-03-19 23:55:07 +00:00
|
|
|
LDFLAGS="${gdbserver_LDFLAGS}" \
|
2017-01-25 08:06:28 +00:00
|
|
|
${CONFIG_SHELL} \
|
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-08-20 12:08:03 +00:00
|
|
|
--disable-werror \
|
2009-08-19 17:44:43 +00:00
|
|
|
"${gdbserver_extra_config[@]}"
|
2008-06-19 15:33:33 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building gdbserver"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} CC=${CT_TARGET}-${CT_CC}
|
2008-06-19 15:33:33 +00:00
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing gdbserver"
|
2016-11-21 07:50:17 +00:00
|
|
|
CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install
|
2008-06-19 15:33:33 +00:00
|
|
|
|
2007-05-17 16:22:51 +00:00
|
|
|
CT_EndStep
|
|
|
|
fi
|
|
|
|
}
|