summaryrefslogtreecommitdiffstats
path: root/meta/conf/distro/include/tcmode-external-sourcery.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/conf/distro/include/tcmode-external-sourcery.inc')
-rw-r--r--meta/conf/distro/include/tcmode-external-sourcery.inc118
1 files changed, 118 insertions, 0 deletions
diff --git a/meta/conf/distro/include/tcmode-external-sourcery.inc b/meta/conf/distro/include/tcmode-external-sourcery.inc
new file mode 100644
index 0000000000..79fef25bd0
--- /dev/null
+++ b/meta/conf/distro/include/tcmode-external-sourcery.inc
@@ -0,0 +1,118 @@
1#
2# Configuration to use external Sourcery G++ toolchain
3#
4
5EXTERNAL_TOOLCHAIN ?= "/usr/local/csl/${TARGET_ARCH}"
6
7TOOLCHAIN_PATH_ADD = "${EXTERNAL_TOOLCHAIN}/bin:"
8PATH =. "${TOOLCHAIN_PATH_ADD}"
9
10CSL_TARGET_SYS_powerpc ?= "powerpc-linux-gnu"
11CSL_TARGET_SYS_powerpc64 ?= "powerpc-linux-gnu"
12CSL_TARGET_SYS_arm ?= "arm-none-linux-gnueabi"
13CSL_TARGET_SYS_mips ?= "mips-linux-gnu"
14CSL_TARGET_SYS_mipsel ?= "mips-linux-gnu"
15CSL_TARGET_SYS_mips64 ?= "mips-linux-gnu"
16CSL_TARGET_SYS_i686 ?= "i686-pc-linux-gnu"
17CSL_TARGET_SYS_i586 ?= "i686-pc-linux-gnu"
18CSL_TARGET_SYS = "${TARGET_SYS}"
19
20TARGET_PREFIX = "${CSL_TARGET_SYS}-"
21
22PREFERRED_PROVIDER_linux-libc-headers = "external-sourcery-toolchain"
23PREFERRED_PROVIDER_linux-libc-headers-dev = "external-sourcery-toolchain"
24PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "external-sourcery-toolchain"
25PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial = "external-sourcery-toolchain"
26PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-intermediate = "external-sourcery-toolchain"
27PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "external-sourcery-toolchain"
28PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "external-sourcery-toolchain"
29PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc = "external-sourcery-toolchain"
30PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs = "external-sourcery-toolchain"
31PREFERRED_PROVIDER_libgcc = "external-sourcery-toolchain"
32PREFERRED_PROVIDER_virtual/libc = "external-sourcery-toolchain"
33PREFERRED_PROVIDER_virtual/libintl = "external-sourcery-toolchain"
34PREFERRED_PROVIDER_virtual/libiconv = "external-sourcery-toolchain"
35PREFERRED_PROVIDER_glibc-thread-db = "external-sourcery-toolchain"
36PREFERRED_PROVIDER_virtual/linux-libc-headers = "external-sourcery-toolchain"
37PREFERRED_PROVIDER_gdbserver ??= "external-sourcery-toolchain"
38
39# No need to re-compile the locale files
40GLIBC_INTERNAL_USE_BINARY_LOCALE = "precompiled"
41ENABLE_BINARY_LOCALE_GENERATION = ""
42
43TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_HOST}"
44
45# Translate to CodeSourcery's names for their optimized files in the toolchain
46def csl_target_core(d):
47 coredata = {
48 'armv7a-vfp-neon': 'armv7-a-neon',
49 'i586': 'sgxx-glibc',
50 'i686': 'sgxx-glibc',
51 'core2': 'sgxx-glibc',
52 'mips': 'mips32',
53 'mipsel': 'el',
54 'powerpc-nf': 'nof',
55 'ppce500': 'te500v1',
56 'ppce500mc': 'te500mc',
57 'ppce500v2': 'te500v2',
58 'ppce600': 'te600'
59 }
60 return coredata.get(d.getVar('TUNE_PKGARCH', True), '')
61
62CSL_TARGET_CORE ?= "${@csl_target_core(d)}"
63
64# Unfortunately, the CSL ia32 toolchain has non-prefixed binaries in its
65# bindir (e.g. gcc, ld). To avoid this messing up our build, we avoid adding
66# this bindir to our PATH, and instead add symlinks to the prefixed binaries
67# to our staging toolchain bindir.
68
69python toolchain_metadata_setup () {
70 if not isinstance(e, bb.event.ConfigParsed):
71 return
72
73 d = e.data
74
75 l = d.createCopy()
76 l.finalize()
77 if os.path.exists(bb.data.expand('${EXTERNAL_TOOLCHAIN}/bin/gcc', l)):
78 d.setVar('TOOLCHAIN_PATH_ADD', '')
79}
80addhandler toolchain_metadata_setup
81
82python toolchain_setup () {
83 if not isinstance(e, bb.event.BuildStarted):
84 return
85
86 d = e.data
87
88 if not d.getVar('TOOLCHAIN_PATH_ADD', True):
89 populate_toolchain_links(d)
90}
91addhandler toolchain_setup
92
93def populate_toolchain_links(d):
94 import errno
95 import os
96 from glob import glob
97
98 d = d.createCopy()
99 d.finalize()
100
101 pattern = d.expand('${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}*')
102 files = glob(pattern)
103 if not files:
104 bb.fatal("Unable to populate toolchain binary symlinks in %s" % pattern)
105
106 bindir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True)
107 bb.mkdirhier(bindir)
108 for f in files:
109 base = os.path.basename(f)
110 newpath = os.path.join(bindir, base)
111 try:
112 os.symlink(f, newpath)
113 except OSError as exc:
114 if exc.errno == errno.EEXIST:
115 break
116 bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc))
117
118require conf/distro/include/csl-versions.inc