From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12983 invoked by alias); 20 Oct 2011 01:28:46 -0000 Received: (qmail 12972 invoked by uid 22791); 20 Oct 2011 01:28:45 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-vw0-f41.google.com (HELO mail-vw0-f41.google.com) (209.85.212.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Oct 2011 01:28:24 +0000 Received: by vws16 with SMTP id 16so2057680vws.0 for ; Wed, 19 Oct 2011 18:28:24 -0700 (PDT) Received: by 10.52.110.10 with SMTP id hw10mr1156250vdb.32.1319074103846; Wed, 19 Oct 2011 18:28:23 -0700 (PDT) Received: from [192.168.1.13] (204.47.255.123.static.snap.net.nz. [123.255.47.204]) by mx.google.com with ESMTPS id hl5sm7344751vdb.18.2011.10.19.18.28.20 (version=SSLv3 cipher=OTHER); Wed, 19 Oct 2011 18:28:22 -0700 (PDT) Message-ID: <4E9F7932.8030401@linaro.org> Date: Thu, 20 Oct 2011 01:28:00 -0000 From: Michael Hope User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 MIME-Version: 1.0 To: Bryan Hundven CC: "Yann E. MORIN" , crossgcc@sourceware.org Subject: Re: [PATCH] scripts: support an empty vendor string References: <5b1330e7264a72b0b502.1318994645@crucis> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact crossgcc-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: crossgcc-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00052.txt.bz2 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 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}" -- For unsubscribe information see http://sourceware.org/lists.html#faq