blob: 4da11da8ef315f2c639e11f4308fdadeb1bdf9c9 [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 Williams864cc432023-02-09 14:54:44 -06007LLVM_RELEASE = "15.0.6"
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 \
13 file://0003-llvm-fix-include-benchmarks.patch;striplevel=2 \
14 file://0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch;striplevel=2"
15
16S = "${RUSTSRC}/src/llvm-project/llvm"
17
18LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe"
19
20inherit cmake python3native
21
22DEPENDS += "ninja-native rust-llvm-native"
23
24ARM_INSTRUCTION_SET:armv5 = "arm"
25ARM_INSTRUCTION_SET:armv4t = "arm"
26
27# rustc_llvm with debug info is not recognized as a valid crate that's
28# generated by rust-llvm-native.
29CFLAGS:remove = "-g"
30CXXFLAGS:remove = "-g"
31
32LLVM_DIR = "llvm${LLVM_RELEASE}"
33
34EXTRA_OECMAKE = " \
35 -DCMAKE_BUILD_TYPE=Release \
36 -DLLVM_TARGETS_TO_BUILD='ARM;AArch64;Mips;PowerPC;RISCV;X86' \
37 -DLLVM_BUILD_DOCS=OFF \
38 -DLLVM_ENABLE_TERMINFO=OFF \
39 -DLLVM_ENABLE_ZLIB=OFF \
Patrick Williams864cc432023-02-09 14:54:44 -060040 -DLLVM_ENABLE_ZSTD=OFF \
Andrew Geissler517393d2023-01-13 08:55:19 -060041 -DLLVM_ENABLE_LIBXML2=OFF \
42 -DLLVM_ENABLE_FFI=OFF \
43 -DLLVM_INSTALL_UTILS=ON \
44 -DLLVM_BUILD_EXAMPLES=OFF \
45 -DLLVM_INCLUDE_EXAMPLES=OFF \
46 -DLLVM_BUILD_TESTS=OFF \
47 -DLLVM_INCLUDE_TESTS=OFF \
48 -DLLVM_TARGET_ARCH=${TARGET_ARCH} \
49 -DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \
50"
51EXTRA_OECMAKE:append:class-target = "\
52 -DCMAKE_CROSSCOMPILING:BOOL=ON \
53 -DLLVM_BUILD_TOOLS=OFF \
54 -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \
55 -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \
56"
57
58EXTRA_OECMAKE:append:class-nativesdk = "\
59 -DCMAKE_CROSSCOMPILING:BOOL=ON \
60 -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
65# The debug symbols are huge here (>2GB) so suppress them since they
66# provide almost no value. If you really need them then override this
67INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
68
69export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config"
70
71do_install:append () {
72 # we don't need any of this stuff to build Rust
73 rm -rf "${D}/usr/lib/cmake"
74}
75
76PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto"
77
78# Add the extra locations to avoid the complaints about unpackaged files
79FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so"
80FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so"
81FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*"
82FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a"
83FILES:${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin"
84FILES:${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake"
85
86BBCLASSEXTEND = "native nativesdk"