diff options
author | Khem Raj <raj.khem@gmail.com> | 2022-08-22 13:59:37 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2022-08-30 14:58:28 -0700 |
commit | d89de99cbbb171a21f37ce64dd9ec2ef79fa033a (patch) | |
tree | 0e64995d3e13d93fe17de27ffeb56b08d3f7f3fe | |
parent | a0554050cc4ecdacc1edb17d81b20f46a7e5d002 (diff) | |
download | meta-clang-d89de99cbbb171a21f37ce64dd9ec2ef79fa033a.tar.gz |
clang-native.bbclass: Add new class
This class is meant to make it easy to use clang for doing native
builds. Some packages e.g. chromium, rust etc. have specific needs when
using clang. clang built by this layer is ineherently a cross compiler
and its using same compiler for doing native and cross builds for
packages. This class should be added to recipes which intend to use
clanf to do the native builds as well.
inherit clang-native
is all you need in the recipe namespace via the .bb or .bbappend file
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | classes-recipe/clang-native.bbclass | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/classes-recipe/clang-native.bbclass b/classes-recipe/clang-native.bbclass new file mode 100644 index 0000000..51fafcd --- /dev/null +++ b/classes-recipe/clang-native.bbclass | |||
@@ -0,0 +1,23 @@ | |||
1 | # inherit this class if you would like to use clang to compile the native | ||
2 | # version of your recipes instead of system compiler ( which is normally gcc ) | ||
3 | # on build machines | ||
4 | # to use it add | ||
5 | # | ||
6 | # inherit clang-native | ||
7 | # | ||
8 | # to the concerned recipe via a bbappend or directly to recipe file | ||
9 | # | ||
10 | DEPENDS:append:runtime-llvm = " clang-native compiler-rt-native libcxx-native" | ||
11 | # Use libcxx headers for native parts | ||
12 | CXXFLAGS:append:runtime-llvm = " -stdlib=libc++" | ||
13 | BUILD_CXXFLAGS:append:runtime-llvm = " -isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++" | ||
14 | # Use libgcc for native parts | ||
15 | LDFLAGS:append:runtime-llvm = " -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc" | ||
16 | BUILD_LDFLAGS:append:runtime-llvm = " -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc" | ||
17 | BUILD_CC:runtime-llvm = "${CCACHE}clang -isysroot=${STAGING_DIR_NATIVE}" | ||
18 | BUILD_CXX:runtime-llvm = "${CCACHE}clang++ -isysroot=${STAGING_DIR_NATIVE}" | ||
19 | BUILD_CPP:runtime-llvm = "${CCACHE}clang -isysroot=${STAGING_DIR_NATIVE} -E" | ||
20 | BUILD_CCLD:runtime-llvm = "${CCACHE}clang" | ||
21 | BUILD_RANLIB:runtime-llvm = "llvm-ranlib" | ||
22 | BUILD_AR:runtime-llvm = "llvm-ar" | ||
23 | BUILD_NM:runtime-llvm = "llvm-nm" | ||