scripts/build/debug/300-gdb.sh
branchbash_array
changeset 1481 195bde4764b1
parent 1281 12a2991fcffb
child 1555 3445f45e6c37
     1.1 --- a/scripts/build/debug/300-gdb.sh	Mon Mar 30 21:17:21 2009 +0000
     1.2 +++ b/scripts/build/debug/300-gdb.sh	Wed Aug 19 19:44:43 2009 +0200
     1.3 @@ -73,29 +73,32 @@
     1.4  }
     1.5  
     1.6  do_debug_gdb_build() {
     1.7 +    local -a extra_config
     1.8 +
     1.9      gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
    1.10      insight_src_dir="${CT_SRC_DIR}/insight-${CT_GDB_VERSION}"
    1.11  
    1.12 -    extra_config=
    1.13      # Version 6.3 and below behave badly with gdbmi
    1.14      case "${CT_GDB_VERSION}" in
    1.15 -        6.2*|6.3)   extra_config="${extra_config} --disable-gdbmi";;
    1.16 +        6.2*|6.3)   extra_config+=("--disable-gdbmi");;
    1.17      esac
    1.18  
    1.19      if [ "${CT_GDB_CROSS}" = "y" ]; then
    1.20 +        local -a cross_extra_config
    1.21 +
    1.22          CT_DoStep INFO "Installing cross-gdb"
    1.23          CT_DoLog EXTRA "Configuring cross-gdb"
    1.24  
    1.25          mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
    1.26          cd "${CT_BUILD_DIR}/build-gdb-cross"
    1.27  
    1.28 -        cross_extra_config="${extra_config}"
    1.29 +        cross_extra_config=("${extra_config[@]}")
    1.30          if [ "${CT_GMP_MPFR}" = "y" ]; then
    1.31 -            cross_extra_config="${cross_extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
    1.32 +            cross_extra_config+=("--with-gmp=${CT_PREFIX_DIR}" "--with-mpfr=${CT_PREFIX_DIR}")
    1.33          fi
    1.34          case "${CT_THREADS}" in
    1.35 -            none)   cross_extra_config="${cross_extra_config} --disable-threads";;
    1.36 -            *)      cross_extra_config="${cross_extra_config} --enable-threads";;
    1.37 +            none)   cross_extra_config+=("--disable-threads");;
    1.38 +            *)      cross_extra_config+=("--enable-threads");;
    1.39          esac
    1.40  
    1.41          CC_for_gdb=
    1.42 @@ -108,7 +111,7 @@
    1.43          gdb_cross_configure="${gdb_src_dir}/configure"
    1.44          [ "${CT_GDB_CROSS_INSIGHT}" = "y" ] && gdb_cross_configure="${insight_src_dir}/configure"
    1.45  
    1.46 -        CT_DoLog DEBUG "Extra config passed: '${cross_extra_config# }'"
    1.47 +        CT_DoLog DEBUG "Extra config passed: '${cross_extra_config[*]}'"
    1.48  
    1.49          CC="${CC_for_gdb}"                              \
    1.50          LD="${LD_for_gdb}"                              \
    1.51 @@ -120,7 +123,7 @@
    1.52              --prefix="${CT_PREFIX_DIR}"                 \
    1.53              --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    1.54              --disable-werror                            \
    1.55 -            ${cross_extra_config}
    1.56 +            "${cross_extra_config[@]}"
    1.57  
    1.58          CT_DoLog EXTRA "Building cross-gdb"
    1.59          CT_DoExecLog ALL make ${PARALLELMFLAGS}
    1.60 @@ -132,13 +135,15 @@
    1.61      fi
    1.62  
    1.63      if [ "${CT_GDB_NATIVE}" = "y" ]; then
    1.64 +        local -a native_extra_config
    1.65 +        local -a ncurses_opt
    1.66 +
    1.67          CT_DoStep INFO "Installing native gdb"
    1.68  
    1.69          CT_DoStep INFO "Installing ncurses library"
    1.70  
    1.71 -        ncurses_opts=
    1.72 -        [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts="${ncurses_opts} --without-cxx --without-cxx-binding"
    1.73 -        [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts="${ncurses_opts} --without-ada"
    1.74 +        [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts+=("--without-cxx" "--without-cxx-binding")
    1.75 +        [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts+=("--without-ada")
    1.76  
    1.77          CT_DoStep INFO "Installing native ncurses tic"
    1.78          CT_DoLog EXTRA "Configuring ncurses tic"
    1.79 @@ -158,7 +163,7 @@
    1.80              --with-build-cc=${CT_REAL_BUILD}-gcc                \
    1.81              --with-build-cpp=${CT_REAL_BUILD}-gcc               \
    1.82              --with-build-cflags="${CT_CFLAGS_FOR_HOST}"         \
    1.83 -            ${ncurses_opts}
    1.84 +            "${ncurses_opts[@]}"
    1.85  
    1.86          # Under some operating systems (eg. Winblows), there is an
    1.87          # extension appended to executables. Find that.
    1.88 @@ -190,7 +195,7 @@
    1.89              --without-sysmouse                                  \
    1.90              --without-progs                                     \
    1.91              --enable-termcap                                    \
    1.92 -            ${ncurses_opts}
    1.93 +            "${ncurses_opts[@]}"
    1.94  
    1.95          CT_DoLog EXTRA "Building ncurses"
    1.96          CT_DoExecLog ALL make ${PARALLELMFLAGS}
    1.97 @@ -209,13 +214,13 @@
    1.98          mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
    1.99          cd "${CT_BUILD_DIR}/build-gdb-native"
   1.100  
   1.101 -        native_extra_config="${extra_config}"
   1.102 +        native_extra_config=("${extra_config[@]}")
   1.103          case "${CT_THREADS}" in
   1.104 -            none)   native_extra_config="${native_extra_config} --disable-threads";;
   1.105 -            *)      native_extra_config="${native_extra_config} --enable-threads";;
   1.106 +            none)   native_extra_config+=("--disable-threads");;
   1.107 +            *)      native_extra_config+=("--enable-threads");;
   1.108          esac
   1.109          if [ "${CT_GDB_NATIVE_USE_GMP_MPFR}" = "y" ]; then
   1.110 -            native_extra_config="${native_extra_config} --with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
   1.111 +            native_extra_config+=("--with-gmp=${CT_SYSROOT_DIR}/usr" "--with-mpfr=${CT_SYSROOT_DIR}/usr")
   1.112          fi
   1.113  
   1.114          if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
   1.115 @@ -228,7 +233,7 @@
   1.116  
   1.117          export ac_cv_func_strncmp_works=yes
   1.118  
   1.119 -        CT_DoLog DEBUG "Extra config passed: '${native_extra_config# }'"
   1.120 +        CT_DoLog DEBUG "Extra config passed: '${native_extra_config[*]}'"
   1.121  
   1.122          CC="${CC_for_gdb}"                              \
   1.123          LD="${LD_for_gdb}"                              \
   1.124 @@ -247,7 +252,7 @@
   1.125              --disable-werror                            \
   1.126              --without-included-gettext                  \
   1.127              --without-develop                           \
   1.128 -            ${native_extra_config}
   1.129 +            "${native_extra_config[@]}"
   1.130  
   1.131          CT_DoLog EXTRA "Building native gdb"
   1.132          CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
   1.133 @@ -264,6 +269,8 @@
   1.134      fi
   1.135  
   1.136      if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
   1.137 +        local -a gdbserver_extra_config
   1.138 +
   1.139          CT_DoStep INFO "Installing gdbserver"
   1.140          CT_DoLog EXTRA "Configuring gdbserver"
   1.141  
   1.142 @@ -280,7 +287,7 @@
   1.143              gdbserver_LDFLAGS=-static
   1.144          fi
   1.145  
   1.146 -        gdbserver_extra_config="${extra_config}"
   1.147 +        gdbserver_extra_config=("${extra_config[@]}")
   1.148  
   1.149          LDFLAGS="${gdbserver_LDFLAGS}"                  \
   1.150          CT_DoExecLog ALL                                \
   1.151 @@ -301,7 +308,7 @@
   1.152              --without-included-gettext                  \
   1.153              --without-develop                           \
   1.154              --disable-werror                            \
   1.155 -            ${gdbserver_extra_config}
   1.156 +            "${gdbserver_extra_config[@]}"
   1.157  
   1.158          CT_DoLog EXTRA "Building gdbserver"
   1.159          CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}