summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2009-08-19 17:52:04 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2009-08-19 17:52:04 (GMT)
commit4de6139e7ed8927c1d7c3f72f5efae697a3bd7ca (patch)
tree9bd09638b85d7ad2d3aaaf4b8d4f308b0f3433cf /scripts
parent9d1cbf2b4145a6ff0ac4834be3459320b35ee7a0 (diff)
parent83a48e12f08e375bddd42ca27eab4896234a42b8 (diff)
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.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/binutils/binutils.sh44
-rw-r--r--scripts/build/cc/gcc.sh94
-rw-r--r--scripts/build/debug/100-dmalloc.sh19
-rw-r--r--scripts/build/debug/300-gdb.sh49
-rw-r--r--scripts/build/libc/eglibc.sh46
-rw-r--r--scripts/build/libc/glibc.sh78
6 files changed, 186 insertions, 144 deletions
diff --git a/scripts/build/binutils/binutils.sh b/scripts/build/binutils/binutils.sh
index 17f04fb..ec9c409 100644
--- a/scripts/build/binutils/binutils.sh
+++ b/scripts/build/binutils/binutils.sh
@@ -17,16 +17,18 @@ do_binutils_extract() {
# Build binutils
do_binutils() {
+ local -a extra_config
+
mkdir -p "${CT_BUILD_DIR}/build-binutils"
cd "${CT_BUILD_DIR}/build-binutils"
CT_DoStep INFO "Installing binutils"
- binutils_opts=
# If GMP and MPFR were configured, then use that,
# otherwise let binutils find the system-wide libraries, if they exist.
if [ "${CT_GMP_MPFR}" = "y" ]; then
- binutils_opts="--with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
+ extra_config+=("--with-gmp=${CT_PREFIX_DIR}")
+ extra_config+=("--with-mpfr=${CT_PREFIX_DIR}")
fi
CT_DoLog EXTRA "Configuring binutils"
@@ -40,7 +42,7 @@ do_binutils() {
--disable-nls \
--disable-multilib \
--disable-werror \
- ${binutils_opts} \
+ "${extra_config[@]}" \
${CT_ARCH_WITH_FLOAT} \
${CT_BINUTILS_EXTRA_CONFIG} \
${BINUTILS_SYSROOT_ARG}
@@ -70,18 +72,27 @@ do_binutils() {
# Now on for the target libraries
do_binutils_target() {
- targets=
- [ "${CT_BINUTILS_FOR_TARGET_IBERTY}" = "y" ] && targets="${targets} libiberty"
- [ "${CT_BINUTILS_FOR_TARGET_BFD}" = "y" ] && targets="${targets} bfd"
- targets="${targets# }"
+ local -a extra_config
+ local -a targets
+ local -a build_targets
+ local -a install_targets
+ local t
+
+ [ "${CT_BINUTILS_FOR_TARGET_IBERTY}" = "y" ] && targets+=("libiberty")
+ [ "${CT_BINUTILS_FOR_TARGET_BFD}" = "y" ] && targets+=("bfd")
+ for t in "${targets[@]}"; do
+ build_targets+=("all-${t}")
+ install_targets+=("install-${t}")
+ done
+
- binutils_opts=
# If GMP and MPFR were configured, then use that
if [ "${CT_GMP_MPFR_TARGET}" = "y" ]; then
- binutils_opts="--with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
+ extra_config+=("--with-gmp=${CT_SYSROOT_DIR}/usr")
+ extra_config+=("--with-mpfr=${CT_SYSROOT_DIR}/usr")
fi
- if [ -n "${targets}" ]; then
+ if [ "${#targets[@]}" -ne 0 ]; then
CT_DoStep INFO "Installing binutils for target"
mkdir -p "${CT_BUILD_DIR}/build-binutils-for-target"
CT_Pushd "${CT_BUILD_DIR}/build-binutils-for-target"
@@ -98,17 +109,14 @@ do_binutils_target() {
--enable-static \
--disable-nls \
--disable-multilib \
- ${binutils_opts} \
+ "${extra_config[@]}" \
${CT_ARCH_WITH_FLOAT} \
${CT_BINUTILS_EXTRA_CONFIG}
- build_targets=$(echo "${targets}" |sed -r -e 's/(^| +)/\1all-/g;')
- install_targets=$(echo "${targets}" |sed -r -e 's/(^| +)/\1install-/g;')
-
- CT_DoLog EXTRA "Building binutils' libraries (${targets}) for target"
- CT_DoExecLog ALL make ${PARALLELMFLAGS} ${build_targets}
- CT_DoLog EXTRA "Installing binutils' libraries (${targets}) for target"
- CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" ${install_targets}
+ CT_DoLog EXTRA "Building binutils' libraries (${targets[*]}) for target"
+ CT_DoExecLog ALL make ${PARALLELMFLAGS} "${build_targets[@]}"
+ CT_DoLog EXTRA "Installing binutils' libraries (${targets[*]}) for target"
+ CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" "${install_targets[@]}"
CT_Popd
CT_EndStep
diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/gcc.sh
index e1f5d25..1737b44 100644
--- a/scripts/build/cc/gcc.sh
+++ b/scripts/build/cc/gcc.sh
@@ -92,8 +92,9 @@ do_cc_core() {
local mode
local build_libgcc
local core_prefix_dir
- local extra_config
local lang_opt
+ local tmp
+ local -a extra_config
eval $1
eval $2
@@ -110,17 +111,21 @@ do_cc_core() {
case "${mode}" in
static)
core_prefix_dir="${CT_CC_CORE_STATIC_PREFIX_DIR}"
- extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
+ extra_config+=("--with-newlib")
+ extra_config+=("--enable-threads=no")
+ extra_config+=("--disable-shared")
copy_headers=y
;;
shared)
core_prefix_dir="${CT_CC_CORE_SHARED_PREFIX_DIR}"
- extra_config="${extra_config} --enable-shared"
+ extra_config+=("--enable-shared")
copy_headers=y
;;
baremetal)
core_prefix_dir="${CT_PREFIX_DIR}"
- extra_config="${extra_config} --with-newlib --enable-threads=no --disable-shared"
+ extra_config+=("--with-newlib")
+ extra_config+=("--enable-threads=no")
+ extra_config+=("--disable-shared")
[ "${CT_CC_LANG_CXX}" = "y" ] && lang_opt="${lang_opt},c++"
copy_headers=n
;;
@@ -134,28 +139,28 @@ do_cc_core() {
CT_DoLog EXTRA "Configuring ${mode} core C compiler"
- extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
- extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
- extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
- extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
- extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
- extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
+ for tmp in ARCH ABI CPU TUNE FPU FLOAT; do
+ eval tmp="\${CT_ARCH_WITH_${tmp}}"
+ if [ -n "${tmp}" ]; then
+ extra_config+=("${tmp}")
+ fi
+ done
if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
- extra_config="${extra_config} --enable-__cxa_atexit"
+ extra_config+=("--enable-__cxa_atexit")
else
- extra_config="${extra_config} --disable-__cxa_atexit"
+ extra_config+=("--disable-__cxa_atexit")
fi
if [ "${CT_GMP_MPFR}" = "y" ]; then
- extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR}"
- extra_config="${extra_config} --with-mpfr=${CT_PREFIX_DIR}"
+ extra_config+=("--with-gmp=${CT_PREFIX_DIR}")
+ extra_config+=("--with-mpfr=${CT_PREFIX_DIR}")
fi
if [ "${CT_PPL_CLOOG_MPC}" = "y" ]; then
- extra_config="${extra_config} --with-ppl=${CT_PREFIX_DIR}"
- extra_config="${extra_config} --with-cloog=${CT_PREFIX_DIR}"
- extra_config="${extra_config} --with-mpc=${CT_PREFIX_DIR}"
+ extra_config+=("--with-ppl=${CT_PREFIX_DIR}")
+ extra_config+=("--with-cloog=${CT_PREFIX_DIR}")
+ extra_config+=("--with-mpc=${CT_PREFIX_DIR}")
fi
- CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
+ CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
# Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532)
CC_FOR_BUILD="${CT_BUILD}-gcc" \
@@ -169,7 +174,7 @@ do_cc_core() {
--with-local-prefix="${CT_SYSROOT_DIR}" \
--disable-multilib \
${CC_CORE_SYSROOT_ARG} \
- ${extra_config} \
+ "${extra_config[@]}" \
--disable-nls \
--enable-symvers=gnu \
--enable-languages="${lang_opt}" \
@@ -249,6 +254,9 @@ do_cc_core() {
#------------------------------------------------------------------------------
# Build final gcc
do_cc() {
+ local -a extra_config
+ local tmp
+
# If building for bare metal, nothing to be done here, the static core conpiler is enough!
[ "${CT_BARE_METAL}" = "y" ] && return 0
@@ -273,35 +281,39 @@ do_cc() {
CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
lang_opt=$(echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;')
- extra_config="--enable-languages=${lang_opt}"
- extra_config="${extra_config} --disable-multilib"
- extra_config="${extra_config} ${CT_ARCH_WITH_ARCH}"
- extra_config="${extra_config} ${CT_ARCH_WITH_ABI}"
- extra_config="${extra_config} ${CT_ARCH_WITH_CPU}"
- extra_config="${extra_config} ${CT_ARCH_WITH_TUNE}"
- extra_config="${extra_config} ${CT_ARCH_WITH_FPU}"
- extra_config="${extra_config} ${CT_ARCH_WITH_FLOAT}"
- [ "${CT_SHARED_LIBS}" = "y" ] || extra_config="${extra_config} --disable-shared"
- [ -n "${CT_CC_PKGVERSION}" ] && extra_config="${extra_config} --with-pkgversion=${CT_CC_PKGVERSION}"
- [ -n "${CT_CC_BUGURL}" ] && extra_config="${extra_config} --with-bugurl=${CT_CC_BUGURL}"
- [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ] && extra_config="${extra_config} --enable-sjlj-exceptions"
- [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ] && extra_config="${extra_config} --disable-sjlj-exceptions"
+ extra_config+=("--enable-languages=${lang_opt}")
+ extra_config+=("--disable-multilib")
+ for tmp in ARCH ABI CPU TUNE FPU FLOAT; do
+ eval tmp="\${CT_ARCH_WITH_${tmp}}"
+ if [ -n "${tmp}" ]; then
+ extra_config+=("${tmp}")
+ fi
+ done
+
+ [ "${CT_SHARED_LIBS}" = "y" ] || extra_config+=("--disable-shared")
+ [ -n "${CT_CC_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_CC_PKGVERSION}")
+ [ -n "${CT_CC_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_CC_BUGURL}")
+ [ "${CT_CC_SJLJ_EXCEPTIONS_USE}" = "y" ] && extra_config+=("--enable-sjlj-exceptions")
+ [ "${CT_CC_SJLJ_EXCEPTIONS_DONT_USE}" = "y" ] && extra_config+=("--disable-sjlj-exceptions")
if [ "${CT_CC_CXA_ATEXIT}" = "y" ]; then
- extra_config="${extra_config} --enable-__cxa_atexit"
+ extra_config+=("--enable-__cxa_atexit")
else
- extra_config="${extra_config} --disable-__cxa_atexit"
+ extra_config+=("--disable-__cxa_atexit")
fi
if [ "${CT_GMP_MPFR}" = "y" ]; then
- extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR}"
- extra_config="${extra_config} --with-mpfr=${CT_PREFIX_DIR}"
+ extra_config+=("--with-gmp=${CT_PREFIX_DIR}")
+ extra_config+=("--with-mpfr=${CT_PREFIX_DIR}")
fi
if [ "${CT_PPL_CLOOG_MPC}" = "y" ]; then
- extra_config="${extra_config} --with-ppl=${CT_PREFIX_DIR}"
- extra_config="${extra_config} --with-cloog=${CT_PREFIX_DIR}"
- extra_config="${extra_config} --with-mpc=${CT_PREFIX_DIR}"
+ extra_config+=("--with-ppl=${CT_PREFIX_DIR}")
+ extra_config+=("--with-cloog=${CT_PREFIX_DIR}")
+ extra_config+=("--with-mpc=${CT_PREFIX_DIR}")
+ fi
+ if [ -n "${CC_ENABLE_CXX_FLAGS}" ]; then
+ extra_config+=("--enable-cxx-flags=${CC_ENABLE_CXX_FLAGS}")
fi
- CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
+ CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
# --enable-symvers=gnu really only needed for sh4 to work around a
# detection problem only matters for gcc-3.2.x and later, I think.
@@ -319,7 +331,7 @@ do_cc() {
--target=${CT_TARGET} \
--prefix="${CT_PREFIX_DIR}" \
${CC_SYSROOT_ARG} \
- ${extra_config} \
+ "${extra_config[@]}" \
--with-local-prefix="${CT_SYSROOT_DIR}" \
--disable-nls \
--enable-threads=posix \
diff --git a/scripts/build/debug/100-dmalloc.sh b/scripts/build/debug/100-dmalloc.sh
index 2c5d80c..f95a36d 100644
--- a/scripts/build/debug/100-dmalloc.sh
+++ b/scripts/build/debug/100-dmalloc.sh
@@ -10,27 +10,28 @@ do_debug_dmalloc_extract() {
}
do_debug_dmalloc_build() {
+ local -a extra_config
+
CT_DoStep INFO "Installing dmalloc"
CT_DoLog EXTRA "Configuring dmalloc"
mkdir -p "${CT_BUILD_DIR}/build-dmalloc"
cd "${CT_BUILD_DIR}/build-dmalloc"
- extra_config=
case "${CT_CC_LANG_CXX}" in
- y) extra_config="${extra_config} --enable-cxx";;
- *) extra_config="${extra_config} --disable-cxx";;
+ y) extra_config+=("--enable-cxx");;
+ *) extra_config+=("--disable-cxx");;
esac
case "${CT_THREADS_NONE}" in
- y) extra_config="${extra_config} --disable-threads";;
- *) extra_config="${extra_config} --enable-threads";;
+ y) extra_config+=("--disable-threads");;
+ *) extra_config+=("--enable-threads");;
esac
case "${CT_SHARED_LIBS}" in
- y) extra_config="${extra_config} --enable-shlib";;
- *) extra_config="${extra_config} --disable-shlib";;
+ y) extra_config+=("--enable-shlib");;
+ *) extra_config+=("--disable-shlib");;
esac
- CT_DoLog DEBUG "Extra config passed: '${extra_config}'"
+ CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
LD="${CT_TARGET}-ld" \
AR="${CT_TARGET}-ar" \
@@ -40,7 +41,7 @@ do_debug_dmalloc_build() {
--prefix=/usr \
--build="${CT_BUILD}" \
--host="${CT_TARGET}" \
- ${extra_config}
+ "${extra_config[@]}"
CT_DoLog EXTRA "Building dmalloc"
CT_DoExecLog ALL make
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index dc3c777..9207ca7 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -73,29 +73,32 @@ do_debug_gdb_extract() {
}
do_debug_gdb_build() {
+ local -a extra_config
+
gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
insight_src_dir="${CT_SRC_DIR}/insight-${CT_GDB_VERSION}"
- extra_config=
# Version 6.3 and below behave badly with gdbmi
case "${CT_GDB_VERSION}" in
- 6.2*|6.3) extra_config="${extra_config} --disable-gdbmi";;
+ 6.2*|6.3) extra_config+=("--disable-gdbmi");;
esac
if [ "${CT_GDB_CROSS}" = "y" ]; then
+ local -a cross_extra_config
+
CT_DoStep INFO "Installing cross-gdb"
CT_DoLog EXTRA "Configuring cross-gdb"
mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
cd "${CT_BUILD_DIR}/build-gdb-cross"
- cross_extra_config="${extra_config}"
+ cross_extra_config=("${extra_config[@]}")
if [ "${CT_GMP_MPFR}" = "y" ]; then
- cross_extra_config="${cross_extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
+ cross_extra_config+=("--with-gmp=${CT_PREFIX_DIR}" "--with-mpfr=${CT_PREFIX_DIR}")
fi
case "${CT_THREADS}" in
- none) cross_extra_config="${cross_extra_config} --disable-threads";;
- *) cross_extra_config="${cross_extra_config} --enable-threads";;
+ none) cross_extra_config+=("--disable-threads");;
+ *) cross_extra_config+=("--enable-threads");;
esac
CC_for_gdb=
@@ -108,7 +111,7 @@ do_debug_gdb_build() {
gdb_cross_configure="${gdb_src_dir}/configure"
[ "${CT_GDB_CROSS_INSIGHT}" = "y" ] && gdb_cross_configure="${insight_src_dir}/configure"
- CT_DoLog DEBUG "Extra config passed: '${cross_extra_config# }'"
+ CT_DoLog DEBUG "Extra config passed: '${cross_extra_config[*]}'"
CC="${CC_for_gdb}" \
LD="${LD_for_gdb}" \
@@ -120,7 +123,7 @@ do_debug_gdb_build() {
--prefix="${CT_PREFIX_DIR}" \
--with-build-sysroot="${CT_SYSROOT_DIR}" \
--disable-werror \
- ${cross_extra_config}
+ "${cross_extra_config[@]}"
CT_DoLog EXTRA "Building cross-gdb"
CT_DoExecLog ALL make ${PARALLELMFLAGS}
@@ -132,13 +135,15 @@ do_debug_gdb_build() {
fi
if [ "${CT_GDB_NATIVE}" = "y" ]; then
+ local -a native_extra_config
+ local -a ncurses_opt
+
CT_DoStep INFO "Installing native gdb"
CT_DoStep INFO "Installing ncurses library"
- ncurses_opts=
- [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts="${ncurses_opts} --without-cxx --without-cxx-binding"
- [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts="${ncurses_opts} --without-ada"
+ [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts+=("--without-cxx" "--without-cxx-binding")
+ [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts+=("--without-ada")
CT_DoStep INFO "Installing native ncurses tic"
CT_DoLog EXTRA "Configuring ncurses tic"
@@ -158,7 +163,7 @@ do_debug_gdb_build() {
--with-build-cc=${CT_REAL_BUILD}-gcc \
--with-build-cpp=${CT_REAL_BUILD}-gcc \
--with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
- ${ncurses_opts}
+ "${ncurses_opts[@]}"
# Under some operating systems (eg. Winblows), there is an
# extension appended to executables. Find that.
@@ -190,7 +195,7 @@ do_debug_gdb_build() {
--without-sysmouse \
--without-progs \
--enable-termcap \
- ${ncurses_opts}
+ "${ncurses_opts[@]}"
CT_DoLog EXTRA "Building ncurses"
CT_DoExecLog ALL make ${PARALLELMFLAGS}
@@ -209,13 +214,13 @@ do_debug_gdb_build() {
mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
cd "${CT_BUILD_DIR}/build-gdb-native"
- native_extra_config="${extra_config}"
+ native_extra_config=("${extra_config[@]}")
case "${CT_THREADS}" in
- none) native_extra_config="${native_extra_config} --disable-threads";;
- *) native_extra_config="${native_extra_config} --enable-threads";;
+ none) native_extra_config+=("--disable-threads");;
+ *) native_extra_config+=("--enable-threads");;
esac
if [ "${CT_GDB_NATIVE_USE_GMP_MPFR}" = "y" ]; then
- native_extra_config="${native_extra_config} --with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
+ native_extra_config+=("--with-gmp=${CT_SYSROOT_DIR}/usr" "--with-mpfr=${CT_SYSROOT_DIR}/usr")
fi
if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
@@ -228,7 +233,7 @@ do_debug_gdb_build() {
export ac_cv_func_strncmp_works=yes
- CT_DoLog DEBUG "Extra config passed: '${native_extra_config# }'"
+ CT_DoLog DEBUG "Extra config passed: '${native_extra_config[*]}'"
CC="${CC_for_gdb}" \
LD="${LD_for_gdb}" \
@@ -247,7 +252,7 @@ do_debug_gdb_build() {
--disable-werror \
--without-included-gettext \
--without-develop \
- ${native_extra_config}
+ "${native_extra_config[@]}"
CT_DoLog EXTRA "Building native gdb"
CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
@@ -264,6 +269,8 @@ do_debug_gdb_build() {
fi
if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
+ local -a gdbserver_extra_config
+
CT_DoStep INFO "Installing gdbserver"
CT_DoLog EXTRA "Configuring gdbserver"
@@ -280,7 +287,7 @@ do_debug_gdb_build() {
gdbserver_LDFLAGS=-static
fi
- gdbserver_extra_config="${extra_config}"
+ gdbserver_extra_config=("${extra_config[@]}")
LDFLAGS="${gdbserver_LDFLAGS}" \
CT_DoExecLog ALL \
@@ -301,7 +308,7 @@ do_debug_gdb_build() {
--without-included-gettext \
--without-develop \
--disable-werror \
- ${gdbserver_extra_config}
+ "${gdbserver_extra_config[@]}"
CT_DoLog EXTRA "Building gdbserver"
CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
diff --git a/scripts/build/libc/eglibc.sh b/scripts/build/libc/eglibc.sh
index 18fac76..245cda8 100644
--- a/scripts/build/libc/eglibc.sh
+++ b/scripts/build/libc/eglibc.sh
@@ -41,19 +41,21 @@ do_libc_get() {
eglibc_ports="${CT_LIBC}-ports-${CT_LIBC_VERSION}.tar.bz2"
# Check if every tarballs are already present
- if [ -a "${CT_TARBALLS_DIR}/${eglibc}" ] && \
- [ -a "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
- [ -a "${CT_TARBALLS_DIR}/${eglibc_localedef}" ] && \
- [ -a "${CT_TARBALLS_DIR}/${eglibc_ports}" ]; then
+ if [ -f "${CT_TARBALLS_DIR}/${eglibc}" \
+ -a -f "${CT_TARBALLS_DIR}/${eglibc_linuxthreads}" \
+ -a -f "${CT_TARBALLS_DIR}/${eglibc_localedef}" \
+ -a -f "${CT_TARBALLS_DIR}/${eglibc_ports}" \
+ ]; then
CT_DoLog DEBUG "Already have 'eglibc-${CT_LIBC_VERSION}'"
return 0
fi
- if [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" ] && \
- [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" ] && \
- [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" ] && \
- [ -a "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" ] && \
- [ "${CT_FORCE_DOWNLOAD}" != "y" ]; then
+ if [ -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc}" \
+ -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_linuxthreads}" \
+ -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_localedef}" \
+ -a -f "${CT_LOCAL_TARBALLS_DIR}/${eglibc_ports}" \
+ "${CT_FORCE_DOWNLOAD}" != "y" \
+ ]; then
CT_DoLog DEBUG "Got 'eglibc-${CT_LIBC_VERSION}' from local storage"
for file in ${eglibc} ${eglibc_linuxthreads} ${eglibc_localedef} ${eglibc_ports}; do
CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${file}" "${CT_TARBALLS_DIR}/${file}"
@@ -199,6 +201,8 @@ do_libc_start_files() {
# This function builds and install the full glibc
do_libc() {
+ local -a extra_config
+
CT_DoStep INFO "Installing C library"
mkdir -p "${CT_BUILD_DIR}/build-libc"
@@ -210,32 +214,32 @@ do_libc() {
# We don't need to be conditional on wether the user did set different
# values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
- extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
+ extra_config+=("--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')")
case "${CT_THREADS}" in
- nptl) extra_config="${extra_config} --with-__thread --with-tls";;
- linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
- none) extra_config="${extra_config} --without-__thread --without-nptl"
+ nptl) extra_config+=("--with-__thread" "--with-tls");;
+ linuxthreads) extra_config+=("--with-__thread" "--without-tls" "--without-nptl");;
+ none) extra_config+=("--without-__thread" "--without-nptl")
case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
*-tls*) ;;
- *) extra_config="${extra_config} --without-tls";;
+ *) extra_config+=("--without-tls");;
esac
;;
esac
case "${CT_SHARED_LIBS}" in
- y) extra_config="${extra_config} --enable-shared";;
- *) extra_config="${extra_config} --disable-shared";;
+ y) extra_config+=("--enable-shared");;
+ *) extra_config+=("--disable-shared");;
esac
case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
- y,) extra_config="${extra_config} --with-fp";;
- ,y) extra_config="${extra_config} --without-fp";;
+ y,) extra_config+=("--with-fp");;
+ ,y) extra_config+=("--without-fp");;
esac
case "$(do_libc_add_ons_list ,)" in
"") ;;
- *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
+ *) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
esac
extra_cc_args="${extra_cc_args} ${CT_ARCH_ENDIAN_OPT}"
@@ -244,7 +248,7 @@ do_libc() {
CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
- CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
+ CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
BUILD_CC="${CT_BUILD}-gcc" \
@@ -261,7 +265,7 @@ do_libc() {
--disable-profile \
--without-gd \
--without-cvs \
- ${extra_config} \
+ "${extra_config[@]}" \
${CT_LIBC_GLIBC_EXTRA_CONFIG}
CT_DoLog EXTRA "Building C library"
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index 9af0135..43b20b3 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -6,6 +6,9 @@
do_libc_get() {
local date
local version
+ local -a addons_list
+
+ addons_list=($(do_libc_add_ons_list " "))
if [ "${CT_LIBC_GLIBC_TARBALL}" = "y" ]; then
# Use release tarballs
@@ -15,7 +18,7 @@ do_libc_get() {
ftp://gcc.gnu.org/pub/glibc/snapshots
# C library addons
- for addon in $(do_libc_add_ons_list " "); do
+ for addon in "${addons_list[@]}"; do
# NPTL addon is not to be downloaded, in any case
[ "${addon}" = "nptl" ] && continue || true
CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \
@@ -35,7 +38,7 @@ do_libc_get() {
"glibc-cvs-${CT_LIBC_VERSION}"
# C library addons
- for addon in $(do_libc_add_ons_list " "); do
+ for addon in "${addons_list[@]}"; do
# NPTL addon is not to be downloaded, in any case
[ "${addon}" = "nptl" ] && continue || true
CT_GetCVS "glibc-${addon}-cvs-${CT_LIBC_VERSION}" \
@@ -54,6 +57,9 @@ do_libc_get() {
# Extract glibc
do_libc_extract() {
local cvs
+ local -a addons_list
+
+ addons_list=($(do_libc_add_ons_list " "))
[ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
@@ -63,7 +69,7 @@ do_libc_extract() {
CT_Patch "glibc-${CT_LIBC_VERSION}" nochdir
# C library addons
- for addon in $(do_libc_add_ons_list " "); do
+ for addon in "${addons_list[@]}"; do
# NPTL addon is not to be extracted, in any case
[ "${addon}" = "nptl" ] && continue || true
CT_Extract "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" nochdir
@@ -82,6 +88,7 @@ do_libc_extract() {
# The configure files may be older than the configure.in files
# if using a snapshot (or even some tarballs). Fake them being
# up to date.
+ sleep 2
find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
CT_Popd
@@ -97,6 +104,7 @@ do_libc_check_config() {
# This function installs the glibc headers needed to build the core compiler
do_libc_headers() {
local cvs
+ local -a extra_config
CT_DoStep INFO "Installing C library headers"
@@ -123,21 +131,23 @@ do_libc_headers() {
# Override libc_cv_ppc_machine so glibc-cvs doesn't complain
# 'a version of binutils that supports .machine "altivec" is needed'.
- addons_list="$(do_libc_add_ons_list ,)"
# We need to remove any threading addon when installing headers
- addons_list="${addons_list//nptl/}"
- addons_list="${addons_list//linuxthreads/}"
- # Remove duplicate, leading and trailing separators
- addons_config="--enable-add-ons=$(echo "${addons_list}" |sed -r -e 's/,+/,/; s/^,//; s/,$//g;')"
+ addons_list="$(do_libc_add_ons_list " " \
+ |sed -r -e 's/\<(nptl|linuxthreads)\>/ /g;' \
+ -e 's/ +/,/g; s/^,+//; s/,+$//;' \
+ )"
- extra_config="${addons_config} $(do_libc_min_kernel_config)"
+ extra_config+=("--enable-add-ons=${addons_list}")
+
+ extra_config+=("${addons_config}")
+ extra_config+=("$(do_libc_min_kernel_config)")
# Pre-seed the configparms file with values from the config option
echo "${CT_LIBC_GLIBC_CONFIGPARMS}" > configparms
cross_cc=$(CT_Which "${CT_TARGET}-gcc")
CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
- CT_DoLog DEBUG "Extra config passed : '${extra_config}'"
+ CT_DoLog DEBUG "Extra config passed : '${extra_config[*]}'"
libc_cv_ppc_machine=yes \
CC=${cross_cc} \
@@ -150,7 +160,7 @@ do_libc_headers() {
--without-cvs \
--disable-sanity-checks \
--enable-hacker-mode \
- ${extra_config} \
+ "${extra_config[@]}" \
--without-nptl
CT_DoLog EXTRA "Installing C library headers"
@@ -246,6 +256,7 @@ do_libc_headers() {
# Build and install start files
do_libc_start_files() {
local cvs
+ local -a extra_config
# Needed only in the NPTL case. Otherwise, return.
[ "${CT_THREADS}" = "nptl" ] || return 0
@@ -260,26 +271,25 @@ do_libc_start_files() {
CT_DoLog EXTRA "Configuring C library"
# Add some default glibc config options if not given by user.
- extra_config=
case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
*-tls*) ;;
- *) extra_config="${extra_config} --with-tls"
+ *) extra_config+=("--with-tls")
esac
case "${CT_SHARED_LIBS}" in
- y) extra_config="${extra_config} --enable-shared";;
- *) extra_config="${extra_config} --disable-shared";;
+ y) extra_config+=("--enable-shared");;
+ *) extra_config+=("--disable-shared");;
esac
case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
- y,) extra_config="${extra_config} --with-fp";;
- ,y) extra_config="${extra_config} --without-fp";;
+ y,) extra_config+=("--with-fp");;
+ ,y) extra_config+=("--without-fp");;
esac
# Obviously, we want threads, as we come here only for NPTL
- extra_config="${extra_config} --with-__thread"
+ extra_config+=("--with-__thread")
addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
- extra_config="${extra_config} ${addons_config}"
+ extra_config+=("${addons_config}")
- extra_config="${extra_config} $(do_libc_min_kernel_config)"
+ extra_config+=("$(do_libc_min_kernel_config)")
# Add some default CC args
glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([[:digit:]]+).*/\1/')
@@ -303,7 +313,7 @@ do_libc_start_files() {
cross_cc=$(CT_Which "${CT_TARGET}-gcc")
CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
- CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
+ CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
# Pre-seed the configparms file with values from the config option
@@ -330,7 +340,7 @@ do_libc_start_files() {
--without-gd \
--with-headers="${CT_HEADERS_DIR}" \
--cache-file=config.cache \
- ${extra_config} \
+ "${extra_config[@]}" \
${CT_LIBC_GLIBC_EXTRA_CONFIG}
#TODO: should check whether slibdir has been set in configparms to */lib64
@@ -353,6 +363,7 @@ do_libc_start_files() {
# This function builds and install the full glibc
do_libc() {
local cvs
+ local -a extra_config
CT_DoStep INFO "Installing C library"
@@ -367,34 +378,33 @@ do_libc() {
# We don't need to be conditional on wether the user did set different
# values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
- extra_config=
case "${CT_THREADS}" in
- nptl) extra_config="${extra_config} --with-__thread --with-tls";;
- linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
- none) extra_config="${extra_config} --without-__thread --without-nptl"
+ nptl) extra_config+=("--with-__thread" "--with-tls");;
+ linuxthreads) extra_config+=("--with-__thread" "--without-tls" "--without-nptl");;
+ none) extra_config+=("--without-__thread" "--without-nptl")
case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
*-tls*) ;;
- *) extra_config="${extra_config} --without-tls";;
+ *) extra_config+=("--without-tls");;
esac
;;
esac
case "${CT_SHARED_LIBS}" in
- y) extra_config="${extra_config} --enable-shared";;
- *) extra_config="${extra_config} --disable-shared";;
+ y) extra_config+=("--enable-shared");;
+ *) extra_config+=("--disable-shared");;
esac
case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
- y,) extra_config="${extra_config} --with-fp";;
- ,y) extra_config="${extra_config} --without-fp";;
+ y,) extra_config+=("--with-fp";;
+ ,y) extra_config+=("--without-fp";;
esac
case "$(do_libc_add_ons_list ,)" in
"") ;;
- *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
+ *) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
esac
- extra_config="${extra_config} $(do_libc_min_kernel_config)"
+ extra_config+=("$(do_libc_min_kernel_config)")
# Add some default CC args
glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([[:digit:]]+).*/\1/')
@@ -463,7 +473,7 @@ do_libc() {
--disable-sanity-checks \
--cache-file=config.cache \
--with-headers="${CT_HEADERS_DIR}" \
- ${extra_config} \
+ "${extra_config[@]}" \
${CT_LIBC_GLIBC_EXTRA_CONFIG}
if grep -l '^install-lib-all:' "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/Makerules" > /dev/null; then