Signed-off-by: Markus Volk <[email protected]>
---
 ...Lists.txt-only-install-opt-viewer-if.patch | 60 +++++++++++++++++++
 meta/recipes-devtools/llvm/llvm_git.bb        | 11 ++--
 2 files changed, 66 insertions(+), 5 deletions(-)
 create mode 100644 
meta/recipes-devtools/llvm/llvm/0001-opt-viewer-CMakeLists.txt-only-install-opt-viewer-if.patch

diff --git 
a/meta/recipes-devtools/llvm/llvm/0001-opt-viewer-CMakeLists.txt-only-install-opt-viewer-if.patch
 
b/meta/recipes-devtools/llvm/llvm/0001-opt-viewer-CMakeLists.txt-only-install-opt-viewer-if.patch
new file mode 100644
index 0000000000..12c9f0d0c0
--- /dev/null
+++ 
b/meta/recipes-devtools/llvm/llvm/0001-opt-viewer-CMakeLists.txt-only-install-opt-viewer-if.patch
@@ -0,0 +1,60 @@
+From 8dbfe220d16054245d8122e620639e7d62a4d791 Mon Sep 17 00:00:00 2001
+From: Markus Volk <[email protected]>
+Date: Thu, 23 Jun 2022 15:07:01 +0200
+Subject: [PATCH] llvm/tools/opt-viewer/CMakeLists.txt: install opt-viewer only
+ if enabled
+
+Upstream-Status: Pending
+
+Signed-off-by: Markus Volk <[email protected]>
+---
+ llvm/tools/opt-viewer/CMakeLists.txt          | 36 ++++++++++---------
+ 1 files changed, 19 insertions(+), 17 deletions(-)
+
+diff --git a/llvm/tools/opt-viewer/CMakeLists.txt 
b/llvm/tools/opt-viewer/CMakeLists.txt
+index c0070f8cbfac..fb6ee384f6d1 100644
+--- a/llvm/tools/opt-viewer/CMakeLists.txt
++++ b/llvm/tools/opt-viewer/CMakeLists.txt
+@@ -1,20 +1,22 @@
+-set (files
+-  "opt-diff.py"
+-  "opt-stats.py"
+-  "opt-viewer.py"
+-  "optpmap.py"
+-  "optrecord.py"
+-  "style.css")
++if(LLVM_HAVE_OPT_VIEWER_MODULES)
++  set (files
++    "opt-diff.py"
++    "opt-stats.py"
++    "opt-viewer.py"
++    "optpmap.py"
++    "optrecord.py"
++    "style.css")
+ 
+-foreach (file ${files})
+-  install(PROGRAMS ${file}
+-    DESTINATION "${CMAKE_INSTALL_DATADIR}/opt-viewer"
+-    COMPONENT opt-viewer)
+-endforeach (file)
++  foreach (file ${files})
++    install(PROGRAMS ${file}
++      DESTINATION "${CMAKE_INSTALL_DATADIR}/opt-viewer"
++      COMPONENT opt-viewer)
++  endforeach (file)
+ 
+-add_custom_target(opt-viewer DEPENDS ${files})
+-if(NOT LLVM_ENABLE_IDE)
+-  add_llvm_install_targets("install-opt-viewer"
+-                           DEPENDS opt-viewer
+-                           COMPONENT opt-viewer)
++  add_custom_target(opt-viewer DEPENDS ${files})
++  if(NOT LLVM_ENABLE_IDE)
++    add_llvm_install_targets("install-opt-viewer"
++                             DEPENDS opt-viewer
++                             COMPONENT opt-viewer)
++  endif()
+ endif()
+-- 
+2.25.1
+
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb 
b/meta/recipes-devtools/llvm/llvm_git.bb
index 0d7b042958..b756b97b96 100644
--- a/meta/recipes-devtools/llvm/llvm_git.bb
+++ b/meta/recipes-devtools/llvm/llvm_git.bb
@@ -31,6 +31,7 @@ SRC_URI = 
"git://github.com/llvm/llvm-project.git;branch=${BRANCH};protocol=http
            
file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch;striplevel=2
 \
            file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \
            
file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2
 \
+           
file://0001-opt-viewer-CMakeLists.txt-only-install-opt-viewer-if.patch;striplevel=2
 \
            "
 
 UPSTREAM_CHECK_GITTAGREGEX = "llvmorg-(?P<pver>\d+(\.\d+)+)"
@@ -112,10 +113,6 @@ do_install() {
         # llvm harcodes usr/lib as install path, so this corrects it to actual 
libdir
         mv -T -n ${D}/${prefix}/lib ${D}/${libdir} || true
 
-        # Remove opt-viewer: https://llvm.org/docs/Remarks.html
-        rm -rf ${D}${datadir}/opt-viewer
-        rmdir ${D}${datadir}
-
         # reproducibility
         sed -i -e 's,${WORKDIR},,g' ${D}/${libdir}/cmake/llvm/LLVMConfig.cmake
 }
@@ -125,7 +122,7 @@ do_install:class-native() {
        install -D -m 0755 ${B}/bin/llvm-config ${D}${bindir}/llvm-config${PV}
 }
 
-PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm 
${PN}-liboptremarks ${PN}-liblto"
+PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm 
${PN}-liboptremarks ${PN}-optviewer ${PN}-liblto"
 
 RRECOMMENDS:${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello 
${PN}-liboptremarks"
 
@@ -149,6 +146,10 @@ FILES:${PN}-llvmhello = "\
     ${libdir}/LLVMHello.so \
 "
 
+FILES:${PN}-optviewer += "\
+    ${datadir}/opt-viewer \
+"
+
 FILES:${PN}-dev += " \
     ${libdir}/llvm-config \
     ${libdir}/libRemarks.so \
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#167269): 
https://lists.openembedded.org/g/openembedded-core/message/167269
Mute This Topic: https://lists.openembedded.org/mt/91943162/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to