blob: 9a152119e113ee5c3734ac987b44f956a4d9aee0 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001# Copyright (C) 2015 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "LLVM based C/C++ compiler Runtime"
5HOMEPAGE = "http://compiler-rt.llvm.org/"
6LICENSE = "MIT | NCSA"
7SECTION = "base"
8
9require clang.inc
10require common-source.inc
11
12inherit cmake pkgconfig pythonnative
13
14
15LIC_FILES_CHKSUM = "file://compiler-rt/LICENSE.TXT;md5=f981c4637a4cd67915ac527b3ead3a59; \
16"
17
18BASEDEPENDS_remove_toolchain-clang_class-target = "compiler-rt libcxx"
19DEPENDS_append_toolchain-clang_class-target = " virtual/${TARGET_PREFIX}compilerlibs"
20TARGET_CXXFLAGS_remove_toolchain-clang = "--stdlib=libc++"
21TUNE_CCARGS_remove_toolchain-clang = "--rtlib=compiler-rt --stdlib=libc++"
22TUNE_CCARGS_remove = "-no-integrated-as"
23DEPENDS += "ninja-native"
24DEPENDS_append_class-nativesdk = " clang-native"
25
26THUMB_TUNE_CCARGS = ""
27#TUNE_CCARGS += "-nostdlib"
28
29HF = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
30HF[vardepvalue] = "${HF}"
31EXTRA_OECMAKE += "-DCOMPILER_RT_STANDALONE_BUILD=OFF \
32 -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=${HOST_ARCH}${HF}${HOST_VENDOR}-${HOST_OS} \
33 -DCOMPILER_RT_BUILD_XRAY=OFF \
34 -DLLVM_ENABLE_PROJECTS='compiler-rt' \
35 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
36 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
37 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
38 -G Ninja ${S}/llvm \
39"
40
41EXTRA_OECMAKE_append_class-nativesdk = "\
42 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
43 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
44"
45
46EXTRA_OECMAKE_append_libc-musl = " -DCOMPILER_RT_BUILD_SANITIZERS=OFF "
47CXXFLAGS_append_libc-musl = " -D_LIBCPP_HAS_MUSL_LIBC=ON "
48EXTRA_OECMAKE_append_mipsarch = "-DCOMPILER_RT_BUILD_SANITIZERS=OFF "
49
50do_compile() {
51 ninja ${PARALLEL_MAKE} compiler-rt
52}
53
54do_install() {
55 DESTDIR=${D} ninja ${PARALLEL_MAKE} install-compiler-rt
56}
57
58
59do_install_append () {
60 if [ -d ${D}${libdir}/linux ]; then
61 for f in `find ${D}${libdir}/linux -maxdepth 1 -type f`
62 do
63 install -D -m 0644 $f ${D}${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/`basename $f`
64 rm $f
65 done
66 rmdir ${D}${libdir}/linux
67 fi
68 for f in `find ${D}${exec_prefix} -maxdepth 1 -name '*.txt' -type f`
69 do
70 install -D -m 0644 $f ${D}${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/`basename $f`
71 rm $f
72 done
73}
74
75FILES_SOLIBSDEV = ""
76FILES_${PN} += "${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/lib*${SOLIBSDEV} \
77 ${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/*.txt \
78 ${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/share/*.txt"
79FILES_${PN}-staticdev += "${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.a"
80FILES_${PN}-dev += "${datadir} ${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.syms"
81INSANE_SKIP_${PN} = "dev-so"
82
83#PROVIDES_append_class-target = "\
84# virtual/${TARGET_PREFIX}compilerlibs \
85# libgcc \
86# libgcc-initial \
87# libgcc-dev \
88# libgcc-initial-dev \
89# "
90#
91
92RDEPENDS_${PN}-dev += "${PN}-staticdev"
93
94BBCLASSEXTEND = "native nativesdk"
95
96ALLOW_EMPTY_${PN} = "1"
97ALLOW_EMPTY_${PN}-dev = "1"
98
99TOOLCHAIN_forcevariable = "clang"