summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/llvm
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2022-04-07 19:00:15 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-19 14:14:01 +0100
commit974f67b18a2f1a15c76785d69e7234594af97a88 (patch)
treecb75bf818d2a7e7471aed2641f24223cd99039ee /meta/recipes-devtools/llvm
parentee06fc2a19665461e143fe3bf7e94b703652e1cf (diff)
downloadopenembedded-core-974f67b18a2f1a15c76785d69e7234594af97a88.tar.gz
llvm: use default install paths
There was a very brittle sed hack against cpp source code that allowed installing multiple llvm versions into the same target/sysroot. Patching with sed is prone to silent regressions as it can change both too little and too much, and it indeed it broke with llvm 14. It's also difficult to tell what the 'right' change should look like. If this feature is actually needed somewhere, please do it properly: proper patch and upstream first. Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/llvm')
-rw-r--r--meta/recipes-devtools/llvm/llvm_git.bb58
1 files changed, 16 insertions, 42 deletions
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_git.bb
index 13f7fb763e..e10348a7f2 100644
--- a/meta/recipes-devtools/llvm/llvm_git.bb
+++ b/meta/recipes-devtools/llvm/llvm_git.bb
@@ -24,7 +24,6 @@ PV = "14.0.0"
MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}"
LLVM_RELEASE = "${PV}"
-LLVM_DIR = "llvm${LLVM_RELEASE}"
BRANCH = "release/${MAJOR_VERSION}.x"
SRCREV = "329fda39c507e8740978d10458451dcdb21563be"
@@ -91,13 +90,6 @@ EXTRA_OECMAKE:append:class-nativesdk = "\
-DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \
"
-do_configure:prepend() {
-# Fix paths in llvm-config
- sed -i "s|sys::path::parent_path(CurrentPath))\.str()|sys::path::parent_path(sys::path::parent_path(CurrentPath))).str()|g" ${S}/tools/llvm-config/llvm-config.cpp
- sed -ri "s#/(bin|include|lib)(/?\")#/\1/${LLVM_DIR}\2#g" ${S}/tools/llvm-config/llvm-config.cpp
- sed -ri "s#lib/${LLVM_DIR}#${baselib}/${LLVM_DIR}#g" ${S}/tools/llvm-config/llvm-config.cpp
-}
-
# patch out build host paths for reproducibility
do_compile:prepend:class-target() {
sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc
@@ -112,34 +104,17 @@ do_compile:class-native() {
}
do_install() {
- DESTDIR=${LLVM_INSTALL_DIR} ninja -v install
- install -D -m 0755 ${B}/bin/llvm-config ${D}${libdir}/${LLVM_DIR}/llvm-config
-
- install -d ${D}${bindir}/${LLVM_DIR}
- cp -r ${LLVM_INSTALL_DIR}${bindir}/* ${D}${bindir}/${LLVM_DIR}/
-
- install -d ${D}${includedir}/${LLVM_DIR}
- cp -r ${LLVM_INSTALL_DIR}${includedir}/* ${D}${includedir}/${LLVM_DIR}/
-
- install -d ${D}${libdir}/${LLVM_DIR}
-
- # The LLVM sources have "/lib" embedded and so we cannot completely rely on the ${libdir} variable
- if [ -d ${LLVM_INSTALL_DIR}${libdir}/ ]; then
- cp -r ${LLVM_INSTALL_DIR}${libdir}/* ${D}${libdir}/${LLVM_DIR}/
- elif [ -d ${LLVM_INSTALL_DIR}${prefix}/lib ]; then
- cp -r ${LLVM_INSTALL_DIR}${prefix}/lib/* ${D}${libdir}/${LLVM_DIR}/
- elif [ -d ${LLVM_INSTALL_DIR}${prefix}/lib64 ]; then
- cp -r ${LLVM_INSTALL_DIR}${prefix}/lib64/* ${D}${libdir}/${LLVM_DIR}/
- fi
+ DESTDIR=${D} ninja -v install
- # Remove unnecessary cmake files
- rm -rf ${D}${libdir}/${LLVM_DIR}/cmake
+ # llvm harcodes usr/lib as install path, so this corrects it to actual libdir
+ mv -T -n ${D}/${prefix}/lib ${D}/${libdir} || true
- ln -s ${LLVM_DIR}/libLLVM-${MAJOR_VERSION}${SOLIBSDEV} ${D}${libdir}/libLLVM-${MAJOR_VERSION}${SOLIBSDEV}
+ # Remove opt-viewer: https://llvm.org/docs/Remarks.html
+ rm -rf ${D}${datadir}/opt-viewer
+ rmdir ${D}${datadir}
- # We'll have to delete the libLLVM.so due to multiple reasons...
- rm -rf ${D}${libdir}/${LLVM_DIR}/libLLVM.so
- rm -rf ${D}${libdir}/${LLVM_DIR}/libLTO.so
+ # reproducibility
+ sed -i -e 's,${WORKDIR},,g' ${D}/${libdir}/cmake/llvm/LLVMConfig.cmake
}
do_install:class-native() {
@@ -152,34 +127,33 @@ PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptrema
RRECOMMENDS:${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liboptremarks"
FILES:${PN}-bugpointpasses = "\
- ${libdir}/${LLVM_DIR}/BugpointPasses.so \
+ ${libdir}/BugpointPasses.so \
"
FILES:${PN}-libllvm = "\
- ${libdir}/${LLVM_DIR}/libLLVM-${MAJOR_VERSION}.so \
${libdir}/libLLVM-${MAJOR_VERSION}.so \
"
FILES:${PN}-liblto += "\
- ${libdir}/${LLVM_DIR}/libLTO.so.* \
+ ${libdir}/libLTO.so.* \
"
FILES:${PN}-liboptremarks += "\
- ${libdir}/${LLVM_DIR}/libRemarks.so.* \
+ ${libdir}/libRemarks.so.* \
"
FILES:${PN}-llvmhello = "\
- ${libdir}/${LLVM_DIR}/LLVMHello.so \
+ ${libdir}/LLVMHello.so \
"
FILES:${PN}-dev += " \
- ${libdir}/${LLVM_DIR}/llvm-config \
- ${libdir}/${LLVM_DIR}/libRemarks.so \
- ${libdir}/${LLVM_DIR}/libLLVM-${PV}.so \
+ ${libdir}/llvm-config \
+ ${libdir}/libRemarks.so \
+ ${libdir}/libLLVM-${PV}.so \
"
FILES:${PN}-staticdev += "\
- ${libdir}/${LLVM_DIR}/*.a \
+ ${libdir}/*.a \
"
INSANE_SKIP:${PN}-libllvm += "dev-so"