diff options
author | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2008-12-09 22:02:20 +0000 |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> | 2008-12-09 22:02:20 +0000 |
commit | eb687c65b33e35e282f152b1bf19163776e599dd (patch) | |
tree | fd84e359d521d76d8cf038845cc2e1c389c243a1 | |
parent | 7ac365e0754388d83a34a4d6a054134d39e0dbed (diff) | |
download | crosstool-ng-eb687c65b33e35e282f152b1bf19163776e599dd.tar.gz crosstool-ng-eb687c65b33e35e282f152b1bf19163776e599dd.tar.bz2 crosstool-ng-eb687c65b33e35e282f152b1bf19163776e599dd.zip |
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(-)
-rw-r--r-- | config/toolchain.in | 1 | ||||
-rw-r--r-- | scripts/functions | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/config/toolchain.in b/config/toolchain.in index 89f3ffba..61d939dd 100644 --- a/config/toolchain.in +++ b/config/toolchain.in @@ -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. diff --git a/scripts/functions b/scripts/functions index cffd6ba9..6fbc9cf3 100644 --- a/scripts/functions +++ b/scripts/functions @@ -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}" |