toolchain-external-codescape-img-mips: new package
[buildroot-gz.git] / toolchain / toolchain-external / toolchain-external.mk
blob2acf9dda2466f4410c2f04458e44e6930fdb2a7e
1 ################################################################################
3 # toolchain-external
5 ################################################################################
7 TOOLCHAIN_EXTERNAL_ADD_TOOLCHAIN_DEPENDENCY = NO
9 # musl does not provide an implementation for sys/queue.h or sys/cdefs.h.
10 # So, add the musl-compat-headers package that will install those files,
11 # into the staging directory:
12 # sys/queue.h: header from NetBSD
13 # sys/cdefs.h: minimalist header bundled in Buildroot
14 ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
15 TOOLCHAIN_EXTERNAL_DEPENDENCIES += musl-compat-headers
16 endif
18 # All the definition that are common between the toolchain-external
19 # generic package and the toolchain-external-package infrastructure
20 # can be found in pkg-toolchain-external.mk
22 # Legacy toolchains that don't use the toolchain-external-package infrastructure
23 # yet. We can recognise that because no provider is set.
24 ifeq ($(call qstrip,$(BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL)),)
26 # Now we are the provider. However, we can't set it to ourselves or we'll get a
27 # circular dependency. Let's set it to a target that we always depend on
28 # instead.
29 BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL = skeleton
31 TOOLCHAIN_EXTERNAL_INSTALL_STAGING = YES
33 # In fact, we don't need to download the toolchain, since it is already
34 # available on the system, so force the site and source to be empty so
35 # that nothing will be downloaded/extracted.
36 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_PREINSTALLED),y)
37 TOOLCHAIN_EXTERNAL_SITE =
38 TOOLCHAIN_EXTERNAL_SOURCE =
39 endif
41 # The Codescape toolchain uses a sysroot layout that places them
42 # side-by-side instead of nested like multilibs. A symlink is needed
43 # much like for the nested sysroots which are handled in
44 # copy_toolchain_sysroot but there is not enough information in there
45 # to determine whether the sysroot layout was nested or side-by-side.
46 # Add the symlink here for now.
47 define TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_SYMLINK
48 $(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))"; \
49 ARCH_SUBDIR=`basename $${ARCH_SYSROOT_DIR}`; \
50 ln -snf . $(STAGING_DIR)/$${ARCH_SUBDIR}
51 endef
53 # Special fixup for Codescape MIPS toolchains, that have bin-<abi> and
54 # sbin-<abi> directories. We create symlinks bin -> bin-<abi> and sbin
55 # -> sbin-<abi> so that the rest of Buildroot can find the toolchain
56 # tools in the appropriate location.
57 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS),y)
58 ifeq ($(BR2_MIPS_OABI32),y)
59 TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_BIN_DIR_SUFFIX = o32
60 else ifeq ($(BR2_MIPS_NABI32),y)
61 TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_BIN_DIR_SUFFIX = n32
62 else ifeq ($(BR2_MIPS_NABI64),y)
63 TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_BIN_DIR_SUFFIX = n64
64 endif
66 define TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_STAGING_FIXUPS
67 rmdir $(STAGING_DIR)/usr/bin $(STAGING_DIR)/usr/sbin
68 ln -sf bin-$(TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_BIN_DIR_SUFFIX) $(STAGING_DIR)/usr/bin
69 ln -sf sbin-$(TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_BIN_DIR_SUFFIX) $(STAGING_DIR)/usr/sbin
70 endef
71 endif
73 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV7A),y)
74 TOOLCHAIN_EXTERNAL_SITE = http://software-dl.ti.com/sdoemb/sdoemb_public_sw/arago_toolchain/2011_09/exports
75 TOOLCHAIN_EXTERNAL_SOURCE = arago-2011.09-armv7a-linux-gnueabi-sdk.tar.bz2
76 TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = arago-toolchain-2011.09-sources.tar.bz2
77 define TOOLCHAIN_EXTERNAL_FIXUP_CMDS
78 mv $(@D)/arago-2011.09/armv7a/* $(@D)/
79 rm -rf $(@D)/arago-2011.09/
80 endef
81 TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS += TOOLCHAIN_EXTERNAL_FIXUP_CMDS
82 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE),y)
83 TOOLCHAIN_EXTERNAL_SITE = http://software-dl.ti.com/sdoemb/sdoemb_public_sw/arago_toolchain/2011_09/exports
84 TOOLCHAIN_EXTERNAL_SOURCE = arago-2011.09-armv5te-linux-gnueabi-sdk.tar.bz2
85 TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = arago-toolchain-2011.09-sources.tar.bz2
86 define TOOLCHAIN_EXTERNAL_FIXUP_CMDS
87 mv $(@D)/arago-2011.09/armv5te/* $(@D)/
88 rm -rf $(@D)/arago-2011.09/
89 endef
90 TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS += TOOLCHAIN_EXTERNAL_FIXUP_CMDS
91 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII),y)
92 TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/nios2-linux-gnu
93 TOOLCHAIN_EXTERNAL_SOURCE = sourceryg++-2016.05-10-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2
94 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH),y)
95 TOOLCHAIN_EXTERNAL_SITE = https://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu
96 TOOLCHAIN_EXTERNAL_SOURCE = renesas-2012.09-61-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2
97 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86),y)
98 TOOLCHAIN_EXTERNAL_SITE = https://sourcery.mentor.com/public/gnu_toolchain/i686-pc-linux-gnu
99 TOOLCHAIN_EXTERNAL_SOURCE = ia32-2012.09-62-i686-pc-linux-gnu-i386-linux.tar.bz2
100 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64),y)
101 TOOLCHAIN_EXTERNAL_SITE = https://sourcery.mentor.com/public/gnu_toolchain/x86_64-amd-linux-gnu
102 TOOLCHAIN_EXTERNAL_SOURCE = amd-2015.11-139-x86_64-amd-linux-gnu-i686-pc-linux-gnu.tar.bz2
103 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS),y)
104 TOOLCHAIN_EXTERNAL_SITE = http://codescape-mips-sdk.imgtec.com/components/toolchain/2016.05-03
105 TOOLCHAIN_EXTERNAL_SOURCE = Codescape.GNU.Tools.Package.2016.05-03.for.MIPS.MTI.Linux.CentOS-5.x86.tar.gz
106 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_SYMLINK
107 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_CODESCAPE_MIPS_STAGING_FIXUPS
108 TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS = 2
109 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS),y)
110 TOOLCHAIN_EXTERNAL_VERSION = 1.1.12
111 TOOLCHAIN_EXTERNAL_SITE = https://googledrive.com/host/0BwnS5DMB0YQ6bDhPZkpOYVFhbk0/musl-$(TOOLCHAIN_EXTERNAL_VERSION)
112 ifeq ($(BR2_arm)$(BR2_ARM_EABI),yy)
113 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-arm-linux-musleabi-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
114 else ifeq ($(BR2_arm)$(BR2_ARM_EABIHF),yy)
115 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-arm-linux-musleabihf-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
116 else ifeq ($(BR2_armeb),y)
117 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-armeb-linux-musleabi-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
118 else ifeq ($(BR2_i386),y)
119 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-i486-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
120 else ifeq ($(BR2_mips),y)
121 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-mips-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
122 else ifeq ($(BR2_mipsel):$(BR2_SOFT_FLOAT),y:)
123 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-mipsel-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
124 else ifeq ($(BR2_mipsel):$(BR2_SOFT_FLOAT),y:y)
125 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-mipsel-sf-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
126 else ifeq ($(BR2_powerpc),y)
127 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-powerpc-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
128 else ifeq ($(BR2_sh4),y)
129 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-sh4-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
130 else ifeq ($(BR2_sh4eb),y)
131 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-sh4eb-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
132 else ifeq ($(BR2_x86_64),y)
133 TOOLCHAIN_EXTERNAL_SOURCE = crossx86-x86_64-linux-musl-$(TOOLCHAIN_EXTERNAL_VERSION).tar.xz
134 endif
135 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC),y)
136 TOOLCHAIN_EXTERNAL_SITE = https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-2014.12
137 ifeq ($(BR2_arc750d)$(BR2_arc770d),y)
138 TOOLCHAIN_EXTERNAL_SYNOPSYS_CORE = arc700
139 else
140 TOOLCHAIN_EXTERNAL_SYNOPSYS_CORE = archs
141 endif
142 ifeq ($(BR2_arcle),y)
143 TOOLCHAIN_EXTERNAL_SYNOPSYS_ENDIANESS = le
144 else
145 TOOLCHAIN_EXTERNAL_SYNOPSYS_ENDIANESS = be
146 endif
147 TOOLCHAIN_EXTERNAL_SOURCE = arc_gnu_2014.12_prebuilt_uclibc_$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ENDIANESS)_$(TOOLCHAIN_EXTERNAL_SYNOPSYS_CORE)_linux_install.tar.gz
148 else
149 # Custom toolchain
150 TOOLCHAIN_EXTERNAL_SITE = $(patsubst %/,%,$(dir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL))))
151 TOOLCHAIN_EXTERNAL_SOURCE = $(notdir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL)))
152 # We can't check hashes for custom downloaded toolchains
153 BR_NO_CHECK_HASH_FOR += $(TOOLCHAIN_EXTERNAL_SOURCE)
154 endif
156 # Some toolchain vendors have a regular file naming pattern.
157 # For them, mass-define _ACTUAL_SOURCE_TARBALL based _SITE.
158 ifneq ($(findstring sourcery.mentor.com/public/gnu_toolchain,$(TOOLCHAIN_EXTERNAL_SITE)),)
159 TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL ?= \
160 $(subst -i686-pc-linux-gnu.tar.bz2,.src.tar.bz2,$(subst -i686-pc-linux-gnu-i386-linux.tar.bz2,-i686-pc-linux-gnu.src.tar.bz2,$(TOOLCHAIN_EXTERNAL_SOURCE)))
161 endif
163 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
164 TOOLCHAIN_EXTERNAL_EXCLUDES = usr/lib/locale/*
166 TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS += \
167 TOOLCHAIN_EXTERNAL_MOVE
168 endif
170 # Checks for an already installed toolchain: check the toolchain
171 # location, check that it is usable, and then verify that it
172 # matches the configuration provided in Buildroot: ABI, C++ support,
173 # kernel headers version, type of C library and all C library features.
174 define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
175 $(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC))
176 $(Q)$(call check_unusable_toolchain,$(TOOLCHAIN_EXTERNAL_CC))
177 $(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
178 $(call check_kernel_headers_version,\
179 $(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC)),\
180 $(call qstrip,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST))); \
181 $(call check_gcc_version,$(TOOLCHAIN_EXTERNAL_CC),\
182 $(call qstrip,$(BR2_TOOLCHAIN_GCC_AT_LEAST))); \
183 if test "$(BR2_arm)" = "y" ; then \
184 $(call check_arm_abi,\
185 "$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)",\
186 $(TOOLCHAIN_EXTERNAL_READELF)) ; \
187 fi ; \
188 if test "$(BR2_INSTALL_LIBSTDCPP)" = "y" ; then \
189 $(call check_cplusplus,$(TOOLCHAIN_EXTERNAL_CXX)) ; \
190 fi ; \
191 if test "$(BR2_TOOLCHAIN_HAS_FORTRAN)" = "y" ; then \
192 $(call check_fortran,$(TOOLCHAIN_EXTERNAL_FC)) ; \
193 fi ; \
194 if test "$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \
195 $(call check_uclibc,$${SYSROOT_DIR}) ; \
196 elif test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
197 $(call check_musl,$${SYSROOT_DIR}) ; \
198 else \
199 $(call check_glibc,$${SYSROOT_DIR}) ; \
201 $(Q)$(call check_toolchain_ssp,$(TOOLCHAIN_EXTERNAL_CC))
202 endef
204 TOOLCHAIN_EXTERNAL_BUILD_CMDS = $(TOOLCHAIN_WRAPPER_BUILD)
206 define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
207 $(TOOLCHAIN_WRAPPER_INSTALL)
208 $(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK)
209 $(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
210 $(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS_BFIN_FDPIC)
211 $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
212 $(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT)
213 endef
215 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y)
216 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_MUSL_LD_LINK
217 endif
219 # Even though we're installing things in both the staging, the host
220 # and the target directory, we do everything within the
221 # install-staging step, arbitrarily.
222 define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
223 $(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
224 $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
225 $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER)
226 $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_BFIN_FDPIC)
227 $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_BFIN_FLAT)
228 $(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
229 endef
231 endif # BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL
234 # Since a virtual package is just a generic package, we can still
235 # define commands for the legacy toolchains.
236 $(eval $(virtual-package))
238 # Ensure the external-toolchain package has a prefix defined.
239 # This comes after the virtual-package definition, which checks the provider.
240 ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
241 ifeq ($(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX)),)
242 $(error No prefix selected for external toolchain package $(BR2_PACKAGE_PROVIDES_TOOLCHAIN_EXTERNAL). Configuration error)
243 endif
244 endif
246 include toolchain/toolchain-external/*/*.mk