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>
This commit is contained in:
parent
0729b544b3
commit
50ac5f9a57
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user