1.1 --- a/scripts/build/libc/uClibc.sh Fri Jan 01 17:09:52 2010 +0100
1.2 +++ b/scripts/build/libc/uClibc.sh Fri Jan 01 18:47:20 2010 +0100
1.3 @@ -187,61 +187,64 @@
1.4 rm -f "${munge_file}"
1.5 touch "${munge_file}"
1.6
1.7 + # Do it all in a sub-shell, it's easier to redirect output
1.8 + (
1.9 +
1.10 # Hack our target in the config file.
1.11 # Also remove stripping: its the responsibility of the
1.12 # firmware builder to strip or not.
1.13 - cat >>"${munge_file}" <<-ENDSED
1.14 -s/^(TARGET_.*)=y$/# \\1 is not set/
1.15 -s/^# TARGET_${CT_KERNEL_ARCH} is not set/TARGET_${CT_KERNEL_ARCH}=y/
1.16 -s/^TARGET_ARCH=".*"/TARGET_ARCH="${CT_KERNEL_ARCH}"/
1.17 -s/.*(DOSTRIP).*/# \\1 is not set/
1.18 -ENDSED
1.19 + cat <<-ENDSED
1.20 + s/^(TARGET_.*)=y$/# \\1 is not set/
1.21 + s/^# TARGET_${CT_KERNEL_ARCH} is not set/TARGET_${CT_KERNEL_ARCH}=y/
1.22 + s/^TARGET_ARCH=".*"/TARGET_ARCH="${CT_KERNEL_ARCH}"/
1.23 + s/.*(DOSTRIP).*/# \\1 is not set/
1.24 + ENDSED
1.25
1.26 # Ah. We may one day need architecture-specific handler here...
1.27 # Hack the ARM {E,O}ABI into the config file
1.28 if [ "${CT_ARCH_ARM_EABI}" = "y" ]; then
1.29 - cat >>"${munge_file}" <<-ENDSED
1.30 -s/.*(CONFIG_ARM_OABI).*/# \\1 is not set/
1.31 -s/.*(CONFIG_ARM_EABI).*/\\1=y/
1.32 -ENDSED
1.33 + cat <<-ENDSED
1.34 + s/.*(CONFIG_ARM_OABI).*/# \\1 is not set/
1.35 + s/.*(CONFIG_ARM_EABI).*/\\1=y/
1.36 + ENDSED
1.37 else
1.38 - cat >>"${munge_file}" <<-ENDSED
1.39 -s/.*(CONFIG_ARM_OABI).*/\\1=y/
1.40 -s/.*(CONFIG_ARM_EABI).*/# \\1 is not set/
1.41 -ENDSED
1.42 + cat <<-ENDSED
1.43 + s/.*(CONFIG_ARM_OABI).*/\\1=y/
1.44 + s/.*(CONFIG_ARM_EABI).*/# \\1 is not set/
1.45 + ENDSED
1.46 fi
1.47
1.48 # Accomodate for old and new uClibc versions, where the
1.49 # way to select between big/little endian has changed
1.50 case "${CT_ARCH_BE},${CT_ARCH_LE}" in
1.51 - y,) cat >>"${munge_file}" <<-ENDSED
1.52 -s/.*(ARCH_LITTLE_ENDIAN).*/# \\1 is not set/
1.53 -s/.*(ARCH_BIG_ENDIAN).*/\\1=y/
1.54 -s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/# \\1 is not set/
1.55 -s/.*(ARCH_WANTS_BIG_ENDIAN).*/\\1=y/
1.56 -ENDSED
1.57 + y,) cat <<-ENDSED
1.58 + s/.*(ARCH_LITTLE_ENDIAN).*/# \\1 is not set/
1.59 + s/.*(ARCH_BIG_ENDIAN).*/\\1=y/
1.60 + s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/# \\1 is not set/
1.61 + s/.*(ARCH_WANTS_BIG_ENDIAN).*/\\1=y/
1.62 + ENDSED
1.63 ;;
1.64 - ,y) cat >>"${munge_file}" <<-ENDSED
1.65 -s/.*(ARCH_LITTLE_ENDIAN).*/\\1=y/
1.66 -s/.*(ARCH_BIG_ENDIAN).*/# \\1 is not set/
1.67 -s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/\\1=y/
1.68 -s/.*(ARCH_WANTS_BIG_ENDIAN).*/# \\1 is not set/
1.69 -ENDSED
1.70 + ,y) cat <<-ENDSED
1.71 + s/.*(ARCH_LITTLE_ENDIAN).*/\\1=y/
1.72 + s/.*(ARCH_BIG_ENDIAN).*/# \\1 is not set/
1.73 + s/.*(ARCH_WANTS_LITTLE_ENDIAN).*/\\1=y/
1.74 + s/.*(ARCH_WANTS_BIG_ENDIAN).*/# \\1 is not set/
1.75 + ENDSED
1.76 ;;
1.77 esac
1.78
1.79 # Accomodate for old and new uClibc version, where the
1.80 # way to select between hard/soft float has changed
1.81 case "${CT_ARCH_FLOAT_HW},${CT_ARCH_FLOAT_SW}" in
1.82 - y,) cat >>"${munge_file}" <<-ENDSED
1.83 -s/^[^_]*(HAS_FPU).*/\\1=y/
1.84 -s/.*(UCLIBC_HAS_FPU).*/\\1=y/
1.85 -ENDSED
1.86 + y,) cat <<-ENDSED
1.87 + s/^[^_]*(HAS_FPU).*/\\1=y/
1.88 + s/.*(UCLIBC_HAS_FPU).*/\\1=y/
1.89 + ENDSED
1.90 ;;
1.91 - ,y) cat >>"${munge_file}" <<-ENDSED
1.92 -s/^[^_]*(HAS_FPU).*/\\# \\1 is not set/
1.93 -s/.*(UCLIBC_HAS_FPU).*/# \\1 is not set/
1.94 -ENDSED
1.95 + ,y) cat <<-ENDSED
1.96 + s/^[^_]*(HAS_FPU).*/\\# \\1 is not set/
1.97 + s/.*(UCLIBC_HAS_FPU).*/# \\1 is not set/
1.98 + ENDSED
1.99 ;;
1.100 esac
1.101
1.102 @@ -254,28 +257,28 @@
1.103 # CROSS_COMPILER_PREFIX is left as is, as the CROSS parameter is forced on the command line
1.104 # DEVEL_PREFIX is left as '/usr/' because it is post-pended to $PREFIX, wich is the correct value of ${PREFIX}/${TARGET}
1.105 # Some (old) versions of uClibc use KERNEL_SOURCE (which is _wrong_), and
1.106 - # newer versions use KERNEL_HEADERS (which is right). See:
1.107 - cat >>"${munge_file}" <<-ENDSED
1.108 -s/^DEVEL_PREFIX=".*"/DEVEL_PREFIX="\\/usr\\/"/
1.109 -s/^RUNTIME_PREFIX=".*"/RUNTIME_PREFIX="\\/"/
1.110 -s/^SHARED_LIB_LOADER_PREFIX=.*/SHARED_LIB_LOADER_PREFIX="\\/lib\\/"/
1.111 -s/^KERNEL_SOURCE=".*"/KERNEL_SOURCE="${quoted_kernel_source}"/
1.112 -s/^KERNEL_HEADERS=".*"/KERNEL_HEADERS="${quoted_headers_dir}"/
1.113 -s/^UCLIBC_DOWNLOAD_PREGENERATED_LOCALE=y/\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE is not set/
1.114 -ENDSED
1.115 + # newer versions use KERNEL_HEADERS (which is right).
1.116 + cat <<-ENDSED
1.117 + s/^DEVEL_PREFIX=".*"/DEVEL_PREFIX="\\/usr\\/"/
1.118 + s/^RUNTIME_PREFIX=".*"/RUNTIME_PREFIX="\\/"/
1.119 + s/^SHARED_LIB_LOADER_PREFIX=.*/SHARED_LIB_LOADER_PREFIX="\\/lib\\/"/
1.120 + s/^KERNEL_SOURCE=".*"/KERNEL_SOURCE="${quoted_kernel_source}"/
1.121 + s/^KERNEL_HEADERS=".*"/KERNEL_HEADERS="${quoted_headers_dir}"/
1.122 + s/^UCLIBC_DOWNLOAD_PREGENERATED_LOCALE=y/\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE is not set/
1.123 + ENDSED
1.124
1.125 if [ "${CT_USE_PIPES}" = "y" ]; then
1.126 if grep UCLIBC_EXTRA_CFLAGS extra/Configs/Config.in >/dev/null 2>&1; then
1.127 # Good, there is special provision for such things as -pipe!
1.128 - cat >>"${munge_file}" <<-ENDSED
1.129 -s/^(UCLIBC_EXTRA_CFLAGS=".*)"$/\\1 -pipe"/
1.130 -ENDSED
1.131 + cat <<-ENDSED
1.132 + s/^(UCLIBC_EXTRA_CFLAGS=".*)"$/\\1 -pipe"/
1.133 + ENDSED
1.134 else
1.135 # Hack our -pipe into WARNINGS, which will be internally incorporated to
1.136 # CFLAGS. This a dirty hack, but yet needed
1.137 - cat >> "${munge_file}" <<-ENDSED
1.138 -s/^(WARNINGS=".*)"$/\\1 -pipe"/
1.139 -ENDSED
1.140 + cat <<-ENDSED
1.141 + s/^(WARNINGS=".*)"$/\\1 -pipe"/
1.142 + ENDSED
1.143 fi
1.144 fi
1.145
1.146 @@ -287,70 +290,76 @@
1.147 # pregenerated locales is not compatible with crosstool; besides,
1.148 # crosstool downloads them as part of getandpatch.sh.
1.149 if [ "${CT_LIBC_UCLIBC_LOCALES}" = "y" ] ; then
1.150 - cat >>"${munge_file}" <<-ENDSED
1.151 -s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\nUCLIBC_PREGENERATED_LOCALE_DATA=y\\n\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\n\\# UCLIBC_HAS_XLOCALE is not
1.152 -ENDSED
1.153 + cat <<-ENDSED
1.154 + s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\
1.155 + UCLIBC_PREGENERATED_LOCALE_DATA=y\\
1.156 + # UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\
1.157 + # UCLIBC_HAS_XLOCALE is not set/
1.158 + ENDSED
1.159 fi
1.160
1.161 # WCHAR support
1.162 if [ "${CT_LIBC_UCLIBC_WCHAR}" = "y" ] ; then
1.163 - cat >>"${munge_file}" <<-ENDSED
1.164 -s/^.*UCLIBC_HAS_WCHAR.*/UCLIBC_HAS_WCHAR=y/
1.165 -ENDSED
1.166 + cat <<-ENDSED
1.167 + s/^.*UCLIBC_HAS_WCHAR.*/UCLIBC_HAS_WCHAR=y/
1.168 + ENDSED
1.169 else
1.170 - cat >>"${munge_file}" <<-ENDSED
1.171 -s/^.*UCLIBC_HAS_WCHAR.*/UCLIBC_HAS_WCHAR=n/
1.172 -ENDSED
1.173 + cat <<-ENDSED
1.174 + s/^.*UCLIBC_HAS_WCHAR.*/UCLIBC_HAS_WCHAR=n/
1.175 + ENDSED
1.176 fi
1.177
1.178 # Force on options needed for C++ if we'll be making a C++ compiler.
1.179 # I'm not sure locales are a requirement for doing C++... Are they?
1.180 if [ "${CT_CC_LANG_CXX}" = "y" ]; then
1.181 - cat >>"${munge_file}" <<-ENDSED
1.182 -s/^# DO_C99_MATH is not set/DO_C99_MATH=y/
1.183 -s/^# UCLIBC_CTOR_DTOR is not set/UCLIBC_CTOR_DTOR=y/
1.184 -#s/^# UCLIBC_HAS_LOCALE is not set/UCLIBC_HAS_LOCALE=y\\nUCLIBC_PREGENERATED_LOCALE_DATA=y\\n\\# UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA is not set\\n\\# UCLIBC_HAS_XLOCALE is not set/
1.185 -s/^# UCLIBC_HAS_GNU_GETOPT is not set/UCLIBC_HAS_GNU_GETOPT=y/
1.186 -ENDSED
1.187 + cat <<-ENDSED
1.188 + s/^# DO_C99_MATH is not set/DO_C99_MATH=y/
1.189 + s/^# UCLIBC_CTOR_DTOR is not set/UCLIBC_CTOR_DTOR=y/
1.190 + s/^# UCLIBC_HAS_GNU_GETOPT is not set/UCLIBC_HAS_GNU_GETOPT=y/
1.191 + ENDSED
1.192 fi
1.193
1.194 # Always build the libpthread_db
1.195 - cat >>"${munge_file}" <<-ENDSED
1.196 -s/^# PTHREADS_DEBUG_SUPPORT is not set.*/PTHREADS_DEBUG_SUPPORT=y/
1.197 -ENDSED
1.198 + cat <<-ENDSED
1.199 + s/^# PTHREADS_DEBUG_SUPPORT is not set.*/PTHREADS_DEBUG_SUPPORT=y/
1.200 + ENDSED
1.201
1.202 # Force on debug options if asked for
1.203 case "${CT_LIBC_UCLIBC_DEBUG_LEVEL}" in
1.204 0)
1.205 - cat >>"${munge_file}" <<-ENDSED
1.206 -s/^DODEBUG=y/# DODEBUG is not set/
1.207 -s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
1.208 -s/^DOASSERTS=y/# DOASSERTS is not set/
1.209 -s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
1.210 -s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
1.211 -s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
1.212 -ENDSED
1.213 + cat <<-ENDSED
1.214 + s/^DODEBUG=y/# DODEBUG is not set/
1.215 + s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
1.216 + s/^DOASSERTS=y/# DOASSERTS is not set/
1.217 + s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
1.218 + s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
1.219 + s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
1.220 + ENDSED
1.221 ;;
1.222 1)
1.223 - cat >>"${munge_file}" <<-ENDSED
1.224 -s/^# DODEBUG is not set.*/DODEBUG=y/
1.225 -s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
1.226 -s/^DOASSERTS=y/# DOASSERTS is not set/
1.227 -s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
1.228 -s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
1.229 -s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
1.230 -ENDSED
1.231 + cat <<-ENDSED
1.232 + s/^# DODEBUG is not set.*/DODEBUG=y/
1.233 + s/^DODEBUG_PT=y/# DODEBUG_PT is not set/
1.234 + s/^DOASSERTS=y/# DOASSERTS is not set/
1.235 + s/^SUPPORT_LD_DEBUG=y/# SUPPORT_LD_DEBUG is not set/
1.236 + s/^SUPPORT_LD_DEBUG_EARLY=y/# SUPPORT_LD_DEBUG_EARLY is not set/
1.237 + s/^UCLIBC_MALLOC_DEBUGGING=y/# UCLIBC_MALLOC_DEBUGGING is not set/
1.238 + ENDSED
1.239 ;;
1.240 2)
1.241 - cat >>"${munge_file}" <<-ENDSED
1.242 -s/^# DODEBUG is not set.*/DODEBUG=y/
1.243 -s/^# DODEBUG_PT is not set.*/DODEBUG_PT=y/
1.244 -s/^# DOASSERTS is not set.*/DOASSERTS=y/
1.245 -s/^# SUPPORT_LD_DEBUG is not set.*/SUPPORT_LD_DEBUG=y/
1.246 -s/^# SUPPORT_LD_DEBUG_EARLY is not set.*/SUPPORT_LD_DEBUG_EARLY=y/
1.247 -s/^# UCLIBC_MALLOC_DEBUGGING is not set/UCLIBC_MALLOC_DEBUGGING=y/
1.248 -ENDSED
1.249 + cat <<-ENDSED
1.250 + s/^# DODEBUG is not set.*/DODEBUG=y/
1.251 + s/^# DODEBUG_PT is not set.*/DODEBUG_PT=y/
1.252 + s/^# DOASSERTS is not set.*/DOASSERTS=y/
1.253 + s/^# SUPPORT_LD_DEBUG is not set.*/SUPPORT_LD_DEBUG=y/
1.254 + s/^# SUPPORT_LD_DEBUG_EARLY is not set.*/SUPPORT_LD_DEBUG_EARLY=y/
1.255 + s/^# UCLIBC_MALLOC_DEBUGGING is not set/UCLIBC_MALLOC_DEBUGGING=y/
1.256 + ENDSED
1.257 ;;
1.258 esac
1.259 +
1.260 + # And now, this is the end
1.261 + ) >>"${munge_file}"
1.262 +
1.263 sed -r -f "${munge_file}" "${src_config_file}" >"${dst_config_file}"
1.264 }