Tidy up a bit the uClibc config munging.

This commit is contained in:
Yann E. MORIN" 2007-07-28 11:59:37 +00:00
parent d4886dbe64
commit 96ef489cb4

View File

@ -38,15 +38,13 @@ do_libc_check_config() {
CT_TestOrAbort "You did not provide a uClibc config file!" -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" -a -f "${CT_LIBC_UCLIBC_CONFIG_FILE}" CT_TestOrAbort "You did not provide a uClibc config file!" -n "${CT_LIBC_UCLIBC_CONFIG_FILE}" -a -f "${CT_LIBC_UCLIBC_CONFIG_FILE}"
cp "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_SRC_DIR}/uClibc.config"
if egrep '^KERNEL_SOURCE=' "${CT_LIBC_UCLIBC_CONFIG_FILE}" >/dev/null 2>&1; then if egrep '^KERNEL_SOURCE=' "${CT_LIBC_UCLIBC_CONFIG_FILE}" >/dev/null 2>&1; then
CT_DoLog WARN "Your uClibc version refers to the kernel _sources_, which is bad." CT_DoLog WARN "Your uClibc version refers to the kernel _sources_, which is bad."
CT_DoLog WARN "I can't guarantee that our little hack will work. Please try to upgrade." CT_DoLog WARN "I can't guarantee that our little hack will work. Please try to upgrade."
fi fi
CT_DoLog EXTRA "Munging uClibc configuration" CT_DoLog EXTRA "Munging uClibc configuration"
mungeuClibcConfig "${CT_SRC_DIR}/uClibc.config" mungeuClibcConfig "${CT_LIBC_UCLIBC_CONFIG_FILE}" "${CT_BUILD_DIR}/uClibc.config"
CT_EndStep CT_EndStep
} }
@ -67,7 +65,7 @@ do_libc_headers() {
{ cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf - { cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
# Retrieve the config file # Retrieve the config file
cp "${CT_SRC_DIR}/uClibc.config" .config cp "${CT_BUILD_DIR}/uClibc.config" .config
# uClibc uses the CROSS environment variable as a prefix to the # uClibc uses the CROSS environment variable as a prefix to the
# compiler tools to use. Setting it to the empty string forces # compiler tools to use. Setting it to the empty string forces
@ -102,7 +100,7 @@ do_libc() {
{ cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf - { cd "${CT_SRC_DIR}/${CT_LIBC_FILE}"; tar cf - .; } |tar xf -
# Retrieve the config file # Retrieve the config file
cp "${CT_SRC_DIR}/uClibc.config" .config cp "${CT_BUILD_DIR}/uClibc.config" .config
# uClibc uses the CROSS environment variable as a prefix to the compiler # uClibc uses the CROSS environment variable as a prefix to the compiler
# tools to use. The newly built tools should be in our path, so we need # tools to use. The newly built tools should be in our path, so we need
@ -147,14 +145,19 @@ do_libc_finish() {
} }
# Initialises the .config file to sensible values # Initialises the .config file to sensible values
# $1: original file
# $2: munged file
mungeuClibcConfig() { mungeuClibcConfig() {
config_file="$1" src_config_file="$1"
dst_config_file="$2"
munge_file="${CT_BUILD_DIR}/munge-uClibc-config.sed" munge_file="${CT_BUILD_DIR}/munge-uClibc-config.sed"
echo -n >"${munge_file}"
# Hack our target in the config file. # Hack our target in the config file.
# Also remove stripping: its the responsibility of the # Also remove stripping: its the responsibility of the
# firmware builder to strip or not. # firmware builder to strip or not.
cat > "${munge_file}" <<-ENDSED cat >>"${munge_file}" <<-ENDSED
s/^(TARGET_.*)=y$/# \\1 is not set/ s/^(TARGET_.*)=y$/# \\1 is not set/
s/^# TARGET_${CT_KERNEL_ARCH} is not set/TARGET_${CT_KERNEL_ARCH}=y/ s/^# TARGET_${CT_KERNEL_ARCH} is not set/TARGET_${CT_KERNEL_ARCH}=y/
s/^TARGET_ARCH=".*"/TARGET_ARCH="${CT_KERNEL_ARCH}"/ s/^TARGET_ARCH=".*"/TARGET_ARCH="${CT_KERNEL_ARCH}"/
@ -283,6 +286,5 @@ s/^# UCLIBC_MALLOC_DEBUGGING is not set/UCLIBC_MALLOC_DEBUGGING=y/
ENDSED ENDSED
;; ;;
esac esac
sed -r -i -f "${munge_file}" "${config_file}" sed -r -f "${munge_file}" "${src_config_file}" >"${dst_config_file}"
rm -f "${munge_file}"
} }