summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2011-12-31 11:02:52 (GMT)
committer Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2012-03-01 19:26:36 (GMT)
commit50ac5f9a573d3918cc5257a30a7c85db7841ac42 (patch)
tree2d0c90a69d96f377f0238db865b1e50bed74d453
parent0729b544b3f943f238042d8169ccb8e2f6c88a95 (diff)
downloadbuildroot-50ac5f9a573d3918cc5257a30a7c85db7841ac42.tar.gz
buildroot-50ac5f9a573d3918cc5257a30a7c85db7841ac42.tar.bz2
Support multilib variants in sub-subdirectories
When an external toolchain has multiple variants organized in sub-directories, Buildroot only copies the selected sysroot and not all sysroots. In order to make this work, Buildroot creates a symbolic link of the name of the original selected sysroot to the main sysroot to trick the compiler so that it finds its libraries at the expected location. I.e, if the toolchain as the following organization (example take on the ARM CodeSourcery toolchain) : . for ARMv5T armv4 for ARMv4T thumb2 for ARMv7-A/Thumb and ARMv4T is selected, then Buildroot will copy the contents of armv4t/ from the toolchain into its $(STAGING_DIR) and then create a $(STAGING_DIR)/armv4t symbolic link to $(STAGING_DIR). However, our logic to do so only works when there was one directory level for multilib sysroots. But in the MIPS CodeSourcery toolchain there are multiple levels. For example, the MIPS16 soft-float little-endian sysroot variant is in mips16/soft-float/el/ compared to the main sysroot. This patch improves our logic to support this case. The logic is a bit more complicated as we don't want to create a symbolic link to an absolute path, but a symbolic link to a relative path, because we want the host/ directory to be relocatable. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r--toolchain/helpers.mk9
1 files changed, 8 insertions, 1 deletions
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 4c3f240..3f4818f 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -103,7 +103,14 @@ copy_toolchain_sysroot = \
if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \
cp -a $${SYSROOT_DIR}/usr/include $(STAGING_DIR)/usr ; \
fi ; \
- ln -s . $(STAGING_DIR)/$${ARCH_SUBDIR} ; \
+ mkdir -p `dirname $(STAGING_DIR)/$${ARCH_SUBDIR}` ; \
+ relpath="./" ; \
+ nbslashs=`echo -n $${ARCH_SUBDIR} | sed 's%[^/]%%g' | wc -c` ; \
+ for slash in `seq 1 $${nbslashs}` ; do \
+ relpath=$${relpath}"../" ; \
+ done ; \
+ ln -s $${relpath} $(STAGING_DIR)/$${ARCH_SUBDIR} ; \
+ echo "Symlinking $(STAGING_DIR)/$${ARCH_SUBDIR} -> $${relpath}" ; \
fi ; \
find $(STAGING_DIR) -type d | xargs chmod 755