summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/llvm/llvm_git.bb
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2023-03-16 10:41:00 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-22 14:47:29 +0000
commit8cf1c4cd42cd632b68ab4195471d23d9188f2bcd (patch)
tree67f43d20e13488a9f40ed87891b573ac849d081e /meta/recipes-devtools/llvm/llvm_git.bb
parentb576cd5d84fc284c2905c2decc1d91be1c6de213 (diff)
downloadpoky-8cf1c4cd42cd632b68ab4195471d23d9188f2bcd.tar.gz
llvm: allow building libllvm in native builds, subject to PACKAGECONFIG
Also, enable that, if opengl is in native DISTRO_FEATURES: this allows mesa-native to build drivers that rely on libllvm, particularly llvmpipe, which is a (sort of) accelerated software renderer that is the only option on build hosts without dedicated or supported GPUs. (From OE-Core rev: ec22bfa67f6f1766102501d4593ce29aafe8c166) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/llvm/llvm_git.bb')
-rw-r--r--meta/recipes-devtools/llvm/llvm_git.bb14
1 files changed, 9 insertions, 5 deletions
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_git.bb
index b4e983d2d0..f133653903 100644
--- a/meta/recipes-devtools/llvm/llvm_git.bb
+++ b/meta/recipes-devtools/llvm/llvm_git.bb
@@ -57,9 +57,11 @@ def get_llvm_arch(bb, d, arch_var):
57def get_llvm_host_arch(bb, d): 57def get_llvm_host_arch(bb, d):
58 return get_llvm_arch(bb, d, 'HOST_ARCH') 58 return get_llvm_arch(bb, d, 'HOST_ARCH')
59 59
60PACKAGECONFIG ??= "" 60PACKAGECONFIG ??= "libllvm"
61PACKAGECONFIG:class-native = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'libllvm', '', d)}"
61# if optviewer OFF, force the modules to be not found or the ones on the host would be found 62# if optviewer OFF, force the modules to be not found or the ones on the host would be found
62PACKAGECONFIG[optviewer] = ",-DPY_PYGMENTS_FOUND=OFF -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF -DPY_YAML_FOUND=OFF,python3-pygments python3-pyyaml,python3-pygments python3-pyyaml" 63PACKAGECONFIG[optviewer] = ",-DPY_PYGMENTS_FOUND=OFF -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF -DPY_YAML_FOUND=OFF,python3-pygments python3-pyyaml,python3-pygments python3-pyyaml"
64PACKAGECONFIG[libllvm] = ""
63 65
64# 66#
65# Default to build all OE-Core supported target arches (user overridable). 67# Default to build all OE-Core supported target arches (user overridable).
@@ -102,14 +104,15 @@ do_compile:prepend:class-target() {
102} 104}
103 105
104do_compile() { 106do_compile() {
107 if ${@bb.utils.contains('PACKAGECONFIG', 'libllvm', 'true', 'false', d)}; then
105 ninja -v ${PARALLEL_MAKE} 108 ninja -v ${PARALLEL_MAKE}
106} 109 else
107
108do_compile:class-native() {
109 ninja -v ${PARALLEL_MAKE} llvm-config llvm-tblgen 110 ninja -v ${PARALLEL_MAKE} llvm-config llvm-tblgen
111 fi
110} 112}
111 113
112do_install() { 114do_install() {
115 if ${@bb.utils.contains('PACKAGECONFIG', 'libllvm', 'true', 'false', d)}; then
113 DESTDIR=${D} ninja -v install 116 DESTDIR=${D} ninja -v install
114 117
115 # llvm harcodes usr/lib as install path, so this corrects it to actual libdir 118 # llvm harcodes usr/lib as install path, so this corrects it to actual libdir
@@ -121,9 +124,10 @@ do_install() {
121 124
122 # reproducibility 125 # reproducibility
123 sed -i -e 's,${WORKDIR},,g' ${D}/${libdir}/cmake/llvm/LLVMConfig.cmake 126 sed -i -e 's,${WORKDIR},,g' ${D}/${libdir}/cmake/llvm/LLVMConfig.cmake
127 fi
124} 128}
125 129
126do_install:class-native() { 130do_install:append:class-native() {
127 install -D -m 0755 ${B}/bin/llvm-tblgen ${D}${bindir}/llvm-tblgen${PV} 131 install -D -m 0755 ${B}/bin/llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
128 install -D -m 0755 ${B}/bin/llvm-config ${D}${bindir}/llvm-config${PV} 132 install -D -m 0755 ${B}/bin/llvm-config ${D}${bindir}/llvm-config${PV}
129 ln -sf llvm-config${PV} ${D}${bindir}/llvm-config 133 ln -sf llvm-config${PV} ${D}${bindir}/llvm-config