1.1 --- a/scripts/build/libc/glibc.sh Wed Aug 19 19:44:43 2009 +0200
1.2 +++ b/scripts/build/libc/glibc.sh Wed Aug 19 19:44:43 2009 +0200
1.3 @@ -6,6 +6,9 @@
1.4 do_libc_get() {
1.5 local date
1.6 local version
1.7 + local -a addons_list
1.8 +
1.9 + addons_list=($(do_libc_add_ons_list " "))
1.10
1.11 if [ "${CT_LIBC_GLIBC_TARBALL}" = "y" ]; then
1.12 # Use release tarballs
1.13 @@ -15,7 +18,7 @@
1.14 ftp://gcc.gnu.org/pub/glibc/snapshots
1.15
1.16 # C library addons
1.17 - for addon in $(do_libc_add_ons_list " "); do
1.18 + for addon in "${addons_list[@]}"; do
1.19 # NPTL addon is not to be downloaded, in any case
1.20 [ "${addon}" = "nptl" ] && continue || true
1.21 CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}" \
1.22 @@ -35,7 +38,7 @@
1.23 "glibc-cvs-${CT_LIBC_VERSION}"
1.24
1.25 # C library addons
1.26 - for addon in $(do_libc_add_ons_list " "); do
1.27 + for addon in "${addons_list[@]}"; do
1.28 # NPTL addon is not to be downloaded, in any case
1.29 [ "${addon}" = "nptl" ] && continue || true
1.30 CT_GetCVS "glibc-${addon}-cvs-${CT_LIBC_VERSION}" \
1.31 @@ -54,6 +57,9 @@
1.32 # Extract glibc
1.33 do_libc_extract() {
1.34 local cvs
1.35 + local -a addons_list
1.36 +
1.37 + addons_list=($(do_libc_add_ons_list " "))
1.38
1.39 [ "${CT_LIBC_GLIBC_CVS}" = "y" ] && cvs="cvs-"
1.40
1.41 @@ -63,7 +69,7 @@
1.42 CT_Patch "glibc-${CT_LIBC_VERSION}" nochdir
1.43
1.44 # C library addons
1.45 - for addon in $(do_libc_add_ons_list " "); do
1.46 + for addon in "${addons_list[@]}"; do
1.47 # NPTL addon is not to be extracted, in any case
1.48 [ "${addon}" = "nptl" ] && continue || true
1.49 CT_Extract "glibc-${addon}-${cvs}${CT_LIBC_VERSION}" nochdir
1.50 @@ -82,6 +88,7 @@
1.51 # The configure files may be older than the configure.in files
1.52 # if using a snapshot (or even some tarballs). Fake them being
1.53 # up to date.
1.54 + sleep 2
1.55 find . -type f -name configure -exec touch {} \; 2>&1 |CT_DoLog ALL
1.56
1.57 CT_Popd
1.58 @@ -97,6 +104,7 @@
1.59 # This function installs the glibc headers needed to build the core compiler
1.60 do_libc_headers() {
1.61 local cvs
1.62 + local -a extra_config
1.63
1.64 CT_DoStep INFO "Installing C library headers"
1.65
1.66 @@ -123,21 +131,23 @@
1.67 # Override libc_cv_ppc_machine so glibc-cvs doesn't complain
1.68 # 'a version of binutils that supports .machine "altivec" is needed'.
1.69
1.70 - addons_list="$(do_libc_add_ons_list ,)"
1.71 # We need to remove any threading addon when installing headers
1.72 - addons_list="${addons_list//nptl/}"
1.73 - addons_list="${addons_list//linuxthreads/}"
1.74 - # Remove duplicate, leading and trailing separators
1.75 - addons_config="--enable-add-ons=$(echo "${addons_list}" |sed -r -e 's/,+/,/; s/^,//; s/,$//g;')"
1.76 + addons_list="$(do_libc_add_ons_list " " \
1.77 + |sed -r -e 's/\<(nptl|linuxthreads)\>/ /g;' \
1.78 + -e 's/ +/,/g; s/^,+//; s/,+$//;' \
1.79 + )"
1.80
1.81 - extra_config="${addons_config} $(do_libc_min_kernel_config)"
1.82 + extra_config+=("--enable-add-ons=${addons_list}")
1.83 +
1.84 + extra_config+=("${addons_config}")
1.85 + extra_config+=("$(do_libc_min_kernel_config)")
1.86
1.87 # Pre-seed the configparms file with values from the config option
1.88 echo "${CT_LIBC_GLIBC_CONFIGPARMS}" > configparms
1.89
1.90 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
1.91 CT_DoLog DEBUG "Using gcc for target: '${cross_cc}'"
1.92 - CT_DoLog DEBUG "Extra config passed : '${extra_config}'"
1.93 + CT_DoLog DEBUG "Extra config passed : '${extra_config[*]}'"
1.94
1.95 libc_cv_ppc_machine=yes \
1.96 CC=${cross_cc} \
1.97 @@ -150,7 +160,7 @@
1.98 --without-cvs \
1.99 --disable-sanity-checks \
1.100 --enable-hacker-mode \
1.101 - ${extra_config} \
1.102 + "${extra_config[@]}" \
1.103 --without-nptl
1.104
1.105 CT_DoLog EXTRA "Installing C library headers"
1.106 @@ -246,6 +256,7 @@
1.107 # Build and install start files
1.108 do_libc_start_files() {
1.109 local cvs
1.110 + local -a extra_config
1.111
1.112 # Needed only in the NPTL case. Otherwise, return.
1.113 [ "${CT_THREADS}" = "nptl" ] || return 0
1.114 @@ -260,26 +271,25 @@
1.115 CT_DoLog EXTRA "Configuring C library"
1.116
1.117 # Add some default glibc config options if not given by user.
1.118 - extra_config=
1.119 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
1.120 *-tls*) ;;
1.121 - *) extra_config="${extra_config} --with-tls"
1.122 + *) extra_config+=("--with-tls")
1.123 esac
1.124 case "${CT_SHARED_LIBS}" in
1.125 - y) extra_config="${extra_config} --enable-shared";;
1.126 - *) extra_config="${extra_config} --disable-shared";;
1.127 + y) extra_config+=("--enable-shared");;
1.128 + *) extra_config+=("--disable-shared");;
1.129 esac
1.130 case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
1.131 - y,) extra_config="${extra_config} --with-fp";;
1.132 - ,y) extra_config="${extra_config} --without-fp";;
1.133 + y,) extra_config+=("--with-fp");;
1.134 + ,y) extra_config+=("--without-fp");;
1.135 esac
1.136 # Obviously, we want threads, as we come here only for NPTL
1.137 - extra_config="${extra_config} --with-__thread"
1.138 + extra_config+=("--with-__thread")
1.139
1.140 addons_config="--enable-add-ons=$(do_libc_add_ons_list ,)"
1.141 - extra_config="${extra_config} ${addons_config}"
1.142 + extra_config+=("${addons_config}")
1.143
1.144 - extra_config="${extra_config} $(do_libc_min_kernel_config)"
1.145 + extra_config+=("$(do_libc_min_kernel_config)")
1.146
1.147 # Add some default CC args
1.148 glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([[:digit:]]+).*/\1/')
1.149 @@ -303,7 +313,7 @@
1.150 cross_cc=$(CT_Which "${CT_TARGET}-gcc")
1.151 CT_DoLog DEBUG "Using gcc for target : '${cross_cc}'"
1.152 CT_DoLog DEBUG "Configuring with addons : '$(do_libc_add_ons_list ,)'"
1.153 - CT_DoLog DEBUG "Extra config args passed: '${extra_config}'"
1.154 + CT_DoLog DEBUG "Extra config args passed: '${extra_config[*]}'"
1.155 CT_DoLog DEBUG "Extra CC args passed : '${extra_cc_args}'"
1.156
1.157 # Pre-seed the configparms file with values from the config option
1.158 @@ -330,7 +340,7 @@
1.159 --without-gd \
1.160 --with-headers="${CT_HEADERS_DIR}" \
1.161 --cache-file=config.cache \
1.162 - ${extra_config} \
1.163 + "${extra_config[@]}" \
1.164 ${CT_LIBC_GLIBC_EXTRA_CONFIG}
1.165
1.166 #TODO: should check whether slibdir has been set in configparms to */lib64
1.167 @@ -353,6 +363,7 @@
1.168 # This function builds and install the full glibc
1.169 do_libc() {
1.170 local cvs
1.171 + local -a extra_config
1.172
1.173 CT_DoStep INFO "Installing C library"
1.174
1.175 @@ -367,34 +378,33 @@
1.176 # We don't need to be conditional on wether the user did set different
1.177 # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
1.178
1.179 - extra_config=
1.180 case "${CT_THREADS}" in
1.181 - nptl) extra_config="${extra_config} --with-__thread --with-tls";;
1.182 - linuxthreads) extra_config="${extra_config} --with-__thread --without-tls --without-nptl";;
1.183 - none) extra_config="${extra_config} --without-__thread --without-nptl"
1.184 + nptl) extra_config+=("--with-__thread" "--with-tls");;
1.185 + linuxthreads) extra_config+=("--with-__thread" "--without-tls" "--without-nptl");;
1.186 + none) extra_config+=("--without-__thread" "--without-nptl")
1.187 case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
1.188 *-tls*) ;;
1.189 - *) extra_config="${extra_config} --without-tls";;
1.190 + *) extra_config+=("--without-tls");;
1.191 esac
1.192 ;;
1.193 esac
1.194
1.195 case "${CT_SHARED_LIBS}" in
1.196 - y) extra_config="${extra_config} --enable-shared";;
1.197 - *) extra_config="${extra_config} --disable-shared";;
1.198 + y) extra_config+=("--enable-shared");;
1.199 + *) extra_config+=("--disable-shared");;
1.200 esac
1.201
1.202 case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
1.203 - y,) extra_config="${extra_config} --with-fp";;
1.204 - ,y) extra_config="${extra_config} --without-fp";;
1.205 + y,) extra_config+=("--with-fp";;
1.206 + ,y) extra_config+=("--without-fp";;
1.207 esac
1.208
1.209 case "$(do_libc_add_ons_list ,)" in
1.210 "") ;;
1.211 - *) extra_config="${extra_config} --enable-add-ons=$(do_libc_add_ons_list ,)";;
1.212 + *) extra_config+=("--enable-add-ons=$(do_libc_add_ons_list ,)");;
1.213 esac
1.214
1.215 - extra_config="${extra_config} $(do_libc_min_kernel_config)"
1.216 + extra_config+=("$(do_libc_min_kernel_config)")
1.217
1.218 # Add some default CC args
1.219 glibc_version_major=$(echo ${CT_LIBC_VERSION} |sed -r -e 's/^([[:digit:]]+).*/\1/')
1.220 @@ -463,7 +473,7 @@
1.221 --disable-sanity-checks \
1.222 --cache-file=config.cache \
1.223 --with-headers="${CT_HEADERS_DIR}" \
1.224 - ${extra_config} \
1.225 + "${extra_config[@]}" \
1.226 ${CT_LIBC_GLIBC_EXTRA_CONFIG}
1.227
1.228 if grep -l '^install-lib-all:' "${CT_SRC_DIR}/glibc-${cvs}${CT_LIBC_VERSION}/Makerules" > /dev/null; then