summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/clang/compiler-rt_git.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/clang/compiler-rt_git.bb')
-rw-r--r--meta/recipes-devtools/clang/compiler-rt_git.bb138
1 files changed, 138 insertions, 0 deletions
diff --git a/meta/recipes-devtools/clang/compiler-rt_git.bb b/meta/recipes-devtools/clang/compiler-rt_git.bb
new file mode 100644
index 0000000000..342a7b0e95
--- /dev/null
+++ b/meta/recipes-devtools/clang/compiler-rt_git.bb
@@ -0,0 +1,138 @@
1# Copyright (C) 2015 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4SUMMARY = "LLVM based C/C++ compiler Runtime"
5DESCRIPTIOM = "Simple builtin library that provides an \
6 implementation of the low-level target-specific \
7 hooks required by code generation and other runtime \
8 components"
9HOMEPAGE = "http://compiler-rt.llvm.org/"
10SECTION = "base"
11
12require common-clang.inc
13require common-source.inc
14
15BPN = "compiler-rt"
16
17inherit cmake pkgconfig python3native
18
19LIC_FILES_CHKSUM = "file://compiler-rt/LICENSE.TXT;md5=d846d1d65baf322d4c485d6ee54e877a"
20
21LIBCPLUSPLUS = ""
22COMPILER_RT = ""
23
24TUNE_CCARGS:remove = "-no-integrated-as"
25
26INHIBIT_DEFAULT_DEPS = "1"
27
28DEPENDS += "ninja-native libgcc"
29DEPENDS:append:class-target = " virtual/cross-c++ clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc gcc-runtime"
30DEPENDS:append:class-nativesdk = " virtual/cross-c++ clang-native clang-crosssdk-${SDK_SYS} nativesdk-gcc-runtime"
31DEPENDS:append:class-native = " clang-native"
32DEPENDS:remove:class-native = "libcxx-native compiler-rt-native"
33
34# Trick clang.bbclass into not creating circular dependencies
35UNWINDLIB:class-nativesdk = "--unwindlib=libgcc"
36COMPILER_RT:class-nativesdk = "-rtlib=libgcc"
37LIBCPLUSPLUS:class-nativesdk = "-stdlib=libstdc++"
38UNWINDLIB:class-native = ""
39COMPILER_RT:class-native = ""
40LIBCPLUSPLUS:class-native = ""
41UNWINDLIB:class-target = "--unwindlib=libgcc"
42COMPILER_RT:class-target = "-rtlib=libgcc"
43LIBCPLUSPLUS:class-target = "-stdlib=libstdc++"
44
45PACKAGECONFIG ??= ""
46PACKAGECONFIG[crt] = "-DCOMPILER_RT_BUILD_CRT:BOOL=ON,-DCOMPILER_RT_BUILD_CRT:BOOL=OFF"
47PACKAGECONFIG[profile] = "-DCOMPILER_RT_BUILD_PROFILE=ON,-DCOMPILER_RT_BUILD_PROFILE=OFF"
48# Context Profiling, might need to enable 'profile' too
49PACKAGECONFIG[ctx-profile] = "-DCOMPILER_RT_BUILD_CTX_PROFILE=ON,-DCOMPILER_RT_BUILD_CTX_PROFILE=OFF"
50
51HF = ""
52HF:class-target = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
53
54CC = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
55CXX = "${CCACHE}${HOST_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
56LDFLAGS += "${COMPILER_RT} ${UNWINDLIB}"
57CXXFLAGS += "${LIBCPLUSPLUS}"
58
59TOOLCHAIN = "clang"
60
61def get_compiler_rt_arch(bb, d):
62 if bb.utils.contains('TUNE_FEATURES', 'armv5 thumb dsp', True, False, d):
63 return 'armv5te'
64 elif bb.utils.contains('TUNE_FEATURES', 'armv4 thumb', True, False, d):
65 return 'armv4t'
66 elif bb.utils.contains('TUNE_FEATURES', 'arm vfp callconvention-hard', True, False, d):
67 return 'armhf'
68 return d.getVar('HOST_ARCH')
69
70OECMAKE_TARGET_COMPILE = "compiler-rt"
71OECMAKE_TARGET_INSTALL = "install-compiler-rt install-compiler-rt-headers"
72OECMAKE_SOURCEPATH = "${S}/llvm"
73EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
74 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
75 -DCOMPILER_RT_STANDALONE_BUILD=ON \
76 -DCOMPILER_RT_INCLUDE_TESTS=OFF \
77 -DCOMPILER_RT_BUILD_XRAY=OFF \
78 -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
79 -DCOMPILER_RT_BUILD_MEMPROF=OFF \
80 -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
81 -DCOMPILER_RT_DEFAULT_TARGET_ARCH=${@get_compiler_rt_arch(bb, d)} \
82 -DLLVM_ENABLE_RUNTIMES='compiler-rt' \
83 -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
84 -DLLVM_APPEND_VC_REV=OFF \
85 -S ${S}/runtimes \
86"
87
88EXTRA_OECMAKE:append:class-target = "\
89 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
90 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
91 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
92 -DCMAKE_C_COMPILER_TARGET=${HOST_SYS} \
93 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
94 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
95"
96
97EXTRA_OECMAKE:append:class-nativesdk = "\
98 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
99 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
100 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
101 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
102 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
103 -DCMAKE_C_COMPILER_TARGET=${HOST_SYS} \
104 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
105"
106
107do_install:append () {
108 mkdir -p ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib
109 mv ${D}${nonarch_libdir}/linux ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib
110 if [ "${HF}" = "hf" ]; then
111 mv -f ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/libclang_rt.builtins-arm.a \
112 ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/libclang_rt.builtins-armhf.a
113 mv -f ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/liborc_rt-arm.a \
114 ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/liborc_rt-armhf.a
115 fi
116}
117
118FILES_SOLIBSDEV = ""
119
120FILES:${PN} += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/lib*${SOLIBSDEV} \
121 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/*.txt \
122 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/share/*.txt"
123FILES:${PN}-staticdev += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.a"
124FILES:${PN}-dev += "${datadir} ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.syms \
125 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/include \
126 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/clang_rt.crt*.o \
127 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/libclang_rt.asan-preinit*.a"
128
129INSANE_SKIP:${PN} = "dev-so libdir"
130INSANE_SKIP:${PN}-dbg = "libdir"
131
132RDEPENDS:${PN}-dev += "${PN}-staticdev"
133
134BBCLASSEXTEND = "native nativesdk"
135
136ALLOW_EMPTY:${PN} = "1"
137
138SYSROOT_DIRS:append:class-target = " ${nonarch_libdir}"