1 ################################################################################
5 ################################################################################
8 # This package implements the support for external toolchains, i.e
9 # toolchains that are available pre-built, ready to use. Such toolchain
10 # may either be readily available on the Web (Linaro, Sourcery
11 # CodeBench, from processor vendors) or may be built with tools like
12 # Crosstool-NG or Buildroot itself. So far, we have tested this
15 # * Toolchains generated by Crosstool-NG
16 # * Toolchains generated by Buildroot
17 # * Toolchains provided by Linaro for the ARM and AArch64
19 # * Sourcery CodeBench toolchains (from Mentor Graphics) for the ARM,
20 # MIPS, PowerPC, x86, x86_64 and NIOS 2 architectures. For the MIPS
21 # toolchain, the -muclibc variant isn't supported yet, only the
22 # default glibc-based variant is.
23 # * Analog Devices toolchains for the Blackfin architecture
24 # * Xilinx toolchains for the Microblaze architecture
25 # * Synopsys DesignWare toolchains for ARC cores
27 # The basic principle is the following
29 # 1. If the toolchain is not pre-installed, download and extract it
30 # in $(TOOLCHAIN_EXTERNAL_INSTALL_DIR). Otherwise,
31 # $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) points to were the toolchain has
32 # already been installed by the user.
34 # 2. For all external toolchains, perform some checks on the
35 # conformity between the toolchain configuration described in the
36 # Buildroot menuconfig system, and the real configuration of the
37 # external toolchain. This is for example important to make sure that
38 # the Buildroot configuration system knows whether the toolchain
39 # supports RPC, IPv6, locales, large files, etc. Unfortunately, these
40 # things cannot be detected automatically, since the value of these
41 # options (such as BR2_TOOLCHAIN_HAS_NATIVE_RPC) are needed at
42 # configuration time because these options are used as dependencies
43 # for other options. And at configuration time, we are not able to
44 # retrieve the external toolchain configuration.
46 # 3. Copy the libraries needed at runtime to the target directory,
47 # $(TARGET_DIR). Obviously, things such as the C library, the dynamic
48 # loader and a few other utility libraries are needed if dynamic
49 # applications are to be executed on the target system.
51 # 4. Copy the libraries and headers to the staging directory. This
52 # will allow all further calls to gcc to be made using --sysroot
53 # $(STAGING_DIR), which greatly simplifies the compilation of the
54 # packages when using external toolchains. So in the end, only the
55 # cross-compiler binaries remains external, all libraries and headers
56 # are imported into the Buildroot tree.
58 # 5. Build a toolchain wrapper which executes the external toolchain
59 # with a number of arguments (sysroot/march/mtune/..) hardcoded,
60 # so we're sure the correct configuration is always used and the
61 # toolchain behaves similar to an internal toolchain.
62 # This toolchain wrapper and symlinks are installed into
63 # $(HOST_DIR)/usr/bin like for the internal toolchains, and the rest
64 # of Buildroot is handled identical for the 2 toolchain types.
66 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC
)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC
),y
)
67 LIB_EXTERNAL_LIBS
+= libatomic.so.
* libc.so.
* libcrypt.so.
* libdl.so.
* libgcc_s.so.
* libm.so.
* libnsl.so.
* libresolv.so.
* librt.so.
* libutil.so.
*
68 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC
)$(BR2_ARM_EABIHF
),yy
)
69 LIB_EXTERNAL_LIBS
+= ld-linux-armhf.so.
*
71 LIB_EXTERNAL_LIBS
+= ld*.so.
*
73 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS
),y
)
74 LIB_EXTERNAL_LIBS
+= libpthread.so.
*
75 ifneq ($(BR2_PACKAGE_GDB
)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
),)
76 LIB_EXTERNAL_LIBS
+= libthread_db.so.
*
81 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC
),y
)
82 LIB_EXTERNAL_LIBS
+= libnss_files.so.
* libnss_dns.so.
*
85 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL
),y
)
86 LIB_EXTERNAL_LIBS
+= libc.so libgcc_s.so.
*
89 ifeq ($(BR2_INSTALL_LIBSTDCPP
),y
)
90 USR_LIB_EXTERNAL_LIBS
+= libstdc
++.so.
*
93 LIB_EXTERNAL_LIBS
+= $(call qstrip
,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
))
95 # Details about sysroot directory selection.
97 # To find the sysroot directory, we use the trick of looking for the
98 # 'libc.a' file with the -print-file-name gcc option, and then
99 # mangling the path to find the base directory of the sysroot.
101 # Note that we do not use the -print-sysroot option, because it is
102 # only available since gcc 4.4.x, and we only recently dropped support
103 # for 4.2.x and 4.3.x.
105 # When doing this, we don't pass any option to gcc that could select a
106 # multilib variant (such as -march) as we want the "main" sysroot,
107 # which contains all variants of the C library in the case of multilib
108 # toolchains. We use the TARGET_CC_NO_SYSROOT variable, which is the
109 # path of the cross-compiler, without the --sysroot=$(STAGING_DIR),
110 # since what we want to find is the location of the original toolchain
111 # sysroot. This "main" sysroot directory is stored in SYSROOT_DIR.
113 # Then, multilib toolchains are a little bit more complicated, since
114 # they in fact have multiple sysroots, one for each variant supported
115 # by the toolchain. So we need to find the particular sysroot we're
118 # To do so, we ask the compiler where its sysroot is by passing all
119 # flags (including -march and al.), except the --sysroot flag since we
120 # want to the compiler to tell us where its original sysroot
121 # is. ARCH_SUBDIR will contain the subdirectory, in the main
122 # SYSROOT_DIR, that corresponds to the selected architecture
123 # variant. ARCH_SYSROOT_DIR will contain the full path to this
126 # One might wonder why we don't just bother with ARCH_SYSROOT_DIR. The
127 # fact is that in multilib toolchains, the header files are often only
128 # present in the main sysroot, and only the libraries are available in
129 # each variant-specific sysroot directory.
132 TOOLCHAIN_EXTERNAL_PREFIX
= $(call qstrip
,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX
))
133 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD
),y
)
134 TOOLCHAIN_EXTERNAL_INSTALL_DIR
= $(HOST_DIR
)/opt
/ext-toolchain
136 TOOLCHAIN_EXTERNAL_INSTALL_DIR
= $(call qstrip
,$(BR2_TOOLCHAIN_EXTERNAL_PATH
))
139 ifeq ($(TOOLCHAIN_EXTERNAL_INSTALL_DIR
),)
140 ifneq ($(TOOLCHAIN_EXTERNAL_PREFIX
),)
141 # if no path set, figure it out from path
142 TOOLCHAIN_EXTERNAL_BIN
:= $(shell dirname
$(shell which
$(TOOLCHAIN_EXTERNAL_PREFIX
)-gcc
))
145 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX
),y
)
146 TOOLCHAIN_EXTERNAL_BIN
:= $(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/$(TOOLCHAIN_EXTERNAL_PREFIX
)/bin
148 TOOLCHAIN_EXTERNAL_BIN
:= $(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/bin
152 # If this is a buildroot toolchain, it already has a wrapper which we want to
153 # bypass. Since this is only evaluated after it has been extracted, we can use
154 # $(wildcard ...) here.
155 TOOLCHAIN_EXTERNAL_SUFFIX
= \
156 $(if
$(wildcard $(TOOLCHAIN_EXTERNAL_BIN
)/*.br_real
),.br_real
)
157 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= \
158 -DBR_CROSS_PATH_SUFFIX
='"$(TOOLCHAIN_EXTERNAL_SUFFIX)"'
160 TOOLCHAIN_EXTERNAL_CROSS
= $(TOOLCHAIN_EXTERNAL_BIN
)/$(TOOLCHAIN_EXTERNAL_PREFIX
)-
161 TOOLCHAIN_EXTERNAL_CC
= $(TOOLCHAIN_EXTERNAL_CROSS
)gcc
$(TOOLCHAIN_EXTERNAL_SUFFIX
)
162 TOOLCHAIN_EXTERNAL_CXX
= $(TOOLCHAIN_EXTERNAL_CROSS
)g
++$(TOOLCHAIN_EXTERNAL_SUFFIX
)
163 TOOLCHAIN_EXTERNAL_READELF
= $(TOOLCHAIN_EXTERNAL_CROSS
)readelf
$(TOOLCHAIN_EXTERNAL_SUFFIX
)
165 ifeq ($(filter $(HOST_DIR
)/%,$(TOOLCHAIN_EXTERNAL_BIN
)),)
166 # TOOLCHAIN_EXTERNAL_BIN points outside HOST_DIR => absolute path
167 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= \
168 -DBR_CROSS_PATH_ABS
='"$(TOOLCHAIN_EXTERNAL_BIN)"'
170 # TOOLCHAIN_EXTERNAL_BIN points inside HOST_DIR => relative path
171 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= \
172 -DBR_CROSS_PATH_REL
='"$(TOOLCHAIN_EXTERNAL_BIN:$(HOST_DIR)/%=%)"'
175 ifeq ($(call qstrip
,$(BR2_GCC_TARGET_CPU_REVISION
)),)
176 CC_TARGET_CPU_
:= $(call qstrip
,$(BR2_GCC_TARGET_CPU
))
178 CC_TARGET_CPU_
:= $(call qstrip
,$(BR2_GCC_TARGET_CPU
)-$(BR2_GCC_TARGET_CPU_REVISION
))
180 CC_TARGET_ARCH_
:= $(call qstrip
,$(BR2_GCC_TARGET_ARCH
))
181 CC_TARGET_ABI_
:= $(call qstrip
,$(BR2_GCC_TARGET_ABI
))
182 CC_TARGET_FPU_
:= $(call qstrip
,$(BR2_GCC_TARGET_FPU
))
183 CC_TARGET_FLOAT_ABI_
:= $(call qstrip
,$(BR2_GCC_TARGET_FLOAT_ABI
))
184 CC_TARGET_MODE_
:= $(call qstrip
,$(BR2_GCC_TARGET_MODE
))
186 # march/mtune/floating point mode needs to be passed to the external toolchain
187 # to select the right multilib variant
188 ifeq ($(BR2_x86_64
),y
)
189 TOOLCHAIN_EXTERNAL_CFLAGS
+= -m64
190 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_64
192 ifneq ($(CC_TARGET_ARCH_
),)
193 TOOLCHAIN_EXTERNAL_CFLAGS
+= -march
=$(CC_TARGET_ARCH_
)
194 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_ARCH
='"$(CC_TARGET_ARCH_)"'
196 ifneq ($(CC_TARGET_CPU_
),)
197 TOOLCHAIN_EXTERNAL_CFLAGS
+= -mcpu
=$(CC_TARGET_CPU_
)
198 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_CPU
='"$(CC_TARGET_CPU_)"'
200 ifneq ($(CC_TARGET_ABI_
),)
201 TOOLCHAIN_EXTERNAL_CFLAGS
+= -mabi
=$(CC_TARGET_ABI_
)
202 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_ABI
='"$(CC_TARGET_ABI_)"'
204 ifneq ($(CC_TARGET_FPU_
),)
205 TOOLCHAIN_EXTERNAL_CFLAGS
+= -mfpu
=$(CC_TARGET_FPU_
)
206 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_FPU
='"$(CC_TARGET_FPU_)"'
208 ifneq ($(CC_TARGET_FLOAT_ABI_
),)
209 TOOLCHAIN_EXTERNAL_CFLAGS
+= -mfloat-abi
=$(CC_TARGET_FLOAT_ABI_
)
210 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_FLOAT_ABI
='"$(CC_TARGET_FLOAT_ABI_)"'
212 ifneq ($(CC_TARGET_MODE_
),)
213 TOOLCHAIN_EXTERNAL_CFLAGS
+= -m
$(CC_TARGET_MODE_
)
214 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_MODE
='"$(CC_TARGET_MODE_)"'
216 ifeq ($(BR2_BINFMT_FLAT
),y
)
217 TOOLCHAIN_EXTERNAL_CFLAGS
+= -Wl
,-elf2flt
218 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_BINFMT_FLAT
220 ifeq ($(BR2_mipsel
)$(BR2_mips64el
),y
)
221 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_MIPS_TARGET_LITTLE_ENDIAN
222 TOOLCHAIN_EXTERNAL_CFLAGS
+= -EL
224 ifeq ($(BR2_mips
)$(BR2_mips64
),y
)
225 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_MIPS_TARGET_BIG_ENDIAN
226 TOOLCHAIN_EXTERNAL_CFLAGS
+= -EB
228 ifeq ($(BR2_arceb
),y
)
229 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_ARC_TARGET_BIG_ENDIAN
230 TOOLCHAIN_EXTERNAL_CFLAGS
+= -EB
233 TOOLCHAIN_EXTERNAL_CFLAGS
+= $(call qstrip
,$(BR2_TARGET_OPTIMIZATION
))
235 ifeq ($(BR2_SOFT_FLOAT
),y
)
236 TOOLCHAIN_EXTERNAL_CFLAGS
+= -msoft-float
237 TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_SOFTFLOAT
=1
240 # musl does not provide a sys/queue.h implementation, so add the
241 # netbsd-queue package that will install a sys/queue.h file in the
242 # staging directory based on the NetBSD implementation.
243 ifeq ($(BR2_TOOLCHAIN_USES_MUSL
),y
)
244 TOOLCHAIN_EXTERNAL_DEPENDENCIES
+= netbsd-queue
247 # The Linaro ARMhf toolchain expects the libraries in
248 # {/usr,}/lib/arm-linux-gnueabihf, but Buildroot copies them to
249 # {/usr,}/lib, so we need to create a symbolic link.
250 define TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK
251 ln
-snf .
$(TARGET_DIR
)/lib
/arm-linux-gnueabihf
252 ln
-snf .
$(TARGET_DIR
)/usr
/lib
/arm-linux-gnueabihf
255 define TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK
256 ln
-snf .
$(TARGET_DIR
)/lib
/armeb-linux-gnueabihf
257 ln
-snf .
$(TARGET_DIR
)/usr
/lib
/armeb-linux-gnueabihf
260 define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
261 ln
-snf .
$(TARGET_DIR
)/lib
/aarch64-linux-gnu
262 ln
-snf .
$(TARGET_DIR
)/usr
/lib
/aarch64-linux-gnu
265 # Special handling for Blackfin toolchain, because of the split in two
266 # tarballs, and the organization of tarball contents. The tarballs
267 # contain ./opt/uClinux/{bfin-uclinux,bfin-linux-uclibc} directories,
268 # which themselves contain the toolchain. This is why we strip more
269 # components than usual.
270 define TOOLCHAIN_EXTERNAL_BLACKFIN_UCLIBC_EXTRA_EXTRACT
271 $(call suitable-extractor
,$(TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS
)) $(DL_DIR
)/$(TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS
) | \
272 $(TAR
) --strip-components
=3 --hard-dereference
-C
$(@D
) $(TAR_OPTIONS
) -
275 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM
),y
)
276 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/arm-none-linux-gnueabi
277 TOOLCHAIN_EXTERNAL_SOURCE
= arm-2014.05
-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.
tar.bz2
278 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV7A
),y
)
279 TOOLCHAIN_EXTERNAL_SITE
= http
://software-dl.ti.com
/sdoemb
/sdoemb_public_sw
/arago_toolchain
/2011_09
/exports
280 TOOLCHAIN_EXTERNAL_SOURCE
= arago-2011.09
-armv7a-linux-gnueabi-sdk.
tar.bz2
281 TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL
= arago-toolchain-2011.09
-sources.
tar.bz2
282 define TOOLCHAIN_EXTERNAL_FIXUP_CMDS
283 mv
$(@D
)/arago-2011.09
/armv7a
/* $(@D
)/
284 rm -rf
$(@D
)/arago-2011.09
/
286 TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS
+= TOOLCHAIN_EXTERNAL_FIXUP_CMDS
287 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE
),y
)
288 TOOLCHAIN_EXTERNAL_SITE
= http
://software-dl.ti.com
/sdoemb
/sdoemb_public_sw
/arago_toolchain
/2011_09
/exports
289 TOOLCHAIN_EXTERNAL_SOURCE
= arago-2011.09
-armv5te-linux-gnueabi-sdk.
tar.bz2
290 TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL
= arago-toolchain-2011.09
-sources.
tar.bz2
291 define TOOLCHAIN_EXTERNAL_FIXUP_CMDS
292 mv
$(@D
)/arago-2011.09
/armv5te
/* $(@D
)/
293 rm -rf
$(@D
)/arago-2011.09
/
295 TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS
+= TOOLCHAIN_EXTERNAL_FIXUP_CMDS
296 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM
),y
)
297 ifeq ($(HOSTARCH
),x86
)
298 TOOLCHAIN_EXTERNAL_SITE
= http
://releases.linaro.org
/14.09/components
/toolchain
/binaries
299 TOOLCHAIN_EXTERNAL_SOURCE
= gcc-linaro-arm-linux-gnueabihf-4.9
-2014.09_linux.
tar.xz
300 TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL
= gcc-linaro-arm-linux-gnueabihf-4.9
-2014.09_src.
tar.bz2
301 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS
+= TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK
303 TOOLCHAIN_EXTERNAL_SITE
= http
://releases.linaro.org
/components
/toolchain
/binaries
/5.2-2015.11-2/arm-linux-gnueabihf
304 TOOLCHAIN_EXTERNAL_SOURCE
= gcc-linaro-5.2
-2015.11-2-x86_64_arm-linux-gnueabihf.
tar.xz
306 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB
),y
)
307 ifeq ($(HOSTARCH
),x86
)
308 TOOLCHAIN_EXTERNAL_SITE
= http
://releases.linaro.org
/14.09/components
/toolchain
/binaries
309 TOOLCHAIN_EXTERNAL_SOURCE
= gcc-linaro-armeb-linux-gnueabihf-4.9
-2014.09_linux.
tar.xz
310 TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL
= gcc-linaro-armeb-linux-gnueabihf-4.9
-2014.09_src.
tar.bz2
311 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS
+= TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK
313 TOOLCHAIN_EXTERNAL_SITE
= http
://releases.linaro.org
/components
/toolchain
/binaries
/5.2-2015.11-2/armeb-linux-gnueabihf
314 TOOLCHAIN_EXTERNAL_SOURCE
= gcc-linaro-5.2
-2015.11-2-x86_64_armeb-linux-gnueabihf.
tar.xz
316 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS
),y
)
317 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/mips-linux-gnu
318 TOOLCHAIN_EXTERNAL_SOURCE
= mips-2015.11
-32-mips-linux-gnu-i686-pc-linux-gnu.
tar.bz2
319 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII
),y
)
320 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/nios2-linux-gnu
321 TOOLCHAIN_EXTERNAL_SOURCE
= sourceryg
++-2015.11-27-nios2-linux-gnu-i686-pc-linux-gnu.
tar.bz2
322 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC_E500V2
),y
)
323 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/powerpc-mentor-linux-gnu
324 TOOLCHAIN_EXTERNAL_SOURCE
= mentor-2012.03
-71-powerpc-mentor-linux-gnu-i686-pc-linux-gnu.
tar.bz2
325 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC
),y
)
326 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/powerpc-linux-gnu
327 TOOLCHAIN_EXTERNAL_SOURCE
= freescale-2011.03
-38-powerpc-linux-gnu-i686-pc-linux-gnu.
tar.bz2
328 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH
),y
)
329 TOOLCHAIN_EXTERNAL_SITE
= https
://sourcery.mentor.com
/public
/gnu_toolchain
/sh-linux-gnu
330 TOOLCHAIN_EXTERNAL_SOURCE
= renesas-2012.09
-61-sh-linux-gnu-i686-pc-linux-gnu.
tar.bz2
331 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86
),y
)
332 TOOLCHAIN_EXTERNAL_SITE
= https
://sourcery.mentor.com
/public
/gnu_toolchain
/i686-pc-linux-gnu
333 TOOLCHAIN_EXTERNAL_SOURCE
= ia32-2012.09
-62-i686-pc-linux-gnu-i386-linux.
tar.bz2
334 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64
),y
)
335 TOOLCHAIN_EXTERNAL_SITE
= https
://sourcery.mentor.com
/public
/gnu_toolchain
/x86_64-amd-linux-gnu
336 TOOLCHAIN_EXTERNAL_SOURCE
= amd-2015.11
-36-x86_64-amd-linux-gnu-i686-pc-linux-gnu.
tar.bz2
337 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_IMG_MIPS
),y
)
338 TOOLCHAIN_EXTERNAL_SITE
= http
://codescape-mips-sdk.imgtec.com
/components
/toolchain
/2015.06-05
339 TOOLCHAIN_EXTERNAL_SOURCE
= Codescape.GNU.Tools.Package
.2015.06-05.for.MIPS.IMG.Linux.CentOS-5.x86.
tar.gz
340 TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS
= 2
341 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESCAPE_MTI_MIPS
),y
)
342 TOOLCHAIN_EXTERNAL_SITE
= http
://codescape-mips-sdk.imgtec.com
/components
/toolchain
/2015.06-05
343 TOOLCHAIN_EXTERNAL_SOURCE
= Codescape.GNU.Tools.Package
.2015.06-05.for.MIPS.MTI.Linux.CentOS-5.x86.
tar.gz
344 TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS
= 2
345 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX
),y
)
346 TOOLCHAIN_EXTERNAL_SITE
= http
://downloads.sourceforge.net
/project
/adi-toolchain
/2014R1
/2014R1-RC2
/i386
347 TOOLCHAIN_EXTERNAL_SOURCE
= blackfin-toolchain-2014R1-RC2.i386.
tar.bz2
348 TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS
= blackfin-toolchain-uclibc-full-2014R1-RC2.i386.
tar.bz2
349 TOOLCHAIN_EXTERNAL_STRIP_COMPONENTS
= 3
350 TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS
+= TOOLCHAIN_EXTERNAL_BLACKFIN_UCLIBC_EXTRA_EXTRACT
351 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64
),y
)
352 ifeq ($(HOSTARCH
),x86
)
353 TOOLCHAIN_EXTERNAL_SITE
= http
://releases.linaro.org
/14.09/components
/toolchain
/binaries
354 TOOLCHAIN_EXTERNAL_SOURCE
= gcc-linaro-aarch64-linux-gnu-4.9
-2014.09_linux.
tar.xz
355 TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL
= gcc-linaro-aarch64-linux-gnu-4.9
-2014.09_src.
tar.bz2
356 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS
+= TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
358 TOOLCHAIN_EXTERNAL_SITE
= http
://releases.linaro.org
/components
/toolchain
/binaries
/5.2-2015.11-2/aarch64-linux-gnu
359 TOOLCHAIN_EXTERNAL_SOURCE
= gcc-linaro-5.2
-2015.11-2-x86_64_aarch64-linux-gnu.
tar.xz
361 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64
),y
)
362 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/aarch64-linux-gnu
363 TOOLCHAIN_EXTERNAL_SOURCE
= aarch64-2014.05
-30-aarch64-linux-gnu-i686-pc-linux-gnu.
tar.bz2
364 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS
),y
)
365 TOOLCHAIN_EXTERNAL_VERSION
= 1.1.6
366 TOOLCHAIN_EXTERNAL_SITE
= https
://googledrive.com
/host
/0BwnS5DMB0YQ6bDhPZkpOYVFhbk0
/musl-
$(TOOLCHAIN_EXTERNAL_VERSION
)
367 ifeq ($(BR2_arm
)$(BR2_ARM_EABI
),yy
)
368 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-arm-linux-musleabi-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
369 else ifeq ($(BR2_arm
)$(BR2_ARM_EABIHF
),yy
)
370 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-arm-linux-musleabihf-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
371 else ifeq ($(BR2_armeb
),y
)
372 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-armeb-linux-musleabi-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
373 else ifeq ($(BR2_i386
),y
)
374 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-i486-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
375 else ifeq ($(BR2_microblazebe
),y
)
376 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-microblaze-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
377 else ifeq ($(BR2_mips
),y
)
378 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-mips-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
379 else ifeq ($(BR2_mipsel
),y
)
380 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-mipsel-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
381 else ifeq ($(BR2_powerpc
),y
)
382 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-powerpc-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
383 else ifeq ($(BR2_x86_64
),y
)
384 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-x86_64-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
386 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC
),y
)
387 TOOLCHAIN_EXTERNAL_SITE
= https
://github.com
/foss-for-synopsys-dwc-arc-processors
/toolchain
/releases
/download
/arc-2014.12
388 ifeq ($(BR2_arc750d
)$(BR2_arc770d
),y
)
389 TOOLCHAIN_EXTERNAL_SYNOPSYS_CORE
= arc700
391 TOOLCHAIN_EXTERNAL_SYNOPSYS_CORE
= archs
393 ifeq ($(BR2_arcle
),y
)
394 TOOLCHAIN_EXTERNAL_SYNOPSYS_ENDIANESS
= le
396 TOOLCHAIN_EXTERNAL_SYNOPSYS_ENDIANESS
= be
398 TOOLCHAIN_EXTERNAL_SOURCE
= arc_gnu_2014.12_prebuilt_uclibc_
$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ENDIANESS
)_
$(TOOLCHAIN_EXTERNAL_SYNOPSYS_CORE
)_linux_install.
tar.gz
401 TOOLCHAIN_EXTERNAL_SITE
= $(patsubst %/,%,$(dir $(call qstrip
,$(BR2_TOOLCHAIN_EXTERNAL_URL
))))
402 TOOLCHAIN_EXTERNAL_SOURCE
= $(notdir $(call qstrip
,$(BR2_TOOLCHAIN_EXTERNAL_URL
)))
403 # We can't check hashes for custom downloaded toolchains
404 BR_NO_CHECK_HASH_FOR
+= $(TOOLCHAIN_EXTERNAL_SOURCE
)
407 # Some toolchain vendors have a regular file naming pattern.
408 # For them, mass-define _ACTUAL_SOURCE_TARBALL based _SITE.
409 ifneq ($(findstring sourcery.mentor.com
/public
/gnu_toolchain
,$(TOOLCHAIN_EXTERNAL_SITE
)),)
410 TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL ?
= \
411 $(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
)))
414 # In fact, we don't need to download the toolchain, since it is already
415 # available on the system, so force the site and source to be empty so
416 # that nothing will be downloaded/extracted.
417 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_PREINSTALLED
),y
)
418 TOOLCHAIN_EXTERNAL_SITE
=
419 TOOLCHAIN_EXTERNAL_SOURCE
=
422 TOOLCHAIN_EXTERNAL_ADD_TOOLCHAIN_DEPENDENCY
= NO
424 TOOLCHAIN_EXTERNAL_INSTALL_STAGING
= YES
426 # Normal handling of downloaded toolchain tarball extraction.
427 ifneq ($(TOOLCHAIN_EXTERNAL_SOURCE
),)
428 TOOLCHAIN_EXTERNAL_EXCLUDES
= usr
/lib
/locale
/*
430 # As a regular package, the toolchain gets extracted in $(@D), but
431 # since it's actually a fairly special package, we need it to be moved
432 # into TOOLCHAIN_EXTERNAL_INSTALL_DIR.
433 define TOOLCHAIN_EXTERNAL_MOVE
434 rm -rf
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/*
435 mkdir
-p
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)
436 mv
$(@D
)/* $(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/
438 TOOLCHAIN_EXTERNAL_POST_EXTRACT_HOOKS
+= \
439 TOOLCHAIN_EXTERNAL_MOVE
442 # Returns the location of the libc.a file for the given compiler + flags
443 define toolchain_find_libc_a
444 $$(readlink
-f
$$(LANG
=C
$(1) -print-file-name
=libc.a
))
447 # Returns the sysroot location for the given compiler + flags. We need
448 # to handle cases where libc.a is in:
454 # - lib32-fp/ (Cavium toolchain)
455 # - lib64-fp/ (Cavium toolchain)
456 # - usr/lib/<tuple>/ (Linaro toolchain)
458 # And variations on these.
459 define toolchain_find_sysroot
460 $$(printf
$(call toolchain_find_libc_a
,$(1)) | sed
-r
-e
's:(usr/)?lib(32|64)?([^/]*)?/([^/]*/)?libc\.a::')
463 # Returns the lib subdirectory for the given compiler + flags (i.e
464 # typically lib32 or lib64 for some toolchains)
465 define toolchain_find_libdir
466 $$(printf
$(call toolchain_find_libc_a
,$(1)) | sed
-r
-e
's:.*/(usr/)?(lib(32|64)?([^/]*)?)/([^/]*/)?libc.a:\2:')
469 # Checks for an already installed toolchain: check the toolchain
470 # location, check that it supports sysroot, and then verify that it
471 # matches the configuration provided in Buildroot: ABI, C++ support,
472 # kernel headers version, type of C library and all C library features.
473 define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
474 $(Q
)$(call check_cross_compiler_exists
,$(TOOLCHAIN_EXTERNAL_CC
))
475 $(Q
)$(call check_unusable_toolchain
,$(TOOLCHAIN_EXTERNAL_CC
))
476 $(Q
)SYSROOT_DIR
="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
477 if
test -z
"$${SYSROOT_DIR}" ; then \
478 @echo
"External toolchain doesn't support --sysroot. Cannot use." ; \
481 $(call check_kernel_headers_version
,\
482 $(call toolchain_find_sysroot
,$(TOOLCHAIN_EXTERNAL_CC
)),\
483 $(call qstrip
,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST
))); \
484 $(call check_gcc_version
,$(TOOLCHAIN_EXTERNAL_CC
),\
485 $(call qstrip
,$(BR2_TOOLCHAIN_GCC_AT_LEAST
))); \
486 if
test "$(BR2_arm)" = "y" ; then \
487 $(call check_arm_abi
,\
488 "$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)",\
489 $(TOOLCHAIN_EXTERNAL_READELF
)) ; \
491 if
test "$(BR2_INSTALL_LIBSTDCPP)" = "y" ; then \
492 $(call check_cplusplus
,$(TOOLCHAIN_EXTERNAL_CXX
)) ; \
494 if
test "$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \
495 $(call check_uclibc
,$${SYSROOT_DIR}) ; \
496 elif
test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
497 $(call check_musl
,$${SYSROOT_DIR}) ; \
499 $(call check_glibc
,$${SYSROOT_DIR}) ; \
503 # With the musl C library, the libc.so library directly plays the role
504 # of the dynamic library loader. We just need to create a symbolic
505 # link to libc.so with the appropriate name.
506 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL
),y
)
509 else ifeq ($(BR2_ARM_EABIHF
),y
)
514 define TOOLCHAIN_EXTERNAL_MUSL_LD_LINK
515 ln
-sf libc.so
$(TARGET_DIR
)/lib
/ld-musl-
$(MUSL_ARCH
).so
.1
517 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS
+= TOOLCHAIN_EXTERNAL_MUSL_LD_LINK
520 # Create a symlink from (usr/)$(ARCH_LIB_DIR) to lib.
521 # Note: the skeleton package additionally creates lib32->lib or lib64->lib
524 # $1: destination directory (TARGET_DIR / STAGING_DIR)
525 create_lib_symlinks
= \
526 $(Q
)DESTDIR
="$(strip $1)" ; \
527 ARCH_LIB_DIR
="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
528 if
[ ! -e
"$${DESTDIR}/$${ARCH_LIB_DIR}" -a
! -e
"$${DESTDIR}/usr/$${ARCH_LIB_DIR}" ]; then \
529 ln
-snf lib
"$${DESTDIR}/$${ARCH_LIB_DIR}" ; \
530 ln
-snf lib
"$${DESTDIR}/usr/$${ARCH_LIB_DIR}" ; \
533 define TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK
534 $(call create_lib_symlinks
,$(STAGING_DIR
))
537 define TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK
538 $(call create_lib_symlinks
,$(TARGET_DIR
))
541 # Integration of the toolchain into Buildroot: find the main sysroot
542 # and the variant-specific sysroot, then copy the needed libraries to
543 # the $(TARGET_DIR) and copy the whole sysroot (libraries and headers)
546 # Variables are defined as follows:
548 # LIBC_A_LOCATION: location of the libc.a file in the default
549 # multilib variant (allows to find the main
551 # Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/usr/lib/libc.a
553 # SYSROOT_DIR: the main sysroot directory, deduced from
554 # LIBC_A_LOCATION by removing the
555 # usr/lib[32|64]/libc.a part of the path.
556 # Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/
558 # ARCH_LIBC_A_LOCATION: location of the libc.a file in the selected
559 # multilib variant (taking into account the
560 # CFLAGS). Allows to find the sysroot of the
561 # selected multilib variant.
562 # Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/mips16/soft-float/el/usr/lib/libc.a
564 # ARCH_SYSROOT_DIR: the sysroot of the selected multilib variant,
565 # deduced from ARCH_LIBC_A_LOCATION by removing
566 # usr/lib[32|64]/libc.a at the end of the path.
567 # Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/mips16/soft-float/el/
569 # ARCH_LIB_DIR: 'lib', 'lib32' or 'lib64' depending on where libraries
570 # are stored. Deduced from ARCH_LIBC_A_LOCATION by
571 # looking at usr/lib??/libc.a.
574 # ARCH_SUBDIR: the relative location of the sysroot of the selected
575 # multilib variant compared to the main sysroot.
576 # Ex: mips16/soft-float/el
578 # SUPPORT_LIB_DIR: some toolchains, such as recent Linaro toolchains,
579 # store GCC support libraries (libstdc++,
580 # libgcc_s, etc.) outside of the sysroot. In
581 # this case, SUPPORT_LIB_DIR is set to a
582 # non-empty value, and points to the directory
583 # where these support libraries are
584 # available. Those libraries will be copied to
585 # our sysroot, and the directory will also be
586 # considered when searching libraries for copy
587 # to the target filesystem.
589 define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
590 $(Q
)SYSROOT_DIR
="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
591 if
test -z
"$${SYSROOT_DIR}" ; then \
592 @echo
"External toolchain doesn't support --sysroot. Cannot use." ; \
595 ARCH_SYSROOT_DIR
="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
596 ARCH_LIB_DIR
="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
597 SUPPORT_LIB_DIR
="" ; \
598 if
test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq
0 ; then \
599 LIBSTDCPP_A_LOCATION
=$$(LANG
=C
$(TOOLCHAIN_EXTERNAL_CC
) $(TOOLCHAIN_EXTERNAL_CFLAGS
) -print-file-name
=libstdc
++.a
) ; \
600 if
[ -e
"$${LIBSTDCPP_A_LOCATION}" ]; then \
601 SUPPORT_LIB_DIR
=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
604 ARCH_SUBDIR
=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
605 if
test -z
"$(BR2_STATIC_LIBS)" ; then \
606 $(call MESSAGE
,"Copying external toolchain libraries to target...") ; \
607 for libs in
$(LIB_EXTERNAL_LIBS
); do \
608 $(call copy_toolchain_lib_root
,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/lib
); \
610 for libs in
$(USR_LIB_EXTERNAL_LIBS
); do \
611 $(call copy_toolchain_lib_root
,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr
/lib
); \
614 if
test "$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" = "y"; then \
615 $(call MESSAGE
,"Copying gdbserver") ; \
616 gdbserver_found
=0 ; \
617 for d in
$${ARCH_SYSROOT_DIR}/usr \
618 $${ARCH_SYSROOT_DIR}/..
/debug-root
/usr \
619 $${ARCH_SYSROOT_DIR}/usr
/$${ARCH_LIB_DIR} \
620 $(TOOLCHAIN_EXTERNAL_INSTALL_DIR
); do \
621 if
test -f
$${d}/bin
/gdbserver
; then \
622 install -m
0755 -D
$${d}/bin
/gdbserver
$(TARGET_DIR
)/usr
/bin
/gdbserver
; \
623 gdbserver_found
=1 ; \
627 if
[ $${gdbserver_found} -eq
0 ] ; then \
628 echo
"Could not find gdbserver in external toolchain" ; \
634 define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
635 $(Q
)SYSROOT_DIR
="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
636 if
test -z
"$${SYSROOT_DIR}" ; then \
637 @echo
"External toolchain doesn't support --sysroot. Cannot use." ; \
640 ARCH_SYSROOT_DIR
="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
641 ARCH_LIB_DIR
="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
642 SUPPORT_LIB_DIR
="" ; \
643 if
test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq
0 ; then \
644 LIBSTDCPP_A_LOCATION
=$$(LANG
=C
$(TOOLCHAIN_EXTERNAL_CC
) $(TOOLCHAIN_EXTERNAL_CFLAGS
) -print-file-name
=libstdc
++.a
) ; \
645 if
[ -e
"$${LIBSTDCPP_A_LOCATION}" ]; then \
646 SUPPORT_LIB_DIR
=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
649 ARCH_SUBDIR
=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
650 $(call MESSAGE
,"Copying external toolchain sysroot to staging...") ; \
651 $(call copy_toolchain_sysroot
,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR})
654 # Special installation target used on the Blackfin architecture when
655 # FDPIC is not the primary binary format being used, but the user has
656 # nonetheless requested the installation of the FDPIC libraries to the
658 ifeq ($(BR2_BFIN_INSTALL_FDPIC_SHARED
),y
)
659 define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
660 $(Q
)$(call MESSAGE
,"Install external toolchain FDPIC libraries to target...") ; \
661 FDPIC_EXTERNAL_CC
=$(dir $(TOOLCHAIN_EXTERNAL_CC
))/..
/..
/bfin-linux-uclibc
/bin
/bfin-linux-uclibc-gcc
; \
662 FDPIC_SYSROOT_DIR
="$(call toolchain_find_sysroot,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
663 FDPIC_LIB_DIR
="$(call toolchain_find_libdir,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
664 FDPIC_SUPPORT_LIB_DIR
="" ; \
665 if
test `find $${FDPIC_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq
0 ; then \
666 FDPIC_LIBSTDCPP_A_LOCATION
=$$(LANG
=C
$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS
) -print-file-name
=libstdc
++.a
) ; \
667 if
[ -e
"$${FDPIC_LIBSTDCPP_A_LOCATION}" ]; then \
668 FDPIC_SUPPORT_LIB_DIR
=`readlink -f $${FDPIC_LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
671 for libs in
$(LIB_EXTERNAL_LIBS
); do \
672 $(call copy_toolchain_lib_root
,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/lib
); \
674 for libs in
$(USR_LIB_EXTERNAL_LIBS
); do \
675 $(call copy_toolchain_lib_root
,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/usr
/lib
); \
680 # Special installation target used on the Blackfin architecture when
681 # shared FLAT is not the primary format being used, but the user has
682 # nonetheless requested the installation of the shared FLAT libraries
683 # to the target filesystem. The flat libraries are found and linked
684 # according to the index in name "libN.so". Index 1 is reserved for
685 # the standard C library. Customer libraries can use 4 and above.
686 ifeq ($(BR2_BFIN_INSTALL_FLAT_SHARED
),y
)
687 define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT
688 $(Q
)$(call MESSAGE
,"Install external toolchain FLAT libraries to target...") ; \
689 FLAT_EXTERNAL_CC
=$(dir $(TOOLCHAIN_EXTERNAL_CC
))..
/..
/bfin-uclinux
/bin
/bfin-uclinux-gcc
; \
690 FLAT_LIBC_A_LOCATION
=`$${FLAT_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -mid-shared-library -print-file-name=libc`; \
691 if
[ -f
$${FLAT_LIBC_A_LOCATION} -a
! -h
$${FLAT_LIBC_A_LOCATION} ] ; then \
692 $(INSTALL
) -D
$${FLAT_LIBC_A_LOCATION} $(TARGET_DIR
)/lib
/lib1.so
; \
697 # Build toolchain wrapper for preprocessor, C and C++ compiler and setup
698 # symlinks for everything else. Skip gdb symlink when we are building our
699 # own gdb to prevent two gdb's in output/host/usr/bin.
700 # The LTO support in gcc creates wrappers for ar, ranlib and nm which load
701 # the lto plugin. These wrappers are called *-gcc-ar, *-gcc-ranlib, and
702 # *-gcc-nm and should be used instead of the real programs when -flto is
703 # used. However, we should not add the toolchain wrapper for them, and they
704 # match the *cc-* pattern. Therefore, an additional case is added for *-ar,
706 define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
707 $(Q
)cd
$(HOST_DIR
)/usr
/bin
; \
708 for i in
$(TOOLCHAIN_EXTERNAL_CROSS
)*; do \
711 *-ar|
*-ranlib|
*-nm
) \
712 ln
-sf
$$(echo
$$i | sed
's%^$(HOST_DIR)%../..%') .
; \
714 *cc|
*cc-
*|
*++|
*++-*|
*cpp) \
715 ln
-sf toolchain-wrapper
$$base; \
718 if
test "$(BR2_PACKAGE_HOST_GDB)" != "y"; then \
719 ln
-sf
$$(echo
$$i | sed
's%^$(HOST_DIR)%../..%') .
; \
723 ln
-sf
$$(echo
$$i | sed
's%^$(HOST_DIR)%../..%') .
; \
730 # Generate gdbinit file for use with Buildroot
732 define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT
733 $(Q
)if
test -f
$(TARGET_CROSS
)gdb
; then \
734 $(call MESSAGE
,"Installing gdbinit"); \
735 $(gen_gdbinit_file
); \
739 # uClibc-ng dynamic loader is called ld-uClibc.so.1, but gcc is not
740 # patched specifically for uClibc-ng, so it continues to generate
741 # binaries that expect the dynamic loader to be named ld-uClibc.so.0,
742 # like with the original uClibc. Therefore, we create an additional
743 # symbolic link to make uClibc-ng systems work properly.
744 define TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO
745 $(Q
)if
test -e
$(TARGET_DIR
)/lib
/ld-uClibc.so
.1; then \
746 ln
-sf ld-uClibc.so
.1 $(TARGET_DIR
)/lib
/ld-uClibc.so
.0 ; \
748 $(Q
)if
test -e
$(TARGET_DIR
)/lib
/ld64-uClibc.so
.1; then \
749 ln
-sf ld64-uClibc.so
.1 $(TARGET_DIR
)/lib
/ld64-uClibc.so
.0 ; \
753 TOOLCHAIN_EXTERNAL_BUILD_CMDS
= $(TOOLCHAIN_BUILD_WRAPPER
)
755 define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
756 $(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK
)
757 $(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
)
758 $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
)
759 $(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT
)
762 # Even though we're installing things in both the staging, the host
763 # and the target directory, we do everything within the
764 # install-staging step, arbitrarily.
765 define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS
766 $(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK
)
767 $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS
)
768 $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
)
769 $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT
)
770 $(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO
)
773 $(eval
$(generic-package
))