GMP and MPFR are no longer a sub-component of gcc (config-wise).
Build and install GMP and MPFR for the target.
Use the target GMP and MPFR to build the native gdb.
Have separate extra_config for cross gdb, native gdb and gdbserver.
Check native GMP and MPFR in //.
/trunk/scripts/build/debug/300-gdb.sh | 27 19 8 0 ++++++++++++++++-------
/trunk/scripts/build/gmp.sh | 47 39 8 0 ++++++++++++++++++++++++++++++++-------
/trunk/scripts/build/mpfr.sh | 49 40 9 0 +++++++++++++++++++++++++++++++++--------
/trunk/steps.mk | 2 2 0 0 ++
/trunk/config/cc/gcc.in | 18 1 17 0 +--------------
/trunk/config/debug/gdb.in | 6 1 5 0 +----
/trunk/config/config.in | 1 1 0 0 +
/trunk/config/gmp_mpfr.in | 34 34 0 0 ++++++++++++++++++++++++++++
8 files changed, 137 insertions(+), 47 deletions(-)
1 # Build script for the gdb debug facility
6 [ "${CT_GDB}" = "y" ] || return 0
7 echo "gdb$(do_debug_gdb_suffix)"
8 if [ "${CT_GDB_NATIVE}" = "y" ]; then
9 echo "ncurses-${CT_NCURSES_VERSION}"
13 do_debug_gdb_suffix() {
14 case "${CT_GDB_VERSION}" in
16 *) echo "-${CT_GDB_VERSION}";;
21 CT_GetFile "gdb$(do_debug_gdb_suffix)" \
22 {ftp,http}://ftp.gnu.org/pub/gnu/gdb \
23 ftp://sources.redhat.com/pub/gdb/{{,old-}releases,snapshots/current}
24 if [ "${CT_GDB_NATIVE}" = "y" ]; then
25 CT_GetFile "ncurses-${CT_NCURSES_VERSION}" \
26 {ftp,http}://ftp.gnu.org/pub/gnu/ncurses \
27 ftp://invisible-island.net/ncurses
31 do_debug_gdb_extract() {
32 CT_ExtractAndPatch "gdb$(do_debug_gdb_suffix)"
33 if [ "${CT_GDB_NATIVE}" = "y" ]; then
34 CT_ExtractAndPatch "ncurses-${CT_NCURSES_VERSION}"
38 do_debug_gdb_build() {
39 gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
42 # Version 6.3 and below behave badly with gdbmi
43 case "${CT_GDB_VERSION}" in
44 6.2*|6.3) extra_config="${extra_config} --disable-gdbmi";;
47 if [ "${CT_GDB_CROSS}" = "y" ]; then
48 CT_DoStep INFO "Installing cross-gdb"
49 CT_DoLog EXTRA "Configuring cross-gdb"
51 mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
52 cd "${CT_BUILD_DIR}/build-gdb-cross"
54 cross_extra_config="${extra_config}"
55 if [ "${CT_CC_GCC_GMP_MPFR}" = "y" ]; then
56 cross_extra_config="${cross_extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
58 case "${CT_THREADS}" in
59 none) cross_extra_config="${cross_extra_config} --disable-threads";;
60 *) cross_extra_config="${cross_extra_config} --enable-threads";;
65 if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
66 CC_for_gdb="gcc -static"
67 LD_for_gdb="ld -static"
70 CT_DoLog DEBUG "Extra config passed: '${cross_extra_config# }'"
74 "${gdb_src_dir}/configure" \
77 --target=${CT_TARGET} \
78 --prefix="${CT_PREFIX_DIR}" \
79 --with-build-sysroot="${CT_SYSROOT_DIR}" \
80 ${cross_extra_config} 2>&1 |CT_DoLog ALL
82 CT_DoLog EXTRA "Building cross-gdb"
83 make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL
85 CT_DoLog EXTRA "Installing cross-gdb"
86 make install 2>&1 |CT_DoLog ALL
91 if [ "${CT_GDB_NATIVE}" = "y" ]; then
92 CT_DoStep INFO "Installing native gdb"
94 CT_DoStep INFO "Installing ncurses library"
95 CT_DoLog EXTRA "Configuring ncurses"
96 mkdir -p "${CT_BUILD_DIR}/build-ncurses"
97 cd "${CT_BUILD_DIR}/build-ncurses"
100 [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts="${ncurses_opts} --without-cxx --without-cxx-binding"
102 "${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}/configure" \
103 --build=${CT_BUILD} \
104 --host=${CT_TARGET} \
105 --with-build-cc=${CT_CC} \
106 --with-build-cpp=${CT_CC} \
107 --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
113 ${ncurses_opts} 2>&1 |CT_DoLog ALL
115 CT_DoLog EXTRA "Building ncurses"
116 make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL
118 CT_DoLog EXTRA "Installing ncurses"
119 mkdir -p -v "${CT_SYSROOT_DIR}/usr/bin" 2>&1 |CT_DoLog ALL
120 make DESTDIR="${CT_SYSROOT_DIR}" install 2>&1 |CT_DoLog ALL
124 CT_DoLog EXTRA "Configuring native gdb"
126 mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
127 cd "${CT_BUILD_DIR}/build-gdb-native"
129 native_extra_config="${extra_config}"
130 case "${CT_THREADS}" in
131 none) native_extra_config="${native_extra_config} --disable-threads";;
132 *) native_extra_config="${native_extra_config} --enable-threads";;
134 if [ "${CT_GMP_MPFR_TARGET}" = "y" ]; then
135 native_extra_config="${native_extra_config} --with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
140 if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
141 CC_for_gdb="${CT_TARGET}-gcc -static"
142 LD_for_gdb="${CT_TARGET}-ld -static"
145 export ac_cv_func_strncmp_works=yes
147 CT_DoLog DEBUG "Extra config passed: '${native_extra_config# }'"
151 "${gdb_src_dir}/configure" \
152 --build=${CT_BUILD} \
153 --host=${CT_TARGET} \
154 --target=${CT_TARGET} \
156 --with-build-sysroot="${CT_SYSROOT_DIR}" \
163 --without-included-gettext \
165 ${native_extra_config} 2>&1 |CT_DoLog ALL
167 CT_DoLog EXTRA "Building native gdb"
168 make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
170 CT_DoLog EXTRA "Installing native gdb"
171 make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL
173 # Building a native gdb also builds a gdbserver
174 find "${CT_DEBUG_INSTALL_DIR}" -type f -name gdbserver -exec rm -fv {} + 2>&1 |CT_DoLog ALL
176 unset ac_cv_func_strncmp_works
181 if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
182 CT_DoStep INFO "Installing gdbserver"
183 CT_DoLog EXTRA "Configuring gdbserver"
185 mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
186 cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
188 # Workaround for bad versions, where the configure
189 # script for gdbserver is not executable...
190 # Bah, GNU folks strike again... :-(
191 chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
194 if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
195 gdbserver_LDFLAGS=-static
198 gdbserver_extra_config="${extra_config}"
200 LDFLAGS="${gdbserver_LDFLAGS}" \
201 "${gdb_src_dir}/gdb/gdbserver/configure" \
202 --build=${CT_BUILD} \
203 --host=${CT_TARGET} \
204 --target=${CT_TARGET} \
207 --localstatedir=/var \
208 --includedir="${CT_HEADERS_DIR}" \
209 --with-build-sysroot="${CT_SYSROOT_DIR}" \
215 --without-included-gettext \
217 ${gdbserver_extra_config} 2>&1 |CT_DoLog ALL
219 CT_DoLog EXTRA "Building gdbserver"
220 make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
222 CT_DoLog EXTRA "Installing gdbserver"
223 make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install 2>&1 |CT_DoLog ALL