Don't force building a gdbserver when only native gdb is selected.
/trunk/config/debug/gdb.in | 1 0 1 0 -
/trunk/scripts/build/debug/300-gdb.sh | 1 0 1 0 -
2 files changed, 2 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"
50 if [ "${CT_CC_GCC_GMP_MPFR}" = "y" ]; then
51 extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
53 case "${CT_THREADS}" in
54 none) extra_config="${extra_config} --disable-threads";;
55 *) extra_config="${extra_config} --enable-threads";;
60 if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
61 CC_for_gdb="gcc -static"
62 LD_for_gdb="ld -static"
67 "${gdb_src_dir}/configure" \
70 --target=${CT_TARGET} \
71 --prefix="${CT_PREFIX_DIR}" \
72 --with-build-sysroot="${CT_SYSROOT_DIR}" \
73 ${extra_config} 2>&1 |CT_DoLog ALL
75 CT_DoLog EXTRA "Building cross-gdb"
76 make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL
78 CT_DoLog EXTRA "Installing cross-gdb"
79 make install 2>&1 |CT_DoLog ALL
84 if [ "${CT_GDB_NATIVE}" = "y" ]; then
85 CT_DoStep INFO "Installing native gdb"
87 CT_DoStep INFO "Installing ncurses library"
88 CT_DoLog EXTRA "Configuring ncurses"
89 mkdir -p "${CT_BUILD_DIR}/build-ncurses"
90 cd "${CT_BUILD_DIR}/build-ncurses"
93 [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts="${ncurses_opts} --without-cxx --without-cxx-binding"
95 "${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}/configure" \
98 --with-build-cc=${CT_CC} \
99 --with-build-cpp=${CT_CC} \
100 --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
106 ${ncurses_opts} 2>&1 |CT_DoLog ALL
108 CT_DoLog EXTRA "Building ncurses"
109 make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL
111 CT_DoLog EXTRA "Installing ncurses"
112 mkdir -p -v "${CT_SYSROOT_DIR}/usr/bin" 2>&1 |CT_DoLog ALL
113 make DESTDIR="${CT_SYSROOT_DIR}" install 2>&1 |CT_DoLog ALL
117 CT_DoLog EXTRA "Configuring native gdb"
119 mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
120 cd "${CT_BUILD_DIR}/build-gdb-native"
122 case "${CT_THREADS}" in
123 none) extra_config="${extra_config} --disable-threads";;
124 *) extra_config="${extra_config} --enable-threads";;
129 if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
130 CC_for_gdb="${CT_TARGET}-gcc -static"
131 LD_for_gdb="${CT_TARGET}-ld -static"
134 export ac_cv_func_strncmp_works=yes
138 "${gdb_src_dir}/configure" \
139 --build=${CT_BUILD} \
140 --host=${CT_TARGET} \
141 --target=${CT_TARGET} \
143 --with-build-sysroot="${CT_SYSROOT_DIR}" \
150 --without-included-gettext \
152 ${extra_config} 2>&1 |CT_DoLog ALL
154 CT_DoLog EXTRA "Building native gdb"
155 make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
157 CT_DoLog EXTRA "Installing native gdb"
158 make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL
160 # Building a native gdb also builds a gdbserver
161 find "${CT_DEBUG_INSTALL_DIR}" -type f -name gdbserver -exec rm -fv {} + 2>&1 |CT_DoLog ALL
163 unset ac_cv_func_strncmp_works
168 if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
169 CT_DoStep INFO "Installing gdbserver"
170 CT_DoLog EXTRA "Configuring gdbserver"
172 mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
173 cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
175 # Workaround for bad versions, where the configure
176 # script for gdbserver is not executable...
177 # Bah, GNU folks strike again... :-(
178 chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
181 if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
182 gdbserver_LDFLAGS=-static
185 LDFLAGS="${gdbserver_LDFLAGS}" \
186 "${gdb_src_dir}/gdb/gdbserver/configure" \
187 --build=${CT_BUILD} \
188 --host=${CT_TARGET} \
189 --target=${CT_TARGET} \
192 --localstatedir=/var \
193 --includedir="${CT_HEADERS_DIR}" \
194 --with-build-sysroot="${CT_SYSROOT_DIR}" \
200 --without-included-gettext \
202 ${extra_config} 2>&1 |CT_DoLog ALL
204 CT_DoLog EXTRA "Building gdbserver"
205 make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
207 CT_DoLog EXTRA "Installing gdbserver"
208 make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL