Skip to contentSkip to conversation

external toolchain: fix sysroot location if the toolchain was moved

PATCH New Yann E. MORIN 3 participants 3 messages Mar 24, 2010 – Mar 31, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 external toolchain: fix sysroot location if the toolchain was moved

From: Yann E. MORIN <[email protected]>

Sysrooted toolchain can be relocated. In this case, the sysroot is no longer located at the place it was configured at.

---

 toolchain/external-toolchain/ext-tool.mk |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
toolchain/external-toolchain/ext-tool.mk +8 -1
index 1f5aa19..80bdae6 100644
@@ -205,7 +205,14 @@ ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 EXTERNAL_LIBS+=libstdc++.so
 endif
 
-SYSROOT_DIR=$(shell LANG=C $(TARGET_CC) -v 2>&1 | grep ^Configured | tr " " "\n" | grep -- "--with-sysroot" | cut -f2 -d=)
+# This dance is needed because the toolchain may have been relocated, so the
+# configured paths may no longer match; fortunately, the sysroot moves along
+# the toolchain, so is always at the same place relative to the toolchain's
+# current location.
+CFG_PREFIX_DIR=$(shell LANG=C $(TARGET_CC) -v 2>&1 | grep ^Configured | tr " " "\n" | grep -- "--prefix=" | cut -f2 -d=)
+CFG_SYSROOT_DIR=$(shell LANG=C $(TARGET_CC) -v 2>&1 | grep ^Configured | tr " " "\n" | grep -- "--with-sysroot=" | cut -f2 -d=)
+REL_SYSROOT_DIR=$(shell echo "$(CFG_SYSROOT_DIR)" |sed -r -e 's:^$(CFG_PREFIX_DIR)::;')
+SYSROOT_DIR=$(TOOLCHAIN_EXTERNAL_PATH)/$(REL_SYSROOT_DIR)
 
 $(STAMP_DIR)/ext-toolchain-installed:
 	@echo "Checking external toolchain settings"
#1 lore raw

PATCH 1/1 external toolchain: fix sysroot location if the toolchain was moved

Hello,

Quoted 4 lines · On Wed, 24 Mar 2010 23:42:42 +0100 "Yann E. MORIN"…

Sysrooted toolchain can be relocated. In this case, the sysroot is no longer located at the place it was configured at.

Something like this was definitely needed. I had another implementation in mind, but yours is nice and simple. Thanks!

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 external toolchain: fix sysroot location if the toolchain was moved

In reply to Yann E. MORIN
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> From: Yann E. MORIN <[email protected]> Yann> Sysrooted toolchain can be relocated. In this case, the sysroot is no Yann> longer located at the place it was configured at.

Yann> Signed-off-by: Yann E. MORIN <[email protected]>

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard