diff mbox series

[v2,1/1] toolchain-external-custom: allow specifying relative path to binaries

Message ID 20180324151135.24751-1-ccrisan@gmail.com
State Superseded
Headers show
Series [v2,1/1] toolchain-external-custom: allow specifying relative path to binaries | expand

Commit Message

Calin Crisan March 24, 2018, 3:11 p.m. UTC
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(-)

Comments

Yann E. MORIN March 25, 2018, 9:01 a.m. UTC | #1
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@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Calin Crisan March 25, 2018, 10:21 a.m. UTC | #2
Yann,

Thanks for reviewing my patch. I have now submitted a v3 that addresses
your remarks.

On Sun, Mar 25, 2018 at 12:01 PM, Yann E. MORIN <yann.morin.1998@free.fr>
wrote:

> 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@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.  |
> '------------------------------^-------^------------------^-
> -------------------'
>
<div dir="ltr">Yann,<div><br></div><div>Thanks for reviewing my patch. I have now submitted a v3 that addresses your remarks.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 25, 2018 at 12:01 PM, Yann E. MORIN <span dir="ltr">&lt;<a href="mailto:yann.morin.1998@free.fr" target="_blank">yann.morin.1998@free.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Calin, All,<br>
<br>
On 2018-03-24 17:11 +0200, Calin Crisan spake thusly:<br>
<span class="">&gt; There are cases where a downloaded toolchain doesn&#39;t have its binaries<br>
&gt; placed directly in a &quot;bin&quot; subfolder (where BuildRoot currently looks<br>
&gt; for them).<br>
&gt;<br>
&gt; A common example is the official Raspberry Pi Toolchain<br>
&gt; (<a href="https://github.com/raspberrypi/tools" rel="noreferrer" target="_blank">https://github.com/<wbr>raspberrypi/tools</a>), which has its binaries in<br>
&gt; &quot;arm-bcm2708/arm-linux-<wbr>gnueabihf/bin&quot;.<br>
&gt;<br>
&gt; This commit introduces BR2_TOOLCHAIN_EXTERNAL_REL_<wbr>BIN_PATH that defaults<br>
&gt; to &quot;bin&quot; and can be changed as needed.<br>
&gt;<br>
&gt; Signed-off-by: Calin Crisan &lt;<a href="mailto:ccrisan@gmail.com">ccrisan@gmail.com</a>&gt;<br>
&gt; ---<br>
&gt;  toolchain/toolchain-external/<a href="http://pkg-toolchain-external.mk" rel="noreferrer" target="_blank">p<wbr>kg-toolchain-external.mk</a>            | 8 +++++++-<br>
&gt;  .../toolchain-external-custom/<wbr>Config.in.options                   | 8 ++++++++<br>
&gt;  2 files changed, 15 insertions(+), 1 deletion(-)<br>
&gt;<br>
&gt; diff --git a/toolchain/toolchain-<wbr>external/<a href="http://pkg-toolchain-external.mk" rel="noreferrer" target="_blank">pkg-toolchain-<wbr>external.mk</a> b/toolchain/toolchain-<wbr>external/<a href="http://pkg-toolchain-external.mk" rel="noreferrer" target="_blank">pkg-toolchain-<wbr>external.mk</a><br>
&gt; index 3bf9fac412..e0a34e1ca9 100644<br>
&gt; --- a/toolchain/toolchain-<wbr>external/<a href="http://pkg-toolchain-external.mk" rel="noreferrer" target="_blank">pkg-toolchain-<wbr>external.mk</a><br>
&gt; +++ b/toolchain/toolchain-<wbr>external/<a href="http://pkg-toolchain-external.mk" rel="noreferrer" target="_blank">pkg-toolchain-<wbr>external.mk</a><br>
&gt; @@ -71,13 +71,19 @@ else<br>
&gt;  TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(call qstrip,$(BR2_TOOLCHAIN_<wbr>EXTERNAL_PATH))<br>
&gt;  endif<br>
&gt;<br>
&gt; +TOOLCHAIN_EXTERNAL_REL_BIN_<wbr>PATH = $(call qstrip,$(BR2_TOOLCHAIN_<wbr>EXTERNAL_REL_BIN_PATH))<br>
&gt; +# if binary path unset (non-custom external toolchains), use &quot;bin&quot;<br>
<br>
</span>Nit: uppercase at beginning of sentence:<br>
    # If binary path....<br>
<span class=""><br>
&gt; +ifeq ($(TOOLCHAIN_EXTERNAL_REL_BIN_<wbr>PATH),)<br>
&gt; +TOOLCHAIN_EXTERNAL_REL_BIN_<wbr>PATH = bin<br>
&gt; +endif<br>
<br>
</span>This can be achieved without the if-block:<br>
<br>
    TOOLCHAIN_EXTERNAL_REL_BIN_<wbr>PATH = $(call qstrip,$(BR2_TOOLCHAIN_<wbr>EXTERNAL_REL_BIN_PATH))<br>
    # If binary path unset (non-custom external toolchains), use &quot;bin&quot;<br>
    TOOLCHAIN_EXTERNAL_REL_BIN_<wbr>PATH ?= bin<br>
<br>
This can even be achieved with a single assignment, too:<br>
<br>
    # If binary path unset (non-custom external toolchains), use &quot;bin&quot;<br>
    TOOLCHAIN_EXTERNAL_REL_BIN_<wbr>PATH = $(or \<br>
        $(call qstrip,$(BR2_TOOLCHAIN_<wbr>EXTERNAL_REL_BIN_PATH)), \<br>
        bin)<br>
<br>
I prefer that last solution (even if it&#39;s the same number os lines)...<br>
<br>
Regards,<br>
Yann E. MORIN.<br>
<div><div class="h5"><br>
&gt;  ifeq ($(TOOLCHAIN_EXTERNAL_INSTALL_<wbr>DIR),)<br>
&gt;  ifneq ($(TOOLCHAIN_EXTERNAL_PREFIX),<wbr>)<br>
&gt;  # if no path set, figure it out from path<br>
&gt;  TOOLCHAIN_EXTERNAL_BIN := $(dir $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-<wbr>gcc))<br>
&gt;  endif<br>
&gt;  else<br>
&gt; -TOOLCHAIN_EXTERNAL_BIN = $(TOOLCHAIN_EXTERNAL_INSTALL_<wbr>DIR)/bin<br>
&gt; +TOOLCHAIN_EXTERNAL_BIN = $(TOOLCHAIN_EXTERNAL_INSTALL_<wbr>DIR)/$(TOOLCHAIN_EXTERNAL_REL_<wbr>BIN_PATH)<br>
&gt;  endif<br>
&gt;<br>
&gt;  # If this is a buildroot toolchain, it already has a wrapper which we want to<br>
&gt; diff --git a/toolchain/toolchain-<wbr>external/toolchain-external-<wbr>custom/Config.in.options b/toolchain/toolchain-<wbr>external/toolchain-external-<wbr>custom/Config.in.options<br>
&gt; index 70c7d8e3c3..b711d9b81f 100644<br>
&gt; --- a/toolchain/toolchain-<wbr>external/toolchain-external-<wbr>custom/Config.in.options<br>
&gt; +++ b/toolchain/toolchain-<wbr>external/toolchain-external-<wbr>custom/Config.in.options<br>
&gt; @@ -12,6 +12,14 @@ config BR2_TOOLCHAIN_EXTERNAL_URL<br>
&gt;       help<br>
&gt;         URL of the custom toolchain tarball to download and install.<br>
&gt;<br>
&gt; +config BR2_TOOLCHAIN_EXTERNAL_REL_<wbr>BIN_PATH<br>
&gt; +     string &quot;Toolchain relative bin path&quot;<br>
&gt; +     default &quot;bin&quot;<br>
&gt; +     depends on BR2_TOOLCHAIN_EXTERNAL_<wbr>DOWNLOAD<br>
&gt; +     help<br>
&gt; +       Path to where the binaries (e.g. the compiler) can be found,<br>
&gt; +       relative to the downloaded toolchain root directory.<br>
&gt; +<br>
&gt;  config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_<wbr>PREFIX<br>
&gt;       string &quot;Toolchain prefix&quot;<br>
&gt;       default &quot;$(ARCH)-linux&quot;<br>
&gt; --<br>
&gt; 2.16.2<br>
&gt;<br>
</div></div>&gt; ______________________________<wbr>_________________<br>
&gt; buildroot mailing list<br>
&gt; <a href="mailto:buildroot@busybox.net">buildroot@busybox.net</a><br>
&gt; <a href="http://lists.busybox.net/mailman/listinfo/buildroot" rel="noreferrer" target="_blank">http://lists.busybox.net/<wbr>mailman/listinfo/buildroot</a><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
.-----------------.-----------<wbr>---------.------------------.-<wbr>-------------------.<br>
|  Yann E. MORIN  | Real-Time Embedded | /&quot;\ ASCII RIBBON | Erics&#39; conspiracy: |<br>
| <a href="tel:%2B33%20662%20376%20056" value="+33662376056">+33 662 376 056</a> | Software  Designer | \ / CAMPAIGN     |  ___               |<br>
| <a href="tel:%2B33%20223%20225%20172" value="+33223225172">+33 223 225 172</a> `------------.-------:  X  AGAINST      |  \e/  There is no  |<br>
| <a href="http://ymorin.is-a-geek.org/" rel="noreferrer" target="_blank">http://ymorin.is-a-geek.org/</a> | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |<br>
&#39;-----------------------------<wbr>-^-------^------------------^-<wbr>-------------------&#39;<br>
</font></span></blockquote></div><br></div>
diff mbox series

Patch

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"
+ifeq ($(TOOLCHAIN_EXTERNAL_REL_BIN_PATH),)
+TOOLCHAIN_EXTERNAL_REL_BIN_PATH = bin
+endif
+
 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"