commit:     d033a41e9d66ede9d09131cbbcd601621f2256ba
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Apr  6 14:12:19 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Apr  6 14:12:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d033a41e

sys-devel/clang: Install clang-tidy headers

The clang-tidy headers are apparently needed to build custom clang-tidy
plugins, so install them.  Since they aren't needed by anything
in ::gentoo at the moment, limit the change to live ebuilds.  I'll add
it to ~arch when another 14.x revbump or release happens.

TODO: split the header targets upstream to make it possible to install
only a subset of generally useful headers rather than all the headers
used by standard clang-tidy plugins.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 sys-devel/clang/clang-14.0.0.9999.ebuild | 11 +++++++----
 sys-devel/clang/clang-15.0.0.9999.ebuild | 11 +++++++----
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/sys-devel/clang/clang-14.0.0.9999.ebuild 
b/sys-devel/clang/clang-14.0.0.9999.ebuild
index a30ff8ddf23e..4cb70129b171 100644
--- a/sys-devel/clang/clang-14.0.0.9999.ebuild
+++ b/sys-devel/clang/clang-14.0.0.9999.ebuild
@@ -105,10 +105,6 @@ check_distribution_components() {
                                        clang-libraries|distribution)
                                                continue
                                                ;;
-                                       # headers for clang-tidy static library
-                                       clang-tidy-headers)
-                                               continue
-                                               ;;
                                        # tools
                                        clang|clangd|clang-*)
                                                ;;
@@ -194,6 +190,7 @@ get_distribution_components() {
                        clang-query
                        clang-reorder-fields
                        clang-tidy
+                       clang-tidy-headers
                        clangd
                        find-all-symbols
                        modularize
@@ -350,6 +347,7 @@ src_install() {
        # Move runtime headers to /usr/lib/clang, where they belong
        mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die
        # move (remaining) wrapped headers back
+       mv "${T}"/clang-tidy "${ED}"/usr/include/ || die
        mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${SLOT}/include || die
 
        # Apply CHOST and version suffix to clang tools
@@ -395,6 +393,11 @@ multilib_src_install() {
        rm -rf "${ED}"/usr/include || die
        mv "${ED}"/usr/lib/llvm/${SLOT}/include "${ED}"/usr/include || die
        mv "${ED}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang 
"${ED}"/usr/include/clangrt || die
+       if multilib_is_native_abi; then
+               # don't wrap clang-tidy headers, the list is too long
+               # (they're fine for non-native ABI but enabling the targets is 
problematic)
+               mv "${ED}"/usr/include/clang-tidy "${T}/" || die
+       fi
 }
 
 multilib_src_install_all() {

diff --git a/sys-devel/clang/clang-15.0.0.9999.ebuild 
b/sys-devel/clang/clang-15.0.0.9999.ebuild
index a30ff8ddf23e..4cb70129b171 100644
--- a/sys-devel/clang/clang-15.0.0.9999.ebuild
+++ b/sys-devel/clang/clang-15.0.0.9999.ebuild
@@ -105,10 +105,6 @@ check_distribution_components() {
                                        clang-libraries|distribution)
                                                continue
                                                ;;
-                                       # headers for clang-tidy static library
-                                       clang-tidy-headers)
-                                               continue
-                                               ;;
                                        # tools
                                        clang|clangd|clang-*)
                                                ;;
@@ -194,6 +190,7 @@ get_distribution_components() {
                        clang-query
                        clang-reorder-fields
                        clang-tidy
+                       clang-tidy-headers
                        clangd
                        find-all-symbols
                        modularize
@@ -350,6 +347,7 @@ src_install() {
        # Move runtime headers to /usr/lib/clang, where they belong
        mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die
        # move (remaining) wrapped headers back
+       mv "${T}"/clang-tidy "${ED}"/usr/include/ || die
        mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${SLOT}/include || die
 
        # Apply CHOST and version suffix to clang tools
@@ -395,6 +393,11 @@ multilib_src_install() {
        rm -rf "${ED}"/usr/include || die
        mv "${ED}"/usr/lib/llvm/${SLOT}/include "${ED}"/usr/include || die
        mv "${ED}"/usr/lib/llvm/${SLOT}/$(get_libdir)/clang 
"${ED}"/usr/include/clangrt || die
+       if multilib_is_native_abi; then
+               # don't wrap clang-tidy headers, the list is too long
+               # (they're fine for non-native ABI but enabling the targets is 
problematic)
+               mv "${ED}"/usr/include/clang-tidy "${T}/" || die
+       fi
 }
 
 multilib_src_install_all() {

Reply via email to