public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
From: Bryan Hundven <bryanhundven@gmail.com>
To: Michael Hope <michael.hope@linaro.org>
Cc: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>,
	crossgcc@sourceware.org
Subject: Re: [PATCH] scripts: support an empty vendor string
Date: Thu, 20 Oct 2011 08:32:00 -0000	[thread overview]
Message-ID: <CAJ+oik0f0Q9PjiHkERYUwS5FB4BKdSFKE-prR7MKiA0UUUybjQ@mail.gmail.com> (raw)
In-Reply-To: <4E9F7932.8030401@linaro.org>

On Wed, Oct 19, 2011 at 6:28 PM, Michael Hope <michael.hope@linaro.org> wrote:
> On 20/10/11 13:35, Michael Hope wrote:
>>
>> scripts: support an empty vendor string
>>>>
>>>>  For Linux and other targets, config.sub defaults to 'unknown'
>>>>  if no vendor was specified.  This patch supplies a fake vendor and
>>>>  then strips it out afterwards.
>>>>
>>>>  This is needed to have an Ubuntu style vendorless tuple such as
>>>>  arm-linux-gnueabi.  Other features like the alias and sed transform
>>>>  don't cover it.
>
> scripts: support an empty vendor string
>
> For Linux and other targets, config.sub defaults to 'unknown'
> if no vendor was specified.  If enabled, this patch supplies a fake vendor
> and then strips it out afterwards.
>
> This is needed to have an Ubuntu style vendorless tuple such as
> arm-linux-gnueabi.  Other features like the alias and sed transform
> don't cover it.
>
> Signed-off-by: Michael Hope <michael.hope@linaro.org>
Reviewed-by: Bryan Hundven <bryanhundven@gmail.com>
>
> diff --git a/config/toolchain.in b/config/toolchain.in
> index d034315..94755fd 100644
> --- a/config/toolchain.in
> +++ b/config/toolchain.in
> @@ -111,6 +111,18 @@
>
>       Keep the default (unknown) if you don't know better.
>
> +config ALLOW_NO_VENDOR
> +    bool
> +    prompt "Allow tuples with no vendor"
> +    default n
> +    help
> +      Set this and set the vendor string to an empty string to allow
> +      tuples with no vendor component such as 'arm-linux-gnueabi'
> +      instead of the default 'arm-unknown-linux-gnueabi'.
> +
> +      This is a backwards compatibility option for earlier
> +      configurations that used an empty string to mean 'unknown'.
> +
>  config TARGET_ALIAS_SED_EXPR
>     string
>     prompt "Tuple's sed transform"
> diff --git a/scripts/functions b/scripts/functions
> index 789b622..2ac4c50 100644
> --- a/scripts/functions
> +++ b/scripts/functions
> @@ -944,6 +944,20 @@
>     fi
>  }
>
> +# Computes the target tuple from the configuration and the supplied
> +# vendor string
> +CT_BuildOneTargetTuple() {
> +    local vendor="${1}"
> +    local target
> +
> +    target="${CT_TARGET_ARCH}"
> +    target="${target}${vendor:+-${vendor}}"
> +    target="${target}${CT_TARGET_KERNEL:+-${CT_TARGET_KERNEL}}"
> +    target="${target}${CT_TARGET_SYS:+-${CT_TARGET_SYS}}"
> +
> +    echo "${target}"
> +}
> +
>  # Compute the target tuple from what is provided by the user
>  # Usage: CT_DoBuildTargetTuple
>  # In fact this function takes the environment variables to build the target
> @@ -993,10 +1007,7 @@
>     CT_DoKernelTupleValues
>
>     # Finish the target tuple construction
> -    CT_TARGET="${CT_TARGET_ARCH}"
> -    CT_TARGET="${CT_TARGET}${CT_TARGET_VENDOR:+-${CT_TARGET_VENDOR}}"
> -    CT_TARGET="${CT_TARGET}${CT_TARGET_KERNEL:+-${CT_TARGET_KERNEL}}"
> -    CT_TARGET="${CT_TARGET}${CT_TARGET_SYS:+-${CT_TARGET_SYS}}"
> +    CT_TARGET=$(CT_BuildOneTargetTuple "${CT_TARGET_VENDOR}")
>
>     # Sanity checks
>     __sed_alias=""
> @@ -1010,8 +1021,15 @@
>       :*:*:*" "*:) CT_Abort "Don't use spaces in the target sed transform,
> it breaks things.";;
>     esac
>
> -    # Canonicalise it
> -    CT_TARGET=$(CT_DoConfigSub "${CT_TARGET}")
> +    if [ "${CT_ALLOW_NO_VENDOR}" = "y" -a -z "${CT_TARGET_VENDOR}" ]; then
> +        # Canonicalise with a fake vendor string then strip it out
> +        local target=$(CT_BuildOneTargetTuple "CT_INVALID")
> +        CT_TARGET=$(CT_DoConfigSub "${target}" |sed -r -s s:CT_INVALID-::)
> +    else
> +        # Canonicalise it
> +        CT_TARGET=$(CT_DoConfigSub "${CT_TARGET}")
> +    fi
> +
>     # Prepare the target CFLAGS
>     CT_ARCH_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_ARCH_ENDIAN_CFLAG}"
>     CT_ARCH_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_ARCH_ARCH_CFLAG}"
>

Thanks, Michael!

-Bryan

--
For unsubscribe information see http://sourceware.org/lists.html#faq

  reply	other threads:[~2011-10-20  8:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19  3:24 Michael Hope
2011-10-19  6:18 ` Bryan Hundven
2011-10-20  0:36   ` Michael Hope
2011-10-20  1:28     ` Michael Hope
2011-10-20  8:32       ` Bryan Hundven [this message]
2011-10-20 22:02       ` Yann E. MORIN
2014-07-28  7:47         ` Bryan Hundven
2014-07-29 20:16           ` Bryan Hundven
2011-10-20 21:54     ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ+oik0f0Q9PjiHkERYUwS5FB4BKdSFKE-prR7MKiA0UUUybjQ@mail.gmail.com \
    --to=bryanhundven@gmail.com \
    --cc=crossgcc@sourceware.org \
    --cc=michael.hope@linaro.org \
    --cc=yann.morin.1998@anciens.enib.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).