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 = "LLVM based C/C++ compiler Runtime" |
| 5 | HOMEPAGE = "http://compiler-rt.llvm.org/" |
| 6 | LICENSE = "MIT | NCSA" |
| 7 | SECTION = "base" |
| 8 | |
| 9 | require clang.inc |
| 10 | require common-source.inc |
| 11 | |
| 12 | inherit cmake pkgconfig pythonnative |
| 13 | |
| 14 | |
| 15 | LIC_FILES_CHKSUM = "file://compiler-rt/LICENSE.TXT;md5=f981c4637a4cd67915ac527b3ead3a59; \ |
| 16 | " |
| 17 | |
| 18 | BASEDEPENDS_remove_toolchain-clang_class-target = "compiler-rt libcxx" |
| 19 | DEPENDS_append_toolchain-clang_class-target = " virtual/${TARGET_PREFIX}compilerlibs" |
| 20 | TARGET_CXXFLAGS_remove_toolchain-clang = "--stdlib=libc++" |
| 21 | TUNE_CCARGS_remove_toolchain-clang = "--rtlib=compiler-rt --stdlib=libc++" |
| 22 | TUNE_CCARGS_remove = "-no-integrated-as" |
| 23 | DEPENDS += "ninja-native" |
| 24 | DEPENDS_append_class-nativesdk = " clang-native" |
| 25 | |
| 26 | THUMB_TUNE_CCARGS = "" |
| 27 | #TUNE_CCARGS += "-nostdlib" |
| 28 | |
| 29 | HF = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}" |
| 30 | HF[vardepvalue] = "${HF}" |
| 31 | EXTRA_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 | |
| 41 | EXTRA_OECMAKE_append_class-nativesdk = "\ |
| 42 | -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \ |
| 43 | -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \ |
| 44 | " |
| 45 | |
| 46 | EXTRA_OECMAKE_append_libc-musl = " -DCOMPILER_RT_BUILD_SANITIZERS=OFF " |
| 47 | CXXFLAGS_append_libc-musl = " -D_LIBCPP_HAS_MUSL_LIBC=ON " |
| 48 | EXTRA_OECMAKE_append_mipsarch = "-DCOMPILER_RT_BUILD_SANITIZERS=OFF " |
| 49 | |
| 50 | do_compile() { |
| 51 | ninja ${PARALLEL_MAKE} compiler-rt |
| 52 | } |
| 53 | |
| 54 | do_install() { |
| 55 | DESTDIR=${D} ninja ${PARALLEL_MAKE} install-compiler-rt |
| 56 | } |
| 57 | |
| 58 | |
| 59 | do_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 | |
| 75 | FILES_SOLIBSDEV = "" |
| 76 | FILES_${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" |
| 79 | FILES_${PN}-staticdev += "${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.a" |
| 80 | FILES_${PN}-dev += "${datadir} ${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.syms" |
| 81 | INSANE_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 | |
| 92 | RDEPENDS_${PN}-dev += "${PN}-staticdev" |
| 93 | |
| 94 | BBCLASSEXTEND = "native nativesdk" |
| 95 | |
| 96 | ALLOW_EMPTY_${PN} = "1" |
| 97 | ALLOW_EMPTY_${PN}-dev = "1" |
| 98 | |
| 99 | TOOLCHAIN_forcevariable = "clang" |