Correctly handle V= only from command line, not from environment.
/trunk/ct-ng.in | 17 8 9 0 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
1 # Build script for the gdb debug facility
4 echo "gdb$(do_debug_gdb_suffix)"
5 if [ "${CT_GDB_NATIVE}" = "y" ]; then
6 echo "ncurses-${CT_NCURSES_VERSION}"
10 do_debug_gdb_suffix() {
11 case "${CT_GDB_VERSION}" in
13 *) echo "-${CT_GDB_VERSION}";;
17 do_debug_gdb_parts() {
22 if [ "${CT_GDB_CROSS}" = y ]; then
23 if [ "${CT_GDB_CROSS_INSIGHT}" = "y" ]; then
30 if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
34 if [ "${CT_GDB_NATIVE}" = "y" ]; then
43 if [ "${do_gdb}" = "y" ]; then
44 CT_GetFile "gdb$(do_debug_gdb_suffix)" \
45 {ftp,http}://ftp.gnu.org/pub/gnu/gdb \
46 ftp://sources.redhat.com/pub/gdb/{{,old-}releases,snapshots/current}
49 if [ "${do_insight}" = "y" ]; then
50 CT_GetFile "insight-${CT_GDB_VERSION}" \
51 ftp://sourceware.org/pub/insight/releases \
52 {ftp,http}://ftp.twaren.net/Unix/Sourceware/insight/releases \
53 {ftp,http}://ftp.gwdg.de/pub/linux/sources.redhat.com/insight/releases
56 if [ "${do_ncurses}" = "y" ]; then
57 CT_GetFile "ncurses-${CT_NCURSES_VERSION}" \
58 {ftp,http}://ftp.gnu.org/pub/gnu/ncurses \
59 ftp://invisible-island.net/ncurses
63 do_debug_gdb_extract() {
66 if [ "${do_gdb}" = "y" ]; then
67 CT_ExtractAndPatch "gdb$(do_debug_gdb_suffix)"
70 if [ "${do_insight}" = "y" ]; then
71 CT_ExtractAndPatch "insight-${CT_GDB_VERSION}"
74 if [ "${do_ncurses}" = "y" ]; then
75 CT_ExtractAndPatch "ncurses-${CT_NCURSES_VERSION}"
79 do_debug_gdb_build() {
80 gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
81 insight_src_dir="${CT_SRC_DIR}/insight-${CT_GDB_VERSION}"
84 # Version 6.3 and below behave badly with gdbmi
85 case "${CT_GDB_VERSION}" in
86 6.2*|6.3) extra_config="${extra_config} --disable-gdbmi";;
89 if [ "${CT_GDB_CROSS}" = "y" ]; then
90 CT_DoStep INFO "Installing cross-gdb"
91 CT_DoLog EXTRA "Configuring cross-gdb"
93 mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
94 cd "${CT_BUILD_DIR}/build-gdb-cross"
96 cross_extra_config="${extra_config}"
97 if [ "${CT_GMP_MPFR}" = "y" ]; then
98 cross_extra_config="${cross_extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
100 case "${CT_THREADS}" in
101 none) cross_extra_config="${cross_extra_config} --disable-threads";;
102 *) cross_extra_config="${cross_extra_config} --enable-threads";;
107 if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
108 CC_for_gdb="gcc -static"
109 LD_for_gdb="ld -static"
112 gdb_cross_configure="${gdb_src_dir}/configure"
113 [ "${CT_GDB_CROSS_INSIGHT}" = "y" ] && gdb_cross_configure="${insight_src_dir}/configure"
115 CT_DoLog DEBUG "Extra config passed: '${cross_extra_config# }'"
120 "${gdb_cross_configure}" \
121 --build=${CT_BUILD} \
123 --target=${CT_TARGET} \
124 --prefix="${CT_PREFIX_DIR}" \
125 --with-build-sysroot="${CT_SYSROOT_DIR}" \
127 ${cross_extra_config}
129 CT_DoLog EXTRA "Building cross-gdb"
130 CT_DoExecLog ALL make ${PARALLELMFLAGS}
132 CT_DoLog EXTRA "Installing cross-gdb"
133 CT_DoExecLog ALL make install
138 if [ "${CT_GDB_NATIVE}" = "y" ]; then
139 CT_DoStep INFO "Installing native gdb"
141 CT_DoStep INFO "Installing ncurses library"
142 CT_DoLog EXTRA "Configuring ncurses"
143 mkdir -p "${CT_BUILD_DIR}/build-ncurses"
144 cd "${CT_BUILD_DIR}/build-ncurses"
147 [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts="${ncurses_opts} --without-cxx --without-cxx-binding"
148 [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts="${ncurses_opts} --without-ada"
151 "${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}/configure" \
152 --build=${CT_BUILD} \
153 --host=${CT_TARGET} \
154 --with-build-cc=${CT_CC} \
155 --with-build-cpp=${CT_CC} \
156 --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
164 CT_DoLog EXTRA "Building ncurses"
165 CT_DoExecLog ALL make ${PARALLELMFLAGS}
167 CT_DoLog EXTRA "Installing ncurses"
168 mkdir -p "${CT_SYSROOT_DIR}/usr/bin"
169 CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install
173 CT_DoLog EXTRA "Configuring native gdb"
175 mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
176 cd "${CT_BUILD_DIR}/build-gdb-native"
178 native_extra_config="${extra_config}"
179 case "${CT_THREADS}" in
180 none) native_extra_config="${native_extra_config} --disable-threads";;
181 *) native_extra_config="${native_extra_config} --enable-threads";;
183 if [ "${CT_GDB_NATIVE_USE_GMP_MPFR}" = "y" ]; then
184 native_extra_config="${native_extra_config} --with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
187 if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
188 CC_for_gdb="${CT_TARGET}-gcc -static"
189 LD_for_gdb="${CT_TARGET}-ld -static"
191 CC_for_gdb="${CT_TARGET}-gcc"
192 LD_for_gdb="${CT_TARGET}-ld"
195 export ac_cv_func_strncmp_works=yes
197 CT_DoLog DEBUG "Extra config passed: '${native_extra_config# }'"
202 "${gdb_src_dir}/configure" \
203 --build=${CT_BUILD} \
204 --host=${CT_TARGET} \
205 --target=${CT_TARGET} \
207 --with-build-sysroot="${CT_SYSROOT_DIR}" \
214 --without-included-gettext \
216 ${native_extra_config}
218 CT_DoLog EXTRA "Building native gdb"
219 CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
221 CT_DoLog EXTRA "Installing native gdb"
222 CT_DoExecLog ALL make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install
224 # Building a native gdb also builds a gdbserver
225 find "${CT_DEBUG_INSTALL_DIR}" -type f -name gdbserver -exec rm -fv {} \; 2>&1 |CT_DoLog ALL
227 unset ac_cv_func_strncmp_works
232 if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
233 CT_DoStep INFO "Installing gdbserver"
234 CT_DoLog EXTRA "Configuring gdbserver"
236 mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
237 cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
239 # Workaround for bad versions, where the configure
240 # script for gdbserver is not executable...
241 # Bah, GNU folks strike again... :-(
242 chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
245 if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
246 gdbserver_LDFLAGS=-static
249 gdbserver_extra_config="${extra_config}"
251 LDFLAGS="${gdbserver_LDFLAGS}" \
253 "${gdb_src_dir}/gdb/gdbserver/configure" \
254 --build=${CT_BUILD} \
255 --host=${CT_TARGET} \
256 --target=${CT_TARGET} \
259 --localstatedir=/var \
260 --includedir="${CT_HEADERS_DIR}" \
261 --with-build-sysroot="${CT_SYSROOT_DIR}" \
267 --without-included-gettext \
270 ${gdbserver_extra_config}
272 CT_DoLog EXTRA "Building gdbserver"
273 CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
275 CT_DoLog EXTRA "Installing gdbserver"
276 CT_DoExecLog ALL make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install