summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Lorenz <philip.lorenz@bmw.de>2024-02-12 13:24:18 +0100
committerKhem Raj <raj.khem@gmail.com>2024-02-15 10:17:01 -0800
commitca26df08948d2d904641c35f6b1b4b289f0d9eac (patch)
tree240e3e4614149e550b41da397dd1ad4f3d7c3a7f
parent5a79141ff12bbd245de6c7024431bd2b8eae93a9 (diff)
downloadmeta-clang-ca26df08948d2d904641c35f6b1b4b289f0d9eac.tar.gz
clang: Allow conditional compilation of clangd
clangd should not be needed in target builds. Extend PACKAGECONFIG to enable selective disabling and disable it by default for target builds. Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de>
-rw-r--r--recipes-devtools/clang/clang_git.bb33
1 files changed, 24 insertions, 9 deletions
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb
index 7cb1c58..7384558 100644
--- a/recipes-devtools/clang/clang_git.bb
+++ b/recipes-devtools/clang/clang_git.bb
@@ -63,12 +63,16 @@ PACKAGECONFIG ??= "compiler-rt libcplusplus lldb-wchar terminfo \
63 ${PACKAGECONFIG_CLANG_COMMON} \ 63 ${PACKAGECONFIG_CLANG_COMMON} \
64 ${@bb.utils.filter('DISTRO_FEATURES', 'lto thin-lto', d)} \ 64 ${@bb.utils.filter('DISTRO_FEATURES', 'lto thin-lto', d)} \
65 " 65 "
66PACKAGECONFIG:class-native = "${PACKAGECONFIG_CLANG_COMMON}" 66PACKAGECONFIG:class-native = "clangd \
67PACKAGECONFIG:class-nativesdk = "${PACKAGECONFIG_CLANG_COMMON} \ 67 ${PACKAGECONFIG_CLANG_COMMON} \
68 "
69PACKAGECONFIG:class-nativesdk = "clangd \
70 ${PACKAGECONFIG_CLANG_COMMON} \
68 ${@bb.utils.filter('DISTRO_FEATURES', 'lto thin-lto', d)} \ 71 ${@bb.utils.filter('DISTRO_FEATURES', 'lto thin-lto', d)} \
69 " 72 "
70 73
71PACKAGECONFIG[bootstrap] = "-DCLANG_ENABLE_BOOTSTRAP=On -DCLANG_BOOTSTRAP_PASSTHROUGH='${PASSTHROUGH}' -DBOOTSTRAP_LLVM_ENABLE_LTO=Thin -DBOOTSTRAP_LLVM_ENABLE_LLD=ON,,," 74PACKAGECONFIG[bootstrap] = "-DCLANG_ENABLE_BOOTSTRAP=On -DCLANG_BOOTSTRAP_PASSTHROUGH='${PASSTHROUGH}' -DBOOTSTRAP_LLVM_ENABLE_LTO=Thin -DBOOTSTRAP_LLVM_ENABLE_LLD=ON,,,"
75PACKAGECONFIG[clangd] = "-DCLANG_ENABLE_CLANGD=ON,-DCLANG_ENABLE_CLANGD=OFF,,"
72PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,," 76PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,"
73PACKAGECONFIG[eh] = "-DLLVM_ENABLE_EH=ON,-DLLVM_ENABLE_EH=OFF,," 77PACKAGECONFIG[eh] = "-DLLVM_ENABLE_EH=ON,-DLLVM_ENABLE_EH=OFF,,"
74PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,," 78PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,"
@@ -243,7 +247,9 @@ endif()\n" ${D}${libdir}/cmake/llvm/LLVMExports-release.cmake
243} 247}
244 248
245do_install:append:class-native () { 249do_install:append:class-native () {
246 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clangd-indexer ${D}${bindir}/clangd-indexer 250 if ${@bb.utils.contains('PACKAGECONFIG', 'clangd', 'true', 'false', d)}; then
251 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clangd-indexer ${D}${bindir}/clangd-indexer
252 fi
247 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-pseudo-gen ${D}${bindir}/clang-pseudo-gen 253 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-pseudo-gen ${D}${bindir}/clang-pseudo-gen
248 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tidy-confusable-chars-gen ${D}${bindir}/clang-tidy-confusable-chars-gen 254 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tidy-confusable-chars-gen ${D}${bindir}/clang-tidy-confusable-chars-gen
249 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen 255 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
@@ -260,7 +266,9 @@ do_install:append:class-native () {
260 266
261do_install:append:class-nativesdk () { 267do_install:append:class-nativesdk () {
262 sed -i -e "s|${B}/./bin/||g" ${D}${libdir}/cmake/llvm/LLVMConfig.cmake 268 sed -i -e "s|${B}/./bin/||g" ${D}${libdir}/cmake/llvm/LLVMConfig.cmake
263 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clangd-indexer ${D}${bindir}/clangd-indexer 269 if ${@bb.utils.contains('PACKAGECONFIG', 'clangd', 'true', 'false', d)}; then
270 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clangd-indexer ${D}${bindir}/clangd-indexer
271 fi
264 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen 272 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
265 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-pseudo-gen ${D}${bindir}/clang-pseudo-gen 273 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-pseudo-gen ${D}${bindir}/clang-pseudo-gen
266 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tidy-confusable-chars-gen ${D}${bindir}/clang-tidy-confusable-chars-gen 274 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tidy-confusable-chars-gen ${D}${bindir}/clang-tidy-confusable-chars-gen
@@ -425,11 +433,18 @@ clang_sysroot_preprocess() {
425 ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV} 433 ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV}
426 # LLDTargets.cmake references the lld executable(!) that some modules/plugins link to 434 # LLDTargets.cmake references the lld executable(!) that some modules/plugins link to
427 install -d ${SYSROOT_DESTDIR}${bindir} 435 install -d ${SYSROOT_DESTDIR}${bindir}
428 for f in lld diagtool clang-${MAJOR_VER} clang-format clang-offload-packager \ 436
429 clang-offload-bundler clang-scan-deps clang-repl \ 437 binaries="lld diagtool clang-${MAJOR_VER} clang-format clang-offload-packager
430 clang-rename clang-refactor clang-check clang-extdef-mapping clang-apply-replacements \ 438 clang-offload-bundler clang-scan-deps clang-repl
431 clang-reorder-fields clang-tidy clang-change-namespace clang-doc clang-include-fixer \ 439 clang-rename clang-refactor clang-check clang-extdef-mapping clang-apply-replacements
432 find-all-symbols clang-move clang-query pp-trace clang-pseudo clangd modularize 440 clang-reorder-fields clang-tidy clang-change-namespace clang-doc clang-include-fixer
441 find-all-symbols clang-move clang-query pp-trace clang-pseudo modularize"
442
443 if ${@bb.utils.contains('PACKAGECONFIG', 'clangd', 'true', 'false', d)}; then
444 binaries="${binaries} clangd"
445 fi
446
447 for f in ${binaries}
433 do 448 do
434 install -m 755 ${D}${bindir}/$f ${SYSROOT_DESTDIR}${bindir}/ 449 install -m 755 ${D}${bindir}/$f ${SYSROOT_DESTDIR}${bindir}/
435 done 450 done