1.1 --- a/scripts/build/libc_glibc.sh Sun May 27 20:22:06 2007 +0000
1.2 +++ b/scripts/build/libc_glibc.sh Sat Jun 02 07:56:45 2007 +0000
1.3 @@ -10,12 +10,9 @@
1.4 CT_GetFile "${CT_LIBC_FILE}" ftp://ftp.gnu.org/gnu/glibc
1.5
1.6 # C library addons
1.7 - addons_list=`echo "${CT_LIBC_ADDONS_LIST}" |sed -r -e 's/,/ /g; s/ $//g;'`
1.8 - case "${CT_THREADS}" in
1.9 - linuxthreads) addons_list="${addons_list} linuxthreads";;
1.10 - esac
1.11 - [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list} ports"
1.12 - for addon in ${addons_list}; do
1.13 + for addon in `do_libc_add_ons_list " "`; do
1.14 + # NPTL addon is not to be downloaded, in any case
1.15 + [ "${addon}" = "nptl" ] && continue || true
1.16 CT_GetFile "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}" ftp://ftp.gnu.org/gnu/glibc
1.17 done
1.18
1.19 @@ -27,12 +24,9 @@
1.20 CT_ExtractAndPatch "${CT_LIBC_FILE}"
1.21
1.22 # C library addons
1.23 - addons_list=`echo "${CT_LIBC_ADDONS_LIST}" |sed -r -e 's/,/ /g; s/ $//g;'`
1.24 - case "${CT_THREADS}" in
1.25 - linuxthreads) addons_list="${addons_list} linuxthreads";;
1.26 - esac
1.27 - [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list} ports"
1.28 - for addon in ${addons_list}; do
1.29 + for addon in `do_libc_add_ons_list " "`; do
1.30 + # NPTL addon is not to be extracted, in any case
1.31 + [ "${addon}" = "nptl" ] && continue || true
1.32 CT_ExtractAndPatch "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
1.33 done
1.34
1.35 @@ -73,15 +67,15 @@
1.36 # Override libc_cv_ppc_machine so glibc-cvs doesn't complain
1.37 # 'a version of binutils that supports .machine "altivec" is needed'.
1.38
1.39 - # We also need to use the ports addon if specified
1.40 - addons_list=
1.41 - case "${CT_LIBC_ADDONS},${CT_LIBC_GLIBC_USE_PORTS}" in
1.42 - y,y) addons_list="${CT_LIBC_ADDONS_LIST},ports";;
1.43 - y,) addons_list="${CT_LIBC_ADDONS_LIST}";;
1.44 - ,y) addons_list="ports";;
1.45 - *) addons_list="";;
1.46 - esac
1.47 - addons_config="--enable-add-ons=`echo ${addons_list} |sed -r -e 's/,+/,/g; s/^,+//; s/,+$//;'`"
1.48 + addons_config="--enable-add-ons=`do_libc_add_ons_list ,`"
1.49 + # We need to remove any threading addon when installing headers
1.50 + addons_config="${addons_config//nptl/}"
1.51 + addons_config="${addons_config//linuxthreads/}"
1.52 + addons_config=`echo "${addons_config}" |sed -r -e 's/,+/,/g; s/^,+//; s/,+$//;'`
1.53 +
1.54 + cross_cc=`which "${CT_TARGET}-gcc" || true`
1.55 + CT_DoLog DEBUG "Using gcc for target: \"${cross_cc}\""
1.56 + CT_DoLog DEBUG "Extra config passed : \"${addons_config}\""
1.57
1.58 libc_cv_ppc_machine=yes \
1.59 CC=${CT_CC_NATIVE} \
1.60 @@ -93,8 +87,8 @@
1.61 --without-cvs \
1.62 --disable-sanity-checks \
1.63 --enable-hacker-mode \
1.64 - --without-nptl \
1.65 - ${addons_config} 2>&1 |CT_DoLog ALL
1.66 + ${addons_config} \
1.67 + --without-nptl 2>&1 |CT_DoLog ALL
1.68
1.69 CT_DoLog EXTRA "Installing C library headers"
1.70
1.71 @@ -207,14 +201,7 @@
1.72 # Obviously, we want threads, as we come here only for NPTL
1.73 extra_config="${extra_config} --with-__thread"
1.74
1.75 - addons_list=
1.76 - case "${CT_LIBC_ADDONS},${CT_LIBC_GLIBC_USE_PORTS}" in
1.77 - y,y) addons_list="nptl,${CT_LIBC_ADDONS_LIST},ports";;
1.78 - y,) addons_list="nptl,${CT_LIBC_ADDONS_LIST}";;
1.79 - ,y) addons_list="nptl,ports";;
1.80 - *) addons_list="nptl";;
1.81 - esac
1.82 - addons_config="--enable-add-ons=`echo ${addons_list} |sed -r -e 's/,+/,/g; s/^,+//; s/,+$//;'`"
1.83 + addons_config="--enable-add-ons=`do_libc_add_ons_list ,`"
1.84 extra_config="${extra_config} ${addons_config}"
1.85
1.86 # Add some default CC args
1.87 @@ -228,9 +215,11 @@
1.88 esac;;
1.89 esac
1.90
1.91 - CT_DoLog DEBUG "Configuring with addons : \"${addons_list}\""
1.92 + cross_cc=`which "${CT_TARGET}-gcc" || true`
1.93 + CT_DoLog DEBUG "Using gcc for target : \"${cross_cc}\""
1.94 + CT_DoLog DEBUG "Configuring with addons : \"`do_libc_add_ons_list ,`\""
1.95 CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\""
1.96 - CT_DoLog DEBUG "Extra CC args passed: \"${extra_cc_args}\""
1.97 + CT_DoLog DEBUG "Extra CC args passed : \"${extra_cc_args}\""
1.98
1.99 # sh3 and sh4 really need to set configparms as of gcc-3.4/glibc-2.3.2
1.100 # note: this is awkward, doesn't work well if you need more than one line in configparms
1.101 @@ -309,22 +298,11 @@
1.102 ,y) extra_config="${extra_config} --without-fp";;
1.103 esac
1.104
1.105 - addons_list=
1.106 - case "${CT_LIBC_ADDONS},${CT_LIBC_GLIBC_USE_PORTS}" in
1.107 - y,y) addons_list="${CT_LIBC_ADDONS_LIST},ports";;
1.108 - y,) addons_list="${CT_LIBC_ADDONS_LIST}";;
1.109 - ,y) addons_list="ports";;
1.110 - *) addons_list="";;
1.111 + case "`do_libc_add_ons_list ,`" in
1.112 + "") ;;
1.113 + *) extra_config="${extra_config} --enable-add-ons=`do_libc_add_ons_list ,`";;
1.114 esac
1.115 - case "${CT_THREADS}" in
1.116 - none) ;;
1.117 - *) addons_list="${addons_list},${CT_THREADS}";;
1.118 - esac
1.119 - case "${addons_list}" in
1.120 - "") ;;
1.121 - *) addons_config="--enable-add-ons=`echo ${addons_list} |sed -r -e 's/,+/,/g; s/^,+//g; s/,+$//;'`";;
1.122 - esac
1.123 - extra_config="${extra_config} ${addons_config}"
1.124 +
1.125
1.126 # Add some default CC args
1.127 if [ "${CT_USE_PIPES}" = "y" ]; then
1.128 @@ -335,9 +313,11 @@
1.129 ,y) extra_cc_args="${extra_cc_args} -mlittle-endian";;
1.130 esac
1.131
1.132 - CT_DoLog DEBUG "Configuring with addons : \"${addons_list}\""
1.133 + cross_cc=`which "${CT_TARGET}-gcc" || true`
1.134 + CT_DoLog DEBUG "Using gcc for target : \"${cross_cc}\""
1.135 + CT_DoLog DEBUG "Configuring with addons : \"`do_libc_add_ons_list ,`\""
1.136 CT_DoLog DEBUG "Extra config args passed: \"${extra_config}\""
1.137 - CT_DoLog DEBUG "Extra CC args passed: \"${extra_cc_args}\""
1.138 + CT_DoLog DEBUG "Extra CC args passed : \"${extra_cc_args}\""
1.139
1.140 # sh3 and sh4 really need to set configparms as of gcc-3.4/glibc-2.3.2
1.141 # note: this is awkward, doesn't work well if you need more than one line in configparms
1.142 @@ -381,7 +361,6 @@
1.143 --disable-sanity-checks \
1.144 --cache-file=config.cache \
1.145 --with-headers="${CT_HEADERS_DIR}" \
1.146 - ${addons_config} \
1.147 ${extra_config} \
1.148 ${CT_LIBC_GLIBC_EXTRA_CONFIG} 2>&1 |CT_DoLog ALL
1.149
1.150 @@ -478,3 +457,17 @@
1.151
1.152 CT_EndStep
1.153 }
1.154 +
1.155 +# Build up the addons list, separated with $1
1.156 +do_libc_add_ons_list() {
1.157 + local sep="$1"
1.158 + local addons_list=`echo "${CT_LIBC_ADDONS_LIST//,/${sep}}" |tr -s ,`
1.159 + case "${CT_THREADS}" in
1.160 + none) ;;
1.161 + *) addons_list="${addons_list}${sep}${CT_THREADS}";;
1.162 + esac
1.163 + [ "${CT_LIBC_GLIBC_USE_PORTS}" = "y" ] && addons_list="${addons_list}${sep}ports"
1.164 + addons_list="${addons_list%%${sep}}"
1.165 + echo "${addons_list##${sep}}"
1.166 +}
1.167 +