diff options
Diffstat (limited to 'meta/recipes-devtools/llvm/llvm_19.1.6.bb')
-rw-r--r-- | meta/recipes-devtools/llvm/llvm_19.1.6.bb | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/meta/recipes-devtools/llvm/llvm_19.1.6.bb b/meta/recipes-devtools/llvm/llvm_19.1.6.bb new file mode 100644 index 0000000000..003676a652 --- /dev/null +++ b/meta/recipes-devtools/llvm/llvm_19.1.6.bb | |||
@@ -0,0 +1,179 @@ | |||
1 | # Copyright (C) 2017 Khem Raj <raj.khem@gmail.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | SUMMARY = "The LLVM Compiler Infrastructure" | ||
5 | HOMEPAGE = "http://llvm.org" | ||
6 | LICENSE = "Apache-2.0-with-LLVM-exception" | ||
7 | SECTION = "devel" | ||
8 | |||
9 | LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe" | ||
10 | |||
11 | DEPENDS = "libffi libxml2 zlib zstd libedit ninja-native llvm-native" | ||
12 | |||
13 | RDEPENDS:${PN}:append:class-target = " ncurses-terminfo" | ||
14 | |||
15 | inherit cmake pkgconfig | ||
16 | # could be 'rcX' or 'git' or empty ( for release ) | ||
17 | VER_SUFFIX = "" | ||
18 | |||
19 | PV .= "${VER_SUFFIX}" | ||
20 | |||
21 | MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}" | ||
22 | |||
23 | LLVM_RELEASE = "${PV}" | ||
24 | |||
25 | SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz \ | ||
26 | file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ | ||
27 | file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ | ||
28 | file://llvm-config \ | ||
29 | " | ||
30 | SRC_URI[sha256sum] = "e3f79317adaa9196d2cfffe1c869d7c100b7540832bc44fe0d3f44a12861fa34" | ||
31 | UPSTREAM_CHECK_URI = "https://github.com/llvm/llvm-project" | ||
32 | UPSTREAM_CHECK_REGEX = "llvmorg-(?P<pver>\d+(\.\d+)+)" | ||
33 | |||
34 | S = "${WORKDIR}/llvm-project-${PV}.src/llvm" | ||
35 | |||
36 | LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install" | ||
37 | |||
38 | def get_llvm_arch(bb, d, arch_var): | ||
39 | import re | ||
40 | a = d.getVar(arch_var) | ||
41 | if re.match(r'(i.86|athlon|x86.64)$', a): return 'X86' | ||
42 | elif re.match(r'arm$', a): return 'ARM' | ||
43 | elif re.match(r'armeb$', a): return 'ARM' | ||
44 | elif re.match(r'aarch64$', a): return 'AArch64' | ||
45 | elif re.match(r'aarch64_be$', a): return 'AArch64' | ||
46 | elif re.match(r'mips(isa|)(32|64|)(r6|)(el|)$', a): return 'Mips' | ||
47 | elif re.match(r'riscv(32|64)(eb|)$', a): return 'RISCV' | ||
48 | elif re.match(r'p(pc|owerpc)(|64)', a): return 'PowerPC' | ||
49 | else: | ||
50 | raise bb.parse.SkipRecipe("Cannot map '%s' to a supported LLVM architecture" % a) | ||
51 | |||
52 | def get_llvm_host_arch(bb, d): | ||
53 | return get_llvm_arch(bb, d, 'HOST_ARCH') | ||
54 | |||
55 | PACKAGECONFIG ??= "libllvm" | ||
56 | # if optviewer OFF, force the modules to be not found or the ones on the host would be found | ||
57 | PACKAGECONFIG[optviewer] = ",-DPY_PYGMENTS_FOUND=OFF -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF -DPY_YAML_FOUND=OFF,python3-pygments python3-pyyaml,python3-pygments python3-pyyaml" | ||
58 | PACKAGECONFIG[libllvm] = "" | ||
59 | |||
60 | # | ||
61 | # Default to build all OE-Core supported target arches (user overridable). | ||
62 | # | ||
63 | LLVM_TARGETS ?= "AMDGPU;${@get_llvm_host_arch(bb, d)}" | ||
64 | |||
65 | ARM_INSTRUCTION_SET:armv5 = "arm" | ||
66 | ARM_INSTRUCTION_SET:armv4t = "arm" | ||
67 | |||
68 | EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \ | ||
69 | -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \ | ||
70 | -DLLVM_ENABLE_PIC=ON \ | ||
71 | -DLLVM_BINDINGS_LIST='' \ | ||
72 | -DLLVM_LINK_LLVM_DYLIB=ON \ | ||
73 | -DLLVM_ENABLE_FFI=ON \ | ||
74 | -DLLVM_ENABLE_RTTI=ON \ | ||
75 | -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \ | ||
76 | -DLLVM_OPTIMIZED_TABLEGEN=ON \ | ||
77 | -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS}' \ | ||
78 | -DLLVM_VERSION_SUFFIX='${VER_SUFFIX}' \ | ||
79 | -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ | ||
80 | -DCMAKE_BUILD_TYPE=Release \ | ||
81 | " | ||
82 | |||
83 | EXTRA_OECMAKE:append:class-target = "\ | ||
84 | -DCMAKE_CROSSCOMPILING:BOOL=ON \ | ||
85 | -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \ | ||
86 | -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \ | ||
87 | " | ||
88 | |||
89 | EXTRA_OECMAKE:append:class-nativesdk = "\ | ||
90 | -DCMAKE_CROSSCOMPILING:BOOL=ON \ | ||
91 | -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \ | ||
92 | -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \ | ||
93 | " | ||
94 | |||
95 | # patch out build host paths for reproducibility | ||
96 | do_compile:prepend:class-target() { | ||
97 | sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc | ||
98 | } | ||
99 | |||
100 | do_compile:prepend:class-nativesdk() { | ||
101 | sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc | ||
102 | } | ||
103 | |||
104 | do_compile() { | ||
105 | if ${@bb.utils.contains('PACKAGECONFIG', 'libllvm', 'true', 'false', d)}; then | ||
106 | ninja -v ${PARALLEL_MAKE} | ||
107 | else | ||
108 | ninja -v ${PARALLEL_MAKE} llvm-config llvm-tblgen | ||
109 | fi | ||
110 | } | ||
111 | |||
112 | do_install() { | ||
113 | if ${@bb.utils.contains('PACKAGECONFIG', 'libllvm', 'true', 'false', d)}; then | ||
114 | DESTDIR=${D} ninja -v install | ||
115 | |||
116 | # llvm harcodes usr/lib as install path, so this corrects it to actual libdir | ||
117 | mv -T -n ${D}/${prefix}/lib ${D}/${libdir} || true | ||
118 | |||
119 | # Remove opt-viewer: https://llvm.org/docs/Remarks.html | ||
120 | rm -rf ${D}${datadir}/opt-viewer | ||
121 | rmdir ${D}${datadir} | ||
122 | |||
123 | # reproducibility | ||
124 | sed -i -e 's,${WORKDIR},,g' ${D}/${libdir}/cmake/llvm/LLVMConfig.cmake | ||
125 | fi | ||
126 | } | ||
127 | |||
128 | do_install:append:class-native() { | ||
129 | install -D -m 0755 ${B}/bin/llvm-tblgen ${D}${bindir}/llvm-tblgen${PV} | ||
130 | install -D -m 0755 ${B}/bin/llvm-config ${D}${bindir}/llvm-config${PV} | ||
131 | ln -sf llvm-config${PV} ${D}${bindir}/llvm-config | ||
132 | } | ||
133 | |||
134 | SYSROOT_PREPROCESS_FUNCS:append:class-target = " llvm_sysroot_preprocess" | ||
135 | |||
136 | llvm_sysroot_preprocess() { | ||
137 | install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ | ||
138 | install -m 0755 ${UNPACKDIR}/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/ | ||
139 | ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV} | ||
140 | } | ||
141 | |||
142 | PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptremarks ${PN}-liblto" | ||
143 | |||
144 | RRECOMMENDS:${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liboptremarks" | ||
145 | |||
146 | FILES:${PN}-bugpointpasses = "\ | ||
147 | ${libdir}/BugpointPasses.so \ | ||
148 | " | ||
149 | |||
150 | FILES:${PN}-libllvm = "\ | ||
151 | ${libdir}/libLLVM-${MAJOR_VERSION}.so \ | ||
152 | ${libdir}/libLLVM.so.${MAJOR_VER}.${MINOR_VER} \ | ||
153 | " | ||
154 | |||
155 | FILES:${PN}-liblto += "\ | ||
156 | ${libdir}/libLTO.so.* \ | ||
157 | " | ||
158 | |||
159 | FILES:${PN}-liboptremarks += "\ | ||
160 | ${libdir}/libRemarks.so.* \ | ||
161 | " | ||
162 | |||
163 | FILES:${PN}-llvmhello = "\ | ||
164 | ${libdir}/LLVMHello.so \ | ||
165 | " | ||
166 | |||
167 | FILES:${PN}-dev += " \ | ||
168 | ${libdir}/llvm-config \ | ||
169 | ${libdir}/libRemarks.so \ | ||
170 | ${libdir}/libLLVM-${PV}.so \ | ||
171 | " | ||
172 | |||
173 | FILES:${PN}-staticdev += "\ | ||
174 | ${libdir}/*.a \ | ||
175 | " | ||
176 | |||
177 | INSANE_SKIP:${PN}-libllvm += "dev-so" | ||
178 | |||
179 | BBCLASSEXTEND = "native nativesdk" | ||