All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] toolchain: add a harmless link when sysroot detection is not accurate
@ 2016-01-22 12:14 Vicente Olivert Riera
  2016-01-22 13:15 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Vicente Olivert Riera @ 2016-01-22 12:14 UTC (permalink / raw)
  To: buildroot

Sometimes is not possible to detect if the sysroots are nested or side
by side. For instance this happens for MIPS big endian, where the
sysroot and the arch-sysroot directories are the same.

For those cases where the sysroot detection is not accurate we add a
harmless symlink necessary for certain toolchains.

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

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 70695ee..1f8a60c 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -163,6 +163,7 @@ copy_toolchain_sysroot = \
 	if [ $${SYSROOT_DIR_CANON} != $${ARCH_SYSROOT_DIR_CANON} ] ; then \
 		relpath="./" ; \
 		if [ $${ARCH_SYSROOT_DIR_CANON:0:$${\#SYSROOT_DIR_CANON}} == $${SYSROOT_DIR_CANON} ] ; then \
+			echo "Nested sysroots detected." ; \
 			if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \
 				cp -a $${SYSROOT_DIR}/usr/include $(STAGING_DIR)/usr ; \
 			fi ; \
@@ -174,9 +175,16 @@ copy_toolchain_sysroot = \
 			ln -s $${relpath} $(STAGING_DIR)/$${ARCH_SUBDIR} ; \
 			echo "Symlinking $(STAGING_DIR)/$${ARCH_SUBDIR} -> $${relpath}" ; \
 		elif [ `dirname $${ARCH_SYSROOT_DIR_CANON}` == `dirname $${SYSROOT_DIR_CANON}` ] ; then \
+			echo "Side by side sysroots detected." ; \
 			ln -snf $${relpath} $(STAGING_DIR)/`basename $${ARCH_SYSROOT_DIR_CANON}` ; \
 			echo "Symlinking $(STAGING_DIR)/`basename $${ARCH_SYSROOT_DIR_CANON}` -> $${relpath}" ; \
 		fi ; \
+	else \
+		relpath="./" ; \
+		echo "Unable to detect if sysroots are nested or side by side." ; \
+		echo "Creating a harmless symlink necessary for certain toolchains." ; \
+		ln -snf $${relpath} $(STAGING_DIR)/`basename $${ARCH_SYSROOT_DIR_CANON}` ; \
+		echo "Symlinking $(STAGING_DIR)/`basename $${ARCH_SYSROOT_DIR_CANON}` -> $${relpath}" ; \
 	fi ; \
 	if test -n "$${SUPPORT_LIB_DIR}" ; then \
 		cp -a $${SUPPORT_LIB_DIR}/* $(STAGING_DIR)/lib/ ; \
-- 
2.4.10

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

* [Buildroot] [PATCH] toolchain: add a harmless link when sysroot detection is not accurate
  2016-01-22 12:14 [Buildroot] [PATCH] toolchain: add a harmless link when sysroot detection is not accurate Vicente Olivert Riera
@ 2016-01-22 13:15 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2016-01-22 13:15 UTC (permalink / raw)
  To: buildroot

Dear Vicente Olivert Riera,

On Fri, 22 Jan 2016 12:14:22 +0000, Vicente Olivert Riera wrote:
> Sometimes is not possible to detect if the sysroots are nested or side
> by side. For instance this happens for MIPS big endian, where the
> sysroot and the arch-sysroot directories are the same.
> 
> For those cases where the sysroot detection is not accurate we add a
> harmless symlink necessary for certain toolchains.
> 
> Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>

Gaah, even more magic in this code.

Can you update the comment above the function, and also in the commit
log explain which toolchain is affected, and give outputs of
-print-file-name that explain the problem ?

It is really important to document all those things, because we
progressively adjust this sorcery to accommodate all toolchains, but
when we'll want to refactor this stuff, it will be very useful to have
some explanation as to why each case was handled this way.

The more I look at this external toolchain mess, the more I think we
should have less magic, and simply for each toolchain have some
explicit code in BR that says "this toolchain is organized this way".
Yes, it means that we will no longer automagically accommodate to
custom external toolchains...

Best regards,

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

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

end of thread, other threads:[~2016-01-22 13:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-22 12:14 [Buildroot] [PATCH] toolchain: add a harmless link when sysroot detection is not accurate Vicente Olivert Riera
2016-01-22 13:15 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.