1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# toolchain-external-codescape-mti-mips
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunTOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_VERSION = 2018.09-02
8*4882a593SmuzhiyunTOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_SITE = https://codescape.mips.com/components/toolchain/$(TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_VERSION)
9*4882a593SmuzhiyunTOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_STRIP_COMPONENTS = 2
10*4882a593Smuzhiyun
11*4882a593Smuzhiyunifeq ($(HOSTARCH),x86)
12*4882a593SmuzhiyunTOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_SOURCE = Codescape.GNU.Tools.Package.$(TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_VERSION).for.MIPS.MTI.Linux.CentOS-6.x86.tar.gz
13*4882a593Smuzhiyunelse
14*4882a593SmuzhiyunTOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_SOURCE = Codescape.GNU.Tools.Package.$(TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_VERSION).for.MIPS.MTI.Linux.CentOS-6.x86_64.tar.gz
15*4882a593Smuzhiyunendif
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun# Special fixup for Codescape MIPS toolchains, that have bin-<abi> and
18*4882a593Smuzhiyun# sbin-<abi> directories. We create symlinks bin -> bin-<abi> and sbin
19*4882a593Smuzhiyun# -> sbin-<abi> so that the rest of Buildroot can find the toolchain
20*4882a593Smuzhiyun# tools in the appropriate location.
21*4882a593Smuzhiyunifeq ($(BR2_MIPS_OABI32),y)
22*4882a593SmuzhiyunTOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_BIN_DIR_SUFFIX = o32
23*4882a593Smuzhiyunelse ifeq ($(BR2_MIPS_NABI32),y)
24*4882a593SmuzhiyunTOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_BIN_DIR_SUFFIX = n32
25*4882a593Smuzhiyunelse ifeq ($(BR2_MIPS_NABI64),y)
26*4882a593SmuzhiyunTOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_BIN_DIR_SUFFIX = n64
27*4882a593Smuzhiyunendif
28*4882a593Smuzhiyun
29*4882a593Smuzhiyundefine TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_STAGING_FIXUPS
30*4882a593Smuzhiyun	rmdir $(STAGING_DIR)/usr/bin $(STAGING_DIR)/usr/sbin
31*4882a593Smuzhiyun	ln -sf bin-$(TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_BIN_DIR_SUFFIX) $(STAGING_DIR)/usr/bin
32*4882a593Smuzhiyun	ln -sf sbin-$(TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_BIN_DIR_SUFFIX) $(STAGING_DIR)/usr/sbin
33*4882a593Smuzhiyunendef
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun# The Codescape toolchain uses a sysroot layout that places them
36*4882a593Smuzhiyun# side-by-side instead of nested like multilibs. A symlink is needed
37*4882a593Smuzhiyun# much like for the nested sysroots which are handled in
38*4882a593Smuzhiyun# copy_toolchain_sysroot but there is not enough information in there
39*4882a593Smuzhiyun# to determine whether the sysroot layout was nested or side-by-side.
40*4882a593Smuzhiyun# Add the symlink here for now.
41*4882a593Smuzhiyundefine TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_SYMLINK
42*4882a593Smuzhiyun	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))"; \
43*4882a593Smuzhiyun	ARCH_SUBDIR=`basename $${ARCH_SYSROOT_DIR}`; \
44*4882a593Smuzhiyun	ln -snf . $(STAGING_DIR)/$${ARCH_SUBDIR}
45*4882a593Smuzhiyunendef
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunTOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_POST_INSTALL_STAGING_HOOKS += \
48*4882a593Smuzhiyun	TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_STAGING_FIXUPS \
49*4882a593Smuzhiyun	TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS_SYMLINK
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun$(eval $(toolchain-external-package))
52