blob: ad755b9b15532f77f16be7252a753d0156d145c7 [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 = "libc++ is a new implementation of the C++ standard library, targeting C++11"
5HOMEPAGE = "http://libcxx.llvm.org/"
6LICENSE = "MIT | NCSA"
7SECTION = "base"
8
9require clang.inc
10require common-source.inc
11
12inherit cmake pythonnative
13
14DEPENDS += "ninja-native"
15BASEDEPENDS_remove_toolchain-clang = "libcxx"
16DEPENDS_append_toolchain-clang = " virtual/${TARGET_PREFIX}compilerlibs"
17TARGET_CXXFLAGS_remove_toolchain-clang = "--stdlib=libc++"
18TUNE_CCARGS_remove_toolchain-clang = "--rtlib=compiler-rt --stdlib=libc++"
19
20PACKAGECONFIG ??= "unwind"
21PACKAGECONFIG_powerpc = ""
22PACKAGECONFIG_mipsarch = ""
23PACKAGECONFIG_riscv64 = ""
24PACKAGECONFIG[unwind] = "-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBUNWIND_ENABLE_SHARED=OFF -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON -DLIBCXXABI_LIBUNWIND_INCLUDES=${S}/projects/libunwind/include, -DLIBCXXABI_USE_LLVM_UNWINDER=OFF,"
25
26#PROVIDES += "${@bb.utils.contains('PACKAGECONFIG', 'unwind', 'libunwind', '', d)}"
27LIBUNWIND = "${@bb.utils.contains('PACKAGECONFIG', 'unwind', ';libunwind', '', d)}"
28
29LIC_FILES_CHKSUM = "file://libcxx/LICENSE.TXT;md5=3de3deb8323d5cf3360104190e804a75 \
30 file://libcxxabi/LICENSE.TXT;md5=9dad5a191d1fc03b31525706040c4ed1 \
31 file://libunwind/LICENSE.TXT;md5=af2bc0b29ead3c8f201c5486f3c9d59b \
32"
33THUMB_TUNE_CCARGS = ""
34#TUNE_CCARGS += "-nostdlib"
35EXTRA_OECMAKE_append_armv5 = " -D_LIBCXXABI_HAS_ATOMIC_BUILTINS=OFF"
36
37EXTRA_OECMAKE += "\
38 -DLIBCXX_CXX_ABI=libcxxabi \
39 -DLIBCXX_USE_COMPILER_RT=YES \
40 -DLIBCXXABI_USE_COMPILER_RT=YES \
41 -DCXX_SUPPORTS_CXX11=ON \
42 -DLIBCXXABI_LIBCXX_INCLUDES=${S}/libcxx/include \
43 -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${S}/libcxxabi/include \
44 -DLIBCXX_CXX_ABI_LIBRARY_PATH=${B}/lib \
45 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
46 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
47 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
48 -DLLVM_ENABLE_PROJECTS='libcxx;libcxxabi${LIBUNWIND}' \
49 -G Ninja \
50 ${S}/llvm \
51"
52
53EXTRA_OECMAKE_append_class-native = " -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF"
54EXTRA_OECMAKE_append_class-nativesdk = " -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF"
55EXTRA_OECMAKE_append_libc-musl = " -DLIBCXX_HAS_MUSL_LIBC=ON "
56
57do_compile() {
58 if ${@bb.utils.contains('PACKAGECONFIG', 'unwind', 'true', 'false', d)}; then
59 ninja -v ${PARALLEL_MAKE} unwind
60 fi
61 ninja -v ${PARALLEL_MAKE} cxxabi
62 ninja -v ${PARALLEL_MAKE} cxx
63}
64
65do_install() {
66 if ${@bb.utils.contains('PACKAGECONFIG', 'unwind', 'true', 'false', d)}; then
67 DESTDIR=${D} ninja ${PARALLEL_MAKE} install-unwind
68 rm -rf ${D}${libdir}/libunwind.so
69 fi
70 DESTDIR=${D} ninja ${PARALLEL_MAKE} install-cxx install-cxxabi
71}
72
73ALLOW_EMPTY_${PN} = "1"
74
75#PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
76
77RDEPENDS_${PN}-dev += "${PN}-staticdev"
78
79BBCLASSEXTEND = "native nativesdk"
80TOOLCHAIN_forcevariable = "clang"