All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Kanavin <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex@linutronix.de>
Subject: [PATCH 03/17] llvm: use default install paths
Date: Thu,  7 Apr 2022 19:00:15 +0200	[thread overview]
Message-ID: <20220407170029.3500874-3-alex@linutronix.de> (raw)
In-Reply-To: <20220407170029.3500874-1-alex@linutronix.de>

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>
---
 meta/recipes-devtools/llvm/llvm_git.bb | 58 +++++++-------------------
 meta/recipes-graphics/mesa/mesa.inc    |  2 +-
 2 files changed, 17 insertions(+), 43 deletions(-)

diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_git.bb
index 13f7fb763e..8f7540fd70 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}
 
-	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"
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index e8c07a4563..21fa1a6a9e 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -52,7 +52,7 @@ ANY_OF_DISTRO_FEATURES:class-target = "opengl vulkan"
 
 PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}"
 
-export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
+export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-config"
 export YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}"
 export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}"
 export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
-- 
2.30.2



  parent reply	other threads:[~2022-04-07 20:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 17:00 [PATCH 01/17] connman-conf: ignore eth0 in qemu in a way that is not sysvinit-specific Alexander Kanavin
2022-04-07 17:00 ` [PATCH 02/17] llvm: update 13.0.1 -> 14.0.0 Alexander Kanavin
2022-04-08  7:03   ` [OE-core] " Richard Purdie
2022-04-08  8:12     ` Alexander Kanavin
2022-04-07 17:00 ` Alexander Kanavin [this message]
2022-04-07 17:00 ` [PATCH 04/17] squashfs-tools: update 4.5 -> 4.5.1 Alexander Kanavin
2022-04-07 19:55   ` [OE-core] " Khem Raj
2022-04-07 19:59     ` Alexander Kanavin
2022-04-07 20:04       ` Khem Raj
2022-04-07 17:00 ` [PATCH 05/17] go-helloworld: update to latest revision Alexander Kanavin
2022-04-07 17:00 ` [PATCH 06/17] piglit: " Alexander Kanavin
2022-04-07 17:00 ` [PATCH 07/17] vulkan-samples: " Alexander Kanavin
2022-04-07 17:00 ` [PATCH 08/17] libxvmc: update 1.0.12 -> 1.0.13 Alexander Kanavin
2022-04-07 17:00 ` [PATCH 09/17] libsndfile1: update 1.0.31 -> 1.1.0 Alexander Kanavin
2022-04-07 17:00 ` [PATCH 10/17] at-spi2-core: update 2.42.0 -> 2.44.0 Alexander Kanavin
2022-04-07 17:00 ` [PATCH 11/17] webkitgtk: update 2.34.6 -> 2.36.0 Alexander Kanavin
2022-04-09  3:25   ` [OE-core] " Khem Raj
2022-04-07 17:00 ` [PATCH 12/17] cmake: update 3.22.3 -> 3.23.0 Alexander Kanavin
2022-04-07 17:00 ` [PATCH 13/17] epiphany: upgrade 41.3 -> 42.0 Alexander Kanavin
2022-04-07 17:00 ` [PATCH 14/17] gdk-pixbuf: upgrade 2.42.6 -> 2.42.8 Alexander Kanavin
2022-04-07 17:00 ` [PATCH 15/17] libgcrypt: upgrade 1.9.4 -> 1.10.1 Alexander Kanavin
2022-04-07 19:46   ` [OE-core] " Khem Raj
2022-04-07 19:56     ` Alexander Kanavin
2022-04-07 17:00 ` [PATCH 16/17] librsvg: upgrade 2.52.7 -> 2.54.0 Alexander Kanavin
2022-04-07 17:00 ` [PATCH 17/17] python3-typing-extensions: upgrade 3.10.0.0 -> 4.1.1 Alexander Kanavin
2022-04-07 19:43   ` [OE-core] " Khem Raj
2022-04-07 19:45     ` Alexander Kanavin
2022-04-07 19:59       ` Khem Raj
2022-04-07 21:14       ` Richard Purdie
2022-04-20 20:05 ` [OE-core] [PATCH 01/17] connman-conf: ignore eth0 in qemu in a way that is not sysvinit-specific Steve Sakoman
2022-04-20 21:00   ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220407170029.3500874-3-alex@linutronix.de \
    --to=alex.kanavin@gmail.com \
    --cc=alex@linutronix.de \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.