Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/1] toolchain-external-custom: allow specifying relative path to binaries
Date: Sun, 25 Mar 2018 11:01:35 +0200	[thread overview]
Message-ID: <20180325090135.GJ2620@scaer> (raw)
In-Reply-To: <20180324151135.24751-1-ccrisan@gmail.com>

Calin, All,

On 2018-03-24 17:11 +0200, Calin Crisan spake thusly:
> There are cases where a downloaded toolchain doesn't have its binaries
> placed directly in a "bin" subfolder (where BuildRoot currently looks
> for them).
> 
> A common example is the official Raspberry Pi Toolchain
> (https://github.com/raspberrypi/tools), which has its binaries in
> "arm-bcm2708/arm-linux-gnueabihf/bin".
> 
> This commit introduces BR2_TOOLCHAIN_EXTERNAL_REL_BIN_PATH that defaults
> to "bin" and can be changed as needed.
> 
> Signed-off-by: Calin Crisan <ccrisan@gmail.com>
> ---
>  toolchain/toolchain-external/pkg-toolchain-external.mk            | 8 +++++++-
>  .../toolchain-external-custom/Config.in.options                   | 8 ++++++++
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index 3bf9fac412..e0a34e1ca9 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -71,13 +71,19 @@ else
>  TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH))
>  endif
>  
> +TOOLCHAIN_EXTERNAL_REL_BIN_PATH = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_REL_BIN_PATH))
> +# if binary path unset (non-custom external toolchains), use "bin"

Nit: uppercase at beginning of sentence:
    # If binary path....

> +ifeq ($(TOOLCHAIN_EXTERNAL_REL_BIN_PATH),)
> +TOOLCHAIN_EXTERNAL_REL_BIN_PATH = bin
> +endif

This can be achieved without the if-block:

    TOOLCHAIN_EXTERNAL_REL_BIN_PATH = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_REL_BIN_PATH))
    # If binary path unset (non-custom external toolchains), use "bin"
    TOOLCHAIN_EXTERNAL_REL_BIN_PATH ?= bin

This can even be achieved with a single assignment, too:

    # If binary path unset (non-custom external toolchains), use "bin"
    TOOLCHAIN_EXTERNAL_REL_BIN_PATH = $(or \
        $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_REL_BIN_PATH)), \
        bin)

I prefer that last solution (even if it's the same number os lines)...

Regards,
Yann E. MORIN.

>  ifeq ($(TOOLCHAIN_EXTERNAL_INSTALL_DIR),)
>  ifneq ($(TOOLCHAIN_EXTERNAL_PREFIX),)
>  # if no path set, figure it out from path
>  TOOLCHAIN_EXTERNAL_BIN := $(dir $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc))
>  endif
>  else
> -TOOLCHAIN_EXTERNAL_BIN = $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/bin
> +TOOLCHAIN_EXTERNAL_BIN = $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/$(TOOLCHAIN_EXTERNAL_REL_BIN_PATH)
>  endif
>  
>  # If this is a buildroot toolchain, it already has a wrapper which we want to
> diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> index 70c7d8e3c3..b711d9b81f 100644
> --- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> +++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
> @@ -12,6 +12,14 @@ config BR2_TOOLCHAIN_EXTERNAL_URL
>  	help
>  	  URL of the custom toolchain tarball to download and install.
>  
> +config BR2_TOOLCHAIN_EXTERNAL_REL_BIN_PATH
> +	string "Toolchain relative bin path"
> +	default "bin"
> +	depends on BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD
> +	help
> +	  Path to where the binaries (e.g. the compiler) can be found,
> +	  relative to the downloaded toolchain root directory.
> +
>  config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX
>  	string "Toolchain prefix"
>  	default "$(ARCH)-linux"
> -- 
> 2.16.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2018-03-25  9:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-24 15:11 [Buildroot] [PATCH v2 1/1] toolchain-external-custom: allow specifying relative path to binaries Calin Crisan
2018-03-25  9:01 ` Yann E. MORIN [this message]
2018-03-25 10:21   ` Calin Crisan

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=20180325090135.GJ2620@scaer \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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