Merge the bash_array branch.
For every components where it makes sense, use bash arrays (instead
of a string with space-separated values) to store the options pased
to ./configure.
1.1 --- a/config/cc/gcc.in Tue Jul 21 01:05:59 2009 +0200
1.2 +++ b/config/cc/gcc.in Wed Aug 19 19:52:04 2009 +0200
1.3 @@ -219,6 +219,17 @@
1.4
1.5 endchoice
1.6
1.7 +config CC_ENABLE_CXX_FLAGS
1.8 + string
1.9 + prompt "Flags to pass to --enable-cxx-flags"
1.10 + default ""
1.11 + help
1.12 + Enter here the value of the gcc's ./configure option --enable-cxx-flags.
1.13 + Leave empty if you don't know better.
1.14 +
1.15 + Note: just pass in the option _value_, that is only the part that goes
1.16 + after the '=' sign.
1.17 +
1.18 config CC_CORE_EXTRA_CONFIG
1.19 string
1.20 prompt "Core gcc extra config"
2.1 --- a/configure Tue Jul 21 01:05:59 2009 +0200
2.2 +++ b/configure Wed Aug 19 19:52:04 2009 +0200
2.3 @@ -318,8 +318,8 @@
2.4 # The regular list of tools we can now easily check for
2.5 has_or_abort prog=bash \
2.6 var=bash \
2.7 - ver='^GNU bash, version [34]\.' \
2.8 - err="'bash' 3.x or above was not found"
2.9 + ver='^GNU bash, version (3\.[1-9]|4)' \
2.10 + err="'bash' 3.1 or above was not found"
2.11 has_or_abort prog=cut
2.12 has_or_abort prog=install var=install
2.13 has_or_abort prog=make \
3.1 --- a/scripts/build/binutils/binutils.sh Tue Jul 21 01:05:59 2009 +0200
3.2 +++ b/scripts/build/binutils/binutils.sh Wed Aug 19 19:52:04 2009 +0200
3.3 @@ -17,16 +17,18 @@
3.4
3.5 # Build binutils
3.6 do_binutils() {
3.7 + local -a extra_config
3.8 +
3.9 mkdir -p "${CT_BUILD_DIR}/build-binutils"
3.10 cd "${CT_BUILD_DIR}/build-binutils"
3.11
3.12 CT_DoStep INFO "Installing binutils"
3.13
3.14 - binutils_opts=
3.15 # If GMP and MPFR were configured, then use that,
3.16 # otherwise let binutils find the system-wide libraries, if they exist.
3.17 if [ "${CT_GMP_MPFR}" = "y" ]; then
3.18 - binutils_opts="--with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
3.19 + extra_config+=("--with-gmp=${CT_PREFIX_DIR}")
3.20 + extra_config+=("--with-mpfr=${CT_PREFIX_DIR}")
3.21 fi
3.22
3.23 CT_DoLog EXTRA "Configuring binutils"
3.24 @@ -40,7 +42,7 @@
3.25 --disable-nls \
3.26 --disable-multilib \
3.27 --disable-werror \
3.28 - ${binutils_opts} \
3.29 + "${extra_config[@]}" \
3.30 ${CT_ARCH_WITH_FLOAT} \
3.31 ${CT_BINUTILS_EXTRA_CONFIG} \
3.32 ${BINUTILS_SYSROOT_ARG}
3.33 @@ -70,18 +72,27 @@
3.34
3.35 # Now on for the target libraries
3.36 do_binutils_target() {
3.37 - targets=
3.38 - [ "${CT_BINUTILS_FOR_TARGET_IBERTY}" = "y" ] && targets="${targets} libiberty"
3.39 - [ "${CT_BINUTILS_FOR_TARGET_BFD}" = "y" ] && targets="${targets} bfd"
3.40 - targets="${targets# }"
3.41 + local -a extra_config
3.42 + local -a targets
3.43 + local -a build_targets
3.44 + local -a install_targets
3.45 + local t
3.46
3.47 - binutils_opts=
3.48 + [ "${CT_BINUTILS_FOR_TARGET_IBERTY}" = "y" ] && targets+=("libiberty")
3.49 + [ "${CT_BINUTILS_FOR_TARGET_BFD}" = "y" ] && targets+=("bfd")
3.50 + for t in "${targets[@]}"; do
3.51 + build_targets+=("all-${t}")
3.52 + install_targets+=("install-${t}")
3.53 + done
3.54 +
3.55 +
3.56 # If GMP and MPFR were configured, then use that
3.57 if [ "${CT_GMP_MPFR_TARGET}" = "y" ]; then
3.58 - binutils_opts="--with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
3.59 + extra_config+=("--with-gmp=${CT_SYSROOT_DIR}/usr")
3.60 + extra_config+=("--with-mpfr=${CT_SYSROOT_DIR}/usr")
3.61 fi
3.62
3.63 - if [ -n "${targets}" ]; then
3.64 + if [ "${#targets[@]}" -ne 0 ]; then
3.65 CT_DoStep INFO "Installing binutils for target"
3.66 mkdir -p "${CT_BUILD_DIR}/build-binutils-for-target"
3.67 CT_Pushd "${CT_BUILD_DIR}/build-binutils-for-target"
3.68 @@ -98,17 +109,14 @@
3.69 --enable-static \
3.70 --disable-nls \
3.71 --disable-multilib \
3.72 - ${binutils_opts} \
3.73 + "${extra_config[@]}" \
3.74 ${CT_ARCH_WITH_FLOAT} \
3.75 ${CT_BINUTILS_EXTRA_CONFIG}
3.76
3.77 - build_targets=$(echo "${targets}" |sed -r -e 's/(^| +)/\1all-/g;')
3.78 - install_targets=$(echo "${targets}" |sed -r -e 's/(^| +)/\1install-/g;')
3.79 -
3.80 - CT_DoLog EXTRA "Building binutils' libraries (${targets}) for target"
3.81 - CT_DoExecLog ALL make ${PARALLELMFLAGS} ${build_targets}
3.82 - CT_DoLog EXTRA "Installing binutils' libraries (${targets}) for target"
3.83 - CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" ${install_targets}
3.84 + CT_DoLog EXTRA "Building binutils' libraries (${targets[*]}) for target"
3.85 + CT_DoExecLog ALL make ${PARALLELMFLAGS} "${build_targets[@]}"
3.86 + CT_DoLog EXTRA "Installing binutils' libraries (${targets[*]}) for target"
3.87 + CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" "${install_targets[@]}"
3.88
3.89 CT_Popd
3.90 CT_EndStep
4.1 --- a/scripts/build/cc/gcc.sh Tue Jul 21 01:05:59 2009 +0200
4.2 +++ b/scripts/build/cc/gcc.sh Wed Aug 19 19:52:04 2009 +0200
4.3 @@ -92,8 +92,9 @@
4.4 local mode
4.5 local build_libgcc
4.6 local core_prefix_dir
4.7 - local extra_config
4.8 local lang_opt
4.9 + local tmp
4.10 + local -a extra_config
4.11
4.12 eval $1
4.13 eval $2
4.14 @@ -110,17 +111,21 @@
4.15 case "${mode}" in
4.16 static)
4.17 core_prefix_dir="${CT_CC_CORE_STATIC_PREFIX_DIR}"
4.18 - extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
4.19 + extra_config+=("--with-newlib")
4.20 + extra_config+=("--enable-threads=no")
4.21 + extra_config+=("--disable-shared")
4.22 copy_headers=y
4.23 ;;
4.24 shared)
4.25 core_prefix_dir="${CT_CC_CORE_SHARED_PREFIX_DIR}"
4.26 - extra_config="${extra_config} --enable-shared"
4.27 + extra_config+=("--enable-shared")
4.28 copy_headers=y
4.29 ;;
4.30 baremetal)
4.31 core_prefix_dir="${CT_PREFIX_DIR}"
4.32 - extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
4.33 + extra_config+=("--with-newlib")
4.34 + extra_config+=("--enable-threads=no")
4.35 + extra_config+=("--disable-shared")
4.36 [ "${CT_CC_LANG_CXX}" = "y" ] && lang_opt="${lang_opt},c++"
4.37 copy_headers=n
4.38 ;;
4.39 @@ -134,28 +139,28 @@
4.40
4.41 CT_DoLog EXTRA "Configuring ${mode} core C compiler"
4.42
4.43 - extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
4.44 - extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
4.45 - extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
4.46 - extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
4.47 - extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
4.48 - extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
4.49 + for tmp in ARCH ABI CPU TUNE FPU FLOAT; do
4.50 + eval tmp="\${CT_ARCH_WITH_${tmp}}"
4.51 + if [ -n "${tmp}" ]; then
4.52 + extra_config+=("${tmp}")
4.53 + fi
4.54 + done
4.55 if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
4.56 - extra_config="${extra_config} --enable-__cxa_atexit"
4.57 + extra_config+=("--enable-__cxa_atexit")
4.58 else
4.59 - extra_config="${extra_config} --disable-__cxa_atexit"
4.60 + extra_config+=("--disable-__cxa_atexit")
4.61 fi
4.62 if [ "${CT_GMP_MPFR}" = "y" ]; then
4.63 - extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR}"
4.64 - extra_config="${extra_config} --with-mpfr=${CT_PREFIX_DIR}"
4.65 + extra_config+=("--with-gmp=${CT_PREFIX_DIR}")
4.66 + extra_config+=("--with-mpfr=${CT_PREFIX_DIR}")
4.67 fi
4.68 if [ "${CT_PPL_CLOOG_MPC}" = "y" ]; then
4.69 - extra_config="${extra_config} --with-ppl=${CT_PREFIX_DIR}"
4.70 - extra_config="${extra_config} --with-cloog=${CT_PREFIX_DIR}"
4.71 - extra_config="${extra_config} --with-mpc=${CT_PREFIX_DIR}"
4.72 + extra_config+=("--with-ppl=${CT_PREFIX_DIR}")
4.73 + extra_config+=("--with-cloog=${CT_PREFIX_DIR}")
4.74 + extra_config+=("--with-mpc=${CT_PREFIX_DIR}")
4.75 fi
4.76
4.77 - CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
4.78 + CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
4.79
4.80 # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
4.81 CC_FOR_BUILD="${CT_BUILD}-gcc" \
4.82 @@ -169,7 +174,7 @@
4.83 --with-local-prefix="${CT_SYSROOT_DIR}" \
4.84 --disable-multilib \
4.85 ${CC_CORE_SYSROOT_ARG} \
4.86 - ${extra_config} \
4.87 + "${extra_config[@]}" \
4.88 --disable-nls \
4.89 --enable-symvers=gnu \
4.90 --enable-languages="${lang_opt}" \
4.91 @@ -249,6 +254,9 @@
4.92 #------------------------------------------------------------------------------
4.93 # Build final gcc
4.94 do_cc() {
4.95 + local -a extra_config
4.96 + local tmp
4.97 +
4.98 # If building for bare metal, nothing to be done here, the static core conpiler is enough!
4.99 [ "${CT_BARE_METAL}" = "y" ] && return 0
4.100
4.101 @@ -273,35 +281,39 @@
4.102 CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
4.103 lang_opt=$(echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;')
4.104
4.105 - extra_config="--enable-languages=${lang_opt}"
4.106 - extra_config="${extra_config} --disable-multilib"
4.107 - extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
4.108 - extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
4.109 - extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
4.110 - extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
4.111 - extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
4.112 - extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
4.113 - [ "${CT_SHARED_LIBS}" = "y" ] || extra_config="${extra_config} --disable-shared"
4.114 - [ -n "${CT_CC_PKGVERSION}" ] && extra_config="${extra_config} --with-pkgversion=${CT_CC_PKGVERSION}"
4.115 - [ -n "${CT_CC_BUGURL}" ] && extra_config="${extra_config} --with-bugurl=${CT_CC_BUGURL}"
4.116 - [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ] && extra_config="${extra_config} --enable-sjlj-exceptions"
4.117 - [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ] && extra_config="${extra_config} --disable-sjlj-exceptions"
4.118 + extra_config+=("--enable-languages=${lang_opt}")
4.119 + extra_config+=("--disable-multilib")
4.120 + for tmp in ARCH ABI CPU TUNE FPU FLOAT; do
4.121 + eval tmp="\${CT_ARCH_WITH_${tmp}}"
4.122 + if [ -n "${tmp}" ]; then
4.123 + extra_config+=("${tmp}")
4.124 + fi
4.125 + done
4.126 +
4.127 + [ "${CT_SHARED_LIBS}" = "y" ] || extra_config+=("--disable-shared")
4.128 + [ -n "${CT_CC_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_CC_PKGVERSION}")
4.129 + [ -n "${CT_CC_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_CC_BUGURL}")
4.130 + [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ] && extra_config+=("--enable-sjlj-exceptions")
4.131 + [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ] && extra_config+=("--disable-sjlj-exceptions")
4.132 if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
4.133 - extra_config="${extra_config} --enable-__cxa_atexit"
4.134 + extra_config+=("--enable-__cxa_atexit")
4.135 else
4.136 - extra_config="${extra_config} --disable-__cxa_atexit"
4.137 + extra_config+=("--disable-__cxa_atexit")
4.138 fi
4.139 if [ "${CT_GMP_MPFR}" = "y" ]; then
4.140 - extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR}"
4.141 - extra_config="${extra_config} --with-mpfr=${CT_PREFIX_DIR}"
4.142 + extra_config+=("--with-gmp=${CT_PREFIX_DIR}")
4.143 + extra_config+=("--with-mpfr=${CT_PREFIX_DIR}")
4.144 fi
4.145 if [ "${CT_PPL_CLOOG_MPC}" = "y" ]; then
4.146 - extra_config="${extra_config} --with-ppl=${CT_PREFIX_DIR}"
4.147 - extra_config="${extra_config} --with-cloog=${CT_PREFIX_DIR}"
4.148 - extra_config="${extra_config} --with-mpc=${CT_PREFIX_DIR}"
4.149 + extra_config+=("--with-ppl=${CT_PREFIX_DIR}")
4.150 + extra_config+=("--with-cloog=${CT_PREFIX_DIR}")
4.151 + extra_config+=("--with-mpc=${CT_PREFIX_DIR}")
4.152 + fi
4.153 + if [ -n "${CC_ENABLE_CXX_FLAGS}" ]; then
4.154 + extra_config+=("--enable-cxx-flags=${CC_ENABLE_CXX_FLAGS}")
4.155 fi
4.156
4.157 - CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
4.158 + CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
4.159
4.160 # --enable-symvers=gnu really only needed for sh4 to work around a
4.161 # detection problem only matters for gcc-3.2.x and later, I think.
4.162 @@ -319,7 +331,7 @@
4.163 --target=${CT_TARGET} \
4.164 --prefix="${CT_PREFIX_DIR}" \
4.165 ${CC_SYSROOT_ARG} \
4.166 - ${extra_config} \
4.167 + "${extra_config[@]}" \
4.168 --with-local-prefix="${CT_SYSROOT_DIR}" \
4.169 --disable-nls \
4.170 --enable-threads=posix \
5.1 --- a/scripts/build/debug/100-dmalloc.sh Tue Jul 21 01:05:59 2009 +0200
5.2 +++ b/scripts/build/debug/100-dmalloc.sh Wed Aug 19 19:52:04 2009 +0200
5.3 @@ -10,27 +10,28 @@
5.4 }
5.5
5.6 do_debug_dmalloc_build() {
5.7 + local -a extra_config
5.8 +
5.9 CT_DoStep INFO "Installing dmalloc"
5.10 CT_DoLog EXTRA "Configuring dmalloc"
5.11
5.12 mkdir -p "${CT_BUILD_DIR}/build-dmalloc"
5.13 cd "${CT_BUILD_DIR}/build-dmalloc"
5.14
5.15 - extra_config=
5.16 case "${CT_CC_LANG_CXX}" in
5.17 - y) extra_config="${extra_config} --enable-cxx";;
5.18 - *) extra_config="${extra_config} --disable-cxx";;
5.19 + y) extra_config+=("--enable-cxx");;
5.20 + *) extra_config+=("--disable-cxx");;
5.21 esac
5.22 case "${CT_THREADS_NONE}" in
5.23 - y) extra_config="${extra_config} --disable-threads";;
5.24 - *) extra_config="${extra_config} --enable-threads";;
5.25 + y) extra_config+=("--disable-threads");;
5.26 + *) extra_config+=("--enable-threads");;
5.27 esac
5.28 case "${CT_SHARED_LIBS}" in
5.29 - y) extra_config="${extra_config} --enable-shlib";;
5.30 - *) extra_config="${extra_config} --disable-shlib";;
5.31 + y) extra_config+=("--enable-shlib");;
5.32 + *) extra_config+=("--disable-shlib");;
5.33 esac
5.34
5.35 - CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
5.36 + CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
5.37
5.38 LD="${CT_TARGET}-ld" \
5.39 AR="${CT_TARGET}-ar" \
5.40 @@ -40,7 +41,7 @@
5.41 --prefix=/usr \
5.42 --build="${CT_BUILD}" \
5.43 --host="${CT_TARGET}" \
5.44 - ${extra_config}
5.45 + "${extra_config[@]}"
5.46
5.47 CT_DoLog EXTRA "Building dmalloc"
5.48 CT_DoExecLog ALL make
6.1 --- a/scripts/build/debug/300-gdb.sh Tue Jul 21 01:05:59 2009 +0200
6.2 +++ b/scripts/build/debug/300-gdb.sh Wed Aug 19 19:52:04 2009 +0200
6.3 @@ -73,29 +73,32 @@
6.4 }
6.5
6.6 do_debug_gdb_build() {
6.7 + local -a extra_config
6.8 +
6.9 gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
6.10 insight_src_dir="${CT_SRC_DIR}/insight-${CT_GDB_VERSION}"
6.11
6.12 - extra_config=
6.13 # Version 6.3 and below behave badly with gdbmi
6.14 case "${CT_GDB_VERSION}" in
6.15 - 6.2*|6.3) extra_config="${extra_config} --disable-gdbmi";;
6.16 + 6.2*|6.3) extra_config+=("--disable-gdbmi");;
6.17 esac
6.18
6.19 if [ "${CT_GDB_CROSS}" = "y" ]; then
6.20 + local -a cross_extra_config
6.21 +
6.22 CT_DoStep INFO "Installing cross-gdb"
6.23 CT_DoLog EXTRA "Configuring cross-gdb"
6.24
6.25 mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
6.26 cd "${CT_BUILD_DIR}/build-gdb-cross"
6.27
6.28 - cross_extra_config="${extra_config}"
6.29 + cross_extra_config=("${extra_config[@]}")
6.30 if [ "${CT_GMP_MPFR}" = "y" ]; then
6.31 - cross_extra_config="${cross_extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
6.32 + cross_extra_config+=("--with-gmp=${CT_PREFIX_DIR}" "--with-mpfr=${CT_PREFIX_DIR}")
6.33 fi
6.34 case "${CT_THREADS}" in
6.35 - none) cross_extra_config="${cross_extra_config} --disable-threads";;
6.36 - *) cross_extra_config="${cross_extra_config} --enable-threads";;
6.37 + none) cross_extra_config+=("--disable-threads");;
6.38 + *) cross_extra_config+=("--enable-threads");;
6.39 esac
6.40
6.41 CC_for_gdb=
6.42 @@ -108,7 +111,7 @@
6.43 gdb_cross_configure="${gdb_src_dir}/configure"
6.44 [ "${CT_GDB_CROSS_INSIGHT}" = "y" ] && gdb_cross_configure="${insight_src_dir}/configure"
6.45
6.46 - CT_DoLog DEBUG "Extra config passed: '${cross_extra_config# }'"
6.47 + CT_DoLog DEBUG "Extra config passed: '${cross_extra_config[*]}'"
6.48
6.49 CC="${CC_for_gdb}" \
6.50 LD="${LD_for_gdb}" \
6.51 @@ -120,7 +123,7 @@
6.52 --prefix="${CT_PREFIX_DIR}" \
6.53 --with-build-sysroot="${CT_SYSROOT_DIR}" \
6.54 --disable-werror \
6.55 - ${cross_extra_config}
6.56 + "${cross_extra_config[@]}"
6.57
6.58 CT_DoLog EXTRA "Building cross-gdb"
6.59 CT_DoExecLog ALL make ${PARALLELMFLAGS}
6.60 @@ -132,13 +135,15 @@
6.61 fi
6.62
6.63 if [ "${CT_GDB_NATIVE}" = "y" ]; then
6.64 + local -a native_extra_config
6.65 + local -a ncurses_opt
6.66 +
6.67 CT_DoStep INFO "Installing native gdb"
6.68
6.69 CT_DoStep INFO "Installing ncurses library"
6.70
6.71 - ncurses_opts=
6.72 - [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts="${ncurses_opts} --without-cxx --without-cxx-binding"
6.73 - [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts="${ncurses_opts} --without-ada"
6.74 + [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts+=("--without-cxx" "--without-cxx-binding")
6.75 + [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts+=("--without-ada")
6.76
6.77 CT_DoStep INFO "Installing native ncurses tic"
6.78 CT_DoLog EXTRA "Configuring ncurses tic"
6.79 @@ -158,7 +163,7 @@
6.80 --with-build-cc=${CT_REAL_BUILD}-gcc \
6.81 --with-build-cpp=${CT_REAL_BUILD}-gcc \
6.82 --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
6.83 - ${ncurses_opts}
6.84 + "${ncurses_opts[@]}"
6.85
6.86 # Under some operating systems (eg. Winblows), there is an
6.87 # extension appended to executables. Find that.
6.88 @@ -190,7 +195,7 @@
6.89 --without-sysmouse \
6.90 --without-progs \
6.91 --enable-termcap \
6.92 - ${ncurses_opts}
6.93 + "${ncurses_opts[@]}"
6.94
6.95 CT_DoLog EXTRA "Building ncurses"
6.96 CT_DoExecLog ALL make ${PARALLELMFLAGS}
6.97 @@ -209,13 +214,13 @@
6.98 mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
6.99 cd "${CT_BUILD_DIR}/build-gdb-native"
6.100
6.101 - native_extra_config="${extra_config}"
6.102 + native_extra_config=("${extra_config[@]}")
6.103 case "${CT_THREADS}" in
6.104 - none) native_extra_config="${native_extra_config} --disable-threads";;
6.105 - *) native_extra_config="${native_extra_config} --enable-threads";;
6.106 + none) native_extra_config+=("--disable-threads");;
6.107 + *) native_extra_config+=("--enable-threads");;
6.108 esac
6.109 if [ "${CT_GDB_NATIVE_USE_GMP_MPFR}" = "y" ]; then
6.110 - native_extra_config="${native_extra_config} --with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
6.111 + native_extra_config+=("--with-gmp=${CT_SYSROOT_DIR}/usr" "--with-mpfr=${CT_SYSROOT_DIR}/usr")
6.112 fi
6.113
6.114 if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
6.115 @@ -228,7 +233,7 @@
6.116
6.117 export ac_cv_func_strncmp_works=yes
6.118
6.119 - CT_DoLog DEBUG "Extra config passed: '${native_extra_config# }'"
6.120 + CT_DoLog DEBUG "Extra config passed: '${native_extra_config[*]}'"
6.121
6.122 CC="${CC_for_gdb}" \
6.123 LD="${LD_for_gdb}" \
6.124 @@ -247,7 +252,7 @@
6.125 --disable-werror \
6.126 --without-included-gettext \
6.127 --without-develop \
6.128 - ${native_extra_config}
6.129 + "${native_extra_config[@]}"
6.130
6.131 CT_DoLog EXTRA "Building native gdb"
6.132 CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
6.133 @@ -264,6 +269,8 @@
6.134 fi
6.135
6.136 if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
6.137 + local -a gdbserver_extra_config
6.138 +
6.139 CT_DoStep INFO "Installing gdbserver"
6.140 CT_DoLog EXTRA "Configuring gdbserver"
6.141
6.142 @@ -280,7 +287,7 @@
6.143 gdbserver_LDFLAGS=-static
6.144 fi
6.145
6.146 - gdbserver_extra_config="${extra_config}"
6.147 + gdbserver_extra_config=("${extra_config[@]}")
6.148
6.149 LDFLAGS="${gdbserver_LDFLAGS}" \
6.150 CT_DoExecLog ALL \
6.151 @@ -301,7 +308,7 @@
6.152 --without-included-gettext \
6.153 --without-develop \
6.154 --disable-werror \
6.155 - ${gdbserver_extra_config}
6.156 + "${gdbserver_extra_config[@]}"
6.157
6.158 CT_DoLog EXTRA "Building gdbserver"
6.159 CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
7.1 --- a/scripts/build/libc/eglibc.sh Tue Jul 21 01:05:59 2009 +0200
7.2 +++ b/scripts/build/libc/eglibc.sh Wed Aug 19 19:52:04 2009 +0200
7.3 @@ -41,19 +41,21 @@
7.4 eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
7.5
7.6 # Check if every tarballs are already present
7.7 - if [ -a "${CT_TARBALLS_DIR}/${eglibc}" ] && \
7.8 - [ -a "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
7.9 - [ -a "${CT_TARBALLS_DIR}/${eglibc_localedef}" ] && \
7.10 - [ -a "${CT_TARBALLS_DIR}/${eglibc_ports}" ]; then
7.11 + if [ -f "${CT_TARBALLS_DIR}/${eglibc}" \
7.12 + -a -f "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" \
7.13 + -a -f "${CT_TARBALLS_DIR}/${eglibc_localedef}" \
7.14 + -a -f "${CT_TARBALLS_DIR}/${eglibc_ports}" \
7.15 + ]; then
7.16 CT_DoLog DEBUG "Already have 'eglibc-${CT_LIBC_VERSION}'"
7.17 return 0
7.18 fi
7.19
7.20 - if [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" ] && \
7.21 - [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
7.22 - [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" ] && \
7.23 - [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" ] && \
7.24 - [ "${CT_FORCE_DOWNLOAD}" != "y" ]; then
7.25 + if [ -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" \
7.26 + -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" \
7.27 + -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" \
7.28 + -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" \
7.29 + "${CT_FORCE_DOWNLOAD}" != "y" \
7.30 + ]; then
7.31 CT_DoLog DEBUG "Got 'eglibc-${CT_LIBC_VERSION}' from local storage"
7.32 for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
7.33 CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
7.34 @@ -199,6 +201,8 @@
7.35
7.36 # This function builds and install the full glibc
7.37 do_libc() {
7.38 + local -a extra_config
7.39 +
7.40 CT_DoStep INFO "Installing C library"
7.41
7.42 mkdir -p "${CT_BUILD_DIR}/build-libc"
7.43 @@ -210,32 +214,32 @@
7.44 # We don't need to be conditional on wether the user did set different
7.45 # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
7.46
7.47 - extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
7.48 + extra_config+=("--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')")
7.49
7.50 case "${CT_THREADS}" in
7.51 - nptl) extra_config="${extra_config} --with-__thread --with-tls";;
7.52 - linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
7.53 - none) extra_config="${extra_config} --without-__thread --without-nptl"
7.54 + nptl) extra_config+=("--with-__thread" "--with-tls");;
7.55 + linuxthreads) extra_config+=("--with-__thread" "--without-tls" "--without-nptl");;
7.56 + none) extra_config+=("--without-__thread" "--without-nptl")
7.57 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
7.58 *-tls*) ;;
7.59 - *) extra_config="${extra_config} --without-tls";;
7.60 + *) extra_config+=("--without-tls");;
7.61 esac
7.62 ;;
7.63 esac
7.64
7.65 case "${CT_SHARED_LIBS}" in
7.66 - y) extra_config="${extra_config} --enable-shared";;
7.67 - *) extra_config="${extra_config} --disable-shared";;
7.68 + y) extra_config+=("--enable-shared");;
7.69 + *) extra_config+=("--disable-shared");;
7.70 esac
7.71
7.72 case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
7.73 - y,) extra_config="${extra_config} --with-fp";;
7.74 - ,y) extra_config="${extra_config} --without-fp";;
7.75 + y,) extra_config+=("--with-fp");;
7.76 + ,y) extra_config+=("--without-fp");;
7.77 esac
7.78
7.79 case "$(do_libc_add_ons_list ,)" in
7.80 "") ;;
7.81 - *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
7.82 + *) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
7.83 esac
7.84
7.85 extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
7.86 @@ -244,7 +248,7 @@
7.87
7.88 CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
7.89 CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
7.90 - CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
7.91 + CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
7.92 CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
7.93
7.94 BUILD_CC="${CT_BUILD}-gcc" \
7.95 @@ -261,7 +265,7 @@
7.96 --disable-profile \
7.97 --without-gd \
7.98 --without-cvs \
7.99 - ${extra_config} \
7.100 + "${extra_config[@]}" \
7.101 ${CT_LIBC_GLIBC_EXTRA_CONFIG}
7.102
7.103 CT_DoLog EXTRA "Building C library"
8.1 --- a/scripts/build/libc/glibc.sh Tue Jul 21 01:05:59 2009 +0200
8.2 +++ b/scripts/build/libc/glibc.sh Wed Aug 19 19:52:04 2009 +0200
8.3 @@ -6,6 +6,9 @@
8.4 do_libc_get() {
8.5 local date
8.6 local version
8.7 + local -a addons_list
8.8 +
8.9 + addons_list=($(do_libc_add_ons_list " "))
8.10
8.11 if [ "${CT_LIBC_GLIBC_TARBALL}" = "y" ]; then
8.12 # Use release tarballs
8.13 @@ -15,7 +18,7 @@
8.14 ftp://gcc.gnu.org/pub/glibc/snapshots
8.15
8.16 # C library addons
8.17 - for addon in $(do_libc_add_ons_list " "); do
8.18 + for addon in "${addons_list[@]}"; do
8.19 # NPTL addon is not to be downloaded, in any case
8.20 [ "${addon}" = "nptl" ] && continue || true
8.21 CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \
8.22 @@ -35,7 +38,7 @@
8.23 "glibc-cvs-${CT_LIBC_VERSION}"
8.24
8.25 # C library addons
8.26 - for addon in $(do_libc_add_ons_list " "); do
8.27 + for addon in "${addons_list[@]}"; do
8.28 # NPTL addon is not to be downloaded, in any case
8.29 [ "${addon}" = "nptl" ] && continue || true
8.30 CT_GetCVS "glibc-${addon}-cvs-${CT_LIBC_VERSION}" \
8.31 @@ -54,6 +57,9 @@
8.32 # Extract glibc
8.33 do_libc_extract() {
8.34 local cvs
8.35 + local -a addons_list
8.36 +
8.37 + addons_list=($(do_libc_add_ons_list " "))
8.38
8.39 [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
8.40
8.41 @@ -63,7 +69,7 @@
8.42 CT_Patch "glibc-${CT_LIBC_VERSION}" nochdir
8.43
8.44 # C library addons
8.45 - for addon in $(do_libc_add_ons_list " "); do
8.46 + for addon in "${addons_list[@]}"; do
8.47 # NPTL addon is not to be extracted, in any case
8.48 [ "${addon}" = "nptl" ] && continue || true
8.49 CT_Extract "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" nochdir
8.50 @@ -82,6 +88,7 @@
8.51 # The configure files may be older than the configure.in files
8.52 # if using a snapshot (or even some tarballs). Fake them being
8.53 # up to date.
8.54 + sleep 2
8.55 find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
8.56
8.57 CT_Popd
8.58 @@ -97,6 +104,7 @@
8.59 # This function installs the glibc headers needed to build the core compiler
8.60 do_libc_headers() {
8.61 local cvs
8.62 + local -a extra_config
8.63
8.64 CT_DoStep INFO "Installing C library headers"
8.65
8.66 @@ -123,21 +131,23 @@
8.67 # Override libc_cv_ppc_machine so glibc-cvs doesn't complain
8.68 # 'a version of binutils that supports .machine "altivec" is needed'.
8.69
8.70 - addons_list="$(do_libc_add_ons_list ,)"
8.71 # We need to remove any threading addon when installing headers
8.72 - addons_list="${addons_list//nptl/}"
8.73 - addons_list="${addons_list//linuxthreads/}"
8.74 - # Remove duplicate, leading and trailing separators
8.75 - addons_config="--enable-add-ons=$(echo "${addons_list}" |sed -r -e 's/,+/,/; s/^,//; s/,$//g;')"
8.76 + addons_list="$(do_libc_add_ons_list " " \
8.77 + |sed -r -e 's/\<(nptl|linuxthreads)\>/ /g;' \
8.78 + -e 's/ +/,/g; s/^,+//; s/,+$//;' \
8.79 + )"
8.80
8.81 - extra_config="${addons_config} $(do_libc_min_kernel_config)"
8.82 + extra_config+=("--enable-add-ons=${addons_list}")
8.83 +
8.84 + extra_config+=("${addons_config}")
8.85 + extra_config+=("$(do_libc_min_kernel_config)")
8.86
8.87 # Pre-seed the configparms file with values from the config option
8.88 echo "${CT_LIBC_GLIBC_CONFIGPARMS}" > configparms
8.89
8.90 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
8.91 CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
8.92 - CT_DoLog DEBUG "Extra config passed : '${extra_config}'"
8.93 + CT_DoLog DEBUG "Extra config passed : '${extra_config[*]}'"
8.94
8.95 libc_cv_ppc_machine=yes \
8.96 CC=${cross_cc} \
8.97 @@ -150,7 +160,7 @@
8.98 --without-cvs \
8.99 --disable-sanity-checks \
8.100 --enable-hacker-mode \
8.101 - ${extra_config} \
8.102 + "${extra_config[@]}" \
8.103 --without-nptl
8.104
8.105 CT_DoLog EXTRA "Installing C library headers"
8.106 @@ -246,6 +256,7 @@
8.107 # Build and install start files
8.108 do_libc_start_files() {
8.109 local cvs
8.110 + local -a extra_config
8.111
8.112 # Needed only in the NPTL case. Otherwise, return.
8.113 [ "${CT_THREADS}" = "nptl" ] || return 0
8.114 @@ -260,26 +271,25 @@
8.115 CT_DoLog EXTRA "Configuring C library"
8.116
8.117 # Add some default glibc config options if not given by user.
8.118 - extra_config=
8.119 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
8.120 *-tls*) ;;
8.121 - *) extra_config="${extra_config} --with-tls"
8.122 + *) extra_config+=("--with-tls")
8.123 esac
8.124 case "${CT_SHARED_LIBS}" in
8.125 - y) extra_config="${extra_config} --enable-shared";;
8.126 - *) extra_config="${extra_config} --disable-shared";;
8.127 + y) extra_config+=("--enable-shared");;
8.128 + *) extra_config+=("--disable-shared");;
8.129 esac
8.130 case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
8.131 - y,) extra_config="${extra_config} --with-fp";;
8.132 - ,y) extra_config="${extra_config} --without-fp";;
8.133 + y,) extra_config+=("--with-fp");;
8.134 + ,y) extra_config+=("--without-fp");;
8.135 esac
8.136 # Obviously, we want threads, as we come here only for NPTL
8.137 - extra_config="${extra_config} --with-__thread"
8.138 + extra_config+=("--with-__thread")
8.139
8.140 addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
8.141 - extra_config="${extra_config} ${addons_config}"
8.142 + extra_config+=("${addons_config}")
8.143
8.144 - extra_config="${extra_config} $(do_libc_min_kernel_config)"
8.145 + extra_config+=("$(do_libc_min_kernel_config)")
8.146
8.147 # Add some default CC args
8.148 glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([[:digit:]]+).*/\1/')
8.149 @@ -303,7 +313,7 @@
8.150 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
8.151 CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
8.152 CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
8.153 - CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
8.154 + CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
8.155 CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
8.156
8.157 # Pre-seed the configparms file with values from the config option
8.158 @@ -330,7 +340,7 @@
8.159 --without-gd \
8.160 --with-headers="${CT_HEADERS_DIR}" \
8.161 --cache-file=config.cache \
8.162 - ${extra_config} \
8.163 + "${extra_config[@]}" \
8.164 ${CT_LIBC_GLIBC_EXTRA_CONFIG}
8.165
8.166 #TODO: should check whether slibdir has been set in configparms to */lib64
8.167 @@ -353,6 +363,7 @@
8.168 # This function builds and install the full glibc
8.169 do_libc() {
8.170 local cvs
8.171 + local -a extra_config
8.172
8.173 CT_DoStep INFO "Installing C library"
8.174
8.175 @@ -367,34 +378,33 @@
8.176 # We don't need to be conditional on wether the user did set different
8.177 # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
8.178
8.179 - extra_config=
8.180 case "${CT_THREADS}" in
8.181 - nptl) extra_config="${extra_config} --with-__thread --with-tls";;
8.182 - linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
8.183 - none) extra_config="${extra_config} --without-__thread --without-nptl"
8.184 + nptl) extra_config+=("--with-__thread" "--with-tls");;
8.185 + linuxthreads) extra_config+=("--with-__thread" "--without-tls" "--without-nptl");;
8.186 + none) extra_config+=("--without-__thread" "--without-nptl")
8.187 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
8.188 *-tls*) ;;
8.189 - *) extra_config="${extra_config} --without-tls";;
8.190 + *) extra_config+=("--without-tls");;
8.191 esac
8.192 ;;
8.193 esac
8.194
8.195 case "${CT_SHARED_LIBS}" in
8.196 - y) extra_config="${extra_config} --enable-shared";;
8.197 - *) extra_config="${extra_config} --disable-shared";;
8.198 + y) extra_config+=("--enable-shared");;
8.199 + *) extra_config+=("--disable-shared");;
8.200 esac
8.201
8.202 case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
8.203 - y,) extra_config="${extra_config} --with-fp";;
8.204 - ,y) extra_config="${extra_config} --without-fp";;
8.205 + y,) extra_config+=("--with-fp";;
8.206 + ,y) extra_config+=("--without-fp";;
8.207 esac
8.208
8.209 case "$(do_libc_add_ons_list ,)" in
8.210 "") ;;
8.211 - *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
8.212 + *) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
8.213 esac
8.214
8.215 - extra_config="${extra_config} $(do_libc_min_kernel_config)"
8.216 + extra_config+=("$(do_libc_min_kernel_config)")
8.217
8.218 # Add some default CC args
8.219 glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([[:digit:]]+).*/\1/')
8.220 @@ -463,7 +473,7 @@
8.221 --disable-sanity-checks \
8.222 --cache-file=config.cache \
8.223 --with-headers="${CT_HEADERS_DIR}" \
8.224 - ${extra_config} \
8.225 + "${extra_config[@]}" \
8.226 ${CT_LIBC_GLIBC_EXTRA_CONFIG}
8.227
8.228 if grep -l '^install-lib-all:' "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/Makerules" > /dev/null; then