toolchain-external: hook for Codescape toolchain side-by-side layout
authorVicente Olivert Riera <Vincent.Riera@imgtec.com>
Tue, 10 May 2016 14:01:38 +0000 (15:01 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 7 Jun 2016 21:41:36 +0000 (23:41 +0200)
The Codescape toolchain uses a sysroot layout that places them
side-by-side instead of nested like multilibs. A symlink is needed much
like for the nested sysroots which are handled in copy_toolchain_sysroot
but there is not enough information in there to determine whether the
sysroot layout was nested or side-by-side.

For the above reason plus the fact that this is the only toolchain
needing this, better to handle that symlink creation using a hook which
will be executed only when that toolchain is selected.

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
toolchain/toolchain-external/toolchain-external.mk

index f3443a23923c0f4753e9259e67eb1825467b15d8..7f46234906435f05aa2da458f6138671a3c46315 100644 (file)
@@ -262,6 +262,18 @@ define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
        ln -snf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu
 endef
 
+# The Codescape toolchain uses a sysroot layout that places them
+# side-by-side instead of nested like multilibs. A symlink is needed
+# much like for the nested sysroots which are handled in
+# copy_toolchain_sysroot but there is not enough information in there
+# to determine whether the sysroot layout was nested or side-by-side.
+# Add the symlink here for now.
+define TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_SYMLINK
+       $(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))"; \
+       ARCH_SUBDIR=`basename $${ARCH_SYSROOT_DIR}`; \
+       ln -snf . $(STAGING_DIR)/$${ARCH_SUBDIR}
+endef
+
 # Special fixup for Codescape MIPS toolchains, that have bin-<abi> and
 # sbin-<abi> directories. We create symlinks bin -> bin-<abi> and sbin
 # -> sbin-<abi> so that the rest of Buildroot can find the toolchain
@@ -351,11 +363,13 @@ TOOLCHAIN_EXTERNAL_SOURCE = amd-2015.11-139-x86_64-amd-linux-gnu-i686-pc-linux-g
 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS),y)
 TOOLCHAIN_EXTERNAL_SITE = http://codescape-mips-sdk.imgtec.com/components/toolchain/2015.10-04
 TOOLCHAIN_EXTERNAL_SOURCE = Codescape.GNU.Tools.Package.2015.10-04.for.MIPS.IMG.Linux.CentOS-5.x86.tar.gz
+TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_SYMLINK
 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_STAGING_FIXUPS
 TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS = 2
 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS),y)
 TOOLCHAIN_EXTERNAL_SITE = http://codescape-mips-sdk.imgtec.com/components/toolchain/2015.10-04
 TOOLCHAIN_EXTERNAL_SOURCE = Codescape.GNU.Tools.Package.2015.10-04.for.MIPS.MTI.Linux.CentOS-5.x86.tar.gz
+TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_SYMLINK
 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_STAGING_FIXUPS
 TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS = 2
 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX),y)