Sanity-check CT_TARGET_VENDOR, CT_TARGET_ALIAS and CT_TARGET_ALIAS_SED_EXPR:

- vendor and alias must not contain spaces
- vendor must not contain dashes '-'
- sed_expr must not generate an alias with a space in it

 /trunk/scripts/functions   |   17    16     1     0 ++++++++++++++++-
 /trunk/config/toolchain.in |    1     1     0     0 +
 2 files changed, 17 insertions(+), 1 deletion(-)
This commit is contained in:
Yann E. MORIN" 2008-12-09 22:02:20 +00:00
parent 7ac365e075
commit eb687c65b3
2 changed files with 17 additions and 1 deletions

View File

@ -33,6 +33,7 @@ config TARGET_VENDOR
A tuple is of the form arch-vendor-kernel-system.
You can set the second part, vendor, to whatever you see fit.
Use a single word, or use underscores "_" to separate words.
Use neither dash nor space, as it breaks things.
Keep the default (unkown) if you don't know better.

View File

@ -697,7 +697,22 @@ CT_DoBuildTargetTuple() {
CT_DoKernelTupleValues
# Finish the target tuple construction
CT_TARGET=$(CT_DoConfigSub "${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}${CT_TARGET_KERNEL:+-}${CT_TARGET_SYS}")
CT_TARGET="${CT_TARGET_ARCH}-${CT_TARGET_VENDOR:-unknown}-${CT_TARGET_KERNEL}${CT_TARGET_KERNEL:+-}${CT_TARGET_SYS}"
# Sanity checks
__sed_alias=""
if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
__sed_alias=$(echo "${CT_TARGET}" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
fi
case ":${CT_TARGET_VENDOR}:${CT_TARGET_ALIAS}:${__sed_alias}:" in
:*" "*:*:*:) CT_Abort "Don't use spaces in the vendor string, it breaks things.";;
:*"-"*:*:*:) CT_Abort "Don't use dashes in the vendor string, it breaks things.";;
:*:*" "*:*:) CT_Abort "Don't use spaces in the target alias, it breaks things.";;
:*:*:*" "*:) CT_Abort "Don't use spaces in the target sed transform, it breaks things.";;
esac
# Canonicalise it
CT_TARGET=$(CT_DoConfigSub "${CT_TARGET}")
# Prepare the target CFLAGS
CT_ARCH_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_ARCH_ENDIAN_CFLAG}"