Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 1 | SUMMARY = "LLVM compiler framework (packaged with rust)" |
| 2 | LICENSE ?= "Apache-2.0-with-LLVM-exception" |
| 3 | HOMEPAGE = "http://www.rust-lang.org" |
| 4 | |
| 5 | # check src/llvm-project/llvm/CMakeLists.txt for llvm version in use |
| 6 | # |
Patrick Williams | 3965356 | 2024-03-01 08:54:02 -0600 | [diff] [blame] | 7 | LLVM_RELEASE = "17.0.6" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 8 | |
| 9 | require rust-source.inc |
| 10 | |
| 11 | SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ |
| 12 | file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ |
Patrick Williams | b542dec | 2023-06-09 01:26:37 -0500 | [diff] [blame] | 13 | file://0003-llvm-fix-include-benchmarks.patch;striplevel=2" |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 14 | |
| 15 | S = "${RUSTSRC}/src/llvm-project/llvm" |
| 16 | |
| 17 | LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe" |
| 18 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 19 | inherit cmake |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 20 | |
| 21 | DEPENDS += "ninja-native rust-llvm-native" |
| 22 | |
| 23 | ARM_INSTRUCTION_SET:armv5 = "arm" |
| 24 | ARM_INSTRUCTION_SET:armv4t = "arm" |
| 25 | |
| 26 | # rustc_llvm with debug info is not recognized as a valid crate that's |
| 27 | # generated by rust-llvm-native. |
| 28 | CFLAGS:remove = "-g" |
| 29 | CXXFLAGS:remove = "-g" |
| 30 | |
| 31 | LLVM_DIR = "llvm${LLVM_RELEASE}" |
| 32 | |
Patrick Williams | da29531 | 2023-12-05 16:48:56 -0600 | [diff] [blame] | 33 | RUST_LLVM_TARGETS ?= "ARM;AArch64;Mips;PowerPC;RISCV;X86" |
| 34 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 35 | EXTRA_OECMAKE = " \ |
| 36 | -DCMAKE_BUILD_TYPE=Release \ |
Patrick Williams | da29531 | 2023-12-05 16:48:56 -0600 | [diff] [blame] | 37 | -DLLVM_TARGETS_TO_BUILD='${RUST_LLVM_TARGETS}' \ |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 38 | -DLLVM_BUILD_DOCS=OFF \ |
| 39 | -DLLVM_ENABLE_TERMINFO=OFF \ |
| 40 | -DLLVM_ENABLE_ZLIB=OFF \ |
Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame] | 41 | -DLLVM_ENABLE_ZSTD=OFF \ |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 42 | -DLLVM_ENABLE_LIBXML2=OFF \ |
| 43 | -DLLVM_ENABLE_FFI=OFF \ |
| 44 | -DLLVM_INSTALL_UTILS=ON \ |
| 45 | -DLLVM_BUILD_EXAMPLES=OFF \ |
| 46 | -DLLVM_INCLUDE_EXAMPLES=OFF \ |
| 47 | -DLLVM_BUILD_TESTS=OFF \ |
| 48 | -DLLVM_INCLUDE_TESTS=OFF \ |
| 49 | -DLLVM_TARGET_ARCH=${TARGET_ARCH} \ |
| 50 | -DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \ |
| 51 | " |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 52 | |
| 53 | # Forcibly disable the detection of these packages as otherwise |
| 54 | # it will look at the host Python install |
| 55 | EXTRA_OECMAKE += "\ |
| 56 | -DPY_PYGMENTS_FOUND=OFF \ |
| 57 | -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF \ |
| 58 | -DPY_YAML_FOUND=OFF \ |
| 59 | " |
| 60 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 61 | EXTRA_OECMAKE:append:class-target = "\ |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 62 | -DLLVM_BUILD_TOOLS=OFF \ |
| 63 | -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ |
| 64 | -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ |
| 65 | " |
| 66 | |
| 67 | EXTRA_OECMAKE:append:class-nativesdk = "\ |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 68 | -DLLVM_BUILD_TOOLS=OFF \ |
| 69 | -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ |
| 70 | -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ |
| 71 | " |
| 72 | |
| 73 | # The debug symbols are huge here (>2GB) so suppress them since they |
| 74 | # provide almost no value. If you really need them then override this |
| 75 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" |
| 76 | |
| 77 | export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" |
| 78 | |
| 79 | do_install:append () { |
| 80 | # we don't need any of this stuff to build Rust |
| 81 | rm -rf "${D}/usr/lib/cmake" |
| 82 | } |
| 83 | |
| 84 | PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto" |
| 85 | |
| 86 | # Add the extra locations to avoid the complaints about unpackaged files |
| 87 | FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so" |
| 88 | FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so" |
| 89 | FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*" |
| 90 | FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a" |
| 91 | FILES:${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin" |
| 92 | FILES:${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake" |
| 93 | |
| 94 | BBCLASSEXTEND = "native nativesdk" |