diff options
author | Khem Raj <raj.khem@gmail.com> | 2015-08-21 14:07:05 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2015-08-21 14:07:05 -0700 |
commit | 1b0f5de3b3137509a7c60d372c5e58782144ac57 (patch) | |
tree | 4c50d5c024fe0f5ac690d522da16fe6a8280318a /classes | |
parent | 94749d600c974c773800192687cb284a8c35b483 (diff) | |
download | meta-clang-1b0f5de3b3137509a7c60d372c5e58782144ac57.tar.gz |
clang/classes: Invert the logic to select toolchain and default to clang
So far we have been selecting which packages are compiled using clang
this patch changes the logic to use clang by default unless selecting
TOOLCHAIN = "gcc"
explicitly in the recipe
We have not yet enabled clang for native recipes, its only enabled for
target recipes needing cross compilation as of now.
Get rid of configuration file and move the code to clang.bbclass,
simplifies the logic
If needed to select gcc to be default system compiler set
TOOLCHAIN = "gcc" in local.conf
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'classes')
-rw-r--r-- | classes/clang.bbclass | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/classes/clang.bbclass b/classes/clang.bbclass index f6cb648..b560289 100644 --- a/classes/clang.bbclass +++ b/classes/clang.bbclass | |||
@@ -1,10 +1,41 @@ | |||
1 | |||
2 | # Add the necessary override | 1 | # Add the necessary override |
3 | TOOLCHAINOVERRIDES = ":toolchain-${TOOLCHAIN}" | 2 | CC_toolchain-clang = "${TARGET_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" |
4 | TOOLCHAINOVERRIDES[vardepsexclude] = "TOOLCHAIN" | 3 | CXX_toolchain-clang = "${TARGET_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" |
4 | CPP_toolchain-clang = "${TARGET_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} -E" | ||
5 | CCLD_toolchain-clang = "${TARGET_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" | ||
6 | THUMB_TUNE_CCARGS_remove_toolchain-clang = "-mthumb-interwork" | ||
7 | TUNE_CCARGS_append_toolchain-clang = " -D__extern_always_inline=inline -no-integrated-as" | ||
8 | |||
9 | TOOLCHAIN_OPTIONS_append_toolchain-clang_class-nativesdk_x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2" | ||
10 | TOOLCHAIN_OPTIONS_append_toolchain-clang_class-nativesdk_x86 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux.so.2" | ||
11 | |||
12 | # choose between 'gcc' 'clang' an empty '' can be used as well | ||
13 | TOOLCHAIN ??= "clang" | ||
14 | |||
15 | TOOLCHAIN_class-native = "gcc" | ||
16 | |||
17 | OVERRIDES .= "${@['', ':toolchain-${TOOLCHAIN}']['${TOOLCHAIN}' != '']}" | ||
18 | OVERRIDES[vardepsexclude] += "TOOLCHAIN" | ||
19 | |||
20 | #DEPENDS_append_toolchain-clang_class-target = " clang-cross-${TARGET_ARCH} " | ||
21 | #DEPENDS_remove_toolchain-clang_allarch = "clang-cross-${TARGET_ARCH}" | ||
22 | |||
23 | def clang_dep_prepend(d): | ||
24 | # | ||
25 | # Ideally this will check a flag so we will operate properly in | ||
26 | # the case where host == build == target, for now we don't work in | ||
27 | # that case though. | ||
28 | # | ||
5 | 29 | ||
6 | OVERRIDES .= "${TOOLCHAINOVERRIDES}" | 30 | deps = "" |
7 | OVERRIDES[vardepsexclude] += "TOOLCHAINOVERRIDES" | 31 | # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not |
32 | # we need that built is the responsibility of the patch function / class, not | ||
33 | # the application. | ||
34 | if not d.getVar('INHIBIT_DEFAULT_DEPS', False): | ||
35 | if not oe.utils.inherits(d, 'allarch'): | ||
36 | deps += " clang-cross-${TARGET_ARCH} " | ||
37 | return deps | ||
8 | 38 | ||
9 | require conf/clang.conf | 39 | CLANGDEPENDS = "${@clang_dep_prepend(d)}" |
10 | 40 | ||
41 | DEPENDS_prepend_toolchain-clang_class-target = "${CLANGDEPENDS} " | ||