Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] toolchain-external.mk: fix ARCH_SUBDIR for side-by-side sysroot toolchains
@ 2016-10-27 15:33 Vicente Olivert Riera
  2016-10-27 17:47 ` Yann E. MORIN
  2016-10-28 12:42 ` Thomas Petazzoni
  0 siblings, 2 replies; 3+ messages in thread
From: Vicente Olivert Riera @ 2016-10-27 15:33 UTC (permalink / raw)
  To: buildroot

ARCH_SUBDIR is computed based on the value of ARCH_SYSROOT_DIR and
SYSROOT_DIR. For nested toolchains ARCH_SYSROOT_DIR is a subdir of
SYSROOT_DIR, so a sed command like this one...

  sed -r -e "s:^${SYSROOT_DIR}(.*)/$:\1:"

...basically removes the leading SYSROOT_DIR part from ARCH_SYSROOT_DIR.

But, for side-by-side sysroot toolchains ARCH_SYSROOT_DIR and
SYSROOT_DIR are at the same level, so the above sed command doesn't
make any effect. This patch detects that situation and uses an
appropriate sed command for it.

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 toolchain/toolchain-external/toolchain-external.mk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index f7c6a19..a25c102 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -665,7 +665,12 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
 			SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
 		fi ; \
 	fi ; \
-	ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
+	if [ "`dirname $${ARCH_SYSROOT_DIR}`" = "`dirname $${SYSROOT_DIR}`" ] ; then \
+		SYSROOT_DIR_DIRNAME=`dirname $${SYSROOT_DIR}`/ ; \
+		ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR_DIRNAME}(.*)/$$:\1:"` ; \
+	else \
+		ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
+	fi ; \
 	$(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \
 	$(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR})
 endef
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] toolchain-external.mk: fix ARCH_SUBDIR for side-by-side sysroot toolchains
  2016-10-27 15:33 [Buildroot] [PATCH] toolchain-external.mk: fix ARCH_SUBDIR for side-by-side sysroot toolchains Vicente Olivert Riera
@ 2016-10-27 17:47 ` Yann E. MORIN
  2016-10-28 12:42 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2016-10-27 17:47 UTC (permalink / raw)
  To: buildroot

Vicente, All,

On 2016-10-27 16:33 +0100, Vicente Olivert Riera spake thusly:
> ARCH_SUBDIR is computed based on the value of ARCH_SYSROOT_DIR and
> SYSROOT_DIR. For nested toolchains ARCH_SYSROOT_DIR is a subdir of
> SYSROOT_DIR, so a sed command like this one...
> 
>   sed -r -e "s:^${SYSROOT_DIR}(.*)/$:\1:"
> 
> ...basically removes the leading SYSROOT_DIR part from ARCH_SYSROOT_DIR.
> 
> But, for side-by-side sysroot toolchains ARCH_SYSROOT_DIR and
> SYSROOT_DIR are at the same level, so the above sed command doesn't
> make any effect. This patch detects that situation and uses an
> appropriate sed command for it.

As discussed on IRC, there was a previous patch of mine on the topic:
    https://patchwork.ozlabs.org/patch/627505/

I did not yet send v2 of that patch:
    https://git.buildroot.org/~ymorin/git/buildroot/commit/?h=yem/ext-toolchain-fixes&id=30ab28ce467b7d7dea5e181cae69ae882f936e98

I'll send it shortly so we can compare the two and decide which is
best.

Regards,
Yann E. MORIN.

> Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
> ---
>  toolchain/toolchain-external/toolchain-external.mk | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index f7c6a19..a25c102 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -665,7 +665,12 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
>  			SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
>  		fi ; \
>  	fi ; \
> -	ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
> +	if [ "`dirname $${ARCH_SYSROOT_DIR}`" = "`dirname $${SYSROOT_DIR}`" ] ; then \
> +		SYSROOT_DIR_DIRNAME=`dirname $${SYSROOT_DIR}`/ ; \
> +		ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR_DIRNAME}(.*)/$$:\1:"` ; \
> +	else \
> +		ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
> +	fi ; \
>  	$(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \
>  	$(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR})
>  endef
> -- 
> 2.10.1
> 
> _______________________________________________
> 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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] toolchain-external.mk: fix ARCH_SUBDIR for side-by-side sysroot toolchains
  2016-10-27 15:33 [Buildroot] [PATCH] toolchain-external.mk: fix ARCH_SUBDIR for side-by-side sysroot toolchains Vicente Olivert Riera
  2016-10-27 17:47 ` Yann E. MORIN
@ 2016-10-28 12:42 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2016-10-28 12:42 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 27 Oct 2016 16:33:42 +0100, Vicente Olivert Riera wrote:

> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index f7c6a19..a25c102 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -665,7 +665,12 @@ define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
>  			SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
>  		fi ; \
>  	fi ; \
> -	ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
> +	if [ "`dirname $${ARCH_SYSROOT_DIR}`" = "`dirname $${SYSROOT_DIR}`" ] ; then \
> +		SYSROOT_DIR_DIRNAME=`dirname $${SYSROOT_DIR}`/ ; \
> +		ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR_DIRNAME}(.*)/$$:\1:"` ; \
> +	else \
> +		ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
> +	fi ; \

I've applied your patch, which I have slightly improved to handle the
SYSROOT_DIR == ARCH_SYSROOT_DIR case, where ARCH_SUBDIR should be
empty. This way, I believe we handle all three cases:

 1. SYSROOT_DIR == ARCH_SYSROOT_DIR

 2. SYSROOT_DIR and ARCH_SYSROOT_DIR are side-by-side

 3. ARCH_SYSROOT_DIR is nested in SYSROOT_DIR

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-28 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-27 15:33 [Buildroot] [PATCH] toolchain-external.mk: fix ARCH_SUBDIR for side-by-side sysroot toolchains Vicente Olivert Riera
2016-10-27 17:47 ` Yann E. MORIN
2016-10-28 12:42 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox