summaryrefslogtreecommitdiff
path: root/toolchain/external-toolchain/ext-tool.mk
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@anciens.enib.fr>2010-03-24 23:42:42 +0100
committerPeter Korsgaard <jacmet@sunsite.dk>2010-03-31 10:50:40 +0200
commit3b7aee23f2ab732f06b8a090ca002fb102d547ee (patch)
treee947f2b5ca873b75a89d28f04aefd3e35d96bd6c /toolchain/external-toolchain/ext-tool.mk
parent0fd372457e6af71a4f5f47827af61816a83ac67d (diff)
external toolchain: fix sysroot location if the toolchain was moved
Sysrooted toolchain can be relocated. In this case, the sysroot is no longer located at the place it was configured at. Signed-off-by: Yann E. MORIN <yann.morin.1998@anciens.enib.fr> Acked-By: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'toolchain/external-toolchain/ext-tool.mk')
-rw-r--r--toolchain/external-toolchain/ext-tool.mk9
1 files changed, 8 insertions, 1 deletions
diff --git a/toolchain/external-toolchain/ext-tool.mk b/toolchain/external-toolchain/ext-tool.mk
index 1f5aa1932..80bdae63b 100644
--- a/toolchain/external-toolchain/ext-tool.mk
+++ b/toolchain/external-toolchain/ext-tool.mk
@@ -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"