toolchain-external-custom: allow specifying relative path to binaries
PATCH v3 1/1 toolchain-external-custom: allow specifying relative path to binaries
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.
--- toolchain/toolchain-external/pkg-toolchain-external.mk | 7 ++++++- .../toolchain-external-custom/Config.in.options | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)
toolchain/toolchain-external/pkg-toolchain-external.mk +6 -1
@@ -71,13 +71,18 @@ else TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH)) endif +# If binary path unset (known, supported external toolchains), use "bin". +TOOLCHAIN_EXTERNAL_REL_BIN_PATH = $(or \ + $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_REL_BIN_PATH)), \ + bin) + 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
toolchain/toolchain-external/toolchain-external-custom/Config.in.options +8 -0
@@ -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"
Signature · 1 line
2.16.2
PATCH v3 1/1 toolchain-external-custom: allow specifying relative path to binaries
Calin, All,
On 2018-03-25 13:18 +0300, Calin Crisan spake thusly:
Quoted 4 lines
There are cases where a downloaded toolchain doesn't have its binaries placed directly in a "bin" subfolder (where BuildRoot currently looks for them).
Quoted 8 lines
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_PATHthat defaults to "bin" and can be changed as needed.Signed-off-by Calin Crisan <[email protected]>
Regards,
Yann E. MORIN.
Quoted 55 lines
--- toolchain/toolchain-external/pkg-toolchain-external.mk | 7 ++++++- .../toolchain-external-custom/Config.in.options | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)toolchain/toolchain-external/pkg-toolchain-external.mk +6
-1@@ -71,13 +71,18 @@ else TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH)) endif +# If binary path unset (known, supported external toolchains), use "bin". +TOOLCHAIN_EXTERNAL_REL_BIN_PATH = $(or \ + $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_REL_BIN_PATH)), \ + bin) + 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 totoolchain/toolchain-external/toolchain-external-custom/Config.in.options +8
-0@@ -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"Signature · 6 lines
2.16.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH v3 1/1 toolchain-external-custom: allow specifying relative path to binaries
In reply to Calin CrisanHello,
toolchain/toolchain-external/pkg-toolchain-external.mk else · line 77
Quoted 4 lines · Calin Crisan
toolchain/toolchain-external/pkg-toolchain-external.mk +4
-0+# If binary path unset (known, supported external toolchains), use "bin". +TOOLCHAIN_EXTERNAL_REL_BIN_PATH = $(or \ + $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_REL_BIN_PATH)), \ + bin)
I found this syntax a bit ugly, so I changed this to:
+TOOLCHAIN_EXTERNAL_REL_BIN_PATH = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_REL_BIN_PATH)) +ifeq ($(TOOLCHAIN_EXTERNAL_REL_BIN_PATH),) +TOOLCHAIN_EXTERNAL_REL_BIN_PATH = bin
+endif
and also I moved this into...
Quoted 7 lines
+
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
... this condition
toolchain/toolchain-external/pkg-toolchain-external.mk else · line 86
Quoted 3 lines
toolchain/toolchain-external/pkg-toolchain-external.mk +1
-1-TOOLCHAIN_EXTERNAL_BIN = $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/bin +TOOLCHAIN_EXTERNAL_BIN = $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/$(TOOLCHAIN_EXTERNAL_REL_BIN_PATH) endif
Applied with this change.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com