rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | # Copyright (C) 2015 Khem Raj <raj.khem@gmail.com> |
| 2 | # Released under the MIT license (see COPYING.MIT for the terms) |
| 3 | |
| 4 | DESCRIPTION = "libc++ is a new implementation of the C++ standard library, targeting C++11" |
| 5 | HOMEPAGE = "http://libcxx.llvm.org/" |
| 6 | LICENSE = "MIT | NCSA" |
| 7 | SECTION = "base" |
| 8 | |
| 9 | require clang.inc |
| 10 | require common-source.inc |
| 11 | |
| 12 | inherit cmake pythonnative |
| 13 | |
| 14 | DEPENDS += "ninja-native" |
| 15 | BASEDEPENDS_remove_toolchain-clang = "libcxx" |
| 16 | DEPENDS_append_toolchain-clang = " virtual/${TARGET_PREFIX}compilerlibs" |
| 17 | TARGET_CXXFLAGS_remove_toolchain-clang = "--stdlib=libc++" |
| 18 | TUNE_CCARGS_remove_toolchain-clang = "--rtlib=compiler-rt --stdlib=libc++" |
| 19 | |
| 20 | PACKAGECONFIG ??= "unwind" |
| 21 | PACKAGECONFIG_powerpc = "" |
| 22 | PACKAGECONFIG_mipsarch = "" |
| 23 | PACKAGECONFIG_riscv64 = "" |
| 24 | PACKAGECONFIG[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)}" |
| 27 | LIBUNWIND = "${@bb.utils.contains('PACKAGECONFIG', 'unwind', ';libunwind', '', d)}" |
| 28 | |
| 29 | LIC_FILES_CHKSUM = "file://libcxx/LICENSE.TXT;md5=3de3deb8323d5cf3360104190e804a75 \ |
| 30 | file://libcxxabi/LICENSE.TXT;md5=9dad5a191d1fc03b31525706040c4ed1 \ |
| 31 | file://libunwind/LICENSE.TXT;md5=af2bc0b29ead3c8f201c5486f3c9d59b \ |
| 32 | " |
| 33 | THUMB_TUNE_CCARGS = "" |
| 34 | #TUNE_CCARGS += "-nostdlib" |
| 35 | EXTRA_OECMAKE_append_armv5 = " -D_LIBCXXABI_HAS_ATOMIC_BUILTINS=OFF" |
| 36 | |
| 37 | EXTRA_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 | |
| 53 | EXTRA_OECMAKE_append_class-native = " -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF" |
| 54 | EXTRA_OECMAKE_append_class-nativesdk = " -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF" |
| 55 | EXTRA_OECMAKE_append_libc-musl = " -DLIBCXX_HAS_MUSL_LIBC=ON " |
| 56 | |
| 57 | do_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 | |
| 65 | do_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 | |
| 73 | ALLOW_EMPTY_${PN} = "1" |
| 74 | |
| 75 | #PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs" |
| 76 | |
| 77 | RDEPENDS_${PN}-dev += "${PN}-staticdev" |
| 78 | |
| 79 | BBCLASSEXTEND = "native nativesdk" |
| 80 | TOOLCHAIN_forcevariable = "clang" |