Fix building native gdb: download, extract, patch, build and install the ncurses library (that is needed by gdb)
/trunk/scripts/build/debug/300-gdb.sh | 46 42 4 0 +++++++++++++++++++++++++++++++++++++----
/trunk/config/debug/gdb.in | 26 25 1 0 ++++++++++++++++++++++-
2 files changed, 67 insertions(+), 5 deletions(-)
1 # Build script for the gdb debug facility
6 [ "${CT_GDB}" = "y" ] || return 0
7 echo "gdb$(do_debug_gdb_suffix)"
8 [ "${CT_GDB_NATIVE}" = "y" ] && echo "ncurses-${CT_NCURSES_VERSION}"
11 do_debug_gdb_suffix() {
12 case "${CT_GDB_VERSION}" in
14 *) echo "-${CT_GDB_VERSION}";;
19 CT_GetFile "gdb$(do_debug_gdb_suffix)" \
20 {ftp,http}://ftp.gnu.org/pub/gnu/gdb \
21 ftp://sources.redhat.com/pub/gdb/{{,old-}releases,snapshots/current}
22 if [ "${CT_GDB_NATIVE}" = "y" ]; then
23 CT_GetFile "ncurses-${CT_NCURSES_VERSION}" \
24 {ftp,http}://ftp.gnu.org/pub/gnu/ncurses \
25 ftp://invisible-island.net/ncurses
29 do_debug_gdb_extract() {
30 CT_ExtractAndPatch "gdb$(do_debug_gdb_suffix)"
31 [ "${CT_GDB_NATIVE}" = "y" ] && CT_ExtractAndPatch "ncurses-${CT_NCURSES_VERSION}"
34 do_debug_gdb_build() {
35 gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
38 # Version 6.3 and below behave badly with gdbmi
39 case "${CT_GDB_VERSION}" in
40 6.2*|6.3) extra_config="${extra_config} --disable-gdbmi";;
43 if [ "${CT_GDB_CROSS}" = "y" ]; then
44 CT_DoStep INFO "Installing cross-gdb"
45 CT_DoLog EXTRA "Configuring cross-gdb"
47 mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
48 cd "${CT_BUILD_DIR}/build-gdb-cross"
52 if [ "${CT_GDB_CROSS_STATIC_GDBSERVER}" = "y" ]; then
53 CC_for_gdb="gcc -static"
54 LD_for_gdb="ld -static"
59 "${gdb_src_dir}/configure" \
62 --target=${CT_TARGET} \
63 --prefix="${CT_PREFIX_DIR}" \
64 --with-build-sysroot="${CT_SYSROOT_DIR}" \
66 ${extra_config} 2>&1 |CT_DoLog ALL
68 CT_DoLog EXTRA "Building cross-gdb"
69 make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL
71 CT_DoLog EXTRA "Installing cross-gdb"
72 make install 2>&1 |CT_DoLog ALL
76 CT_DoStep INFO "Installing gdbserver"
77 CT_DoLog EXTRA "Configuring gdbserver"
79 mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
80 cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
82 # Workaround for bad versions, where the configure
83 # script for gdbserver is not executable...
84 # Bah, GNU folks strike again... :-(
85 chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
88 if [ "${CT_GDB_CROSS_STATIC_GDBSERVER}" = "y" ]; then
89 gdbserver_LDFLAGS=-static
92 LDFLAGS="${gdbserver_LDFLAGS}" \
93 "${gdb_src_dir}/gdb/gdbserver/configure" \
96 --target=${CT_TARGET} \
99 --localstatedir=/var \
100 --includedir="${CT_HEADERS_DIR}" \
101 --with-build-sysroot="${CT_SYSROOT_DIR}" \
107 --without-included-gettext \
108 ${extra_config} 2>&1 |CT_DoLog ALL
110 CT_DoLog EXTRA "Building gdbserver"
111 make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
113 CT_DoLog EXTRA "Installing gdbserver"
114 make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL
119 if [ "${CT_GDB_NATIVE}" = "y" ]; then
120 CT_DoStep INFO "Installing native gdb"
122 CT_DoStep INFO "Installing ncurses library"
123 CT_DoLog EXTRA "Configuring ncurses"
124 mkdir -p "${CT_BUILD_DIR}/build-ncurses"
125 cd "${CT_BUILD_DIR}/build-ncurses"
128 [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts="${ncurses_opts} --without-cxx --without-cxx-binding"
130 "${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}/configure" \
131 --build=${CT_BUILD} \
132 --host=${CT_TARGET} \
133 --with-build-cc=${CT_CC} \
134 --with-build-cpp=${CT_CC} \
135 --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
142 ${ncurses_opts} 2>&1 |CT_DoLog ALL
144 CT_DoLog EXTRA "Building ncurses"
145 make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL
147 CT_DoLog EXTRA "Installing ncurses"
148 make DESTDIR="${CT_SYSROOT_DIR}" install 2>&1 |CT_DoLog ALL
152 CT_DoLog EXTRA "Configuring native gdb"
154 mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
155 cd "${CT_BUILD_DIR}/build-gdb-native"
157 "${gdb_src_dir}/configure" \
158 --build=${CT_BUILD} \
159 --host=${CT_TARGET} \
160 --target=${CT_TARGET} \
162 --with-build-sysroot="${CT_SYSROOT_DIR}" \
168 --disable-gdbserver \
169 --without-included-gettext \
170 ${extra_config} 2>&1 |CT_DoLog ALL
172 CT_DoLog EXTRA "Building native gdb"
173 make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
175 CT_DoLog EXTRA "Installing native gdb"
176 make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL