blob: 57bbe79cdf16c0319270dc4a201c4d83523ddfa2 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001SUMMARY = "LLVM compiler framework (packaged with rust)"
2LICENSE ?= "Apache-2.0-with-LLVM-exception"
3HOMEPAGE = "http://www.rust-lang.org"
4
5# check src/llvm-project/llvm/CMakeLists.txt for llvm version in use
6#
Patrick Williamsb542dec2023-06-09 01:26:37 -05007LLVM_RELEASE = "16.0.2"
Andrew Geissler517393d2023-01-13 08:55:19 -06008
9require rust-source.inc
10
11SRC_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 Williamsb542dec2023-06-09 01:26:37 -050013 file://0003-llvm-fix-include-benchmarks.patch;striplevel=2"
Andrew Geissler517393d2023-01-13 08:55:19 -060014
15S = "${RUSTSRC}/src/llvm-project/llvm"
16
17LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe"
18
Patrick Williamsac13d5f2023-11-24 18:59:46 -060019inherit cmake
Andrew Geissler517393d2023-01-13 08:55:19 -060020
21DEPENDS += "ninja-native rust-llvm-native"
22
23ARM_INSTRUCTION_SET:armv5 = "arm"
24ARM_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.
28CFLAGS:remove = "-g"
29CXXFLAGS:remove = "-g"
30
31LLVM_DIR = "llvm${LLVM_RELEASE}"
32
33EXTRA_OECMAKE = " \
34 -DCMAKE_BUILD_TYPE=Release \
35 -DLLVM_TARGETS_TO_BUILD='ARM;AArch64;Mips;PowerPC;RISCV;X86' \
36 -DLLVM_BUILD_DOCS=OFF \
37 -DLLVM_ENABLE_TERMINFO=OFF \
38 -DLLVM_ENABLE_ZLIB=OFF \
Patrick Williams864cc432023-02-09 14:54:44 -060039 -DLLVM_ENABLE_ZSTD=OFF \
Andrew Geissler517393d2023-01-13 08:55:19 -060040 -DLLVM_ENABLE_LIBXML2=OFF \
41 -DLLVM_ENABLE_FFI=OFF \
42 -DLLVM_INSTALL_UTILS=ON \
43 -DLLVM_BUILD_EXAMPLES=OFF \
44 -DLLVM_INCLUDE_EXAMPLES=OFF \
45 -DLLVM_BUILD_TESTS=OFF \
46 -DLLVM_INCLUDE_TESTS=OFF \
47 -DLLVM_TARGET_ARCH=${TARGET_ARCH} \
48 -DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \
49"
Patrick Williamsac13d5f2023-11-24 18:59:46 -060050
51# Forcibly disable the detection of these packages as otherwise
52# it will look at the host Python install
53EXTRA_OECMAKE += "\
54 -DPY_PYGMENTS_FOUND=OFF \
55 -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF \
56 -DPY_YAML_FOUND=OFF \
57"
58
Andrew Geissler517393d2023-01-13 08:55:19 -060059EXTRA_OECMAKE:append:class-target = "\
Andrew Geissler517393d2023-01-13 08:55:19 -060060 -DLLVM_BUILD_TOOLS=OFF \
61 -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \
62 -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \
63"
64
65EXTRA_OECMAKE:append:class-nativesdk = "\
Andrew Geissler517393d2023-01-13 08:55:19 -060066 -DLLVM_BUILD_TOOLS=OFF \
67 -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \
68 -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \
69"
70
71# The debug symbols are huge here (>2GB) so suppress them since they
72# provide almost no value. If you really need them then override this
73INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
74
75export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config"
76
77do_install:append () {
78 # we don't need any of this stuff to build Rust
79 rm -rf "${D}/usr/lib/cmake"
80}
81
82PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto"
83
84# Add the extra locations to avoid the complaints about unpackaged files
85FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so"
86FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so"
87FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*"
88FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a"
89FILES:${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin"
90FILES:${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake"
91
92BBCLASSEXTEND = "native nativesdk"