|
|
@ -1,67 +1,33 @@ |
|
|
|
# Build script for the gdb debug facility |
|
|
|
# Build script for the gdb debug facility |
|
|
|
|
|
|
|
|
|
|
|
do_debug_gdb_get() { |
|
|
|
do_debug_gdb_get() |
|
|
|
|
|
|
|
{ |
|
|
|
CT_Fetch GDB |
|
|
|
CT_Fetch GDB |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
do_debug_gdb_extract() { |
|
|
|
do_debug_gdb_extract() |
|
|
|
|
|
|
|
{ |
|
|
|
CT_ExtractPatch GDB |
|
|
|
CT_ExtractPatch GDB |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do_debug_gdb_build() { |
|
|
|
|
|
|
|
local -a extra_config |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 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" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gdb_src_dir="${CT_SRC_DIR}/gdb" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_GDB_HAS_PKGVERSION_BUGURL}" = "y" ]; then |
|
|
|
# Workaround for bad versions, where the configure |
|
|
|
[ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}") |
|
|
|
# script for gdbserver is not executable... |
|
|
|
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") |
|
|
|
# Bah, GNU folks strike again... :-( |
|
|
|
fi |
|
|
|
chmod a+x "${CT_SRC_DIR}/gdb/gdb/gdbserver/configure" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do_debug_gdb_build() |
|
|
|
|
|
|
|
{ |
|
|
|
if [ "${CT_GDB_CROSS}" = "y" ]; then |
|
|
|
if [ "${CT_GDB_CROSS}" = "y" ]; then |
|
|
|
local -a cross_extra_config |
|
|
|
|
|
|
|
local gcc_version p _p |
|
|
|
local gcc_version p _p |
|
|
|
local cross_CFLAGS cross_LDFLAGS |
|
|
|
local -a cross_extra_config |
|
|
|
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing cross-gdb" |
|
|
|
CT_DoStep INFO "Installing cross-gdb" |
|
|
|
CT_DoLog EXTRA "Configuring cross-gdb" |
|
|
|
|
|
|
|
|
|
|
|
cross_extra_config=( "${CT_GDB_CROSS_EXTRA_CONFIG_ARRAY[@]}" ) |
|
|
|
|
|
|
|
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-gdb-cross" |
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-gdb-cross" |
|
|
|
cd "${CT_BUILD_DIR}/build-gdb-cross" |
|
|
|
cd "${CT_BUILD_DIR}/build-gdb-cross" |
|
|
|
|
|
|
|
|
|
|
|
cross_extra_config=("${extra_config[@]}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then |
|
|
|
|
|
|
|
cross_extra_config+=("--disable-build-with-cxx") |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# For gdb-cross this combination of flags forces |
|
|
|
|
|
|
|
# gdb configure to fall back to default '-lexpat' flag |
|
|
|
|
|
|
|
# which is acceptable. |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# 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. |
|
|
|
|
|
|
|
cross_extra_config+=("--with-expat") |
|
|
|
|
|
|
|
cross_extra_config+=("--without-libexpat-prefix") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "${CT_THREADS}" in |
|
|
|
|
|
|
|
none) cross_extra_config+=("--disable-threads");; |
|
|
|
|
|
|
|
*) cross_extra_config+=("--enable-threads");; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_GDB_CROSS_PYTHON}" = "y" ]; then |
|
|
|
if [ "${CT_GDB_CROSS_PYTHON}" = "y" ]; then |
|
|
|
if [ -z "${CT_GDB_CROSS_PYTHON_BINARY}" ]; then |
|
|
|
if [ -z "${CT_GDB_CROSS_PYTHON_BINARY}" ]; then |
|
|
|
if [ "${CT_CANADIAN}" = "y" -o "${CT_CROSS_NATIVE}" = "y" ]; then |
|
|
|
if [ "${CT_CANADIAN}" = "y" -o "${CT_CROSS_NATIVE}" = "y" ]; then |
|
|
@ -84,18 +50,6 @@ do_debug_gdb_build() { |
|
|
|
cross_extra_config+=("--disable-sim") |
|
|
|
cross_extra_config+=("--disable-sim") |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ]; then |
|
|
|
|
|
|
|
cross_extra_config+=("--disable-nls") |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cross_CFLAGS="${CT_CFLAGS_FOR_HOST}" |
|
|
|
|
|
|
|
cross_LDFLAGS="${CT_LDFLAGS_FOR_HOST}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then |
|
|
|
|
|
|
|
cross_CFLAGS+=" -static" |
|
|
|
|
|
|
|
cross_LDFLAGS+=" -static" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ${CT_HOST}-gcc --version 2>&1 | grep clang; then |
|
|
|
if ${CT_HOST}-gcc --version 2>&1 | grep clang; then |
|
|
|
# clang detects the line from gettext's _ macro as format string |
|
|
|
# clang detects the line from gettext's _ macro as format string |
|
|
|
# not being a string literal and produces a lot of warnings - which |
|
|
|
# not being a string literal and produces a lot of warnings - which |
|
|
@ -104,45 +58,15 @@ do_debug_gdb_build() { |
|
|
|
cross_extra_config+=("--enable-build-warnings=,-Wno-format-nonliteral,-Wno-format-security") |
|
|
|
cross_extra_config+=("--enable-build-warnings=,-Wno-format-nonliteral,-Wno-format-security") |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Fix up whitespace. Some older GDB releases (e.g. 6.8a) get confused if there |
|
|
|
do_gdb_backend \ |
|
|
|
# are multiple consecutive spaces: sub-configure scripts replace them with a |
|
|
|
buildtype=cross \ |
|
|
|
# single space and then complain that $CC value changed from that in |
|
|
|
host="${CT_HOST}" \ |
|
|
|
# the master directory. |
|
|
|
cflags="${CT_CFLAGS_FOR_HOST}" \ |
|
|
|
cross_CFLAGS=`echo ${cross_CFLAGS}` |
|
|
|
ldflags="${CT_LDFLAGS_FOR_HOST}" \ |
|
|
|
cross_LDFLAGS=`echo ${cross_LDFLAGS}` |
|
|
|
prefix="${CT_PREFIX_DIR}" \ |
|
|
|
|
|
|
|
static="${CT_GDB_CROSS_STATIC}" \ |
|
|
|
# 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") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog DEBUG "Extra config passed: '${cross_extra_config[*]}'" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoExecLog CFG \ |
|
|
|
|
|
|
|
CPP="${CT_HOST_CPP}" \ |
|
|
|
|
|
|
|
CC="${CT_HOST_CC}" \ |
|
|
|
|
|
|
|
CXX="${CT_HOST_CXX}" \ |
|
|
|
|
|
|
|
LD="${CT_HOST_LD}" \ |
|
|
|
|
|
|
|
CFLAGS="${cross_CFLAGS}" \ |
|
|
|
|
|
|
|
CXXFLAGS="${cross_CFLAGS}" \ |
|
|
|
|
|
|
|
LDFLAGS="${cross_LDFLAGS}" \ |
|
|
|
|
|
|
|
${CONFIG_SHELL} \ |
|
|
|
|
|
|
|
"${gdb_src_dir}/configure" \ |
|
|
|
|
|
|
|
--build=${CT_BUILD} \ |
|
|
|
|
|
|
|
--host=${CT_HOST} \ |
|
|
|
|
|
|
|
--target=${CT_TARGET} \ |
|
|
|
|
|
|
|
--prefix="${CT_PREFIX_DIR}" \ |
|
|
|
|
|
|
|
--with-build-sysroot="${CT_SYSROOT_DIR}" \ |
|
|
|
|
|
|
|
--with-sysroot="${CT_SYSROOT_DIR}" \ |
|
|
|
--with-sysroot="${CT_SYSROOT_DIR}" \ |
|
|
|
--disable-werror \ |
|
|
|
"${cross_extra_config[@]}" |
|
|
|
"${cross_extra_config[@]}" \ |
|
|
|
|
|
|
|
"${CT_GDB_CROSS_EXTRA_CONFIG_ARRAY[@]}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building cross-gdb" |
|
|
|
|
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing cross-gdb" |
|
|
|
|
|
|
|
CT_DoExecLog ALL make install |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_BUILD_MANUALS}" = "y" ]; then |
|
|
|
if [ "${CT_BUILD_MANUALS}" = "y" ]; then |
|
|
|
CT_DoLog EXTRA "Building and installing the cross-GDB manuals" |
|
|
|
CT_DoLog EXTRA "Building and installing the cross-GDB manuals" |
|
|
@ -171,206 +95,170 @@ do_debug_gdb_build() { |
|
|
|
CT_EndStep |
|
|
|
CT_EndStep |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# TBD combine GDB native and gdbserver backends, build either or both in a single pass. |
|
|
|
if [ "${CT_GDB_NATIVE}" = "y" -o "${CT_GDB_GDBSERVER}" = "y" ]; then |
|
|
|
if [ "${CT_GDB_NATIVE}" = "y" ]; then |
|
|
|
|
|
|
|
local -a native_extra_config |
|
|
|
local -a native_extra_config |
|
|
|
local native_CFLAGS native_LDFLAGS |
|
|
|
local subdir |
|
|
|
|
|
|
|
|
|
|
|
CT_DoStep INFO "Installing native gdb" |
|
|
|
CT_DoStep INFO "Installing native gdb" |
|
|
|
CT_DoLog EXTRA "Configuring native gdb" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-gdb-native" |
|
|
|
mkdir -p "${CT_BUILD_DIR}/build-gdb-native" |
|
|
|
cd "${CT_BUILD_DIR}/build-gdb-native" |
|
|
|
cd "${CT_BUILD_DIR}/build-gdb-native" |
|
|
|
|
|
|
|
|
|
|
|
native_extra_config=("${extra_config[@]}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# We may not have C++ language configured for target |
|
|
|
|
|
|
|
if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then |
|
|
|
|
|
|
|
native_extra_config+=("--disable-build-with-cxx") |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# GDB on Mingw depends on PDcurses, not ncurses |
|
|
|
# GDB on Mingw depends on PDcurses, not ncurses |
|
|
|
if [ "${CT_MINGW32}" != "y" ]; then |
|
|
|
if [ "${CT_MINGW32}" != "y" ]; then |
|
|
|
native_extra_config+=("--with-curses") |
|
|
|
native_extra_config+=("--with-curses") |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Build a native gdbserver later if required. |
|
|
|
# Build a native gdbserver if needed. If building only |
|
|
|
|
|
|
|
# gdbserver, configure in the subdirectory. |
|
|
|
# Newer versions enable it automatically for a native target by default. |
|
|
|
# Newer versions enable it automatically for a native target by default. |
|
|
|
native_extra_config+=("--enable-gdbserver=no") |
|
|
|
if [ "${CT_GDB_GDBSERVER}" != "y" ]; then |
|
|
|
|
|
|
|
native_extra_config+=("--disable-gdbserver") |
|
|
|
# Target libexpat resides in sysroot and does not have |
|
|
|
else |
|
|
|
# any dependencies, so just passing '-lexpat' to gcc is enough. |
|
|
|
native_extra_config+=("--enable-gdbserver") |
|
|
|
# |
|
|
|
if [ "${CT_GDB_NATIVE_BUILD_IPA_LIB}" = "y" ]; then |
|
|
|
# By default gdb configure looks for expat in '$prefix/lib' |
|
|
|
gdbserver_extra_config+=("--enable-inprocess-agent") |
|
|
|
# directory. In our case '$prefix/lib' resolves to '/usr/lib' |
|
|
|
else |
|
|
|
# where libexpat for build platform lives, which is |
|
|
|
gdbserver_extra_config+=("--disable-inprocess-agent") |
|
|
|
# unacceptable for cross-compiling. |
|
|
|
fi |
|
|
|
# |
|
|
|
if [ "${CT_GDB_NATIVE}" != "y" ]; then |
|
|
|
# To prevent this '--without-libexpat-prefix' flag must be passed. |
|
|
|
subdir=gdbserver/ |
|
|
|
# Thus configure falls back to '-lexpat', which is exactly what we want. |
|
|
|
fi |
|
|
|
# |
|
|
|
|
|
|
|
# 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. |
|
|
|
|
|
|
|
native_extra_config+=("--with-expat") |
|
|
|
|
|
|
|
native_extra_config+=("--without-libexpat-prefix") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "${CT_THREADS}" in |
|
|
|
|
|
|
|
none) native_extra_config+=("--disable-threads");; |
|
|
|
|
|
|
|
*) native_extra_config+=("--enable-threads");; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ]; then |
|
|
|
|
|
|
|
native_extra_config+=("--disable-nls") |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
native_CFLAGS="${CT_ALL_TARGET_CFLAGS}" |
|
|
|
|
|
|
|
native_LDFLAGS="${CT_ALL_TARGET_LDFLAGS}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then |
|
|
|
|
|
|
|
native_CFLAGS+=" -static" |
|
|
|
|
|
|
|
native_LDFLAGS+=" -static" |
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
export ac_cv_func_strncmp_works=yes |
|
|
|
export ac_cv_func_strncmp_works=yes |
|
|
|
|
|
|
|
|
|
|
|
# Disable binutils options when building from the binutils-gdb repo. |
|
|
|
# TBD do we need all these? Eg why do we disable TUI if we build curses for target? |
|
|
|
native_extra_config+=("--disable-binutils") |
|
|
|
native_extra_config+=( |
|
|
|
native_extra_config+=("--disable-ld") |
|
|
|
--without-uiout |
|
|
|
native_extra_config+=("--disable-gas") |
|
|
|
--disable-tui |
|
|
|
|
|
|
|
--disable-gdbtk |
|
|
|
native_CFLAGS=`echo ${native_CFLAGS}` |
|
|
|
--without-x |
|
|
|
native_LDFLAGS=`echo ${native_LDFLAGS}` |
|
|
|
--disable-sim |
|
|
|
|
|
|
|
--without-included-gettext |
|
|
|
CT_DoLog DEBUG "Extra config passed: '${native_extra_config[*]}'" |
|
|
|
--without-develop |
|
|
|
|
|
|
|
--sysconfdir=/etc |
|
|
|
CT_DoExecLog CFG \ |
|
|
|
--localstatedir=/var |
|
|
|
CPP="${CT_TARGET_CPP}" \ |
|
|
|
) |
|
|
|
CC="${CT_TARGET_CC}" \ |
|
|
|
|
|
|
|
CXX="${CT_TARGET_CXX}" \ |
|
|
|
do_gdb_backend \ |
|
|
|
LD="${CT_TARGET_LD}" \ |
|
|
|
buildtype=native \ |
|
|
|
CFLAGS="${native_CFLAGS}" \ |
|
|
|
subdir=${subdir} \ |
|
|
|
CXXFLAGS="${native_CFLAGS}" \ |
|
|
|
host="${CT_TARGET}" \ |
|
|
|
LDFLAGS="${native_LDFLAGS}" \ |
|
|
|
cflags="${CT_ALL_TARGET_CFLAGS}" \ |
|
|
|
${CONFIG_SHELL} \ |
|
|
|
ldflags="${CT_ALL_TARGET_LDFLAGS}" \ |
|
|
|
"${gdb_src_dir}/configure" \ |
|
|
|
static="${CT_GDB_NATIVE_STATIC}" \ |
|
|
|
--build=${CT_BUILD} \ |
|
|
|
static_libstdc="${CT_GDB_NATIVE_STATIC_LIBSTDC}" \ |
|
|
|
--host=${CT_TARGET} \ |
|
|
|
prefix=/usr \ |
|
|
|
--target=${CT_TARGET} \ |
|
|
|
destdir="${CT_DEBUGROOT_DIR}" \ |
|
|
|
--prefix=/usr \ |
|
|
|
|
|
|
|
--with-build-sysroot="${CT_SYSROOT_DIR}" \ |
|
|
|
|
|
|
|
--without-uiout \ |
|
|
|
|
|
|
|
--disable-tui \ |
|
|
|
|
|
|
|
--disable-gdbtk \ |
|
|
|
|
|
|
|
--without-x \ |
|
|
|
|
|
|
|
--disable-sim \ |
|
|
|
|
|
|
|
--disable-werror \ |
|
|
|
|
|
|
|
--without-included-gettext \ |
|
|
|
|
|
|
|
--without-develop \ |
|
|
|
|
|
|
|
"${native_extra_config[@]}" |
|
|
|
"${native_extra_config[@]}" |
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building native gdb" |
|
|
|
|
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing native gdb" |
|
|
|
|
|
|
|
CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Building a native gdb also builds a gdbserver |
|
|
|
|
|
|
|
find "${CT_DEBUGROOT_DIR}" -type f -name gdbserver -exec rm -fv {} \; 2>&1 |CT_DoLog ALL |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unset ac_cv_func_strncmp_works |
|
|
|
unset ac_cv_func_strncmp_works |
|
|
|
|
|
|
|
|
|
|
|
CT_EndStep # native gdb build |
|
|
|
CT_EndStep # native gdb build |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_GDB_GDBSERVER}" = "y" ]; then |
|
|
|
do_gdb_backend() |
|
|
|
local -a gdbserver_extra_config |
|
|
|
{ |
|
|
|
local gdbserver_CFLAGS gdbserver_LDFLAGS |
|
|
|
local host prefix destdir cflags ldflags static buildtype subdir |
|
|
|
|
|
|
|
local -a extra_config |
|
|
|
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 a+x "${gdb_src_dir}/gdb/gdbserver/configure" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gdbserver_extra_config=("${extra_config[@]}") |
|
|
|
for arg in "$@"; do |
|
|
|
|
|
|
|
case "$arg" in |
|
|
|
|
|
|
|
--*) |
|
|
|
|
|
|
|
extra_config+=("${arg}") |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
|
|
|
|
eval "${arg// /\\ }" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
# We may not have C++ language configured for target |
|
|
|
if [ "${CT_GDB_HAS_PKGVERSION_BUGURL}" = "y" ]; then |
|
|
|
if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then |
|
|
|
[ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}") |
|
|
|
gdbserver_extra_config+=("--disable-build-with-cxx") |
|
|
|
[ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}") |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_GDB_GDBSERVER_HAS_IPA_LIB}" = "y" ]; then |
|
|
|
# Disable binutils options when building from the binutils-gdb repo. |
|
|
|
if [ "${CT_GDB_GDBSERVER_BUILD_IPA_LIB}" = "y" ]; then |
|
|
|
extra_config+=("--disable-binutils") |
|
|
|
gdbserver_extra_config+=("--enable-inprocess-agent") |
|
|
|
extra_config+=("--disable-ld") |
|
|
|
else |
|
|
|
extra_config+=("--disable-gas") |
|
|
|
gdbserver_extra_config+=("--disable-inprocess-agent") |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Disable binutils options when building from the binutils-gdb repo. |
|
|
|
if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then |
|
|
|
gdbserver_extra_config+=("--disable-binutils") |
|
|
|
extra_config+=("--disable-build-with-cxx") |
|
|
|
gdbserver_extra_config+=("--disable-ld") |
|
|
|
fi |
|
|
|
gdbserver_extra_config+=("--disable-gas") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gdbserver_CFLAGS="${CT_ALL_TARGET_CFLAGS}" |
|
|
|
case "${CT_THREADS}" in |
|
|
|
gdbserver_LDFLAGS="${CT_ALL_TARGET_LDFLAGS}" |
|
|
|
none) extra_config+=("--disable-threads");; |
|
|
|
|
|
|
|
*) extra_config+=("--enable-threads");; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then |
|
|
|
if [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ]; then |
|
|
|
gdbserver_CFLAGS+=" -static" |
|
|
|
extra_config+=("--disable-nls") |
|
|
|
gdbserver_LDFLAGS+=" -static" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${CT_GDB_GDBSERVER_STATIC_LIBSTDCXX}" = "y" ]; then |
|
|
|
# Target libexpat resides in sysroot and does not have |
|
|
|
gdbserver_LDFLAGS+=" -static-libstdc++" |
|
|
|
# any dependencies, so just passing '-lexpat' to gcc is enough. |
|
|
|
fi |
|
|
|
# |
|
|
|
|
|
|
|
# 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. |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# 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. |
|
|
|
|
|
|
|
extra_config+=("--with-expat") |
|
|
|
|
|
|
|
extra_config+=("--without-libexpat-prefix") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${static}" = "y" ]; then |
|
|
|
|
|
|
|
cflags+=" -static" |
|
|
|
|
|
|
|
ldflags+=" -static" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
if [ "${static_libstdc}" = "y" ]; then |
|
|
|
|
|
|
|
ldflags+=" -static-libstdc++" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
gdbserver_CFLAGS=`echo ${gdbserver_CFLAGS}` |
|
|
|
|
|
|
|
gdbserver_LDFLAGS=`echo ${gdbserver_LDFLAGS}` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog DEBUG "Extra config passed: '${gdbserver_extra_config[*]}'" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoExecLog CFG \ |
|
|
|
|
|
|
|
CPP="${CT_TARGET_CPP}" \ |
|
|
|
|
|
|
|
CC="${CT_TARGET_CC}" \ |
|
|
|
|
|
|
|
CXX="${CT_TARGET_CXX}" \ |
|
|
|
|
|
|
|
LD="${CT_TARGET_LD}" \ |
|
|
|
|
|
|
|
CFLAGS="${gdbserver_CFLAGS}" \ |
|
|
|
|
|
|
|
CXXFLAGS="${gdbserver_CFLAGS}" \ |
|
|
|
|
|
|
|
LDFLAGS="${gdbserver_LDFLAGS}" \ |
|
|
|
|
|
|
|
${CONFIG_SHELL} \ |
|
|
|
|
|
|
|
"${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 \ |
|
|
|
|
|
|
|
--disable-werror \ |
|
|
|
|
|
|
|
"${gdbserver_extra_config[@]}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building gdbserver" |
|
|
|
|
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} CC=${CT_TARGET}-${CT_CC} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing gdbserver" |
|
|
|
|
|
|
|
CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_EndStep |
|
|
|
# Fix up whitespace. Some older GDB releases (e.g. 6.8a) get confused if there |
|
|
|
fi |
|
|
|
# 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. |
|
|
|
|
|
|
|
cflags=`echo ${cflags}` |
|
|
|
|
|
|
|
ldflags=`echo ${ldflags}` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Configuring ${buildtype} gdb" |
|
|
|
|
|
|
|
CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TBD: is passing CPP/CC/CXX/LD needed? GCC should be determining this automatically from the triplets |
|
|
|
|
|
|
|
CT_DoExecLog CFG \ |
|
|
|
|
|
|
|
CPP="${host}-cpp" \ |
|
|
|
|
|
|
|
CC="${host}-gcc" \ |
|
|
|
|
|
|
|
CXX="${host}-g++" \ |
|
|
|
|
|
|
|
LD="${host}-ld" \ |
|
|
|
|
|
|
|
CFLAGS="${cflags}" \ |
|
|
|
|
|
|
|
CXXFLAGS="${cflags}" \ |
|
|
|
|
|
|
|
LDFLAGS="${ldflags}" \ |
|
|
|
|
|
|
|
${CONFIG_SHELL} \ |
|
|
|
|
|
|
|
"${CT_SRC_DIR}/gdb/${subdir}configure" \ |
|
|
|
|
|
|
|
--build=${CT_BUILD} \ |
|
|
|
|
|
|
|
--host=${host} \ |
|
|
|
|
|
|
|
--target=${CT_TARGET} \ |
|
|
|
|
|
|
|
--prefix="${prefix}" \ |
|
|
|
|
|
|
|
--with-build-sysroot="${CT_SYSROOT_DIR}" \ |
|
|
|
|
|
|
|
--includedir="${CT_HEADERS_DIR}" \ |
|
|
|
|
|
|
|
--disable-werror \ |
|
|
|
|
|
|
|
"${extra_config[@]}" \ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Building ${buildtype} gdb" |
|
|
|
|
|
|
|
CT_DoExecLog ALL make ${JOBSFLAGS} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CT_DoLog EXTRA "Installing ${buildtype} gdb" |
|
|
|
|
|
|
|
CT_DoExecLog ALL make install ${destdir:+DESTDIR="${destdir}"} |
|
|
|
} |
|
|
|
} |
|
|
|