From b9ef02282197380ef05edbd0eb852e1934ceb59b Mon Sep 17 00:00:00 2001 From: aprospero Date: Mon, 17 Mar 2025 14:12:53 +0100 Subject: fix: [Issue #1061] - check for existence before trying to process a file In certain configurations LLVMConfig.cmake does not exist. If that's the case do_install breaks for the nativesdk-clang recipe. Eg. set the following: EXTRA_OECMAKE:append:pn-nativesdk-clang = " -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON" as suggested here: https://llvm.org/docs/BuildingADistribution.html Signed-off-by: aprospero --- recipes-devtools/clang/clang_git.bb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index f863c84..cdf832a 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb @@ -276,7 +276,9 @@ do_install:append:class-native () { } do_install:append:class-nativesdk () { - sed -i -e "s|${B}/./bin/||g" ${D}${libdir}/cmake/llvm/LLVMConfig.cmake + if [ -e ${D}${libdir}/cmake/llvm/LLVMConfig.cmake ] ; then + sed -i -e "s|${B}/./bin/||g" ${D}${libdir}/cmake/llvm/LLVMConfig.cmake + fi if ${@bb.utils.contains('PACKAGECONFIG', 'clangd', 'true', 'false', d)}; then install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clangd-indexer ${D}${bindir}/clangd-indexer fi @@ -293,7 +295,9 @@ do_install:append:class-nativesdk () { rm -rf ${D}${datadir}/llvm #reproducibility - sed -i -e 's,${B},,g' ${D}${libdir}/cmake/llvm/LLVMConfig.cmake + if [ -e ${D}${libdir}/cmake/llvm/LLVMConfig.cmake ] ; then + sed -i -e 's,${B},,g' ${D}${libdir}/cmake/llvm/LLVMConfig.cmake + fi } PACKAGES =+ "${PN}-libllvm ${PN}-lldb-python ${PN}-libclang-cpp ${PN}-tidy ${PN}-format ${PN}-tools \ -- cgit v1.2.3-54-g00ecf